Add an upcall performance test program + example context function
[dragonfly.git] / test / sysperf / upcall.S
1         /*
2          * $DragonFly: src/test/sysperf/upcall.S,v 1.1 2003/11/21 06:58:28 dillon Exp $
3          */
4         .text
5         .globl  callused_wrapper
6
7         /*
8          * On entry:    %eax contains function
9          *              %ecx contains data
10          *              Stack: [eax,ecx,eflags,oldip]
11          */
12 callused_wrapper:
13         pushl   %edx            /* save %edx */
14         pushl   %ecx            /* func(data) */
15         call    *%eax
16         addl    $4,%esp
17         incl    upc+8           /* set pending bit (prevents upcalls) */
18         subl    $32,upc+4       /* cleanup critical section count */
19         popl    %edx
20         pushl   %esp            /* sp pointing to os supplied frame */
21         pushl   $-1             /* upcid */
22         pushl   $2              /* FETCH next */
23         call    upc_control
24         popl    %eax
25         popl    %ecx
26         popfl
27         ret
28