platform_switchout
authorAlan Cox <alan@linux.intel.com>
Thu, 29 Mar 2018 22:55:49 +0000 (23:55 +0100)
committerAlan Cox <alan@linux.intel.com>
Thu, 29 Mar 2018 22:55:49 +0000 (23:55 +0100)
Updated everywhere that looks like it needs it

29 files changed:
Kernel/cpu-z180/z180.s
Kernel/lib/65c816.s
Kernel/platform-68hc11test/tricks.s
Kernel/platform-appleiie/tricks.s
Kernel/platform-atarist/tricks.S
Kernel/platform-coco2/tricks.s
Kernel/platform-coco2cart/tricks.s
Kernel/platform-coco3/tricks.s
Kernel/platform-dragon-nx32/tricks.s
Kernel/platform-ibmpc/tricks.S
Kernel/platform-micropack/tricks.s
Kernel/platform-msp430fr5969/tricks.S
Kernel/platform-msx1/tricks.s
Kernel/platform-multicomp09/tricks.s
Kernel/platform-nc100/tricks.s
Kernel/platform-pcw8256/tricks.s
Kernel/platform-pdp11/tricks.S
Kernel/platform-plus3/tricks.s
Kernel/platform-px4plus/tricks.s
Kernel/platform-socz80/tricks.s
Kernel/platform-v65/tricks.s
Kernel/platform-v68-banked/tricks.S
Kernel/platform-v68-softmmu/tricks.S
Kernel/platform-v68/tricks.S
Kernel/platform-z80pack-lite/tricks.s
Kernel/platform-z80pack32/tricks.s
Kernel/platform-zeta-v2/tricks.s
Kernel/platform-zx128/tricks.s
Kernel/process.c

index 967ab13..1ef3971 100644 (file)
@@ -25,7 +25,7 @@
         .globl _getproc
         .globl _trap_monitor
         .globl _switchin
-        .globl _switchout
+        .globl _platform_switchout
         .globl _dofork
         .globl map_kernel
         .globl map_process_always
@@ -674,13 +674,9 @@ z180_irq_unused:
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-; 
-; This function can have no arguments or auto variables.
-_switchout:
-        di
-        call _chksigs
+_platform_switchout:
+       di
         ; save machine state
-
         ld hl, #0 ; return code set here is ignored, but _switchin can 
         ; return from either _switchout OR _dofork, so they must both write 
         ; U_DATA__U_SP with the following on the stack:
index 4f12020..1c3b7ff 100644 (file)
@@ -6,7 +6,7 @@
         .include "../kernel816.def"
        .include "../platform/zeropage.inc"
 
-       .export _switchout
+       .export _platform_switchout
        .export _switchin
        .export _dofork
 
@@ -29,9 +29,8 @@
        .i8
        .a8
 
-_switchout:
+_platform_switchout:
        sei
-       jsr     _chksigs
        rep     #$10                    ; Index to 16bit
        .i16
        ldx     #0
@@ -40,38 +39,6 @@ _switchout:
        phx
        tsx
        stx     U_DATA__U_SP
-       sep     #$10                    ; Back to 8 for C code
-
-       .i8
-       lda     _nready
-       bne     slow_path
-idling:
-       cli
-       jsr     _platform_idle
-       sei
-       lda     _nready
-       beq     idling
-       cmp     #1
-       bne     slow_path
-
-       rep #$10
-       .i16
-       ldx     U_DATA__U_PTAB
-       lda     a:0,x
-       cmp     #P_READY
-       bne     slow_path
-       lda     #P_RUNNING
-       sta     a:P_TAB__P_STATUS_OFFSET,x
-       plx
-       stx     sp
-       plx                             ; discard 0
-       sep     #$30
-       ; Get back into the way C expects us
-       .i8
-       .a8
-       cli
-       rts
-slow_path:
        ;
        ;       Switch of task - save our udata and stack. Note we are
        ;       saving the stack we are executing upon !
index 2f9be56..e94cebe 100644 (file)
@@ -12,7 +12,7 @@
         .globl getproc
         .globl trap_monitor
         .globl inint
-        .globl switchout
+        .globl platform_switchout
         .globl switchin
         .globl dofork
        .globl ramtop
@@ -43,13 +43,11 @@ switchstack:
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
 ;
-; This function can have no arguments or auto variables.
 ; We have no registers to preserve as the compiler assumes a function call
 ; clobbers the works.
 ;
-switchout:
+platform_switchout:
        sei
-        jsr chksigs
 
         ; save machine state
         ldx #0 ; return code set here is ignored, but _switchin can 
index 78e0dac..d5a5f5a 100644 (file)
@@ -1,7 +1,7 @@
 ;
 ;      6502 version
 ;
-        .export _switchout
+        .export _platform_switchout
         .export _switchin
         .export _dofork
        .export _ramtop
