rsc | d54ead7 | 2004-12-28 04:20:39 +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 setmcontext | ||||
9 | setmcontext: | ||||
10 | movl 4(%esp), %edx | ||||
11 | movl 8(%edx), %fs | ||||
12 | movl 12(%edx), %es | ||||
13 | movl 16(%edx), %ds | ||||
14 | movl 76(%edx), %ss | ||||
15 | movl 20(%edx), %edi | ||||
16 | movl 24(%edx), %esi | ||||
17 | movl 28(%edx), %ebp | ||||
18 | movl %esp, %ecx | ||||
19 | movl 72(%edx), %esp | ||||
20 | pushl 60(%edx) /* eip */ | ||||
21 | pushl 44(%edx) /* ecx */ | ||||
22 | pushl 48(%edx) /* eax */ | ||||
23 | movl 36(%edx), %ebx | ||||
24 | movl 40(%edx), %edx | ||||
25 | movl 12(%ecx), %eax | ||||
26 | popl %eax | ||||
27 | popl %ecx | ||||
28 | ret | ||||
29 | |||||
30 | .globl getmcontext | ||||
31 | getmcontext: | ||||
32 | pushl %edx | ||||
33 | movl 8(%esp), %edx | ||||
34 | movl %fs, 8(%edx) | ||||
35 | movl %es, 12(%edx) | ||||
36 | movl %ds, 16(%edx) | ||||
37 | movl %ss, 76(%edx) | ||||
38 | movl %edi, 20(%edx) | ||||
39 | movl %esi, 24(%edx) | ||||
40 | movl %ebp, 28(%edx) | ||||
41 | movl %ebx, 36(%edx) | ||||
42 | movl $1, 48(%edx) | ||||
43 | popl %eax | ||||
44 | movl %eax, 40(%edx) | ||||
45 | movl %ecx, 44(%edx) | ||||
46 | movl (%esp), %eax /* eip */ | ||||
47 | movl %eax, 60(%edx) | ||||
48 | movl %esp, %eax | ||||
49 | addl $4, %eax /* setmcontext will re-push the eip */ | ||||
50 | movl %eax, 72(%edx) | ||||
51 | movl 40(%edx), %edx | ||||
52 | xorl %eax, %eax | ||||
53 | ret | ||||
54 |