Print this page
9736 kmdb tortures via single-step miscellaneous trap
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/kdi/kdi_asm.s
          +++ new/usr/src/uts/intel/kdi/kdi_asm.s
↓ open down ↓ 398 lines elided ↑ open up ↑
 399  399          pushq   $-1             /* phony trap error code */
 400  400          pushq   $-1             /* phony trap number */
 401  401  
 402  402          subq    $REG_OFF(KDIREG_TRAPNO), %rsp
 403  403          KDI_SAVE_REGS(%rsp)
 404  404  
 405  405          movq    %cr3, %rax
 406  406          movq    %rax, REG_OFF(KDIREG_CR3)(%rsp)
 407  407  
 408  408          movq    REG_OFF(KDIREG_SS)(%rsp), %rax
      409 +        movq    %rax, REG_OFF(KDIREG_SAVPC)(%rsp)
 409  410          xchgq   REG_OFF(KDIREG_RIP)(%rsp), %rax
 410  411          movq    %rax, REG_OFF(KDIREG_SS)(%rsp)
 411  412  
 412  413          movq    REG_OFF(KDIREG_RSP)(%rsp), %rax
 413  414          addq    $8, %rax
 414  415          movq    %rax, REG_OFF(KDIREG_RSP)(%rsp)
 415  416  
 416  417          /*
 417  418           * We've saved all of the general-purpose registers, and have a stack
 418  419           * that is irettable (after we strip down to the error code)
 419  420           */
 420  421  
 421  422          GET_CPUSAVE_ADDR        /* %rax = cpusave, %rbx = CPU ID */
 422  423  
 423  424          ADVANCE_CRUMB_POINTER(%rax, %rcx, %rdx)
 424  425  
 425  426          ADD_CRUMB(%rax, KRM_CPU_STATE, $KDI_CPU_STATE_SLAVE, %rdx)
 426  427  
 427  428          movq    REG_OFF(KDIREG_RIP)(%rsp), %rcx
 428  429          ADD_CRUMB(%rax, KRM_PC, %rcx, %rdx)
      430 +        movq    REG_OFF(KDIREG_RSP)(%rsp), %rcx
      431 +        ADD_CRUMB(%rax, KRM_SP, %rcx, %rdx)
      432 +        ADD_CRUMB(%rax, KRM_TRAPNO, $-1, %rdx)
 429  433  
      434 +        movq    $KDI_CPU_STATE_SLAVE, KRS_CPU_STATE(%rax)
      435 +
 430  436          pushq   %rax
 431  437          jmp     kdi_save_common_state
 432  438  
 433  439          SET_SIZE(kdi_slave_entry)
 434  440  
 435  441  /*
 436  442   * The state of the world:
 437  443   *
 438  444   * The stack has a complete set of saved registers and segment
 439  445   * selectors, arranged in the kdi_regs.h order.  It also has a pointer
↓ open down ↓ 271 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX