Blob


1 .globl getmcontext
2 getmcontext:
3 movl 4(%esp), %eax
5 movl %fs, 8(%eax)
6 movl %es, 12(%eax)
7 movl %ds, 16(%eax)
8 movl %ss, 76(%eax)
9 movl %edi, 20(%eax)
10 movl %esi, 24(%eax)
11 movl %ebp, 28(%eax)
12 movl %ebx, 36(%eax)
13 movl %edx, 40(%eax)
14 movl %ecx, 44(%eax)
16 movl $1, 48(%eax) /* %eax */
17 movl (%esp), %ecx /* %eip */
18 movl %ecx, 60(%eax)
19 leal 4(%esp), %ecx /* %esp */
20 movl %ecx, 72(%eax)
22 movl 44(%eax), %ecx /* restore %ecx */
23 movl $0, %eax
24 ret
26 .globl setmcontext
27 setmcontext:
28 movl 4(%esp), %eax
30 movl 8(%eax), %fs
31 movl 12(%eax), %es
32 movl 16(%eax), %ds
33 movl 76(%eax), %ss
34 movl 20(%eax), %edi
35 movl 24(%eax), %esi
36 movl 28(%eax), %ebp
37 movl 36(%eax), %ebx
38 movl 40(%eax), %edx
39 movl 44(%eax), %ecx
41 movl 72(%eax), %esp
42 pushl 60(%eax) /* new %eip */
43 movl 48(%eax), %eax
44 ret