| Commit | Line | Data |
|---|---|---|
| 3eb3763b | 1 | /* |
| 0a455ac5 | 2 | * $DragonFly: src/test/sysperf/upcall.S,v 1.2 2003/11/21 08:32:45 dillon Exp $ |
| 3eb3763b MD |
3 | */ |
| 4 | .text | |
| 5 | .globl callused_wrapper | |
| 6 | ||
| 0a455ac5 MD |
7 | #define CRIT_COUNT 4 /* not a good idea to hardwire this XXX */ |
| 8 | #define PENDING 8 /* not a good idea to hardwire this XXX */ | |
| 9 | ||
| 3eb3763b MD |
10 | /* |
| 11 | * On entry: %eax contains function | |
| 12 | * %ecx contains data | |
| 13 | * Stack: [eax,ecx,eflags,oldip] | |
| 14 | */ | |
| 15 | callused_wrapper: | |
| 0a455ac5 | 16 | pushl %edx /* save %edx (upcall pointer) */ |
| 3eb3763b MD |
17 | pushl %ecx /* func(data) */ |
| 18 | call *%eax | |
| 19 | addl $4,%esp | |
| 0a455ac5 MD |
20 | popl %edx /* upcall pointer */ |
| 21 | incl PENDING(%edx) /* set pending bit (prevents upcalls) */ | |
| 22 | subl $32,CRIT_COUNT(%edx) /* cleanup critical section count */ | |
| 3eb3763b MD |
23 | pushl %esp /* sp pointing to os supplied frame */ |
| 24 | pushl $-1 /* upcid */ | |
| 25 | pushl $2 /* FETCH next */ | |
| 26 | call upc_control | |
| 27 | popl %eax | |
| 28 | popl %ecx | |
| 0a455ac5 | 29 | popl %edx |
| 3eb3763b MD |
30 | popfl |
| 31 | ret | |
| 32 |