From: Alan Cox Date: Tue, 2 Jan 2018 19:20:28 +0000 (+0000) Subject: 65c816: fix wrap on DP computation, and add brk handling X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=36143f0398e9e02e18dbf40185c1606f121060a0;p=FUZIX.git 65c816: fix wrap on DP computation, and add brk handling --- diff --git a/Kernel/lowlevel-65c816.s b/Kernel/lowlevel-65c816.s index 355c5d5a..d98c5f4d 100644 --- a/Kernel/lowlevel-65c816.s +++ b/Kernel/lowlevel-65c816.s @@ -8,6 +8,7 @@ .export map_process_always .export map_kernel .export _userpage + .export _brk_limit .export sigret_irq .export sigret @@ -116,6 +117,7 @@ setdp: adc #STACK_BANKOFF ; we now point at the stack inc a ; plus 0x100 xba ; Swap to get xx00 format we need + and #$FF00 ; remove any carry bits tcd pla @@ -362,10 +364,33 @@ signal_out: cli rtl ; return into user app handler ; +; +; Helper for brk(). In this case we need it in asm to deal with the +; strange dual stack setup +; +_brk_limit: + .a8 + .i8 + rep #$10 + .i16 + ldx U_DATA__U_SYSCALL_SP + lda f:2,x + tax + lda f:1,x + dex + dex + dex ; allow 384 bytes headroom + sep #$10 + .i8 + rts + +; ; doexec is a special case syscall exit path. Set up the bank ; registers and return directly to the start of the user process ; _doexec: + .a8 + .i8 sta ptr1 stx ptr1+1 ; address to execute from sei @@ -1011,5 +1036,5 @@ sigret_irq: .i8 syscall_vector: - jsl KERNEL_FAR+syscall_entry + jsl KERNEL_CODE_FAR+syscall_entry rts