@@ -39,13 +39,9 @@ _ramtop:
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
 ;
-; FIXME: make sure we optimise the switch to self case higher up the stack!
-; 
-; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
        sei
 
-        jsr _chksigs
 ;
 ;      Put the C stack on the CPU stack, and store that in U_SP
 ;
index 5d1b30b..70d010d 100644 (file)
@@ -1,7 +1,7 @@
 #include "../kernel-68000.def"
 
 
-.globl _switchout,_switchin,_dofork
+.globl _platfomr_switchout,_switchin,_dofork
 
 .mri 1
 
@@ -9,11 +9,8 @@
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-; 
-; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
         or #$0700,sr
-        bsr _chksigs
         ; save machine state
 
         clr.w -(sp) ; return code set here is ignored, but _switchin can 
index bb43618..5974993 100644 (file)
@@ -20,7 +20,7 @@
 
        # exported
         .globl _switchout
-        .globl _switchin
+        .globl _platform_switchin
         .globl _dofork
        .globl _ramtop
 
@@ -37,12 +37,8 @@ _ramtop:
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-;
-; 
-; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
        orcc #0x10              ; irq off
-        jsr _chksigs
 
         ; save machine state, including Y and U used by our C code
         ldd #0 ; return code set here is ignored, but _switchin can 
index 8e62a8f..b5ca7b5 100644 (file)
@@ -20,7 +20,7 @@
        .globl _platform_idle
 
        # exported
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _dofork
        .globl _ramtop
@@ -41,9 +41,8 @@ _ramtop:
 ;
 ; 
 ; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
        orcc #0x10              ; irq off
-        jsr _chksigs
 
         ; save machine state, including Y and U used by our C code
         ldd #0 ; return code set here is ignored, but _switchin can 
index e6e14d4..84c45d1 100644 (file)
@@ -12,7 +12,7 @@
        .globl _swap_finish
 
        ;; exported
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _dofork
        .globl _ramtop
@@ -40,13 +40,8 @@ fork_proc_ptr:
 ;;; possibly the same process, and switches it in.  When a process is
 ;;; restarted after calling switchout, it thinks it has just returned
 ;;; from switchout().
-;;;
-;;; FIXME: make sure we optimise the switch to self case higher up the stack!
-;;;
-;;; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
        orcc    #0x10           ; irq off
-        jsr    _chksigs        ; check for signals
 
         ;; save machine state
         ldd    #0              ; return zero
index 058f7d6..fc50984 100644 (file)
@@ -18,7 +18,7 @@
        .globl _platform_idle
 
        # exported
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _dofork
        .globl _ramtop
@@ -37,12 +37,8 @@ _ramtop:
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
 ;
-; FIXME: make sure we optimise the switch to self case higher up the stack!
-; 
-; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
        orcc #0x10              ; irq off
-        jsr _chksigs
 
         ; save machine state, including Y and U used by our C code
         ldd #0 ; return code set here is ignored, but _switchin can 
@@ -51,53 +47,6 @@ _switchout:
        pshs d,y,u
        sts U_DATA__U_SP        ; this is where the SP is restored in _switchin
 
-       ; See if we are about to go idle
-       lda _nready
-       ; Someone else will run - go the slow path into the scheduler
-       bne slow_path
-
-       ;
-       ; Wait for something to become ready
-       ;
-idling:
-       andcc #0xef
-       jsr _platform_idle
-       orcc #0x10
-
-       lda _nready
-       beq idling
-
-       ; Did multiple things wake up, if so we must follow the slow
-       ; path
-       cmpa #1
-       bne slow_path
-
-       ; Was the waker us ?
-       ldx U_DATA__U_PTAB
-       lda P_TAB__P_STATUS_OFFSET,x
-       cmpa #P_READY
-       ; No: follow the slow path
-       bne slow_path
-
-       ; We can use the fast path for returning.
-       ;
-       ; Mark ourself running with a new time slice allocation
-       ;
-       lda #P_RUNNING
-       sta P_TAB__P_STATUS_OFFSET,x
-       ldx #0
-       stx _runticks
-       ;
-       ; We idled and got the CPU back - fast path, and we know
-       ; we are not a pre-emption. In effect the switchout() becomes
-       ; a normal function call and we don't have to stash anything or
-       ; bank switch.
-       ;
-       andcc #0xef
-       puls d,y,u,pc
-
-
-slow_path:
        ; Stash the uarea into process memory bank
        jsr map_process_always
 
index 84fbbee..a0e4897 100644 (file)
@@ -11,7 +11,7 @@
        .text
 
        .globl switchin
-       .globl switchout
+       .globl platform_switchout
        .globl dofork
 
 
@@ -68,28 +68,8 @@ fork_copy:
        /* Called to give up processor time. We will pop out of this in
           potentially some other process, but we might also come back
           directly */
