From e1000c6c4f70917de78801bcb5935888b43fa15d Mon Sep 17 00:00:00 2001 From: Brett Gordon Date: Thu, 22 Oct 2015 13:08:32 -0400 Subject: [PATCH] coco3: uput/uget bugfix: restore kernel's mmu while iterating --- Kernel/platform-coco3/usermem_gime.s | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Kernel/platform-coco3/usermem_gime.s b/Kernel/platform-coco3/usermem_gime.s index 5addfd7d..bc981e48 100644 --- a/Kernel/platform-coco3/usermem_gime.s +++ b/Kernel/platform-coco3/usermem_gime.s @@ -195,7 +195,7 @@ min: rts a@ std ,u rts - + ;;; A faster user-kernel space copy ;;; takes: usr = usr space ptr ;;; takes: krn = kernel space ptr @@ -264,7 +264,13 @@ a@ lda ,u+ ; get a byte sta ,x+ ; store it leay -1,y ; bump counter bne a@ ; loop if not done - ;; inc outter loop + ;; end inner loop + ;; clean up kernel mmu's for next mapping or returning + ldd #$0001 ; restore kernel mapping (manually) + std $ffa8 + ldd #$0203 + std $ffaa + ;; increment out loop variables puls u ; restore data stack ldd krn ; add this iteration's byte count addd icount ; from source address @@ -277,10 +283,6 @@ a@ lda ,u+ ; get a byte std count lbne b@ ; if bytes left to copy then repeat ;; return - ldd #$0001 ; restore kernel mapping (manually) - std $ffa8 - ldd #$0203 - std $ffaa ldx #0 ; return #0 - success puls u,y,cc,pc ; return -- 2.34.1