z80: Fix in() and make it fastcall while we are at it
authorAlan Cox <alan@linux.intel.com>
Wed, 3 Oct 2018 13:35:29 +0000 (14:35 +0100)
committerAlan Cox <alan@linux.intel.com>
Wed, 3 Oct 2018 13:35:29 +0000 (14:35 +0100)
Kernel/cpu-z80/cpu.h
Kernel/lowlevel-z80-banked.s
Kernel/lowlevel-z80-thunked.s
Kernel/lowlevel-z80.s

index 859500a..172d681 100644 (file)
@@ -23,7 +23,7 @@ typedef uint16_t uptr_t;              /* Userspace pointer equivalent */
 typedef uint16_t irqflags_t;
 
 extern void out(uint8_t addr, uint8_t val);
-extern uint8_t in(uint8_t addr);
+extern uint8_t in(uint8_t addr) __z88dk_fastcall;
 
 /* Z80 binaries start with a JP */
 #define EMAGIC    0xc3    /* Header of executable */
index b4e241b..0a1524d 100644 (file)
@@ -672,12 +672,7 @@ _out:
        jp (hl)
 
 _in:
-       pop hl
-       pop de
-       pop bc
-       push bc
-       push de
-       push hl
+       ld c,l
        in l, (c)
        ret
 
index a942aca..f06b7b8 100644 (file)
@@ -422,10 +422,7 @@ _out:
        jp (hl)
 
 _in:
-       pop hl
-       pop bc
-       push bc
-       push hl
+       ld c,l
        in l, (c)
        ret
 
index cd50970..db6476f 100644 (file)
@@ -424,12 +424,6 @@ mmu_irq_ret:
        ld a, (0)
 
        call map_save_kernel
-       ;
-       ;       FIXME: re-implement sanity checks and add a stack one
-       ;
-
-       ; We need the kernel mapped for the IRQ handling
-       call map_kernel_di
 
        cp #0xC3
        call nz, null_pointer_trap
@@ -700,11 +694,11 @@ _out:
        push bc
        jp (hl)
 
+;
+;      Use z88dk_fastcall for in.
+;
 _in:
-       pop hl
-       pop bc
-       push bc
-       push hl
+       ld c,l
        in l, (c)
        ret