mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
Make extram uint8_t
This commit is contained in:
parent
8158ac647c
commit
8c97057809
5 changed files with 10 additions and 10 deletions
|
|
@ -153,7 +153,7 @@ int main(int argc, char *argv[]) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
memset(extram_buf, 0x00, extram_len);
|
memset(extram_buf, 0x00, extram_len);
|
||||||
uvm32_extram(vmst, extram_buf, extram_len);
|
uvm32_extram(vmst, (uint8_t *)extram_buf, extram_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetMainReady();
|
SDL_SetMainReady();
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ int main(int argc, char *argv[]) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
memset(extram_buf, 0x00, extram_len);
|
memset(extram_buf, 0x00, extram_len);
|
||||||
uvm32_extram(&vmst, extram_buf, extram_len);
|
uvm32_extram(&vmst, (uint8_t *)extram_buf, extram_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup terminal for getch()
|
// setup terminal for getch()
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ void setUp(void) {
|
||||||
uvm32_init(&vmst);
|
uvm32_init(&vmst);
|
||||||
uvm32_load(&vmst, rom_bin, rom_bin_len);
|
uvm32_load(&vmst, rom_bin, rom_bin_len);
|
||||||
memset(extram, 0x00, sizeof(extram));
|
memset(extram, 0x00, sizeof(extram));
|
||||||
uvm32_extram(&vmst, extram, sizeof(extram));
|
uvm32_extram(&vmst, (uint8_t *)extram, sizeof(extram));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tearDown(void) {
|
void tearDown(void) {
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ void uvm32_init(uvm32_state_t *vmst) {
|
||||||
vmst->_status = UVM32_STATUS_PAUSED;
|
vmst->_status = UVM32_STATUS_PAUSED;
|
||||||
|
|
||||||
vmst->_extramLen = 0;
|
vmst->_extramLen = 0;
|
||||||
vmst->_extram = (uint32_t *)NULL;
|
vmst->_extram = (uint8_t *)NULL;
|
||||||
vmst->_extramDirty = false;
|
vmst->_extramDirty = false;
|
||||||
|
|
||||||
vmst->_core.pc = MINIRV32_RAM_IMAGE_OFFSET;
|
vmst->_core.pc = MINIRV32_RAM_IMAGE_OFFSET;
|
||||||
|
|
@ -130,7 +130,7 @@ bool get_safeptr_null_terminated(uvm32_state_t *vmst, uint32_t addr, uvm32_slice
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf->ptr = (uint8_t *)&vmst->_extram[ptrstart/4]; // extram is uint32_t*
|
buf->ptr = (uint8_t *)&vmst->_extram[ptrstart];
|
||||||
buf->len = p - ptrstart;
|
buf->len = p - ptrstart;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -170,7 +170,7 @@ bool get_safeptr(uvm32_state_t *vmst, uint32_t addr, uint32_t len, uvm32_slice_t
|
||||||
buf->len = 0;
|
buf->len = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
buf->ptr = (uint8_t *)&vmst->_extram[ptrstart/4]; // extram is uint32_t*
|
buf->ptr = (uint8_t *)&vmst->_extram[ptrstart];
|
||||||
buf->len = len;
|
buf->len = len;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -444,7 +444,7 @@ uint32_t _uvm32_extramStore(void *userdata, uint32_t addr, uint32_t val, uint32_
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uvm32_extram(uvm32_state_t *vmst, uint32_t *ram, uint32_t len) {
|
void uvm32_extram(uvm32_state_t *vmst, uint8_t *ram, uint32_t len) {
|
||||||
vmst->_extram = ram;
|
vmst->_extram = ram;
|
||||||
vmst->_extramLen = len;
|
vmst->_extramLen = len;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ typedef struct {
|
||||||
uint8_t _memory[UVM32_MEMORY_SIZE]; /*! Memory */
|
uint8_t _memory[UVM32_MEMORY_SIZE]; /*! Memory */
|
||||||
uvm32_evt_t _ioevt; /*! Event to be returned on next pause */
|
uvm32_evt_t _ioevt; /*! Event to be returned on next pause */
|
||||||
uint8_t *_stack_canary; /*! Location of stack canary */
|
uint8_t *_stack_canary; /*! Location of stack canary */
|
||||||
uint32_t *_extram; /*! External RAM pointer, or NULL */
|
uint8_t *_extram; /*! External RAM pointer, or NULL */
|
||||||
uint32_t _extramLen; /*! Length of external RAM */
|
uint32_t _extramLen; /*! Length of external RAM */
|
||||||
bool _extramDirty; /*! Flag to indicate VM code has modified extram since last run */
|
bool _extramDirty; /*! Flag to indicate VM code has modified extram since last run */
|
||||||
} uvm32_state_t;
|
} uvm32_state_t;
|
||||||
|
|
@ -168,8 +168,8 @@ uvm32_slice_t uvm32_arg_getbuf(uvm32_state_t *vmst, uvm32_evt_t *evt, uvm32_arg_
|
||||||
uvm32_slice_t uvm32_arg_getbuf_fixed(uvm32_state_t *vmst, uvm32_evt_t *evt, uvm32_arg_t arg, uint32_t len);
|
uvm32_slice_t uvm32_arg_getbuf_fixed(uvm32_state_t *vmst, uvm32_evt_t *evt, uvm32_arg_t arg, uint32_t len);
|
||||||
|
|
||||||
|
|
||||||
/*! Setup a block of memory to act as external RAM, it will be available on in VM code at address `UVM32_EXTRAM_BASE`. The memory is not copied, so the caller must ensure it remains available until `uvm32_extram()` is called to setup a different region or the VM is ended */
|
/*! Setup a block of memory to act as external RAM, it will be available on in VM code at address `UVM32_EXTRAM_BASE`. The memory is not copied, so the caller must ensure it remains available until `uvm32_extram()` is called to setup a different region or the VM is ended. */
|
||||||
void uvm32_extram(uvm32_state_t *vmst, uint32_t *ram, uint32_t len);
|
void uvm32_extram(uvm32_state_t *vmst, uint8_t *extram, uint32_t len);
|
||||||
|
|
||||||
/*! Check to see if the external RAM is marked as dirty. If the VM code writes to the external RAM, this flag is set. The flag is automatically cleared next time uvm32_run() is called */
|
/*! Check to see if the external RAM is marked as dirty. If the VM code writes to the external RAM, this flag is set. The flag is automatically cleared next time uvm32_run() is called */
|
||||||
bool uvm32_extramDirty(uvm32_state_t *vmst);
|
bool uvm32_extramDirty(uvm32_state_t *vmst);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue