mac-rom/OS/NKEventGroupWrapper.a
Elliot Nunn c087445dd0 Correct names of NK Event Group wrapper code
The names of the NanoKernel MP calls made by this 68k ROM library were
found by inspecting the PowerPC MPLibrary, which makes these and many
other MP calls. The document "Adding Multitasking Capability to
Applications Using Multiprocessing Services" gave some background
information. It also helped to determine the function signatures of the
MP calls and of these ROM wrappers.
2017-12-26 09:53:20 +08:00

91 lines
1.8 KiB
Plaintext

; Straightforward 68k wrappers for three NanoKernel MPCalls related to EventGroups
; How the FE1F trap makes MP calls:
;
; 68 reg | input | output
; -----------------------------------------------
; D0 | r0/MPCall selector | r3/return value 1
; A0 | r3/argument 1 | r4/return value 2
; D1 | r4/argument 2 | r5/return value 3
; A1 | r5/argument 3 | r6/return value 4
; pascal OSStatus NKCreateEvent(long return_space, MPEventID *event);
NKCreateEvent PROC EXPORT
LINK A6, #0
MOVEQ.L #49, D0
DC.W $FE1F ; CALL
MOVE.L D0, $C(A6) ; return r3;
MOVE.L $8(A6), D0 ; if(event) *event = r4;
BEQ.S @NOPTR
MOVE.L D0, A1
MOVE.L A0, (A1)
@NOPTR
UNLK A6
MOVE.L (SP)+, A0
ADDQ #4, SP
JMP (A0)
; pascal OSStatus NKSetSWIEvent(long return_space, MPEventID event, long swi);
NKSetSWIEvent PROC EXPORT
LINK A6, #0
MOVE.L $C(A6), A0 ; r3 = event;
MOVE.L $8(A6), D1 ; r4 = swi;
MOVEQ.L #54, D0
DC.W $FE1F ; CALL
MOVE.L D0, $10(A6) ; return r3;
UNLK A6
MOVE.L (SP)+, A0
ADDQ.L #8, SP
JMP (A0)
; pascal OSStatus NKWaitForEvent(MPEventID event, MPEventFlags *flags, Duration duration)
NKWaitForEvent PROC EXPORT
LINK A6, #$0
MOVE.L $8(A6), A1 ; r5 = duration;
MOVE.L $10(A6), A0 ; r3 = event;
MOVEQ.L #52, D0
DC.W $FE1F ; CALL
MOVE.L D0, $14(A6) ; return r3;
MOVE.L $C(A6), D0 ; if(flags) *flags = r4;
BEQ.B @NOPTR
MOVE.L D0, A1
MOVE.L A0, (A1)
@NOPTR
UNLK A6
MOVE.L (SP)+, A0
; DC.W $DEFC, $000C
OPT NONE ; not sure how this instruction got here!
ADDA.W #$C, SP
JMP (A0)
END