Let us make a device page in shadow memory
This commit is contained in:
parent
a82f7d79f8
commit
28b9265042
|
@ -108,7 +108,7 @@ err:
|
|||
/* clang-format on */
|
||||
|
||||
int
|
||||
uxn_boot(Uxn *u, Stack *wst, Stack *rst, Uint8 *memory)
|
||||
uxn_boot(Uxn *u, Uint8 *ram, Uint8 *dev, Stack *wst, Stack *rst)
|
||||
{
|
||||
Uint32 i;
|
||||
char *cptr = (char *)u;
|
||||
|
@ -116,7 +116,7 @@ uxn_boot(Uxn *u, Stack *wst, Stack *rst, Uint8 *memory)
|
|||
cptr[i] = 0x00;
|
||||
u->wst = wst;
|
||||
u->rst = rst;
|
||||
u->ram = memory;
|
||||
u->ram = ram;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ typedef signed short Sint16;
|
|||
typedef unsigned int Uint32;
|
||||
|
||||
#define PAGE_PROGRAM 0x0100
|
||||
#define PAGE_DEV 0xfd00
|
||||
#define PAGE_WST 0xfe00
|
||||
#define PAGE_RST 0xff00
|
||||
|
||||
|
@ -45,7 +46,7 @@ typedef struct Uxn {
|
|||
Device dev[16];
|
||||
} Uxn;
|
||||
|
||||
int uxn_boot(Uxn *u, Stack *wst, Stack *rst, Uint8 *memory);
|
||||
int uxn_boot(Uxn *u, Uint8 *ram, Uint8 *dev, Stack *wst, Stack *rst);
|
||||
int uxn_eval(Uxn *u, Uint16 pc);
|
||||
int uxn_halt(Uxn *u, Uint8 error, Uint16 addr);
|
||||
Device *uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *, Uint8), void (*deofn)(Device *, Uint8));
|
||||
|
|
|
@ -143,7 +143,7 @@ main(int argc, char **argv)
|
|||
|
||||
shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8));
|
||||
memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
|
||||
if(!uxn_boot(&u, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST), memory))
|
||||
if(!uxn_boot(&u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST)))
|
||||
return error("Boot", "Failed");
|
||||
|
||||
/* system */ devsystem = uxn_port(&u, 0x0, system_dei, system_deo);
|
||||
|
|
|
@ -278,9 +278,9 @@ start(Uxn *u, char *rom)
|
|||
memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
|
||||
shadow = (Uint8 *)calloc(0xffff, sizeof(Uint8));
|
||||
|
||||
if(!uxn_boot(&hypervisor, (Stack *)(shadow + 0xfc00), (Stack *)(shadow + 0xfd00), shadow))
|
||||
if(!uxn_boot(&hypervisor, shadow, shadow + PAGE_DEV, (Stack *)(shadow + 0xfb00), (Stack *)(shadow + 0xfc00)))
|
||||
return error("Boot", "Failed to start uxn.");
|
||||
if(!uxn_boot(u, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST), memory))
|
||||
if(!uxn_boot(u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST)))
|
||||
return error("Boot", "Failed to start uxn.");
|
||||
if(!load(&hypervisor, "hypervisor.rom"))
|
||||
error("Hypervisor", "No debugger found.");
|
||||
|
|
Loading…
Reference in New Issue