3 .extern __v3_hvm_ros_signal_handler
6 This is the entry point for signal dispatch
9 VMM invokes this stub when a user signal is
10 raised and: the relevant address space
11 is active, and we are at user-level.
12 It will be invoked on exactly one core,
13 although there are no guarantees on which one.
54 The VMM puts us here with what looks like a long mode
55 interrupt dispatch, but it's from CPL 3 to CPL 3 and
56 it's not done as an interrupt injection per se, so
57 we can be interrupted, and deliverable interrupts
58 automatically prioritize over us.
60 The start of the stack (before the VMM pushes the fake
61 interrupt frame is 16 byte aligned
63 48bitsblank | return SS (16 bits)
66 48bitsblank | return CS (16 bits)
68 ERROR CODE (HVM-specific non-zero number here) <- RSP on entry
70 We then need simply to do this:
73 arrange 16 byte alignment at entry of call
74 call the handler (if installed)
82 .global __v3_hvm_ros_signal_handler_stub
83 __v3_hvm_ros_signal_handler_stub: /* we are 16 byte aligned on entry 16 + 6*8 for interrupt frame */
84 GPR_SAVE() /* push 15 words, all but rsp, now not aligned - need 1 more word */
85 subq $8, %rsp /* make us 16 byte aligned */
87 #if DEBUG_ENTRY /* print out something if we are debugging - Note this is danerous code */
96 movq %rsp, %rbp /* give us a stack frame for any callee that needs it */
97 movabs __v3_hvm_ros_signal_handler, %rax /* find the user-level handler */
98 testq %rax, %rax /* return immediately if it doesn't exist */
99 jz skip_handler /* " */
100 movq 128(%rsp), %rdi /* error code becomes argument for user-level handler */
101 callq *%rax /* call handelr - 16 byte aligned at call */
105 addq $8, %rsp /* get rid of stack alignment pad */
106 GPR_LOAD() /* rbp is restored here */
107 addq $8, %rsp /* nuke the error code */
108 iretq /* restore rip, rsp, and rflags */
112 .asciz "Got to signal handler stub\12"