v65c816: turn on more features, fix memory map bugs
authorAlan Cox <alan@linux.intel.com>
Thu, 14 Dec 2017 17:10:51 +0000 (17:10 +0000)
committerAlan Cox <alan@linux.intel.com>
Thu, 14 Dec 2017 17:10:51 +0000 (17:10 +0000)
Turn on networking core support
Correct the definitions so we are not 0x200 bytes off on the stacks
Move the IRQ DP into $FFxx as it can share with the vectors
Move discard into the upper bits of the stacks where it can be reclaimed

Kernel/platform-v65c816/Makefile
Kernel/platform-v65c816/README
Kernel/platform-v65c816/config.h
Kernel/platform-v65c816/kernel.def
Kernel/platform-v65c816/ld65.cfg

index b1904c4..39c6013 100644 (file)
@@ -5,12 +5,15 @@ CSRCS += devices.c main.c
 LSRCS = ../lib/65c816.s
 LOBJS = $(patsubst ../lib/%.s,%.o, $(LSRCS))
 
+NSRCS = ../dev/net/net_native.c
+NOBJS = $(patsubst ../dev/net/%.c,%.o, $(NSRCS))
+
 ASRCS = v65.s crt0.s
 ASRCS += commonmem.s
 
 COBJS = $(CSRCS:.c=$(BINEXT))
 AOBJS = $(ASRCS:.s=$(BINEXT))
-OBJS  = $(COBJS) $(AOBJS) $(LOBJS)
+OBJS  = $(COBJS) $(AOBJS) $(LOBJS) $(NOBJS)
 
 JUNK = $(CSRCS:.c=.o) $(CSRCS:.c=.s) $(ASRCS:.s=.o)
 
@@ -19,6 +22,9 @@ all:  $(OBJS)
 $(COBJS): %$(BINEXT): %.c
        $(CROSS_CC) $(CROSS_CCOPTS) $(CROSS_CC_SEG1) $<
 
+$(NOBJS): %$(BINEXT): ../dev/net/%.c
+       $(CROSS_CC) $(CROSS_CCOPTS) $(CROSS_CC_SEG1) -o $@ $<
+
 $(AOBJS): %$(BINEXT): %.s
        $(CROSS_AS) $(ASOPTS) $< -o $*$(BINEXT)
 
@@ -36,6 +42,7 @@ image:
        ../devio.o ../filesys.o ../process.o ../inode.o ../syscall_fs.o \
        ../syscall_proc.o ../syscall_other.o ../mm.o ../bank65c816.o \
        ../tty.o ../devsys.o ../syscall_fs2.o ../syscall_fs3.o \
-       ../syscall_exec16.o ../usermem.o ../usermem_std-65c816.o devtty.o
+       ../syscall_exec16.o ../usermem.o ../usermem_std-65c816.o devtty.o \
+       ../syscall_net.o net_native.o
        dd if=../fuzix.bin of=fuzix.img bs=256 skip=255 count=1
        dd if=../fuzix.bin of=fuzix.img bs=256 seek=1 skip=1 conv=notrunc
\ No newline at end of file
index 058cca8..4c150b3 100644 (file)
@@ -11,7 +11,7 @@ Bank 0:
        0xF000          7 x 256 byte CPU stacks for processes paired
                        with their direct pages
        0xFE00          I/O page
-       0xFF00          Vectors                 [packed at 0 in image]
+       0xFF00          Vectors and IRQ DP      [packed at 0 in image]
 
 And in user space
 
index 7c728dd..266f6ab 100644 (file)
 
 #define CONFIG_CALL_R2L                /* Runtime stacks arguments backwards */
 
+/* Networking (not usable yet but for debug/development) */
+#define CONFIG_NET
+#define CONFIG_NET_NATIVE
+
 /*
  *     We have 512K of RAM and have to allocate it in banks due to the CPU
  *     bank granularity. That gives us 7 processes plus kernel and more
@@ -23,7 +27,8 @@
 #define MAX_MAPS       7
 #define MAP_SIZE    0xFC00  /* 0-FBFF */
 
-#define STACK_BANKOFF  0xF0    /* F000-FBFF */
+/* 0xEE because our first bank is 1 and 0xEE + 2 * 1 = 0xF0 */
+#define STACK_BANKOFF  0xEE    /* F000-FDFF */
 
 #define TICKSPERSEC 100            /* Ticks per second */
 #define MAPBASE            0x0000  /* We map from 0 */
 /* Device parameters */
 #define NUM_DEV_TTY 1
 #define TTYDEV   BOOT_TTY /* Device used by kernel for messages, panics */
-#define NBUFS    8        /* Number of block buffers */
-#define NMOUNTS         2        /* Number of mounts at a time */
+#define NBUFS    8       /* Number of block buffers */
+#define NMOUNTS         4        /* Number of mounts at a time */
 
 #define platform_discard()     /* for now - wants fixing */
+
+
+#define OFTSIZE                24
+#define ITABSIZE       32
index 0b09abd..86bf7aa 100644 (file)
@@ -12,12 +12,13 @@ ZPBASE                      .set $0
 KERNEL_BANK            .set $0         ; bank number
 KERNEL_FAR             .set $000000    ; 24 bit
 
-; Add this to the bank number to get the high 8bits of the 16bit CPU stack
+; Add this to twice the bank number to get the high 8bits of the 16bit CPU stack
 ; for this process
-STACK_BANKOFF          .set $F0        ; F000-FBFF
+STACK_BANKOFF          .set $EE        ; F000-FDFF
 ; Direct page for IRQ processing (saves us saving/restoring DP registers)
 ; Can probably use the same page as the IRQ CPU stack... FIXME
-IRQ_DP                 .set $FD00      ; FD00-FDFF
+; FIXME clashes with end of stack banks
+IRQ_DP                 .set $FF00      ; FF00-FF3F
 KERNEL_DP              .set $00        ; We use the real ZP for kernel DP
 
 MAP_SIZE               .set $FC00
index a8b5471..5805a49 100644 (file)
@@ -2,7 +2,8 @@ MEMORY {
        RAMZ:   start = $0000, size = $0100, type = rw, fill = yes;
        UDATA:  start = $0100, size = $0200, type = rw, fill = yes;
        MAIN:   start = $0300, size = $ED00, type = rw, fill = yes;
-       USEG:   start = $F000, size = $0E00, type = rw, fill = yes;
+       USEG:   start = $F000, size = $0200, type = rw, fill = yes;
+       USEGH:  start = $F200, size = $0C00, type = rw, fill = yes;
        IO:     start = $FE00, size = $0100, type = rw, fill = yes;
        STUB:   start = $FF00, size = $00E0, type = rw, fill = yes;
        VECTOR: start = $FFE0, size = $0020, type = rw, fill = yes;
@@ -19,8 +20,8 @@ SEGMENTS {
        DATA:           load = MAIN, type = rw, define = yes;
        BSS:            load = MAIN, type = bss, define = yes;
 
-       DISCARD:        load = MAIN, type = ro;
-       DISCARDDATA:    load = MAIN, type = ro;
+       DISCARD:        load = USEGH, type = ro;
+       DISCARDDATA:    load = USEGH, type = ro;
 
        STUBS:          load = STUB, type = ro;
        VECTORS:        load = VECTOR, type = ro;