1174 * If we've taken a GPF, we don't (unfortunately) have the address that
1175 * induced the fault. So instead of setting the fault to BADADDR,
1176 * we'll set the fault to ILLOP.
1177 */
1178 0:
1179 orw $CPU_DTRACE_ILLOP, %cx
1180 movw %cx, CPUC_DTRACE_FLAGS(%rax)
1181 jmp 2f
1182 1:
1183 orw $CPU_DTRACE_BADADDR, %cx
1184 movw %cx, CPUC_DTRACE_FLAGS(%rax) /* set fault to bad addr */
1185 movq %r15, CPUC_DTRACE_ILLVAL(%rax)
1186 /* fault addr is illegal value */
1187 2:
1188 movq REGOFF_RIP(%rbp), %rdi
1189 movq %rdi, %r12
1190 call dtrace_instr_size
1191 addq %rax, %r12
1192 movq %r12, REGOFF_RIP(%rbp)
1193 INTR_POP
1194 call *x86_md_clear
1195 jmp tr_iret_auto
1196 /*NOTREACHED*/
1197 3:
1198 leaq dtrace_badflags(%rip), %rdi
1199 xorl %eax, %eax
1200 call panic
1201 4:
1202 leaq dtrace_badtrap(%rip), %rdi
1203 xorl %eax, %eax
1204 call panic
1205 SET_SIZE(cmntrap_pushed)
1206 SET_SIZE(cmntrap)
1207 SET_SIZE(_cmntrap)
1208
1209 #elif defined(__i386)
1210
1211
1212 ENTRY_NP2(cmntrap, _cmntrap)
1213
1214 INTR_PUSH
1580 ALTENTRY(_sys_rtt)
1581 CLI(%rax) /* disable interrupts */
1582 ALTENTRY(_sys_rtt_ints_disabled)
1583 movq %rsp, %rdi /* pass rp to sys_rtt_common */
1584 call sys_rtt_common /* do common sys_rtt tasks */
1585 testq %rax, %rax /* returning to userland? */
1586 jz sr_sup
1587
1588 /*
1589 * Return to user
1590 */
1591 ASSERT_UPCALL_MASK_IS_SET
1592 cmpw $UCS_SEL, REGOFF_CS(%rsp) /* test for native (64-bit) lwp? */
1593 je sys_rtt_syscall
1594
1595 /*
1596 * Return to 32-bit userland
1597 */
1598 ALTENTRY(sys_rtt_syscall32)
1599 USER32_POP
1600 call *x86_md_clear
1601 jmp tr_iret_user
1602 /*NOTREACHED*/
1603
1604 ALTENTRY(sys_rtt_syscall)
1605 /*
1606 * Return to 64-bit userland
1607 */
1608 USER_POP
1609 ALTENTRY(nopop_sys_rtt_syscall)
1610 call *x86_md_clear
1611 jmp tr_iret_user
1612 /*NOTREACHED*/
1613 SET_SIZE(nopop_sys_rtt_syscall)
1614
1615 /*
1616 * Return to supervisor
1617 * NOTE: to make the check in trap() that tests if we are executing
1618 * segment register fixup/restore code work properly, sr_sup MUST be
1619 * after _sys_rtt .
1620 */
1621 ALTENTRY(sr_sup)
1622 /*
1623 * Restore regs before doing iretq to kernel mode
1624 */
1625 INTR_POP
1626 jmp tr_iret_kernel
1627 .globl _sys_rtt_end
1628 _sys_rtt_end:
1629 /*NOTREACHED*/
1630 SET_SIZE(sr_sup)
|
1174 * If we've taken a GPF, we don't (unfortunately) have the address that
1175 * induced the fault. So instead of setting the fault to BADADDR,
1176 * we'll set the fault to ILLOP.
1177 */
1178 0:
1179 orw $CPU_DTRACE_ILLOP, %cx
1180 movw %cx, CPUC_DTRACE_FLAGS(%rax)
1181 jmp 2f
1182 1:
1183 orw $CPU_DTRACE_BADADDR, %cx
1184 movw %cx, CPUC_DTRACE_FLAGS(%rax) /* set fault to bad addr */
1185 movq %r15, CPUC_DTRACE_ILLVAL(%rax)
1186 /* fault addr is illegal value */
1187 2:
1188 movq REGOFF_RIP(%rbp), %rdi
1189 movq %rdi, %r12
1190 call dtrace_instr_size
1191 addq %rax, %r12
1192 movq %r12, REGOFF_RIP(%rbp)
1193 INTR_POP
1194 call x86_md_clear
1195 jmp tr_iret_auto
1196 /*NOTREACHED*/
1197 3:
1198 leaq dtrace_badflags(%rip), %rdi
1199 xorl %eax, %eax
1200 call panic
1201 4:
1202 leaq dtrace_badtrap(%rip), %rdi
1203 xorl %eax, %eax
1204 call panic
1205 SET_SIZE(cmntrap_pushed)
1206 SET_SIZE(cmntrap)
1207 SET_SIZE(_cmntrap)
1208
1209 #elif defined(__i386)
1210
1211
1212 ENTRY_NP2(cmntrap, _cmntrap)
1213
1214 INTR_PUSH
1580 ALTENTRY(_sys_rtt)
1581 CLI(%rax) /* disable interrupts */
1582 ALTENTRY(_sys_rtt_ints_disabled)
1583 movq %rsp, %rdi /* pass rp to sys_rtt_common */
1584 call sys_rtt_common /* do common sys_rtt tasks */
1585 testq %rax, %rax /* returning to userland? */
1586 jz sr_sup
1587
1588 /*
1589 * Return to user
1590 */
1591 ASSERT_UPCALL_MASK_IS_SET
1592 cmpw $UCS_SEL, REGOFF_CS(%rsp) /* test for native (64-bit) lwp? */
1593 je sys_rtt_syscall
1594
1595 /*
1596 * Return to 32-bit userland
1597 */
1598 ALTENTRY(sys_rtt_syscall32)
1599 USER32_POP
1600 call x86_md_clear
1601 jmp tr_iret_user
1602 /*NOTREACHED*/
1603
1604 ALTENTRY(sys_rtt_syscall)
1605 /*
1606 * Return to 64-bit userland
1607 */
1608 USER_POP
1609 ALTENTRY(nopop_sys_rtt_syscall)
1610 call x86_md_clear
1611 jmp tr_iret_user
1612 /*NOTREACHED*/
1613 SET_SIZE(nopop_sys_rtt_syscall)
1614
1615 /*
1616 * Return to supervisor
1617 * NOTE: to make the check in trap() that tests if we are executing
1618 * segment register fixup/restore code work properly, sr_sup MUST be
1619 * after _sys_rtt .
1620 */
1621 ALTENTRY(sr_sup)
1622 /*
1623 * Restore regs before doing iretq to kernel mode
1624 */
1625 INTR_POP
1626 jmp tr_iret_kernel
1627 .globl _sys_rtt_end
1628 _sys_rtt_end:
1629 /*NOTREACHED*/
1630 SET_SIZE(sr_sup)
|