]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/xen/xen.s
audiosb16: cleanup audioprobe(), cast ISAConf.port to ulong
[plan9front.git] / sys / src / 9 / xen / xen.s
1 #include "xendefs.h"
2 #include "mem.h"
3
4 #define ENTRY(X) TEXT X(SB), $0 
5
6 /*
7  * XXX there's a race in here because we can get an upcall
8  * betwen the spllo() (in xenupcall) and the rti.  This will make
9  * handlers stack, which could lead to a blown stack.  Probably
10  * not worth fixing (but possibly worth detecting and panicing).
11  *
12  * For fun get some popcorn and turn off the lights and read the
13  * linux solution (search for scrit/ecrit).
14  */
15 ENTRY(hypervisor_callback)
16         SUBL    $8, SP          /* space for ecode and trap type */
17         PUSHL   DS                      /* save DS */
18         PUSHL   $(KDSEL)
19         POPL    DS                      /* fix up DS */
20         PUSHL   ES                      /* save ES */
21         PUSHL   $(KDSEL)
22         POPL    ES                      /* fix up ES */
23
24         PUSHL   FS                      /* save the rest of the Ureg struct */
25         PUSHL   GS
26         PUSHAL
27
28         PUSHL   SP                      /* Ureg* argument to trap */
29         CALL xenupcall+0(SB)
30         POPL    AX
31
32         POPAL
33         POPL    GS
34         POPL    FS
35         POPL    ES
36         POPL    DS
37         ADDL    $8, SP                  /* pop error code and trap type */
38         IRETL
39
40 /* Hypervisor uses this for application faults while it executes.*/
41 ENTRY(failsafe_callback)
42         IRETL
43         PUSHL   AX
44         CALL    install_safe_pf_handler(SB)
45         MOVL    32(SP), BX
46         MOVW    BX, DS
47         MOVL    36(SP), BX
48         MOVW    BX, ES
49         MOVL    40(SP), BX
50         MOVW    BX, FS
51         MOVL    44(SP), BX
52         MOVW    BX, GS
53         CALL    install_normal_pf_handler(SB)
54         POPL            AX
55         ADDL    $16, SP
56         IRETL
57
58 /* xen traps with varying argument counts */
59 TEXT xencall6(SB), $0
60         MOVL    VDI+20(FP), DI
61 TEXT xencall5(SB), $0
62         MOVL    VSI+16(FP), SI
63 TEXT xencall4(SB), $0
64         MOVL    VDX+12(FP), DX
65 TEXT xencall3(SB), $0
66         MOVL    VCX+8(FP), CX
67 TEXT xencall2(SB), $0
68         MOVL    VBX+4(FP), BX
69 TEXT xencall1(SB), $0
70         MOVL    op+0(FP), AX
71         INT     $0x82
72         RET