From 2cfefb8adcb659428a5448e811c33a9de5347c75 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 22 Nov 2014 22:48:15 +0000 Subject: [PATCH] pcw8256: Various fixes 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 | 5 ++-- Kernel/platform-pcw8256/commonmem.s | 40 +------------------------ Kernel/platform-pcw8256/pcw8256.s | 46 ++++++++++++++++++----------- 3 files changed, 32 insertions(+), 59 deletions(-) diff --git a/Kernel/platform-pcw8256/Makefile b/Kernel/platform-pcw8256/Makefile index 5ee8a06d..ab7fd464 100644 --- a/Kernel/platform-pcw8256/Makefile +++ b/Kernel/platform-pcw8256/Makefile @@ -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) diff --git a/Kernel/platform-pcw8256/commonmem.s b/Kernel/platform-pcw8256/commonmem.s index 3cd0aa70..30f4321b 100644 --- a/Kernel/platform-pcw8256/commonmem.s +++ b/Kernel/platform-pcw8256/commonmem.s @@ -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 - .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- .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 diff --git a/Kernel/platform-pcw8256/pcw8256.s b/Kernel/platform-pcw8256/pcw8256.s index cd649c5d..f3744c82 100644 --- a/Kernel/platform-pcw8256/pcw8256.s +++ b/Kernel/platform-pcw8256/pcw8256.s @@ -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 -- 2.34.1