-switchout:
+platform_switchout:
        cli
-       call chksigs
-       movb nready,%al
-       cmpb $1,%al
-       bne slow_path
-idling:
-       sti
-       call platform_idle
-       cli
-       movb nready,%al
-       cmpb $0,%al
-       je idling
-
-       /* Ok there is something to run - but is it us ? */
-       cmpb $1,%al
-       jne slow_path
-
-       /* Fast path out */
-       ret
-
-slow_path:
        xorw %ax,%ax
        pushw %ax
        pushw %ei
index b789c99..5cd15b0 100644 (file)
@@ -8,7 +8,7 @@
         .globl _getproc
         .globl _trap_monitor
         .globl trap_illegal
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _doexec
         .globl _dofork
@@ -34,9 +34,8 @@
 ; from switchout().
 ;
 ; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
         di
-        call _chksigs
         ; save machine state
 
         ld hl, #0 ; return code set here is ignored, but _switchin can 
index 6ff3d59..7db7092 100644 (file)
@@ -30,7 +30,7 @@ proc load_overlay
 ; from switchout().
 
 .globl switchin
-proc switchout
+proc platform_switchout
        dint                              // interrupts off
        clr r12                           // set return code
        pushm #12, r15                    // save all registers (r15 to r4)
index 1269ac3..f3b0d73 100644 (file)
@@ -38,9 +38,8 @@ _ramtop:
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-; 
-; This function can have no arguments or auto variables.
 _platform_switchout:
+       di
         ; save machine state
 
         ld hl, #0 ; return code set here is ignored, but _switchin can 
index 811fc9b..dc719cb 100644 (file)
@@ -13,7 +13,7 @@
        .globl curr_tr
 
        ;; exported
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _dofork
        .globl _ramtop
@@ -41,13 +41,8 @@ fork_proc_ptr:
 ;;; possibly the same process, and switches it in.  When a process is
 ;;; restarted after calling switchout, it thinks it has just returned
 ;;; from switchout().
-;;;
-;;; FIXME: make sure we optimise the switch to self case higher up the stack!
-;;;
-;;; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
        orcc    #0x10           ; irq off
-        jsr    _chksigs        ; check for signals
 
         ;; save machine state
         ldd    #0              ; return zero
index ff1ba23..079eddb 100644 (file)
@@ -8,7 +8,7 @@
         .globl _getproc
         .globl _trap_monitor
         .globl trap_illegal
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _doexec
         .globl _dofork
@@ -40,12 +40,8 @@ _need_resched:
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
 ;
-; FIXME: make sure we optimise the switch to self case higher up the stack!
-; 
 ; This function can have no arguments or auto variables.
-_switchout:
-        di
-        call _chksigs
+_platform_switchout:
         ; save machine state
 
         ld hl, #0 ; return code set here is ignored, but _switchin can 
index 9506e20..cb61b91 100644 (file)
@@ -7,7 +7,7 @@
         .globl _trap_monitor
         .globl trap_illegal
         .globl _inint
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _doexec
         .globl _dofork
@@ -33,9 +33,8 @@
 ; FIXME: make sure we optimise the switch to self case higher up the stack!
 ; 
 ; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
         di
-        call _chksigs
         ; save machine state
 
        ld a, #'O'
index 30521a6..7f3cb36 100644 (file)
@@ -6,9 +6,8 @@
        .globl _switchout
        .globl _dofork
 
-_switchout:
+_platform_switchout:
        bis 0340,0177776
-       jsr pc,_chksigs
        clr -(sp)
        mov r5,-(sp)
        mov r4,-(sp)
index 4744ac1..9033c33 100644 (file)
@@ -13,7 +13,7 @@
         .globl _trap_monitor
         .globl trap_illegal
         .globl _inint
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _doexec
         .globl _dofork
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-;
-; FIXME: make sure we optimise the switch to self case higher up the stack!
-; 
-; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
         di
-        call _chksigs
         ; save machine state
 
         ld hl, #0 ; return code set here is ignored, but _switchin can 
index a667313..631dc11 100644 (file)
@@ -9,7 +9,7 @@
         .globl _trap_monitor
         .globl trap_illegal
         .globl _inint
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _doexec
         .globl _dofork
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-;
-; FIXME: make sure we optimise the switch to self case higher up the stack!
-; 
-; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
         di
-       push af
-        call _chksigs
-       pop af
         ; save machine state
 
         ld hl, #0 ; return code set here is ignored, but _switchin can 
index 04dd0a4..7156db4 100644 (file)
@@ -10,7 +10,7 @@
         .globl _trap_monitor
         .globl trap_illegal
         .globl _inint
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _dofork
         .globl _runticks
@@ -40,9 +40,8 @@
 ; from switchout().
 ; 
 ; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
         di
-        call _chksigs
         ; save machine state
 
         ld hl, #0 ; return code set here is ignored, but _switchin can 
