Check the the ops mount pointer is not NULL before indirecting through it.
[dragonfly/vkernel-mp.git] / test / sysperf / sw.S
blobe6f5a8dee87be4052822ca96511f6348c9befd1a
2                 /*
3                  * sw.S
4                  *
5                  * $DragonFly: src/test/sysperf/sw.S,v 1.1 2003/08/12 04:29:44 dillon Exp $
6                  */
7                 .text
8                 .globl  qswitch, qrestore, qinit, qirestore, qstart
10 #if USE_ALL
12 #define PUSHAL          pushal
13 #define POPAL           popal
15 #endif
17 #if USE_CALLU1
19 #define PUSHAL          \
20         pushl   %ebx ;  \
21         pushl   %esi ;  \
22         pushl   %edi ;  \
23         pushl   %ebp 
25 #define POPAL           \
26         popl    %ebp ;  \
27         popl    %edi ;  \
28         popl    %esi ;  \
29         popl    %ebx
31 #endif
33 #if USE_CALLU2
35 #define PUSHAL                  \
36         subl    $16,%esp ;      \
37         movl    %ebx,(%esp) ;   \
38         movl    %esi,4(%esp) ;  \
39         movl    %edi,8(%esp) ;  \
40         movl    %ebp,12(%esp)
42 #define POPAL                   \
43         movl    (%esp),%ebx ;   \
44         movl    4(%esp),%esi ;  \
45         movl    8(%esp),%edi ;  \
46         movl    12(%esp),%ebp ; \
47         addl    $16,%esp
49 #endif
51                 /* qswitch(&olddesc, newdesc) */
52 qswitch:
53                 movl    8(%esp),%eax    /* new state */
54                 movl    4(%esp),%edx    /* save old state */
55                 PUSHAL
56                 pushl   $qrestore
57                 movl    %esp,(%edx)
58                 movl    %eax,%esp
59                 ret
61                 /* qstart(newdesc) */
62 qstart:
63                 movl    4(%esp),%esp
64                 ret
66 qrestore:
67                 POPAL
68                 ret
70                 /* newdesc = qinit(topofstk, func, arg) */
71 qinit:
72                 movl    4(%esp),%eax
73                 subl    $16,%eax
74                 movl    $qirestore,0(%eax)
75                 movl    8(%esp),%ecx
76                 movl    %ecx,4(%eax)
77                 movl    $0,8(%eax)
78                 movl    12(%esp),%ecx
79                 movl    %ecx,12(%eax)
80                 ret /* return eax */
82 qirestore:
83                 ret