pcw8256: Various fixes
authorAlan Cox <alan@etchedpixels.co.uk>
Sat, 22 Nov 2014 22:48:15 +0000 (22:48 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Sat, 22 Nov 2014 22:48:15 +0000 (22:48 +0000)
Make sure we link the commonmem.s first
Use the standard commonmem
Move the written parts of common clear of the first 256 bytes (so swap can
work)

Kernel/platform-pcw8256/Makefile
Kernel/platform-pcw8256/commonmem.s
Kernel/platform-pcw8256/pcw8256.s

index 5ee8a06..ab7fd46 100644 (file)
@@ -2,8 +2,9 @@
 CSRCS = devlpr.c devtty.c devfd.c
 CSRCS += devices.c main.c
 
-ASRCS =  crt0.s pcw8256.s
-ASRCS += tricks.s commonmem.s fdc765.s
+# Need common listed first so we know where the udata map lives
+ASRCS =  crt0.s commonmem.s pcw8256.s
+ASRCS += tricks.s fdc765.s
 
 COBJS = $(CSRCS:.c=.rel)
 AOBJS = $(ASRCS:.s=.rel)
index 3cd0aa7..30f4321 100644 (file)
@@ -6,45 +6,7 @@
 
         .module commonmem
 
-        ; exported symbols
-        .globl _ub
-        .globl _udata
-        .globl kstack_top
-        .globl istack_top
-        .globl istack_switched_sp
-
         .area _COMMONMEM
 
-_ub:    ; first 512 bytes: starts with struct u_block, with the kernel stack working down from above
-_udata:
-kstack_base:
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-kstack_top:
+       .include "../cpu-z80/std-commonmem.s"
 
-        ; next 256 bytes: 254 byte interrupt stack, then 2 byte saved stack pointer
-istack_base:
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-        .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-istack_top:
-istack_switched_sp: .dw 0
index cd649c5..f3744c8 100644 (file)
@@ -127,8 +127,6 @@ init_hardware:
 
             .area _COMMONMEM
 
-_kernel_flag:
-           .db 1
 
 _program_vectors:
             ; we are called, with interrupts disabled, by both newproc() and crt0
@@ -246,22 +244,6 @@ map_restore:push hl
            pop af
             pop hl
             ret
-;
-;      These are in common, that means that on a system that switches
-; common by task there are multiple copies of this information.
-;
-; Safe IFF we always reload the *full* map when task switching (we do)
-;
-map_current:
-           .db 0               ; need this tracked
-           .db 0               ; hardware ports are write only
-           .db 0
-; Safe because we never task switch from an IRQ while in kernel mode.
-; In user mode we won't restore the saved area anyway
-map_save_area:
-           .db 0
-           .db 0
-           .db 0
 
 
 _bugout:    pop hl
@@ -296,6 +278,7 @@ outcharl:
            out (0xE0), a
            ret
 
+
            .area _CODE
 
 ;
@@ -471,3 +454,30 @@ clearal:
 
 roller:            .db 0
 cursorpos:  .dw 0
+
+;
+;      We need map_current to be at least 256 bytes into common as we
+;      swap the first 256 bytes.
+;
+;      FIXME: should we teach the tools about a 'commondata' ?
+;
+           .area _COMMONMEM
+;
+;      These are in common, that means that on a system that switches
+; common by task there are multiple copies of this information.
+;
+; Safe IFF we always reload the *full* map when task switching (we do)
+;
+map_current:
+           .db 0               ; need this tracked
+           .db 0               ; hardware ports are write only
+           .db 0
+; Safe because we never task switch from an IRQ while in kernel mode.
+; In user mode we won't restore the saved area anyway
+map_save_area:
+           .db 0
+           .db 0
+           .db 0
+
+_kernel_flag:
+           .db 1