Debian Codegraph @

arch/x86_64/gcc/context.s

raw
1 //
2 // arch/x86_64/gcc/context.s
3 //
4 // CEN64: Cycle-Accurate Nintendo 64 Emulator.
5 // Copyright (C) 2015, Tyler J. Stachecki.
6 //
7 // This file is subject to the terms and conditions defined in
8 // 'LICENSE', which is part of this source code package.
9 //
10
11 //
12 // cen64_context_restore(cen64_context *context);
13 //
14 // Loads CPU registers that were saved with cen64_context_save.
15 // Only CPU registers that the calling convention considers to
16 // be 'volatile' are restored.
17 //
18 .ifdef __MINGW__
19 .file "context.s"
20 .section .text.unlikely,"x"
21 .p2align 4,,15
22 .globl cen64_context_restore
23 .def cen64_context_restore; .scl 2; .type 32; .endef
24 .seh_proc cen64_context_restore
25 cen64_context_restore:
26 .seh_endprologue
27
28 # VR4300: FPU control word
29 ldmxcsr 0x80(%rcx)
30
31 # RSP: acc_lo, acc_md, acc_hi
32 movdqa 0x00(%rcx), %xmm5
33
34 retq
35 .seh_endproc
36
37 .else
38 .section .text.unlikely,"ax",@progbits
39 .globl cen64_context_restore
40 .type cen64_context_restore, @function
41 cen64_context_restore:
42 .cfi_startproc
43
44 # VR4300: FPU control word
45 ldmxcsr 0x80(%rdi)
46
47 # RSP: acc_lo, acc_md, acc_hi
48 movdqa 0x00(%rdi), %xmm5
49 movdqa 0x10(%rdi), %xmm6
50 movdqa 0x20(%rdi), %xmm7
51
52 # RSP: vcc, vco, vce
53 movdqa 0x30(%rdi), %xmm11
54 movdqa 0x40(%rdi), %xmm12
55 movdqa 0x50(%rdi), %xmm13
56 movdqa 0x60(%rdi), %xmm14
57 movdqa 0x70(%rdi), %xmm15
58
59 retq
60 .cfi_endproc
61
62 .size cen64_context_restore,.-cen64_context_restore
63 .endif
64
65 //
66 // cen64_context_save(cen64_context *context);
67 //
68 // Stores CPU registers that the calling convention considers
69 // to be 'volatile'. These registers can be saved at a later
70 // time with cen64_context_save.
71 //
72 .ifdef __MINGW__
73 .file "context.s"
74 .section .text.unlikely,"x"
75 .p2align 4,,15
76 .globl cen64_context_save
77 .def cen64_context_save; .scl 2; .type 32; .endef
78 .seh_proc cen64_context_save
79 cen64_context_save:
80 .seh_endprologue
81
82 # VR4300: FPU control word
83 stmxcsr 0x80(%rcx)
84
85 # RSP: acc_lo, acc_md, acc_hi
86 movdqa %xmm5, 0x00(%rcx)
87
88 retq
89 .seh_endproc
90
91 .else
92 .section .text.unlikely,"ax",@progbits
93 .globl cen64_context_save
94 .type cen64_context_save, @function
95 cen64_context_save:
96 .cfi_startproc
97
98 # VR4300: FPU control word
99 stmxcsr 0x80(%rdi)
100
101 # RSP: acc_lo, acc_md, acc_hi
102 movdqa %xmm5, 0x00(%rdi)
103 movdqa %xmm6, 0x10(%rdi)
104 movdqa %xmm7, 0x20(%rdi)
105
106 # RSP: vcc, vco, vce
107 movdqa %xmm11, 0x30(%rdi)
108 movdqa %xmm12, 0x40(%rdi)
109 movdqa %xmm13, 0x50(%rdi)
110 movdqa %xmm14, 0x60(%rdi)
111 movdqa %xmm15, 0x70(%rdi)
112
113 retq
114 .cfi_endproc
115
116 .size cen64_context_save,.-cen64_context_save
117 .endif
118