index d55361c..32e809c 100644 (file)
@@ -1,7 +1,7 @@
 ;
 ;      6502 version
 ;
-        .export _switchout
+        .export _platform_switchout
         .export _switchin
         .export _dofork
        .export _ramtop
@@ -36,14 +36,9 @@ _ramtop:
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-;
-; FIXME: make sure we optimise the switch to self case higher up the stack!
-; 
-; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
        sei
 
-        jsr _chksigs
 ;
 ;      Put the C stack on the CPU stack, and store that in U_SP
 ;
index 212bd77..09dd413 100644 (file)
@@ -1,7 +1,7 @@
 #include "../kernel-68000.def"
 #include "kernel.def"
 
-.globl switchout,switchin,dofork,udata_shadow,udata_stash
+.globl platform_switchout,switchin,dofork,udata_shadow,udata_stash
 
 
 .mri 1
@@ -31,9 +31,8 @@
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-switchout:
+platform_switchout:
         or #$0700,sr
-        bsr chksigs
         ; save machine state
 
         clr.w -(sp) ; return code set here is ignored, but switchin can
index 6b80226..1790138 100644 (file)
@@ -2,7 +2,7 @@
 #include "kernel.def"
 
 
-.globl switchout,switchin,dofork,udata_shadow
+.globl platform_switchout,switchin,dofork,udata_shadow
 
 .mri 1
 
@@ -10,9 +10,8 @@
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-switchout:
+platform_switchout:
         or #$0700,sr
-        bsr chksigs
         ; save machine state
 
         clr.w -(sp) ; return code set here is ignored, but switchin can
index 477962d..bbe2040 100644 (file)
@@ -1,7 +1,7 @@
 #include "../kernel-68000.def"
 
 
-.globl switchout,switchin,dofork,udata_shadow
+.globl platform_switchout,switchin,dofork,udata_shadow
 
 .mri 1
 
@@ -9,11 +9,8 @@
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-; 
-; This function can have no arguments or auto variables.
-switchout:
+platform_switchout:
         or #$0700,sr
-        bsr chksigs
         ; save machine state
 
         clr.w -(sp) ; return code set here is ignored, but switchin can
index 4b7ec31..703fa47 100644 (file)
@@ -8,7 +8,7 @@
         .globl _getproc
         .globl _trap_monitor
         .globl trap_illegal
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _doexec
         .globl _dofork
@@ -40,12 +40,8 @@ _ramtop:
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
 ;
-; FIXME: make sure we optimise the switch to self case higher up the stack!
-; 
-; This function can have no arguments or auto variables.
-_switchout:
+_platform__switchout:
         di
-        call _chksigs
         ; save machine state
 
         ld hl, #0 ; return code set here is ignored, but _switchin can 
index 3f70cf3..3e30fe4 100644 (file)
@@ -9,7 +9,7 @@
         .globl _trap_monitor
         .globl trap_illegal
         .globl _inint
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _doexec
         .globl _dofork
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-;
-; FIXME: make sure we optimise the switch to self case higher up the stack!
-; 
-; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
         di
-        call _chksigs
         ; save machine state
 
         ld hl, #0 ; return code set here is ignored, but _switchin can 
index 0502b0d..8939fdf 100644 (file)
@@ -8,7 +8,7 @@
         .globl _getproc
         .globl _trap_monitor
         .globl trap_illegal
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
         .globl _doexec
         .globl _dofork
@@ -40,13 +40,8 @@ _need_resched:
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-;
-; FIXME: make sure we optimise the switch to self case higher up the stack!
-; 
-; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
         di
-        call _chksigs
         ; save machine state
 
         ld hl, #0 ; return code set here is ignored, but _switchin can 
index 41519b3..defe921 100644 (file)
@@ -7,11 +7,10 @@
 
         .globl _ptab_alloc
         .globl _newproc
-        .globl _chksigs
         .globl _getproc
         .globl _trap_monitor
         .globl trap_illegal
-        .globl _switchout
+        .globl _platform_switchout
         .globl _switchin
        .globl _low_bank
        .globl _dup_low_page
 ; possibly the same process, and switches it in.  When a process is
 ; restarted after calling switchout, it thinks it has just returned
 ; from switchout().
-;
-; This function can have no arguments or auto variables.
-_switchout:
+_platform_switchout:
         di
-       push af
-        call _chksigs
-       pop af
         ; save machine state
 
         ld hl, #0 ; return code set here is ignored, but _switchin can 
index e102f54..7c9e6a4 100644 (file)
@@ -501,6 +501,8 @@ void unix_syscall(void)
                   don't look for optimizations. Likewise we know a signal
                   process will stay running/ready */
                platform_switchout();
+               /* We will check the signals before we return to user space
+                  so all is good */
        }
        ei();
        chksigs();