From 02327d1e2bb638e6ca834d55e2c2eb28738d5e4c Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 22 Nov 2014 00:12:34 +0000 Subject: [PATCH] types: rework the types for the BASE/TOP configurations This makes it a fair bit cleaner --- Kernel/include/kernel.h | 5 +++-- Kernel/platform-6502test/config.h | 8 ++++---- Kernel/platform-dragon/config.h | 6 +++--- Kernel/platform-micropack/config.h | 8 ++++---- Kernel/platform-micropack/main.c | 2 +- Kernel/platform-micropack/z80pack.s | 5 +++++ Kernel/platform-msx1/config.h | 6 +++--- Kernel/platform-msx1/msx1.s | 5 +++++ Kernel/platform-msx2/config.h | 6 +++--- Kernel/platform-msx2/msx2.s | 4 ++++ Kernel/platform-nc100/config.h | 11 +++++++---- Kernel/platform-pcw8256/config.h | 10 ++++++---- Kernel/platform-trs80/config.h | 6 +++--- Kernel/platform-trs80/main.c | 2 +- Kernel/platform-trs80/trs80.s | 3 +++ Kernel/platform-z80pack/config.h | 6 +++--- Kernel/platform-z80pack/main.c | 2 +- Kernel/platform-zx128/config.h | 11 +++++++---- Kernel/platform-zx128/main.c | 2 +- Kernel/platform-zx128/zx128.s | 5 +++++ Kernel/simple.c | 4 ++-- Kernel/single.c | 20 +++++++++++--------- Kernel/start.c | 10 +++++----- Kernel/syscall_exec.c | 27 +++++++++++++-------------- 24 files changed, 103 insertions(+), 71 deletions(-) diff --git a/Kernel/include/kernel.h b/Kernel/include/kernel.h index f741d2cd..eadaee62 100644 --- a/Kernel/include/kernel.h +++ b/Kernel/include/kernel.h @@ -554,7 +554,7 @@ COMMON int _uzero(uint8_t *user, usize_t count); /* platform/tricks.s */ COMMON void switchout(void); -COMMON void doexec(void *start_addr); +COMMON void doexec(uint16_t start_addr); COMMON void switchin(ptptr process); COMMON int16_t dofork(ptptr child); @@ -701,7 +701,8 @@ CODE2 uint8_t *swapout_prepare_uarea(ptptr p); CODE2 uint8_t *swapin_prepare_uarea(ptptr p); CODE2 void map_init(void); CODE2 void platform_idle(void); -extern uint8_t *ramtop; /* Note: ramtop must be in common in some cases */ +/* Will need a uptr_t eventually */ +extern uint16_t ramtop; /* Note: ramtop must be in common in some cases */ CODE2 extern void platform_interrupt(void); CODE2 int16_t __exit(void); /* FUZIX system call 0 */ diff --git a/Kernel/platform-6502test/config.h b/Kernel/platform-6502test/config.h index 899b284e..8029327e 100644 --- a/Kernel/platform-6502test/config.h +++ b/Kernel/platform-6502test/config.h @@ -42,11 +42,11 @@ #define VT_BOTTOM 23 #define TICKSPERSEC 100 /* Ticks per second */ -#define PROGBASE ((char *)(0x0200)) /* also data base */ -#define PROGLOAD ((char *)(0x0200)) -#define PROGTOP ((char *)(0xF000)) /* Top of program, base of U_DATA */ +#define PROGBASE 0x0200 /* also data base */ +#define PROGLOAD 0x0200 +#define PROGTOP 0xF000 /* Top of program, base of U_DATA */ -#define BOOT_TTY 3 /* Set this to default device for stdio, stderr */ +#define BOOT_TTY 513 /* Set this to default device for stdio, stderr */ /* In this case, the default is the first TTY device */ /* Temp FIXME set to serial port for debug ease */ diff --git a/Kernel/platform-dragon/config.h b/Kernel/platform-dragon/config.h index 088b4888..385367f6 100644 --- a/Kernel/platform-dragon/config.h +++ b/Kernel/platform-dragon/config.h @@ -40,9 +40,9 @@ #define VT_BOTTOM 23 #define TICKSPERSEC 100 /* Ticks per second */ -#define PROGBASE ((uint8_t *)(0x0000)) /* also data base */ -#define PROGLOAD ((uint8_t *)(0x0000)) /* also data base */ -#define PROGTOP ((uint8_t *)(0x7C00)) /* Top of program */ +#define PROGBASE 0x0000 /* also data base */ +#define PROGLOAD 0x0000 /* also data base */ +#define PROGTOP 0x7C00 /* Top of program */ #define BOOT_TTY (512 + 1) /* Set this to default device for stdio, stderr */ /* In this case, the default is the first TTY device */ diff --git a/Kernel/platform-micropack/config.h b/Kernel/platform-micropack/config.h index 43d07a94..db5e9153 100644 --- a/Kernel/platform-micropack/config.h +++ b/Kernel/platform-micropack/config.h @@ -23,10 +23,10 @@ #define CONFIG_BANKS 1 #define TICKSPERSEC 100 /* Ticks per second */ -#define PROGBASE ((char *)(0x0000)) /* also data base */ -#define PROGLOAD ((char *)(0x0100)) -#define PROGTOP ((char *)(0x7D00)) /* Top of program, base of U_DATA */ -#define PROC_SIZE 32 /* Memory needed per process */ +#define PROGBASE 0x0000 /* also data base */ +#define PROGLOAD 0x0100 +#define PROGTOP 0x7D00 /* Top of program, base of U_DATA */ +#define PROC_SIZE 32 /* Memory needed per process */ #define SWAP_SIZE 0x40 /* 32K in blocks (we actually don't need the low 256) */ #define SWAPBASE 0x0000 /* We swap the lot in one, include the */ diff --git a/Kernel/platform-micropack/main.c b/Kernel/platform-micropack/main.c index cf1cd2af..0413eca1 100644 --- a/Kernel/platform-micropack/main.c +++ b/Kernel/platform-micropack/main.c @@ -4,7 +4,7 @@ #include #include -uint8_t *ramtop = PROGTOP; +uint16_t ramtop = PROGTOP; /* On idle we spin checking for the terminals. Gives us more responsiveness for the polled ports */ diff --git a/Kernel/platform-micropack/z80pack.s b/Kernel/platform-micropack/z80pack.s index 2952e48e..beadff2c 100644 --- a/Kernel/platform-micropack/z80pack.s +++ b/Kernel/platform-micropack/z80pack.s @@ -17,6 +17,7 @@ .globl init_hardware .globl _program_vectors .globl _system_tick_counter + .globl _kernel_flag .globl map_kernel .globl map_process @@ -147,3 +148,7 @@ map_restore: outchar: out (0x01), a ret + +; needs to be common +_kernel_flag: + .db 1 diff --git a/Kernel/platform-msx1/config.h b/Kernel/platform-msx1/config.h index e902a0b9..5219f2eb 100644 --- a/Kernel/platform-msx1/config.h +++ b/Kernel/platform-msx1/config.h @@ -27,9 +27,9 @@ #define VT_BOTTOM 23 #define TICKSPERSEC 50 /* Ticks per second (actually should be dynamic FIXME) */ -#define PROGBASE ((char *)(0x0000)) /* also data base */ -#define PROGLOAD ((char *)(0x0100)) -#define PROGTOP ((char *)(0x7D00)) /* Top of program (uarea stash) */ +#define PROGBASE 0x0000 /* also data base */ +#define PROGLOAD 0x0100 +#define PROGTOP 0x7D00 /* Top of program (uarea stash) */ #define BOOT_TTY (512 + 1) /* Set this to default device for stdio, stderr */ /* In this case, the default is the first TTY device */ diff --git a/Kernel/platform-msx1/msx1.s b/Kernel/platform-msx1/msx1.s index 61b703b9..cb4c85c7 100644 --- a/Kernel/platform-msx1/msx1.s +++ b/Kernel/platform-msx1/msx1.s @@ -15,6 +15,7 @@ .globl map_save .globl map_restore .globl _slot_table + .globl _kernel_flag ; video driver .globl _vtinit @@ -78,6 +79,10 @@ _trap_reboot: di halt +_kernel_flag: + .db 1 + + ; ----------------------------------------------------------------------------- ; KERNEL MEMORY BANK (below 0xF000, only accessible when the kernel is mapped) ; ----------------------------------------------------------------------------- diff --git a/Kernel/platform-msx2/config.h b/Kernel/platform-msx2/config.h index 8790e83f..f5a0c83b 100644 --- a/Kernel/platform-msx2/config.h +++ b/Kernel/platform-msx2/config.h @@ -24,9 +24,9 @@ #define VT_BOTTOM 23 #define TICKSPERSEC 50 /* Ticks per second (actually should be dynamic FIXME) */ -#define PROGBASE ((char *)(0x0000)) /* also data base */ -#define PROGLOAD ((char *)(0x0100)) -#define PROGTOP ((char *)(0xF000)) /* Top of program, base of U_DATA */ +#define PROGBASE 0x0000 /* also data base */ +#define PROGLOAD 0x0100 +#define PROGTOP 0xF000 /* Top of program, base of U_DATA */ #define BOOT_TTY (512 + 1) /* Set this to default device for stdio, stderr */ /* In this case, the default is the first TTY device */ diff --git a/Kernel/platform-msx2/msx2.s b/Kernel/platform-msx2/msx2.s index b42a5067..58efd6c9 100644 --- a/Kernel/platform-msx2/msx2.s +++ b/Kernel/platform-msx2/msx2.s @@ -14,6 +14,7 @@ .globl map_process_always .globl map_save .globl map_restore + .globl _kernel_flag ; video driver .globl _vtinit @@ -78,6 +79,9 @@ _trap_reboot: di halt +_kernel_flag: + .db 1 + ; ----------------------------------------------------------------------------- ; KERNEL MEMORY BANK (below 0xF000, only accessible when the kernel is mapped) ; ----------------------------------------------------------------------------- diff --git a/Kernel/platform-nc100/config.h b/Kernel/platform-nc100/config.h index 8027c79c..fd35a20a 100644 --- a/Kernel/platform-nc100/config.h +++ b/Kernel/platform-nc100/config.h @@ -1,6 +1,10 @@ /* NC100 or NC200 - your choice */ #define CONFIG_NC200 +#ifdef CONFIG_NC200 +#define CONFIG_CPM_EMU +#endif + /* Enable to make ^Z dump the inode table for debug */ #undef CONFIG_IDUMP /* Enable to make ^A drop back into the monitor */ @@ -36,10 +40,9 @@ #endif #define TICKSPERSEC 100 /* Ticks per second */ -#define PROGBASE ((char *)(0x0000)) /* also data base */ -#define PROGLOAD ((char *)(0x0100)) -#define PROGTOP ((char *)(0xF000)) /* Top of program, base of U_DATA */ -//#define PROC_SIZE 64 /* Memory needed per process (for now) */ +#define PROGBASE 0x0000 /* also data base */ +#define PROGLOAD 0x0100 +#define PROGTOP 0xF000 /* Top of program, base of U_DATA */ #define BOOT_TTY (512+1) /* Set this to default device for stdio, stderr */ /* In this case, the default is the first TTY device */ diff --git a/Kernel/platform-pcw8256/config.h b/Kernel/platform-pcw8256/config.h index 5175433f..e652afa2 100644 --- a/Kernel/platform-pcw8256/config.h +++ b/Kernel/platform-pcw8256/config.h @@ -8,6 +8,8 @@ #define CONFIG_MULTI /* Single tasking */ #undef CONFIG_SINGLETASK +/* CPM emulation capable */ +#define CONFIG_CPM_EMU /* 16K reported page size */ #define CONFIG_PAGE_SIZE 16 /* We use flexible 16K banks so use the helper */ @@ -28,10 +30,10 @@ #define VT_BOTTOM 31 #define TICKSPERSEC 50 /* Ticks per second */ -#define PROGBASE ((char *)(0x0000)) /* memory base of program */ -#define PROGLOAD ((char *)(0x0100)) /* load base of program */ -#define PROGTOP ((char *)(0xF000)) /* Top of program, base of U_DATA */ -#define PROC_SIZE 64 /* Memory needed per process */ +#define PROGBASE 0x0000 /* memory base of program */ +#define PROGLOAD 0x0100 /* load base of program */ +#define PROGTOP 0xF000 /* Top of program, base of U_DATA */ +#define PROC_SIZE 64 /* Memory needed per process */ #define SWAP_SIZE 0x80 /* 64K in blocks (we actually don't need the low 256) */ #define SWAPBASE 0x0000 /* We swap the lot in one, include the */ diff --git a/Kernel/platform-trs80/config.h b/Kernel/platform-trs80/config.h index 80629fe5..b0f385e2 100644 --- a/Kernel/platform-trs80/config.h +++ b/Kernel/platform-trs80/config.h @@ -23,9 +23,9 @@ #define VT_BOTTOM 24 #define TICKSPERSEC 60 /* Ticks per second */ -#define PROGBASE ((char *)(0x0000)) /* Base of user */ -#define PROGLOAD ((char *)(0x0100)) /* Load and run here -#define PROGTOP ((char *)(0xF900)) /* Top of program, base of U_DATA */ +#define PROGBASE 0x0000 /* Base of user */ +#define PROGLOAD 0x0100 /* Load and run here */ +#define PROGTOP 0xF900 /* Top of program, base of U_DATA */ #define PROC_SIZE 64 /* Memory needed per process */ #define SWAP_SIZE 0x80 /* 64K in blocks (we actually don't need quite all) */ diff --git a/Kernel/platform-trs80/main.c b/Kernel/platform-trs80/main.c index 7ba957b7..1859ec11 100644 --- a/Kernel/platform-trs80/main.c +++ b/Kernel/platform-trs80/main.c @@ -4,7 +4,7 @@ #include #include -uint8_t *ramtop = PROGTOP; +uint16_t ramtop = PROGTOP; /* On idle we spin checking for the terminals. Gives us more responsiveness for the polled ports */ diff --git a/Kernel/platform-trs80/trs80.s b/Kernel/platform-trs80/trs80.s index 36726034..6247f354 100644 --- a/Kernel/platform-trs80/trs80.s +++ b/Kernel/platform-trs80/trs80.s @@ -16,6 +16,7 @@ .globl map_save .globl map_restore .globl platform_interrupt_all + .globl _kernel_flag ; exported debugging tools .globl _trap_monitor @@ -120,6 +121,8 @@ opsave: .db 0x36 _opreg: .db 0x36 ; kernel map, 80 columns _modout: .db 0x50 ; 80 column, sound enabled, altchars off, ; external I/O enabled, 4MHz +_kernel_flag: + .db 1 ; We start in kernel mode _program_vectors: ; we are called, with interrupts disabled, by both newproc() and crt0 diff --git a/Kernel/platform-z80pack/config.h b/Kernel/platform-z80pack/config.h index 161af1fe..e66238d1 100644 --- a/Kernel/platform-z80pack/config.h +++ b/Kernel/platform-z80pack/config.h @@ -20,9 +20,9 @@ #define CONFIG_BANKS 1 #define TICKSPERSEC 100 /* Ticks per second */ -#define PROGLOAD ((char *)(0x0000)) /* also data base */ -#define PROGBASE ((char *)(0x0100)) /* also data base */ -#define PROGTOP ((char *)(0xED00)) /* Top of program, base of U_DATA copy */ +#define PROGLOAD 0x0000 /* also data base */ +#define PROGBASE 0x0100 /* also data base */ +#define PROGTOP 0xED00 /* Top of program, base of U_DATA copy */ #define PROC_SIZE 60 /* Memory needed per process */ #define SWAP_SIZE 0x78 /* 60K in blocks (we actually don't need the low 256) */ diff --git a/Kernel/platform-z80pack/main.c b/Kernel/platform-z80pack/main.c index 15670722..79c9de0b 100644 --- a/Kernel/platform-z80pack/main.c +++ b/Kernel/platform-z80pack/main.c @@ -4,7 +4,7 @@ #include #include -uint8_t *ramtop = PROGTOP; +uint16_t ramtop = PROGTOP; void pagemap_init(void) diff --git a/Kernel/platform-zx128/config.h b/Kernel/platform-zx128/config.h index 5efb322c..68e75dbd 100644 --- a/Kernel/platform-zx128/config.h +++ b/Kernel/platform-zx128/config.h @@ -17,7 +17,9 @@ #define CONFIG_FONT8X8 #define CONFIG_FONT8X8SMALL -/* We have 1 bank at C000 with 6 possible pages to map, but I'm not sure if CONFIG_BANK_FIXED is our choise. */ +/* We have 1 bank at C000 with 6 possible pages to map, but I'm not sure + if CONFIG_BANK_FIXED is our choice. */ + /* Fixed banking */ #define CONFIG_BANK_FIXED /* 6 16K banks, 1 is for kernel needs */ @@ -34,14 +36,15 @@ #define VT_BOTTOM 23 #define TICKSPERSEC 50 /* Ticks per second */ -#define PROGBASE ((char *)(0xC000)) /* also data base */ -#define PROGTOP ((char *)(0xFFFF)) /* Top of program, base of U_DATA copy */ +#define PROGBASE 0xC000 /* also data base */ +#define PROGLOAD 0xC000 /* also data base */ +#define PROGTOP 0xFD00 /* Top of program, base of U_DATA copy */ #define PROC_SIZE 16 /* Memory needed per process */ #define UDATA_BLOCKS 0 /* We swap the stash not the uarea */ #define UDATA_SWAPSIZE 0 -#define BOOT_TTY (1) /* Set this to default device for stdio, stderr */ +#define BOOT_TTY (512+1) /* Set this to default device for stdio, stderr */ /* In this case, the default is the first TTY device */ /* We need a tidier way to do this from the loader */ diff --git a/Kernel/platform-zx128/main.c b/Kernel/platform-zx128/main.c index 15670722..79c9de0b 100644 --- a/Kernel/platform-zx128/main.c +++ b/Kernel/platform-zx128/main.c @@ -4,7 +4,7 @@ #include #include -uint8_t *ramtop = PROGTOP; +uint16_t ramtop = PROGTOP; void pagemap_init(void) diff --git a/Kernel/platform-zx128/zx128.s b/Kernel/platform-zx128/zx128.s index 61676573..766ee4e6 100644 --- a/Kernel/platform-zx128/zx128.s +++ b/Kernel/platform-zx128/zx128.s @@ -25,6 +25,8 @@ .globl map_save .globl map_restore + .globl _kernel_flag + .globl _fd_bankcmd ; exported debugging tools @@ -170,3 +172,6 @@ map_store: outchar: out (#0x15), A ret + +_kernel_flag: + .db 1 diff --git a/Kernel/simple.c b/Kernel/simple.c index 81a7a662..5df4d0da 100644 --- a/Kernel/simple.c +++ b/Kernel/simple.c @@ -22,14 +22,14 @@ int pagemap_alloc(ptptr p) int pagemap_realloc(uint16_t size) { - if (size >= (uint16_t) ramtop) + if (size >= ramtop) return ENOMEM; return 0; } uint16_t pagemap_mem_used(void) { - return ((uint16_t)(PROGTOP - PROGBASE)) >> 10; + return (PROGTOP - PROGBASE) >> 10; } void pagemap_init(void) diff --git a/Kernel/single.c b/Kernel/single.c index a8bf9fb6..585bb7de 100644 --- a/Kernel/single.c +++ b/Kernel/single.c @@ -127,7 +127,7 @@ static int count(uint8_t ** sp, uint16_t * lp) static int do_swap_out(uint8_t * s, uint16_t l) { - uint8_t *p = ramtop - 1; + uint8_t *p = (uint8_t *)(ramtop - 1); // Xpanic("do_swap_out "); // Xout((uint16_t)s); @@ -164,10 +164,10 @@ static int do_swap_out(uint8_t * s, uint16_t l) *p-- = (uint16_t) ramtop >> 8; *p = (uint16_t) ramtop & 0xFF; // Xpanic("Ramtop was "); -// Xout((uint16_t)ramtop); - ramtop = p; +// Xout(ramtop); + ramtop = (uint16_t)p; // Xpanic(" now "); -// Xout((uint16_t)ramtop); +// Xout(ramtop); // Xpanic("\r\n"); s; l; @@ -212,7 +212,9 @@ static void unpack(uint8_t * d, uint8_t * p, uint16_t l) static void do_swap_in(uint8_t * d, uint16_t l) { - uint8_t *p = (uint8_t *) (ramtop[0] | (((uint16_t) ramtop[1]) << 8)); /* Recover old base pointer */ + uint8_t *p; + p = (uint8_t *) ramtop; + p = (uint8_t *) (p[0] | (((uint16_t) p[1]) << 8)); /* Recover old base pointer */ // Xout(ramtop[1]); // Xout(ramtop[2]); // Xpanic("Entry Ramtop: "); @@ -220,7 +222,7 @@ static void do_swap_in(uint8_t * d, uint16_t l) // Xpanic("New Ramtop: "); // Xout((uint16_t)p); unpack(d, p, l); - ramtop = p; + ramtop = (uint16_t)p; // Xpanic("\r\n"); } #endif @@ -233,7 +235,7 @@ static void Xmemcpy(uint8_t * d, uint8_t * s, uint16_t l) static int do_swap_out(uint8_t * p, uint16_t l) { - uint16_t room = (uint16_t) ramtop - udata.u_top; + uint16_t room = ramtop - udata.u_top; uint8_t *d; Xpanic("len "); @@ -244,7 +246,7 @@ static int do_swap_out(uint8_t * p, uint16_t l) return -1; ramtop -= l + 2; Xpanic("ramtop now "); - Xout((uint16_t) ramtop); + Xout(ramtop); d = (uint8_t *) ramtop; d[0] = l & 0xFF; d[1] = l >> 8; @@ -269,7 +271,7 @@ static void do_swap_in(uint8_t * d, uint16_t l) int swapout(ptptr p) { - uint8_t *oldtop = ramtop; + uint16_t oldtop = ramtop; p; // Xpanic("Swapout"); // Xout((uint16_t)udata.u_ptab); diff --git a/Kernel/start.c b/Kernel/start.c index d6bff316..abb490d1 100644 --- a/Kernel/start.c +++ b/Kernel/start.c @@ -62,14 +62,14 @@ void create_init(void) *j = NO_FILE; } /* Poke the execve arguments into user data space so _execve() can read them back */ - uput(arg, PROGLOAD, sizeof(arg)); + uput(arg, (void *)PROGLOAD, sizeof(arg)); /* Poke in arv[0] - FIXME: Endianisms... */ - uputw((uint16_t)PROGLOAD + 1, PROGLOAD + 7); + uputw(PROGLOAD+1 , (void *)(PROGLOAD + 7)); /* Set up things to look like the process is calling _execve() */ - udata.u_argn = (uint16_t) PROGLOAD; - udata.u_argn1 = (uint16_t)PROGLOAD + 0x7; /* Arguments (just "/init") */ - udata.u_argn2 = (uint16_t)PROGLOAD + 0xb; /* Environment (none) */ + udata.u_argn = PROGLOAD; + udata.u_argn1 = PROGLOAD + 0x7; /* Arguments (just "/init") */ + udata.u_argn2 = PROGLOAD + 0xb; /* Environment (none) */ } void fuzix_main(void) diff --git a/Kernel/syscall_exec.c b/Kernel/syscall_exec.c index e6763b1f..8e3bf36c 100644 --- a/Kernel/syscall_exec.c +++ b/Kernel/syscall_exec.c @@ -35,13 +35,13 @@ int16_t _execve(void) staticfast struct s_argblk *abuf, *ebuf; int16_t (**sigp) (); int argc; - uint16_t emu_size, emu_copy; - uint8_t *progptr, *emu_ptr, *emu_base; + uint16_t emu_size, emu_copy, progptr; + uint16_t emu_ptr, emu_base; staticfast uint16_t top; uint8_t c; uint16_t blocks; - top = (uint16_t)ramtop; + top = ramtop; if (!(ino = n_open(name, NULLINOPTR))) return (-1); @@ -76,7 +76,7 @@ int16_t _execve(void) if (buf[3] == 'F' && buf[4] == 'Z' && buf[5] == 'X' && buf[6] == '1') { top = buf[7] | ((unsigned int)buf[8] << 8); if (top == 0) /* Legacy 'all space' binary */ - top = (uint16_t)ramtop; + top = ramtop; emu_ino = 0; // no emulation, thanks } else { #ifdef CONFIG_CPM_EMU @@ -88,7 +88,7 @@ int16_t _execve(void) udata.u_error = ENOEXEC; goto nogood2; } - top = (uint16_t)ramtop; + top = ramtop; #else emu_size; emu_copy; @@ -133,10 +133,10 @@ int16_t _execve(void) /* We are definitely going to succeed with the exec, * so we can start writing over the old program */ - uput(buf, PROGLOAD, 512); /* Move 1st Block to user bank */ + uput(buf, (uint8_t *)PROGLOAD, 512); /* Move 1st Block to user bank */ brelse(buf); - c = ugetc(PROGLOAD); + c = ugetc((uint8_t *)PROGLOAD); if (c != 0xC3) kprintf("Botched uput\n"); @@ -150,15 +150,14 @@ int16_t _execve(void) if (emu_ino) { emu_size = emu_ino->c_node.i_size; // round up to nearest multiple of 256 bytes, fit it in below ramtop - emu_ptr = - (char *) (udata.u_top - ((emu_size + 255) & 0xff00)); + emu_ptr = udata.u_top - ((emu_size + 255) & 0xff00); emu_base = emu_ptr; blk = 0; while (emu_size) { buf = bread(emu_ino->c_dev, bmap(emu_ino, blk, 1), 0); // read block emu_copy = min(512, emu_size); - uput(buf, emu_ptr, emu_copy); // copy to userspace + uput(buf, (uint8_t *)emu_ptr, emu_copy); // copy to userspace bufdiscard((bufptr) buf); brelse((bufptr) buf); // release block // adjust pointers @@ -174,11 +173,11 @@ int16_t _execve(void) * of process memory */ - uzero(emu_ptr, top - emu_ptr); + uzero((uint8_t *)emu_ptr, top - emu_ptr); } else #endif { - emu_base = (uint8_t *)top; + emu_base = top; } /* emu_base now points at the byte after the last byte the program can occupy */ @@ -197,7 +196,7 @@ int16_t _execve(void) for (blk = 1; blk <= blocks; ++blk) { buf = bread(ino->c_dev, bmap(ino, blk, 1), 0); - uput(buf, progptr, 512); + uput(buf, (uint8_t *)progptr, 512); bufdiscard((bufptr) buf); brelse((bufptr) buf); progptr += 512; @@ -206,7 +205,7 @@ int16_t _execve(void) udata.u_break = (int) progptr; // Set initial break for program // zero all remaining process memory above the last block loaded. - uzero(progptr, emu_base - progptr); + uzero((uint8_t *)progptr, emu_base - progptr); // Turn off caught signals for (sigp = udata.u_sigvec; sigp < udata.u_sigvec + NSIGS; ++sigp) -- 2.34.1