From 317cce2de9e6e7512926a2180278794912217d32 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 13 Sep 2016 23:34:07 +0100 Subject: [PATCH] v68: move to one process in RAM at a time to make debug easier, tidy stuff We can now mount the root fs. We can't get any further until there's enough bits to produce a test binary. --- Kernel/platform-v68/Makefile | 2 +- Kernel/platform-v68/config.h | 33 ++++++++++++++++++++++++++++----- Kernel/platform-v68/main.c | 26 ++++++++++++++++++++------ 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/Kernel/platform-v68/Makefile b/Kernel/platform-v68/Makefile index 9e730d2a..b6f97c9d 100644 --- a/Kernel/platform-v68/Makefile +++ b/Kernel/platform-v68/Makefile @@ -34,7 +34,7 @@ image: $(CROSS_LD) -M -o fuzix.elf -T fuzix.ld \ crt0.o \ p68000.o ../start.o ../version.o ../lowlevel-68000.o \ - tricks.o main.o ../timer.o ../kdata.o devices.o \ + tricks.o ../simple.o main.o ../timer.o ../kdata.o devices.o \ ../devio.o ../filesys.o ../process.o ../inode.o ../syscall_fs.o \ ../syscall_proc.o ../syscall_other.o ../mm.o ../swap.o ../buddy.o \ ../tty.o ../devsys.o ../usermem.o ../syscall_fs2.o \ diff --git a/Kernel/platform-v68/config.h b/Kernel/platform-v68/config.h index ba43a0f5..cc5bb4dd 100644 --- a/Kernel/platform-v68/config.h +++ b/Kernel/platform-v68/config.h @@ -4,10 +4,32 @@ #undef CONFIG_MONITOR /* Profil syscall support (not yet complete) */ #undef CONFIG_PROFIL -/* Multiple processes in memory at once */ -#define CONFIG_MULTI /* Single tasking - for now while we get it booting */ #undef CONFIG_SINGLETASK + +#define CONFIG_32BIT + +/* Multiple processes in memory at once */ +#define CONFIG_MULTI + +#define CONFIG_SWAP_ONLY +#define CONFIG_USERMEM_DIRECT +#define CONFIG_BANKS 1 +#define PROC_SIZE 128 + +#define PROGBASE 0x20000UL +#define PROGTOP 0x30000UL +#define SWAP_SIZE 256 +#define SWAPBASE PROGBASE +#define SWAPTOP 0x30000UL +#define MAX_SWAPS PTABSIZE +#define swap_map(x) ((uint8_t *)(x)) + +#define SWAPDEV (1) + +#if 0 +/* Multiple processes in memory at once */ +#define CONFIG_MULTI /* Buddy based MMU */ #define CONFIG_BUDDY_MMU #define BUDDY_NUMLEVEL 9 /* 1 MByte */ @@ -20,9 +42,12 @@ #define BUDDY_TABLE BUDDY_START /* Pull the table from the pool */ #define BUDDY_TREESIZE 511 /* 1MB in 4K pages */ -#define CONFIG_32BIT #define CONFIG_BANKS 1 /* FIXME */ #define CONFIG_USERMEM_BUDDY /* TODO */ +/* Programs run under MMU with zero base */ +#define PROGBASE 0 + +#endif #define TICKSPERSEC 100 /* Ticks per second */ @@ -41,5 +66,3 @@ #define MAX_BLKDEV 4 -/* Programs run under MMU with zero base */ -#define PROGBASE 0 diff --git a/Kernel/platform-v68/main.c b/Kernel/platform-v68/main.c index 1dc968ca..56c81d69 100644 --- a/Kernel/platform-v68/main.c +++ b/Kernel/platform-v68/main.c @@ -17,12 +17,13 @@ void do_beep(void) /* * MMU initialize */ - +#if 0 void pagemap_init(void) { /* Allocate the buddy tables and init them */ //FIXME buddy_init(); } +#endif void map_init(void) { @@ -32,7 +33,7 @@ u_block udata_block[PTABSIZE]; uaddr_t ramtop; uint8_t *membase[PTABSIZE]; uint8_t need_resched; - +#if 0 /* Offsets into the buddy map for each level, byte aligned */ const uint16_t buddy_level[BUDDY_NUMLEVEL] = { 0, /* 256 4K pages */ @@ -45,7 +46,7 @@ const uint16_t buddy_level[BUDDY_NUMLEVEL] = { 508, /* 2 512K pages */ 510, /* 1 1MB page */ }; - +#endif /* * We can do our fork handling in C for once. The only oddity here is * the fixups to run parent first and avoid needless memory thrashing @@ -82,16 +83,16 @@ int16_t dofork(ptptr p) /* All our binaries are zero address based */ -void *pagemap_base(void) +uint8_t *pagemap_base(void) { - return 0; + return (uint8_t*)0x20000UL; } void program_mmu(uint8_t *phys, usize_t top) { } -uint8_t platform_param(unsigned char *p) +uint8_t platform_param(char *p) { return 0; } @@ -104,3 +105,16 @@ void memzero(void *p, usize_t len) { memset(p, 0, len); } + +arg_t _memalloc(void) +{ + udata.u_error = ENOSYS; + return -1; +} + +arg_t _memfree(void) +{ + udata.u_error = ENOSYS; + return -1; +} + -- 2.34.1