-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux-amd64.S
78 lines (72 loc) · 1.33 KB
/
linux-amd64.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
71
72
73
74
75
76
77
78
.file "linux-amd64.S"
/* void context_init(void **sp,void *co) */
.text
.globl context_init
context_init:
pushq %rax
movq %rsp,%rax
movq (%rdi),%rsp
pushq $cco_entry
pushq $0
pushq $0
pushq $0
pushq $0
pushq $0
pushq $0
pushq %rsi
pushq $0
pushq $0
pushq $0
pushq $0
pushq $0
pushq $0
pushq $0
pushq $0
pushq $0
movq %rsp,(%rdi)
movq %rax,%rsp
popq %rax
retq
/* void context_switch(void **sp) */
.text
.global context_switch
context_switch:
pushq $context_switch_end
pushfq
pushq %rax
pushq %rbx
pushq %rcx
pushq %rdx
pushq %rsi
pushq %rdi
pushq %rbp
pushq %r8
pushq %r9
pushq %r10
pushq %r11
pushq %r12
pushq %r13
pushq %r14
pushq %r15
movq (%rdi),%rax
movq %rsp,(%rdi)
movq %rax,%rsp
popq %r15
popq %r14
popq %r13
popq %r12
popq %r11
popq %r10
popq %r9
popq %r8
popq %rbp
popq %rdi
popq %rsi
popq %rdx
popq %rcx
popq %rbx
popq %rax
popfq
retq
context_switch_end:
retq