]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/DebugSupportDxe/X64/AsmFuncs.S
Remove ".intel_syntax", convert MASM to GAS.
[mirror_edk2.git] / MdeModulePkg / Universal / DebugSupportDxe / X64 / AsmFuncs.S
CommitLineData
7b414b4e 1#/**@file\r
2# Low leve x64 specific debug support functions.\r
3#\r
43a99f08 4# Copyright (c) 2006 - 2008, Intel Corporation\r
7b414b4e 5# All rights reserved. This program and the accompanying materials\r
6# are licensed and made available under the terms and conditions of the BSD License\r
7# which accompanies this distribution. The full text of the license may be found at\r
8# http://opensource.org/licenses/bsd-license.php\r
9#\r
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12#\r
43a99f08 13#**/ \r
c1f23d63 14\r
132f41f0 15ASM_GLOBAL ASM_PFX(OrigVector)\r
16ASM_GLOBAL ASM_PFX(InterruptEntryStub)\r
17ASM_GLOBAL ASM_PFX(StubSize)\r
18ASM_GLOBAL ASM_PFX(CommonIdtEntry)\r
19ASM_GLOBAL ASM_PFX(FxStorSupport)\r
43a99f08 20 \r
21.data \r
c1f23d63 22\r
43a99f08 23ASM_PFX(StubSize): .long ASM_PFX(InterruptEntryStubEnd) - ASM_PFX(InterruptEntryStub)\r
24ASM_PFX(AppRsp): .long 0x11111111 # ?\r
25 .long 0x11111111 # ?\r
26ASM_PFX(DebugRsp): .long 0x22222222 # ?\r
27 .long 0x22222222 # ?\r
28ASM_PFX(ExtraPush): .long 0x33333333 # ?\r
29 .long 0x33333333 # ?\r
30ASM_PFX(ExceptData): .long 0x44444444 # ?\r
31 .long 0x44444444 # ?\r
32ASM_PFX(Rflags): .long 0x55555555 # ?\r
33 .long 0x55555555 # ?\r
34ASM_PFX(OrigVector): .long 0x66666666 # ?\r
35 .long 0x66666666 # ?\r
c1f23d63 36\r
43a99f08 37## The declarations below define the memory region that will be used for the debug stack.\r
38## The context record will be built by pushing register values onto this stack.\r
39## It is imparitive that alignment be carefully managed, since the FXSTOR and\r
40## FXRSTOR instructions will GP fault if their memory operand is not 16 byte aligned.\r
41##\r
42## The stub will switch stacks from the application stack to the debuger stack\r
43## and pushes the exception number.\r
44##\r
45## Then we building the context record on the stack. Since the stack grows down,\r
46## we push the fields of the context record from the back to the front. There\r
47## are 336 bytes of stack used prior allocating the 512 bytes of stack to be\r
48## used as the memory buffer for the fxstor instruction. Therefore address of\r
49## the buffer used for the FXSTOR instruction is &Eax - 336 - 512, which\r
50## must be 16 byte aligned.\r
51##\r
52## We carefully locate the stack to make this happen.\r
53##\r
54## For reference, the context structure looks like this:\r
55## struct {\r
56## UINT64 ExceptionData;\r
57## FX_SAVE_STATE_X64 FxSaveState; // 512 bytes, must be 16 byte aligned\r
58## UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
59## UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;\r
60## UINT64 RFlags;\r
61## UINT64 Ldtr, Tr;\r
62## UINT64 Gdtr[2], Idtr[2];\r
63## UINT64 Rip;\r
64## UINT64 Gs, Fs, Es, Ds, Cs, Ss;\r
65## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;\r
66## UINT64 R8, R9, R10, R11, R12, R13, R14, R15;\r
67## } SYSTEM_CONTEXT_X64; // 64 bit system context record\r
68\r
69.align 16\r
70DebugStackEnd : .ascii "DbgStkEnd >>>>>>" # 16 byte long string - must be 16 bytes to preserve alignment\r
71 .rept 0x1ffc\r
72 .long 0x00000000 \r
73 .endr\r
74 # 32K should be enough stack\r
75 # This allocation is coocked to insure\r
76 # that the the buffer for the FXSTORE instruction\r
77 # will be 16 byte aligned also.\r
78 #\r
79ASM_PFX(ExceptionNumber): .long 0x77777777 # first entry will be the vector number pushed by the stub\r
80 .long 0x77777777 # ?\r
81\r
82DebugStackBegin : .ascii "<<<< DbgStkBegin" # initial debug ESP == DebugStackBegin, set in stub\r
83 \r
84\r
85.text\r
86\r
87#------------------------------------------------------------------------------\r
88# BOOLEAN\r
89# FxStorSupport (\r
90# void\r
91# )\r
92#\r
93# Abstract: Returns TRUE if FxStor instructions are supported\r
94#\r
132f41f0 95ASM_GLOBAL ASM_PFX(FxStorSupport)\r
43a99f08 96ASM_PFX(FxStorSupport): \r
97#\r
98# cpuid corrupts rbx which must be preserved per the C calling convention\r
99#\r
7b8c3785 100 pushq %rbx\r
101 movq $1, %rax\r
43a99f08 102 cpuid\r
7b8c3785 103 movl %edx, %eax\r
104 andq $0x01000000, %rax\r
105 shrq $24, %rax\r
106 popq %rbx\r
43a99f08 107 ret\r
108#------------------------------------------------------------------------------\r
109# void\r
110# Vect2Desc (\r
111# IA32_IDT_GATE_DESCRIPTOR * DestDesc, // rcx\r
112# void (*Vector) (void) // rdx\r
113# )\r
114#\r
115# Abstract: Encodes an IDT descriptor with the given physical address\r
116#\r
132f41f0 117ASM_GLOBAL ASM_PFX(Vect2Desc)\r
43a99f08 118ASM_PFX(Vect2Desc):\r
7b8c3785 119 movq %rdx, %rax\r
120 movw %ax, (%rcx) # write bits 15..0 of offset\r
121 movw %cs, %dx\r
122 movw %dx, 2(%rcx) # SYS_CODE_SEL from GDT\r
123 movw $(0x0e00 | 0x8000), 4(%rcx) # type = 386 interrupt gate, present\r
124 shrq $16, %rax\r
125 movw %ax, 6(%rcx) # write bits 31..16 of offset\r
126 shrq $16, %rax\r
127 movl %eax, 8(%rcx) # write bits 63..32 of offset\r
43a99f08 128\r
129 ret\r
130\r
131#------------------------------------------------------------------------------\r
132# InterruptEntryStub\r
133#\r
134# Abstract: This code is not a function, but is a small piece of code that is\r
135# copied and fixed up once for each IDT entry that is hooked.\r
136#\r
132f41f0 137ASM_GLOBAL ASM_PFX(InterruptEntryStub)\r
43a99f08 138ASM_PFX(InterruptEntryStub):\r
139\r
7b8c3785 140 pushq $0 # push vector number - will be modified before installed\r
43a99f08 141 jmp ASM_PFX(CommonIdtEntry)\r
142 \r
132f41f0 143ASM_GLOBAL ASM_PFX(InterruptEntryStubEnd)\r
43a99f08 144ASM_PFX(InterruptEntryStubEnd):\r
c1f23d63 145\r
43a99f08 146#------------------------------------------------------------------------------\r
147# CommonIdtEntry\r
148#\r
149# Abstract: This code is not a function, but is the common part for all IDT\r
150# vectors.\r
151#\r
132f41f0 152ASM_GLOBAL ASM_PFX(CommonIdtEntry)\r
43a99f08 153##\r
154## At this point, the stub has saved the current application stack esp into AppRsp\r
155## and switched stacks to the debug stack, where it pushed the vector number\r
156##\r
157## The application stack looks like this:\r
158##\r
159## ...\r
160## (last application stack entry)\r
161## [16 bytes alignment, do not care it]\r
162## SS from interrupted task\r
163## RSP from interrupted task\r
164## rflags from interrupted task\r
165## CS from interrupted task\r
166## RIP from interrupted task\r
167## Error code <-------------------- Only present for some exeption types\r
168##\r
169## Vector Number <----------------- pushed in our IDT Entry\r
170##\r
171\r
172\r
173## The stub switched us to the debug stack and pushed the interrupt number.\r
174##\r
175## Next, construct the context record. It will be build on the debug stack by\r
176## pushing the registers in the correct order so as to create the context structure\r
177## on the debug stack. The context record must be built from the end back to the\r
178## beginning because the stack grows down...\r
179#\r
180## For reference, the context record looks like this:\r
181##\r
182## typedef\r
183## struct {\r
184## UINT64 ExceptionData;\r
185## FX_SAVE_STATE_X64 FxSaveState;\r
186## UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
187## UINT64 Cr0, Cr2, Cr3, Cr4, Cr8;\r
188## UINT64 RFlags;\r
189## UINT64 Ldtr, Tr;\r
190## UINT64 Gdtr[2], Idtr[2];\r
191## UINT64 Rip;\r
192## UINT64 Gs, Fs, Es, Ds, Cs, Ss;\r
193## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;\r
194## UINT64 R8, R9, R10, R11, R12, R13, R14, R15;\r
195## } SYSTEM_CONTEXT_X64; // 64\r
196ASM_PFX(CommonIdtEntry):\r
43a99f08 197## NOTE: we save rsp here to prevent compiler put rip reference cause error AppRsp\r
7b8c3785 198 pushq %rax\r
199 movq (8)(%rsp), %rax # save vector number\r
200 movq %rax, ASM_PFX(ExceptionNumber) # save vector number\r
201 popq %rax\r
202 addq $8, %rsp # pop vector number\r
203 movq %rsp, ASM_PFX(AppRsp) # save stack top\r
204 movq DebugStackBegin, %rsp # switch to debugger stack\r
205 subq $8, %rsp # leave space for vector number\r
43a99f08 206## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;\r
207## UINT64 R8, R9, R10, R11, R12, R13, R14, R15;\r
7b8c3785 208 pushq %r15\r
209 pushq %r14\r
210 pushq %r13\r
211 pushq %r12\r
212 pushq %r11\r
213 pushq %r10\r
214 pushq %r9\r
215 pushq %r8\r
216 pushq %rax\r
217 pushq %rcx\r
218 pushq %rdx\r
219 pushq %rbx\r
220 pushq %rsp\r
221 pushq %rbp\r
222 pushq %rsi\r
223 pushq %rdi\r
43a99f08 224## Save interrupt state rflags register...\r
225 pushfq\r
7b8c3785 226 popq %rax\r
227 movq %rax, ASM_PFX(Rflags)\r
43a99f08 228## We need to determine if any extra data was pushed by the exception, and if so, save it\r
229## To do this, we check the exception number pushed by the stub, and cache the\r
230## result in a variable since we'll need this again.\r
7b8c3785 231 cmpl $0, ASM_PFX(ExceptionNumber)\r
43a99f08 232 jz ExtraPushOne\r
7b8c3785 233 cmpl $10, ASM_PFX(ExceptionNumber)\r
43a99f08 234 jz ExtraPushOne\r
7b8c3785 235 cmpl $11, ASM_PFX(ExceptionNumber)\r
43a99f08 236 jz ExtraPushOne\r
7b8c3785 237 cmpl $12, ASM_PFX(ExceptionNumber)\r
43a99f08 238 jz ExtraPushOne\r
7b8c3785 239 cmpl $13, ASM_PFX(ExceptionNumber)\r
43a99f08 240 jz ExtraPushOne\r
7b8c3785 241 cmpl $14, ASM_PFX(ExceptionNumber)\r
43a99f08 242 jz ExtraPushOne\r
7b8c3785 243 cmpl $17, ASM_PFX(ExceptionNumber)\r
43a99f08 244 jz ExtraPushOne\r
7b8c3785 245 movl $0, ASM_PFX(ExtraPush)\r
246 movl $0, ASM_PFX(ExceptData)\r
43a99f08 247 jmp ExtraPushDone\r
248ExtraPushOne:\r
7b8c3785 249 movl $1, ASM_PFX(ExtraPush)\r
43a99f08 250\r
251## If there's some extra data, save it also, and modify the saved AppRsp to effectively\r
252## pop this value off the application's stack.\r
7b8c3785 253 movq ASM_PFX(AppRsp), %rax \r
254 movq (%rax), %rbx\r
255 movq %rbx, ASM_PFX(ExceptData)\r
256 addq $8, %rax\r
257 movq %rax, ASM_PFX(AppRsp)\r
43a99f08 258\r
259ExtraPushDone:\r
260\r
261## The "push" above pushed the debug stack rsp. Since what we're actually doing\r
262## is building the context record on the debug stack, we need to save the pushed\r
263## debug RSP, and replace it with the application's last stack entry...\r
7b8c3785 264 movq 24(%rsp), %rax\r
265 movq %rax, ASM_PFX(DebugRsp)\r
266 movq ASM_PFX(AppRsp), %rax \r
267 addq $40, %rax\r
43a99f08 268 # application stack has ss, rsp, rflags, cs, & rip, so\r
509bc208 269 # last actual application stack entry is 40 bytes\r
270 # into the application stack.\r
7b8c3785 271 movq %rax, 24(%rsp)\r
509bc208 272\r
43a99f08 273## continue building context record\r
274## UINT64 Gs, Fs, Es, Ds, Cs, Ss; insure high 16 bits of each is zero\r
7b8c3785 275 movq %ss, %rax\r
276 pushq %rax\r
43a99f08 277 # CS from application is one entry back in application stack\r
7b8c3785 278 movq ASM_PFX(AppRsp), %rax\r
279 movzxw 8(%rax), %rax\r
280 pushq %rax\r
281\r
282 movq %ds, %rax\r
283 pushq %rax\r
284 movq %es, %rax\r
285 pushq %rax\r
286 movq %fs, %rax\r
287 pushq %rax\r
288 movq %gs, %rax\r
289 pushq %rax\r
43a99f08 290## UINT64 Rip;\r
291 # Rip from application is on top of application stack\r
7b8c3785 292 movq ASM_PFX(AppRsp), %rax \r
293 pushq (%rax)\r
43a99f08 294## UINT64 Gdtr[2], Idtr[2];\r
7b8c3785 295 push $0\r
296 push $0\r
297 sidtq (%rsp)\r
298 push $0\r
299 push $0\r
300 sgdtq (%rsp)\r
43a99f08 301\r
302## UINT64 Ldtr, Tr;\r
7b8c3785 303 xorq %rax, %rax\r
304 str %ax\r
305 pushq %rax\r
306 sldt %ax\r
307 pushq %rax\r
43a99f08 308\r
309## UINT64 RFlags;\r
310## Rflags from application is two entries back in application stack\r
7b8c3785 311 movq ASM_PFX(AppRsp), %rax \r
312 pushq 16(%rax)\r
43a99f08 313## UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;\r
314## insure FXSAVE/FXRSTOR is enabled in CR4...\r
315## ... while we're at it, make sure DE is also enabled...\r
7b8c3785 316 movq %cr8, %rax\r
317 pushq %rax\r
318 movq %cr4, %rax\r
319 orq $0x208, %rax\r
320 movq %rax, %cr4\r
321 pushq %rax\r
322 movq %cr3, %rax\r
323 pushq %rax\r
324 movq %cr2, %rax\r
325 pushq %rax\r
326 push $0\r
327 movq %cr0, %rax\r
328 pushq %rax\r
43a99f08 329## UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
7b8c3785 330 movq %dr7, %rax\r
331 pushq %rax\r
43a99f08 332## clear Dr7 while executing debugger itself\r
7b8c3785 333 xorq %rax, %rax\r
334 movq %rax, %dr7\r
43a99f08 335\r
7b8c3785 336 movq %dr6, %rax\r
337 pushq %rax\r
43a99f08 338## insure all status bits in dr6 are clear...\r
7b8c3785 339 xorq %rax, %rax\r
340 movq %rax, %dr6\r
341\r
342 movq %dr3, %rax\r
343 pushq %rax\r
344 movq %dr2, %rax\r
345 pushq %rax\r
346 movq %dr1, %rax\r
347 pushq %rax\r
348 movq %dr0, %rax\r
349 pushq %rax\r
43a99f08 350\r
351## FX_SAVE_STATE_X64 FxSaveState;\r
7b8c3785 352 subq $512, %rsp\r
353 movq %rsp, %rdi\r
43a99f08 354 # IMPORTANT!! The debug stack has been carefully constructed to\r
355 # insure that rsp and rdi are 16 byte aligned when we get here.\r
356 # They MUST be. If they are not, a GP fault will occur.\r
509bc208 357 \r
358 # FXSTOR_RDI\r
7b8c3785 359 fxsave (%rdi)\r
43a99f08 360\r
361## UINT64 ExceptionData;\r
7b8c3785 362 movq ASM_PFX(ExceptData), %rax\r
363 pushq %rax\r
509bc208 364\r
43a99f08 365# call to C code which will in turn call registered handler\r
366# pass in the vector number\r
7b8c3785 367 movq %rsp, %rdx\r
368 movq ASM_PFX(ExceptionNumber), %rcx \r
369 subq $40, %rsp\r
43a99f08 370 call ASM_PFX(InterruptDistrubutionHub)\r
7b8c3785 371 addq $40, %rsp\r
43a99f08 372# restore context...\r
373## UINT64 ExceptionData;\r
7b8c3785 374 addq $8, %rsp\r
509bc208 375\r
43a99f08 376## FX_SAVE_STATE_X64 FxSaveState;\r
7b8c3785 377 movq %rsp, %rsi\r
509bc208 378 \r
379 # FXRSTOR_RSI\r
7b8c3785 380 fxrstor (%rsi)\r
509bc208 381\r
7b8c3785 382 addq $512, %rsp\r
509bc208 383\r
384## UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
7b8c3785 385 popq %rax\r
386 movq %rax, %dr0\r
387 popq %rax\r
388 movq %rax, %dr1\r
389 popq %rax\r
390 movq %rax, %dr2\r
391 popq %rax\r
392 movq %rax, %dr3\r
509bc208 393\r
43a99f08 394## skip restore of dr6. We cleared dr6 during the context save.\r
7b8c3785 395 addq $8, %rsp\r
396 popq %rax\r
397 movq %rax, %dr7\r
509bc208 398\r
43a99f08 399## UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;\r
7b8c3785 400 popq %rax\r
401 movq %rax, %cr0\r
402 addq $8, %rsp\r
403 popq %rax\r
404 movq %rax, %cr2\r
405 popq %rax\r
406 movq %rax, %cr3\r
407 popq %rax\r
408 movq %rax, %cr4\r
409 popq %rax\r
410 movq %rax, %cr8\r
43a99f08 411## UINT64 RFlags;\r
7b8c3785 412 movq ASM_PFX(AppRsp), %rax \r
413 popq 16(%rax)\r
43a99f08 414## UINT64 Ldtr, Tr;\r
415## UINT64 Gdtr[2], Idtr[2];\r
416## Best not let anyone mess with these particular registers...\r
7b8c3785 417 addq $48, %rsp\r
43a99f08 418## UINT64 Rip;\r
7b8c3785 419 popq (%rax)\r
43a99f08 420\r
421## UINT64 Gs, Fs, Es, Ds, Cs, Ss;\r
422## NOTE - modified segment registers could hang the debugger... We\r
423## could attempt to insulate ourselves against this possibility,\r
424## but that poses risks as well.\r
425##\r
426\r
7b8c3785 427 popq %rax\r
428 # movq %rax, %gs\r
429 popq %rax\r
430 # movq %rax, %fs\r
431 popq %rax\r
432 movq %rax, %es\r
433 popq %rax\r
434 movq %rax, %ds\r
435 movq ASM_PFX(AppRsp), %rax \r
436 popq 8(%rax)\r
437 popq %rax\r
438 movq %rax, %ss\r
43a99f08 439## The next stuff to restore is the general purpose registers that were pushed\r
440## using the "push" instruction.\r
441##\r
442## The value of RSP as stored in the context record is the application RSP\r
443## including the 5 entries on the application stack caused by the exception\r
444## itself. It may have been modified by the debug agent, so we need to\r
445## determine if we need to relocate the application stack.\r
446\r
7b8c3785 447 movq 24(%rsp), %rbx # move the potentially modified AppRsp into rbx\r
448 movq ASM_PFX(AppRsp), %rax \r
449 addq $40, %rax\r
450 cmpq %rax, %rbx\r
43a99f08 451 je NoAppStackMove\r
452\r
7b8c3785 453 movq ASM_PFX(AppRsp), %rax \r
454 movq (%rax), %rcx # RIP\r
455 movq %rcx, (%rbx)\r
43a99f08 456\r
7b8c3785 457 movq 8(%rax), %rcx # CS\r
458 movq %rcx, 8(%rbx)\r
43a99f08 459\r
7b8c3785 460 movq 16(%rax), %rcx # RFLAGS\r
461 movq %rcx, 16(%rbx)\r
43a99f08 462\r
7b8c3785 463 movq 24(%rax), %rcx # RSP\r
464 movq %rcx, 24(%rbx)\r
43a99f08 465\r
7b8c3785 466 movq 32(%rax), %rcx # SS\r
467 movq %rcx, 32(%rbx)\r
43a99f08 468\r
7b8c3785 469 movq %rbx, %rax # modify the saved AppRsp to the new AppRsp\r
470 movq %rax, ASM_PFX(AppRsp)\r
43a99f08 471NoAppStackMove:\r
7b8c3785 472 movq ASM_PFX(DebugRsp), %rax # restore the DebugRsp on the debug stack\r
43a99f08 473 # so our "pop" will not cause a stack switch\r
7b8c3785 474 movq %rax, 24(%rsp)\r
43a99f08 475\r
7b8c3785 476 cmpl $0x068, ASM_PFX(ExceptionNumber)\r
43a99f08 477 jne NoChain\r
478\r
479Chain:\r
480\r
481## Restore rflags so when we chain, the flags will be exactly as if we were never here.\r
482## We gin up the stack to do an iretq so we can get ALL the flags.\r
7b8c3785 483 movq ASM_PFX(AppRsp), %rax \r
484 movq 40(%rax), %rbx\r
485 pushq %rbx\r
486 movq %ss, %rax\r
487 pushq %rax\r
488 movq %rsp, %rax\r
489 addq $16, %rax\r
490 pushq %rax\r
491 movq ASM_PFX(AppRsp), %rax \r
492 movq 16(%rax), %rbx\r
493 andq $0xfffffffffffffcff, %rbx # special handling for IF and TF\r
494 pushq %rbx\r
495 movq %cs, %rax\r
496 pushq %rax\r
497 movq PhonyIretq, %rax \r
498 pushq %rax\r
43a99f08 499 iretq\r
500PhonyIretq:\r
501\r
502## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;\r
503## UINT64 R8, R9, R10, R11, R12, R13, R14, R15;\r
7b8c3785 504 popq %rdi\r
505 popq %rsi\r
506 popq %rbp\r
507 popq %rsp\r
508 popq %rbx\r
509 popq %rdx\r
510 popq %rcx\r
511 popq %rax\r
512 popq %r8\r
513 popq %r9\r
514 popq %r10\r
515 popq %r11\r
516 popq %r12\r
517 popq %r13\r
518 popq %r14\r
519 popq %r15\r
43a99f08 520\r
521## Switch back to application stack\r
7b8c3785 522 movq ASM_PFX(AppRsp), %rsp \r
43a99f08 523## Jump to original handler\r
524 jmp ASM_PFX(OrigVector)\r
525NoChain:\r
526## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;\r
527## UINT64 R8, R9, R10, R11, R12, R13, R14, R15;\r
7b8c3785 528 popq %rdi\r
529 popq %rsi\r
530 popq %rbp\r
531 popq %rsp\r
532 popq %rbx\r
533 popq %rdx\r
534 popq %rcx\r
535 popq %rax\r
536 popq %r8\r
537 popq %r9\r
538 popq %r10\r
539 popq %r11\r
540 popq %r12\r
541 popq %r13\r
542 popq %r14\r
543 popq %r15\r
43a99f08 544\r
545## Switch back to application stack\r
7b8c3785 546 movq ASM_PFX(AppRsp), %rsp \r
43a99f08 547\r
548## We're outa here...\r
549 iret\r