rsc | 110c707 | 2006-04-21 03:34:44 +0000 | [diff] [blame] | 1 | .globl _tas |
| 2 | _tas: |
| 3 | movl $0xCAFEBABE, %eax |
| 4 | movl 4(%esp), %ecx |
| 5 | xchgl %eax, 0(%ecx) |
| 6 | ret |
| 7 | |
| 8 | .globl _getmcontext |
| 9 | _getmcontext: |
| 10 | movl 4(%esp), %eax |
| 11 | |
| 12 | movl %fs, 8(%eax) |
| 13 | movl %es, 12(%eax) |
| 14 | movl %ds, 16(%eax) |
| 15 | movl %ss, 76(%eax) |
| 16 | movl %edi, 20(%eax) |
| 17 | movl %esi, 24(%eax) |
| 18 | movl %ebp, 28(%eax) |
| 19 | movl %ebx, 36(%eax) |
| 20 | movl %edx, 40(%eax) |
| 21 | movl %ecx, 44(%eax) |
| 22 | |
| 23 | movl $1, 48(%eax) /* %eax */ |
| 24 | movl (%esp), %ecx /* %eip */ |
| 25 | movl %ecx, 60(%eax) |
| 26 | leal 4(%esp), %ecx /* %esp */ |
| 27 | movl %ecx, 72(%eax) |
| 28 | |
| 29 | movl 44(%eax), %ecx /* restore %ecx */ |
| 30 | movl $0, %eax |
| 31 | ret |
| 32 | |
| 33 | .globl _setmcontext |
| 34 | _setmcontext: |
| 35 | movl 4(%esp), %eax |
| 36 | |
| 37 | movl 8(%eax), %fs |
| 38 | movl 12(%eax), %es |
| 39 | movl 16(%eax), %ds |
| 40 | movl 76(%eax), %ss |
| 41 | movl 20(%eax), %edi |
| 42 | movl 24(%eax), %esi |
| 43 | movl 28(%eax), %ebp |
| 44 | movl 36(%eax), %ebx |
| 45 | movl 40(%eax), %edx |
| 46 | movl 44(%eax), %ecx |
| 47 | |
| 48 | movl 72(%eax), %esp |
| 49 | pushl 60(%eax) /* new %eip */ |
| 50 | movl 48(%eax), %eax |
| 51 | ret |
| 52 | |