File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ # NOTE: This is not yet safe to use. Checked in for the same of reference.
2
+ #
3
+ # (int) slp_switch (void);
4
+
5
+ .text
6
+ .type slp_switch, @function
7
+ # This next line is required to the C code can find and
8
+ # link against this function.
9
+ .global slp_switch
10
+ slp_switch:
11
+ pushq %rbp
12
+ pushq %r15
13
+ pushq %r14
14
+ pushq %r13
15
+ pushq %r12
16
+ pushq %rbx
17
+
18
+ # Disabled for now, which should ideally give us identical
19
+ # behaviour to the inline C version. Can add this when we
20
+ # are ready for it.
21
+ #subq $8, %rsp
22
+ #stmxcsr (%rsp)
23
+
24
+ movq %rsp , %rdi
25
+
26
+ call slp_save_state # diff = slp_save_state([?]stackref)
27
+
28
+ cmp $-1 , %rax # if (diff == -1)
29
+ je .exit # return -1;
30
+
31
+ cmp $1 , %rax # if (diff == 1)
32
+ je .no_restore # return 0;
33
+
34
+ .restore:
35
+ add %rax , %rsp # Adjust the stack pointer for the state we are restoring.
36
+
37
+ call slp_restore_state # slp_restore_state()
38
+
39
+ .no_restore:
40
+ xor %rax , %rax # Switch successful (whether we restored or not).
41
+
42
+ .exit:
43
+ #ldmxcsr (%rsp)
44
+ #addq $8, %rsp
45
+
46
+ popq %rbx
47
+ popq %r12
48
+ popq %r13
49
+ popq %r14
50
+ popq %r15
51
+ # rbp gets popped by the leave statement
52
+
53
+ leave
54
+ ret
55
+ .LFE11:
56
+ .size slp_switch, .-slp_switch
You can’t perform that action at this time.
0 commit comments