tgl6502: snapshot of syscall work
authorAlan Cox <alan@linux.intel.com>
Sat, 17 Jan 2015 01:13:43 +0000 (01:13 +0000)
committerAlan Cox <alan@linux.intel.com>
Sat, 17 Jan 2015 01:13:43 +0000 (01:13 +0000)
We make syscalls now, but the arguments are mashed.

Kernel/platform-tgl6502/tgl6502.s

index 63cee77..2ab37cc 100644 (file)
@@ -366,33 +366,42 @@ syscall_entry:
            ; Remove the arguments. This is fine as by the time we go back
            ; to the user stack we'll have finished with them
            lda sp
+           sta ptr1
            ldx sp+1
+           stx ptr1+1
            jsr cincaxy
            sta sp
            stx sp+1
 
-           ldy #0
            ;
            ;   We copy the arguments but need to deal with the compiler
            ;   stacking in the reverse order. At this point ptr1 points
            ;   to the last byte of the arguments (first argument). We go
            ;   down the stack copying words up the argument list.
            ;
-
+           ldx #'S'
+           stx $FF03
+           ldx #0
+           pha
+           tya
+           jsr outcharhex
+           pla
+           iny
+           dey
+           beq noargs
 copy_args:
            lda (ptr1),y                ; copy the arguments over
-           sta U_DATA__U_ARGN,x
-           iny
-            inx
+           sta U_DATA__U_ARGN+1,x
+           dey
            lda (ptr1),y
            sta U_DATA__U_ARGN,x
-            iny
-            dex
-            dex
-           dex
-           cpy #8
+            inx
+           inx
+            dey
            bne copy_args
-
+noargs:
+           ldx #'Y'
+           stx $FF03
            ;
            ; Now we need to stack switch. Save the adjusted stack we want
            ; for return
@@ -420,6 +429,9 @@ copy_args:
            lda #>kstack_top
            sta sp+1
 
+           ldx #'S'
+           stx $FF03
+
            cli
 ;
 ;      Caution: We may enter here and context switch and another task