xref: /plan9/sys/src/9/pc/plan9l.s (revision 7dd7cddf99dd7472612f1413b4da293630e6b1bc)
1#include "mem.h"
2
3/*
4 * This must match io.h.
5 */
6#define VectorSYSCALL	0x40
7
8/*
9 *  Used to get to the first process:
10 * 	set up an interrupt return frame and IRET to user level.
11 */
12TEXT touser(SB), $0
13	PUSHL	$(UDSEL)			/* old ss */
14	MOVL	sp+0(FP), AX			/* old sp */
15	PUSHL	AX
16	MOVL	$0x200, AX			/* interrupt enable flag */
17	PUSHL	AX				/* old flags */
18	PUSHL	$(UESEL)			/* old cs */
19	PUSHL	$(UTZERO+32)			/* old pc */
20	MOVL	$(UDSEL), AX
21	MOVW	AX, DS
22	MOVW	AX, ES
23	MOVW	AX, GS
24	MOVW	AX, FS
25	IRETL
26
27/*
28 * This is merely _strayintr from l.s optimised to vector
29 * to syscall() without going through trap().
30 */
31TEXT _syscallintr(SB), $0
32	PUSHL	$VectorSYSCALL			/* trap type */
33
34	PUSHL	DS
35	PUSHL	ES
36	PUSHL	FS
37	PUSHL	GS
38	PUSHAL
39	MOVL	$(KDSEL), AX
40	MOVW	AX, DS
41	MOVW	AX, ES
42	PUSHL	SP
43	CALL	syscall(SB)
44
45	POPL	AX
46	POPAL
47	POPL	GS
48	POPL	FS
49	POPL	ES
50	POPL	DS
51	ADDL	$8, SP				/* pop error code and trap type */
52	IRETL
53