/* Taken from solo5 */
#include <x86/traps.h>
+#include <uk/asm/cfi.h>
#define ENTRY(X) .global X ; .type X, @function ; X:
.macro PUSH_CALLER_SAVE
- pushq %rdi
- pushq %rsi
- pushq %rdx
- pushq %rcx
- pushq %rax
- pushq %r8
- pushq %r9
- pushq %r10
- pushq %r11
- pushq %rbx
- pushq %rbp
- pushq %r12
- pushq %r13
- pushq %r14
- pushq %r15
+ pushq_reg_cfi rdi
+ pushq_reg_cfi rsi
+ pushq_reg_cfi rdx
+ pushq_reg_cfi rcx
+ pushq_reg_cfi rax
+ pushq_reg_cfi r8
+ pushq_reg_cfi r9
+ pushq_reg_cfi r10
+ pushq_reg_cfi r11
+ pushq_reg_cfi rbx
+ pushq_reg_cfi rbp
+ pushq_reg_cfi r12
+ pushq_reg_cfi r13
+ pushq_reg_cfi r14
+ pushq_reg_cfi r15
.endm
.macro POP_CALLER_SAVE
- popq %r15
- popq %r14
- popq %r13
- popq %r12
- popq %rbp
- popq %rbx
- popq %r11
- popq %r10
- popq %r9
- popq %r8
- popq %rax
- popq %rcx
- popq %rdx
- popq %rsi
- popq %rdi
+ popq_reg_cfi r15
+ popq_reg_cfi r14
+ popq_reg_cfi r13
+ popq_reg_cfi r12
+ popq_reg_cfi rbp
+ popq_reg_cfi rbx
+ popq_reg_cfi r11
+ popq_reg_cfi r10
+ popq_reg_cfi r9
+ popq_reg_cfi r8
+ popq_reg_cfi rax
+ popq_reg_cfi rcx
+ popq_reg_cfi rdx
+ popq_reg_cfi rsi
+ popq_reg_cfi rdi
.endm
.macro TRAP_ENTRY trapname, has_ec
ENTRY(ASM_TRAP_SYM(\trapname))
+ .cfi_startproc simple
+ .cfi_signal_frame
+ .cfi_def_cfa rsp, 0
+.if \has_ec
+ /* Error code is pushed on the stack after the return address */
+ .cfi_def_cfa_offset 16
+.else
+ /* There is only the return address on the stack */
+ .cfi_def_cfa_offset 8
+.endif
+ .cfi_offset rip, -8
+ /* Description of the stack with active IST */
+ .cfi_offset cs, 0
+ .cfi_offset rflags, 8
+ .cfi_offset rsp, 16
+ .cfi_offset ss, 24
cld
.if !\has_ec
- pushq $0 /* no error code, pass 0 */
+ pushq_cfi $0 /* no error code, pass 0 */
.endif
PUSH_CALLER_SAVE
subq $__REGS_PAD_SIZE, %rsp /* we have some padding */
+ .cfi_adjust_cfa_offset __REGS_PAD_SIZE
movq %rsp, %rdi
movq __REGS_OFFSETOF_ORIG_RAX(%rsp), %rsi
call do_\trapname
addq $__REGS_PAD_SIZE, %rsp /* we have some padding */
+ .cfi_adjust_cfa_offset -__REGS_PAD_SIZE
POP_CALLER_SAVE
addq $8, %rsp /* discard error code */
+ .cfi_adjust_cfa_offset -8
iretq
+ .cfi_endproc
.endm
.macro IRQ_ENTRY irqno
ENTRY(cpu_irq_\irqno)
+ .cfi_startproc simple
+ .cfi_signal_frame
+ .cfi_def_cfa rsp, 8
+ .cfi_offset rip, -8
+
+ /* Description of the stack with active IST */
+ .cfi_offset cs, 0
+ .cfi_offset rflags, 8
+ .cfi_offset rsp, 16
+ .cfi_offset ss, 24
cld
- pushq $0 /* no error code */
+ pushq_cfi $0 /* no error code */
PUSH_CALLER_SAVE
subq $__REGS_PAD_SIZE, %rsp /* we have some padding */
+ .cfi_adjust_cfa_offset __REGS_PAD_SIZE
movq %rsp, %rdi
movq $\irqno, %rsi
call _ukplat_irq_handle
addq $__REGS_PAD_SIZE, %rsp /* we have some padding */
+ .cfi_adjust_cfa_offset -__REGS_PAD_SIZE
POP_CALLER_SAVE
addq $8, %rsp
+ .cfi_adjust_cfa_offset -8
iretq
+ .cfi_endproc
.endm
TRAP_ENTRY divide_error, 0