-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux-i386.S
70 lines (56 loc) · 1.21 KB
/
linux-i386.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
.file "linux-i386.S"
/* void context_init(void **sp,void *co) */
.text
.globl context_init
context_init:
push %eax
push %ebx
push %ecx
mov 16(%esp),%ecx /* sp */
mov 20(%esp),%ebx /* co */
mov %esp,%eax /* backup sp */
mov (%ecx),%esp /* set target sp */
push %ebx
push $0
push $cco_entry
push $0
push $0
push $0
push $0
push $0
push $0
push $0
push $0
mov %esp,(%ecx)
mov %eax,%esp
pop %ecx
pop %ebx
pop %eax
ret
/* void context_switch(void **sp) */
.text
.global context_switch
context_switch:
push $context_switch_end
pushf
push %eax
push %ebx
push %ecx
push %edx
push %esi
push %edi
push %ebp
mov %esp,%ebx
mov 40(%esp),%eax
mov (%eax),%esp
mov %ebx,(%eax)
pop %ebp
pop %edi
pop %esi
pop %edx
pop %ecx
pop %ebx
pop %eax
popf
context_switch_end:
ret