From b6a7e5bfc7619ad108bc730eb95c08e0d1e42164 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 21 Jul 2015 23:34:00 +0100 Subject: [PATCH] 68hc11: flesh out more of the support code --- Kernel/platform-68hc11test/kernel.def | 49 +++++++++----- Kernel/platform-68hc11test/p68hc11.s | 92 ++++++++++++++++++++++++++- 2 files changed, 125 insertions(+), 16 deletions(-) diff --git a/Kernel/platform-68hc11test/kernel.def b/Kernel/platform-68hc11test/kernel.def index 59eab43e..7205c685 100644 --- a/Kernel/platform-68hc11test/kernel.def +++ b/Kernel/platform-68hc11test/kernel.def @@ -9,38 +9,57 @@ ; ; EEPROM entry points ; -; A = srcbank, B = dstbank -; IX = src, returns value in D +; A = bank +; X = src, returns value in B or D .equ fargetb , 0xF840 -.equ fargetw , 0xF842 +.equ fargetw , 0xF843 ; -; A = srcbank, B = dstbank -; IX = dst, IY = dstval +; A = bank B = value +; X = dst +; +.equ farputb , 0xF846 ; -.equ farputb , 0xF844 -.equ farputw , 0xF846 +; A = bank +; X = dst, Y = value +; +.equ farputw , 0xF849 ; ; A = srcbank, B = dstbank -; IX = dst, IY = src +; X = dst, Y = src ; kernel:_tmp1 = length (in kernel bank) ; -.equ farcopy , 0xF848 +.equ farcopy , 0xF84C ; -; A = bank, IX = function, IY = far stack +; A = bank, X = function, Y = far stack ; -.equ farcall , 0xF84A +.equ farcall , 0xF84F ; -; A = bank, IX = function, IY = far stack +; A = bank, X = function, Y = far stack ; -.equ farjump , 0xF84C +.equ farjump , 0xF852 ; ; A = bank ; -.equ setbank , 0xF84E +.equ setbank , 0xF855 ; ; D = 0 ; -.equ reboot , 0xF850 +.equ reboot , 0xF858 +; +; A = srcbank, B = dstbank +; X = dst, Y = src +; kernel:_tmp1 = length (in kernel bank) +; +.equ farzcopy , 0xF85B +; +; A = bank +; X = dst +; Y = len +; +; Return in D +; +.equ farzero , 0xF85E +; ; ; ; Low memory usage (not banked) diff --git a/Kernel/platform-68hc11test/p68hc11.s b/Kernel/platform-68hc11test/p68hc11.s index e01800aa..e0bb1ca8 100644 --- a/Kernel/platform-68hc11test/p68hc11.s +++ b/Kernel/platform-68hc11test/p68hc11.s @@ -135,15 +135,105 @@ map_process: .globl _uzero +; +; D = user address +; doexec: + xgdx ; function into X + ldaa usrbank ; bank + ldy U_DATA__U_ISP + jsr farcall +; +; If this returns we should probably do an exit call or something +; FIXME +; + jmp trap_monitor + + +; +; D = user address +; sigdispatch: + xgdx + ldy U_DATA__U_SYSCALL_SP + ldaa usrbank + ; This may not return which is fine + jmp farcall + ; Signal handler completed and returned back to the eeprom and thus + ; banked back to kernel so returns to our caller + +; +; We have no common but instead route far accesses via the eeprom +; helpers in the firmware. +; _ugetc: + xgdx + ldaa usrbank + jsr fargetb + clra + rts _ugetw: + xgdx + ldaa usrbank + jmp fargetw + +; +; D = src, 2(s) = dest, 4(s) = size +; _ugets: + tsx + xgdy ; D was src, we want it in Y + ldd 4,x ; size + std tmp1 ; in tmp1 + ldx 2,x ; destination in X + clrb ; 0 = kernel + ldaa usrbank ; user space + jmp farzcopy ; returns error/size in D +; +; D = src, 2(s) = dest, 4(s) = size +; _uget: + tsx + xgdy ; D was src, we want it in Y + ldd 4,x ; size + std tmp1 ; in tmp1 + ldx 2,x ; destination in X + clrb ; 0 = kernel + ldaa usrbank ; user space + jmp farcopy +; +; D = value, 2(s) = dst +; _uputc: + tsx + ldx 2,x ; x is dst + xgdy ; value into y + ldaa usrbank + jmp farputb + _uputw: + tsx + ldx 2,x ; x is dst + xgdy ; value into y + ldaa usrbank + jmp farputw +; +; D = src, 2(s) = dst, 4(s) = size +; _uput: + tsx + xgdy ; D was src, we want it in Y + ldd 4,x ; size + std tmp1 ; in tmp1 + ldx 2,x ; destination in X + clra ; 0 = kernel + ldab usrbank ; user space + jmp farcopy _uzero: - /* FIXME */ + tsx + ldy 2,x ; length + xgdx ; pointer + ldaa usrbank + jmp farzero + rts -- 2.34.1