Merge from vendor branch FILE:
[dragonfly.git] / lib / libcaps / i386 / upcall.S
1         /*
2          * $DragonFly: src/lib/libcaps/i386/upcall.S,v 1.2 2003/12/07 04:21:54 dillon Exp $
3          */
4
5 #include "asmacros.h"
6 #include "asdefs.h"
7
8         .text
9         .globl  upc_callused_wrapper
10
11         /*
12          * On entry:    %eax contains function
13          *              %ecx contains data
14          *              Stack: [eax,ecx,eflags,oldip]
15          */
16 NON_GPROF_ENTRY(upc_callused_wrapper)
17         pushl   %edx            /* save %edx (upcall pointer) */
18         pushl   %ecx            /* func(data) */
19         call    *%eax
20         addl    $4,%esp
21         popl    %edx            /* upcall pointer */
22         movl    UPC_UTHREAD(%edx),%eax
23         incl    UPC_PENDING(%edx)    /* set pending bit (prevents upcalls) */
24         subl    $TDPRI_CRIT,TD_PRI(%eax) /* cleanup critical section count */
25         pushl   %esp            /* sp pointing to os supplied frame */
26         pushl   $-1             /* upcid */
27         pushl   $2              /* FETCH next */
28         call    upc_control
29         popl    %eax
30         popl    %ecx
31         popl    %edx
32         popfl
33         ret
34