diff options
Diffstat (limited to 'arch/x86_64/ia32/ia32entry.S')
-rw-r--r-- | arch/x86_64/ia32/ia32entry.S | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S index 5244f803203d..e0eb0c712fe9 100644 --- a/arch/x86_64/ia32/ia32entry.S +++ b/arch/x86_64/ia32/ia32entry.S | |||
@@ -55,20 +55,34 @@ | |||
55 | * with the int 0x80 path. | 55 | * with the int 0x80 path. |
56 | */ | 56 | */ |
57 | ENTRY(ia32_sysenter_target) | 57 | ENTRY(ia32_sysenter_target) |
58 | CFI_STARTPROC | 58 | CFI_STARTPROC simple |
59 | CFI_DEF_CFA rsp,0 | ||
60 | CFI_REGISTER rsp,rbp | ||
59 | swapgs | 61 | swapgs |
60 | movq %gs:pda_kernelstack, %rsp | 62 | movq %gs:pda_kernelstack, %rsp |
61 | addq $(PDA_STACKOFFSET),%rsp | 63 | addq $(PDA_STACKOFFSET),%rsp |
62 | sti | 64 | sti |
63 | movl %ebp,%ebp /* zero extension */ | 65 | movl %ebp,%ebp /* zero extension */ |
64 | pushq $__USER32_DS | 66 | pushq $__USER32_DS |
67 | CFI_ADJUST_CFA_OFFSET 8 | ||
68 | /*CFI_REL_OFFSET ss,0*/ | ||
65 | pushq %rbp | 69 | pushq %rbp |
70 | CFI_ADJUST_CFA_OFFSET 8 | ||
71 | CFI_REL_OFFSET rsp,0 | ||
66 | pushfq | 72 | pushfq |
73 | CFI_ADJUST_CFA_OFFSET 8 | ||
74 | /*CFI_REL_OFFSET rflags,0*/ | ||
67 | movl $VSYSCALL32_SYSEXIT, %r10d | 75 | movl $VSYSCALL32_SYSEXIT, %r10d |
76 | CFI_REGISTER rip,r10 | ||
68 | pushq $__USER32_CS | 77 | pushq $__USER32_CS |
78 | CFI_ADJUST_CFA_OFFSET 8 | ||
79 | /*CFI_REL_OFFSET cs,0*/ | ||
69 | movl %eax, %eax | 80 | movl %eax, %eax |
70 | pushq %r10 | 81 | pushq %r10 |
82 | CFI_ADJUST_CFA_OFFSET 8 | ||
83 | CFI_REL_OFFSET rip,0 | ||
71 | pushq %rax | 84 | pushq %rax |
85 | CFI_ADJUST_CFA_OFFSET 8 | ||
72 | cld | 86 | cld |
73 | SAVE_ARGS 0,0,1 | 87 | SAVE_ARGS 0,0,1 |
74 | /* no need to do an access_ok check here because rbp has been | 88 | /* no need to do an access_ok check here because rbp has been |
@@ -79,6 +93,7 @@ ENTRY(ia32_sysenter_target) | |||
79 | .previous | 93 | .previous |
80 | GET_THREAD_INFO(%r10) | 94 | GET_THREAD_INFO(%r10) |
81 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) | 95 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) |
96 | CFI_REMEMBER_STATE | ||
82 | jnz sysenter_tracesys | 97 | jnz sysenter_tracesys |
83 | sysenter_do_call: | 98 | sysenter_do_call: |
84 | cmpl $(IA32_NR_syscalls),%eax | 99 | cmpl $(IA32_NR_syscalls),%eax |
@@ -94,14 +109,20 @@ sysenter_do_call: | |||
94 | andl $~0x200,EFLAGS-R11(%rsp) | 109 | andl $~0x200,EFLAGS-R11(%rsp) |
95 | RESTORE_ARGS 1,24,1,1,1,1 | 110 | RESTORE_ARGS 1,24,1,1,1,1 |
96 | popfq | 111 | popfq |
112 | CFI_ADJUST_CFA_OFFSET -8 | ||
113 | /*CFI_RESTORE rflags*/ | ||
97 | popq %rcx /* User %esp */ | 114 | popq %rcx /* User %esp */ |
115 | CFI_ADJUST_CFA_OFFSET -8 | ||
116 | CFI_REGISTER rsp,rcx | ||
98 | movl $VSYSCALL32_SYSEXIT,%edx /* User %eip */ | 117 | movl $VSYSCALL32_SYSEXIT,%edx /* User %eip */ |
118 | CFI_REGISTER rip,rdx | ||
99 | swapgs | 119 | swapgs |
100 | sti /* sti only takes effect after the next instruction */ | 120 | sti /* sti only takes effect after the next instruction */ |
101 | /* sysexit */ | 121 | /* sysexit */ |
102 | .byte 0xf, 0x35 | 122 | .byte 0xf, 0x35 |
103 | 123 | ||
104 | sysenter_tracesys: | 124 | sysenter_tracesys: |
125 | CFI_RESTORE_STATE | ||
105 | SAVE_REST | 126 | SAVE_REST |
106 | CLEAR_RREGS | 127 | CLEAR_RREGS |
107 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ | 128 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ |
@@ -140,21 +161,28 @@ sysenter_tracesys: | |||
140 | * with the int 0x80 path. | 161 | * with the int 0x80 path. |
141 | */ | 162 | */ |
142 | ENTRY(ia32_cstar_target) | 163 | ENTRY(ia32_cstar_target) |
143 | CFI_STARTPROC | 164 | CFI_STARTPROC simple |
165 | CFI_DEF_CFA rsp,0 | ||
166 | CFI_REGISTER rip,rcx | ||
167 | /*CFI_REGISTER rflags,r11*/ | ||
144 | swapgs | 168 | swapgs |
145 | movl %esp,%r8d | 169 | movl %esp,%r8d |
170 | CFI_REGISTER rsp,r8 | ||
146 | movq %gs:pda_kernelstack,%rsp | 171 | movq %gs:pda_kernelstack,%rsp |
147 | sti | 172 | sti |
148 | SAVE_ARGS 8,1,1 | 173 | SAVE_ARGS 8,1,1 |
149 | movl %eax,%eax /* zero extension */ | 174 | movl %eax,%eax /* zero extension */ |
150 | movq %rax,ORIG_RAX-ARGOFFSET(%rsp) | 175 | movq %rax,ORIG_RAX-ARGOFFSET(%rsp) |
151 | movq %rcx,RIP-ARGOFFSET(%rsp) | 176 | movq %rcx,RIP-ARGOFFSET(%rsp) |
177 | CFI_REL_OFFSET rip,RIP-ARGOFFSET | ||
152 | movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */ | 178 | movq %rbp,RCX-ARGOFFSET(%rsp) /* this lies slightly to ptrace */ |
153 | movl %ebp,%ecx | 179 | movl %ebp,%ecx |
154 | movq $__USER32_CS,CS-ARGOFFSET(%rsp) | 180 | movq $__USER32_CS,CS-ARGOFFSET(%rsp) |
155 | movq $__USER32_DS,SS-ARGOFFSET(%rsp) | 181 | movq $__USER32_DS,SS-ARGOFFSET(%rsp) |
156 | movq %r11,EFLAGS-ARGOFFSET(%rsp) | 182 | movq %r11,EFLAGS-ARGOFFSET(%rsp) |
183 | /*CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/ | ||
157 | movq %r8,RSP-ARGOFFSET(%rsp) | 184 | movq %r8,RSP-ARGOFFSET(%rsp) |
185 | CFI_REL_OFFSET rsp,RSP-ARGOFFSET | ||
158 | /* no need to do an access_ok check here because r8 has been | 186 | /* no need to do an access_ok check here because r8 has been |
159 | 32bit zero extended */ | 187 | 32bit zero extended */ |
160 | /* hardware stack frame is complete now */ | 188 | /* hardware stack frame is complete now */ |
@@ -164,6 +192,7 @@ ENTRY(ia32_cstar_target) | |||
164 | .previous | 192 | .previous |
165 | GET_THREAD_INFO(%r10) | 193 | GET_THREAD_INFO(%r10) |
166 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) | 194 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) |
195 | CFI_REMEMBER_STATE | ||
167 | jnz cstar_tracesys | 196 | jnz cstar_tracesys |
168 | cstar_do_call: | 197 | cstar_do_call: |
169 | cmpl $IA32_NR_syscalls,%eax | 198 | cmpl $IA32_NR_syscalls,%eax |
@@ -177,12 +206,16 @@ cstar_do_call: | |||
177 | jnz int_ret_from_sys_call | 206 | jnz int_ret_from_sys_call |
178 | RESTORE_ARGS 1,-ARG_SKIP,1,1,1 | 207 | RESTORE_ARGS 1,-ARG_SKIP,1,1,1 |
179 | movl RIP-ARGOFFSET(%rsp),%ecx | 208 | movl RIP-ARGOFFSET(%rsp),%ecx |
209 | CFI_REGISTER rip,rcx | ||
180 | movl EFLAGS-ARGOFFSET(%rsp),%r11d | 210 | movl EFLAGS-ARGOFFSET(%rsp),%r11d |
211 | /*CFI_REGISTER rflags,r11*/ | ||
181 | movl RSP-ARGOFFSET(%rsp),%esp | 212 | movl RSP-ARGOFFSET(%rsp),%esp |
213 | CFI_RESTORE rsp | ||
182 | swapgs | 214 | swapgs |
183 | sysretl | 215 | sysretl |
184 | 216 | ||
185 | cstar_tracesys: | 217 | cstar_tracesys: |
218 | CFI_RESTORE_STATE | ||
186 | SAVE_REST | 219 | SAVE_REST |
187 | CLEAR_RREGS | 220 | CLEAR_RREGS |
188 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ | 221 | movq $-ENOSYS,RAX(%rsp) /* really needed? */ |
@@ -226,11 +259,18 @@ ia32_badarg: | |||
226 | */ | 259 | */ |
227 | 260 | ||
228 | ENTRY(ia32_syscall) | 261 | ENTRY(ia32_syscall) |
229 | CFI_STARTPROC | 262 | CFI_STARTPROC simple |
263 | CFI_DEF_CFA rsp,SS+8-RIP | ||
264 | /*CFI_REL_OFFSET ss,SS-RIP*/ | ||
265 | CFI_REL_OFFSET rsp,RSP-RIP | ||
266 | /*CFI_REL_OFFSET rflags,EFLAGS-RIP*/ | ||
267 | /*CFI_REL_OFFSET cs,CS-RIP*/ | ||
268 | CFI_REL_OFFSET rip,RIP-RIP | ||
230 | swapgs | 269 | swapgs |
231 | sti | 270 | sti |
232 | movl %eax,%eax | 271 | movl %eax,%eax |
233 | pushq %rax | 272 | pushq %rax |
273 | CFI_ADJUST_CFA_OFFSET 8 | ||
234 | cld | 274 | cld |
235 | /* note the registers are not zero extended to the sf. | 275 | /* note the registers are not zero extended to the sf. |
236 | this could be a problem. */ | 276 | this could be a problem. */ |
@@ -278,6 +318,8 @@ quiet_ni_syscall: | |||
278 | jmp ia32_ptregs_common | 318 | jmp ia32_ptregs_common |
279 | .endm | 319 | .endm |
280 | 320 | ||
321 | CFI_STARTPROC | ||
322 | |||
281 | PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi | 323 | PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi |
282 | PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi | 324 | PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi |
283 | PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx | 325 | PTREGSCALL stub32_sigaltstack, sys32_sigaltstack, %rdx |
@@ -290,8 +332,9 @@ quiet_ni_syscall: | |||
290 | PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend, %rdx | 332 | PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend, %rdx |
291 | 333 | ||
292 | ENTRY(ia32_ptregs_common) | 334 | ENTRY(ia32_ptregs_common) |
293 | CFI_STARTPROC | ||
294 | popq %r11 | 335 | popq %r11 |
336 | CFI_ADJUST_CFA_OFFSET -8 | ||
337 | CFI_REGISTER rip, r11 | ||
295 | SAVE_REST | 338 | SAVE_REST |
296 | call *%rax | 339 | call *%rax |
297 | RESTORE_REST | 340 | RESTORE_REST |