From ba7c96396fcc0ea9f2dec3ec0fdb91b95505e942 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 28 Nov 2014 22:05:47 +0000 Subject: [PATCH] dragon: SAM implementation of the user memory copier --- Kernel/platform-dragon/usermem_sam.s | 116 +++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 Kernel/platform-dragon/usermem_sam.s diff --git a/Kernel/platform-dragon/usermem_sam.s b/Kernel/platform-dragon/usermem_sam.s new file mode 100644 index 00000000..b21ecf5b --- /dev/null +++ b/Kernel/platform-dragon/usermem_sam.s @@ -0,0 +1,116 @@ + .module usermem + +; +; 6809 + SAM copy to and from userspace +; +; This is linked by the 6881 using platforms only. MMU based +; machines simply don't need it. + + + include "kernel.def" + include "../kernel09.def" + + .globl __ugetc + .globl __ugetw + .globl __uget + .globl __ugets + + .globl __uputc + .globl __uputw + .globl __uput + .globl __uzero + + .area .common + +__ugetc: + SAM_USER + ldb ,x + lda #0 + tfr d,x + SAM_KERNEL + rts + +__ugetw: + SAM_USER + ldx ,x + SAM_KERNEL + rts + +__uget: + pshs u,y + ldu 6,s ; user address + ldy 8,s ; count +ugetl: + lda ,x++ + SAM_USER + sta ,u++ + SAM_KERNEL + leay -1,y + cmpy #0 + bne ugetl + puls u,y,pc + +__ugets: + pshs u,y + ldu 6,s ; user address + ldy 8,s ; count +ugetsl: + SAM_USER + lda ,x++ + beq ugetse + SAM_KERNEL + sta ,u++ + leay -1,y + cmpy #0 + bne ugetsl + ldx #0xffff ; unterminated - error + lda #0 + sta -1,u ; force termination + puls u,y,pc + +ugetse: + SAM_KERNEL + sta ,u + ldx #0 + puls u,y,pc + + +__uputc: + SAM_USER + stb ,x + SAM_KERNEL + rts + +__uputw: + SAM_USER + ldb 2,s + stb ,x + SAM_KERNEL + rts + +__uput: + pshs u,y + ldu 6,s ; user address + ldy 8,s ; count +uputl: + SAM_USER + lda ,x++ + SAM_KERNEL + sta ,u++ + leay -1,y + cmpy #0 + bne uputl + puls u,y,pc + +__uzero: + pshs y + lda #0 + ldy 6,s + SAM_USER +uzloop: + sta ,x+ + leay -1,y + cmpy #0 + bne uzloop + SAM_KERNEL + puls y,pc -- 2.34.1