Add src/test and throw in some of the ad-hoc timing and testing programs
[dragonfly.git] / test / sysperf / sw.S
1
2                 /*
3                  * sw.S
4                  *
5                  * $DragonFly: src/test/sysperf/sw.S,v 1.1 2003/08/12 02:29:44 dillon Exp $
6                  */
7                 .text
8                 .globl  qswitch, qrestore, qinit, qirestore, qstart
9
10 #if USE_ALL
11
12 #define PUSHAL          pushal
13 #define POPAL           popal
14
15 #endif
16
17 #if USE_CALLU1
18
19 #define PUSHAL          \
20         pushl   %ebx ;  \
21         pushl   %esi ;  \
22         pushl   %edi ;  \
23         pushl   %ebp 
24
25 #define POPAL           \
26         popl    %ebp ;  \
27         popl    %edi ;  \
28         popl    %esi ;  \
29         popl    %ebx
30
31 #endif
32
33 #if USE_CALLU2
34
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)
41
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
48
49 #endif
50
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
60
61                 /* qstart(newdesc) */
62 qstart:
63                 movl    4(%esp),%esp
64                 ret
65
66 qrestore:
67                 POPAL
68                 ret
69
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 */
81
82 qirestore:
83                 ret