DSRCS = ../dev/z80pack/devlpr.c ../dev/z80pack/devfd.c
CSRCS = devices.c main.c devtty.c
-CBSRCS = syscall_bank.c
ASRCS = crt0.s z80pack.s
ASRCS += tricks.s commonmem.s
AOBJS = $(ASRCS:.s=.rel)
COBJS = $(CSRCS:.c=.rel)
-CBOBJS = $(CBSRCS:.c=.rel)
DOBJS = $(patsubst ../dev/z80pack/%.c,%.rel, $(DSRCS))
-OBJS = $(AOBJS) $(COBJS) $(DOBJS) $(CBOBJS)
+OBJS = $(AOBJS) $(COBJS) $(DOBJS)
CROSS_CCOPTS += -I../dev/z80pack/
all: $(OBJS)
-syscall_bank.h: ../include/syscall_name.h ../syscall_fs.c ../syscall_fs2.c ../syscall_fs3.c ../syscall_other.c ../syscall_exec16.c
- ../tools/map_syscall ../syscall_fs.c ../syscall_fs2.c ../syscall_fs3.c ../syscall_other.c ../syscall_exec16.c >syscall_bank.h
-
-syscall_bank.c: syscall_bank.h
-
$(AOBJS): %.rel: %.s
$(CROSS_AS) $(ASOPTS) $<
$(COBJS): %.rel: %.c
$(CROSS_CC) $(CROSS_CCOPTS) -c $<
-$(CBOBJS): %.rel: %.c
- $(CROSS_CC) $(CROSS_CCOPTS) --constseg DATAAL -c $<
-
$(DOBJS): %.rel: ../dev/z80pack/%.c
$(CROSS_CC) $(CROSS_CCOPTS) -c $<
A FUZIX target for z80pack.
Test environment for a very squashed build to see what we can achieve in
-64K + disk banking and explore ROM banking ideas
+64K
-Not a useful target, but memory testing stuff
+We build a kernel from 0x8000-0xFFFF and everything needs to either fit in
+that space, or we will need some kind of overlay for obscure syscalls. We
+can't however swap the overlays over userspace because there may be pointers
+to userspace addresses in the syscalls. One option might be to mark binaries
+by required level and have level 1 binaries given less room but loaded with
+the overlay. That would work well since it's only a few obscure calls we need
+to boot out.
-File system code is paged with the banks being 4K spaced 0xE00 length copies
-of the bank and any fixed data that dribbles over the end.
+The obvious calls to bank out are
-TODO:
-Turn memory images into a loadable binary and a block for the disk
-Preload the exec syscall bank into the main binary so startup works
+rename (526 bytes)
+mkdir (481 bytes)
+rmdir (356 bytes)
+It may also be possible to bank out some of execve if we don't allow the
+code/data of a binary to be the full space so we have room for it.
-Savings:
+Other options include just having an overlay zone of about 1.5K which would
+hold either
-Other candidates for the bot which are big are waitpid at 380 bytes and
-signal + sigdisp at 621 bytes the pair. signal/sigdisp normally occur only
-at startup and signal handling so would be acceptable-ish, waitpid always
-involves a task switch anyway. Neither are ideal but they might work.
+rename
+mkdir
+rmdir
-Some inline tricks with tty might also save a tiny bit of RAM
-Put the swap stack at 0x80-0xFF as we can't realistically run CP/M
-emulation.
+execve (and helpers)
+
+waitpid
+flock
-Other thoughts. When working with small app have a version of some of the
-overlays that can be loaded in the top of app space - how to do relocations
-and patches ?
-Do we want to keep the overlays in the swap space gapped between each
-swapped app. Disk swap is usually cheap spacewise and it would speed up
-their fetching.
diskload: di
ld sp, #stack
- ld hl, #0x88
+ ld hl, #0x6000
exx
xor a
ld h, a
#undef CONFIG_BANK_FIXED
/* Swap only */
#define CONFIG_SWAP_ONLY
-/* Simple user copies */
-#define CONFIG_USERMEM_DIRECT
+/* Mini platform */
+#define CONFIG_LEVEL_0
/* Banks as reported to user space */
#define CONFIG_BANKS 1
; WRS: Note we list all our segments here, even though
; we don't use them all, because their ordering is set
; when they are first seen.
- .area _CODE6 ; overlaid by 3 4 5 (which are smaller)
.area _CODE
.area _CODE2
.area _CONST
-mwxuy
-r
-i fuzix.ihx
--b _DATAAL=0xC000
--b _CODE=0xC040
--b _DISCARD=0x5000
+-b _DISCARD=0x6000
-b _UDATA=0x7E00
--b _CODE6=0x8000
--b _CODE3=0x8000
--b _CODE4=0x8000
--b _CODE5=0x8000
--b _CODE7=0x8000
+-b _CODE=0x8000
-l z80
platform-micropack/crt0.rel
platform-micropack/commonmem.rel
devsys.rel
platform-micropack/devlpr.rel
platform-micropack/devtty.rel
-platform-micropack/syscall_bank.rel
-e
used(p);
return 0;
}
+
+size_t strlcpy(char *dst, const char *src, size_t dstsize)
+{
+ size_t len = strlen(src);
+ size_t cp = len >= dstsize ? dstsize - 1 : len;
+ memcpy(dst, src, cp);
+ dst[cp] = 0;
+ return len;
+}
+++ /dev/null
-#include "cpu.h"
-const uint8_t syscall_bank[] = {
-#include "syscall_bank.h"
-};
-
; set system RAM size
ld hl, #64
ld (_ramsize), hl
- ld hl, #32 ; 64K for kernel
+ ld hl, #32 ; 32K for kernel
ld (_procmem), hl
ld a, #1
out (0x01), a
ret
+;
+; Not used yet - will be needed if we do the 3 overlays
+;
overlay_syscall_entry:
ld hl, #18
add hl, sp
.db 0
_curbank:
.db 0
+_syscall_bank:
+ .db 0