All pastes #53771 Raw Edit

Mine

public text v1 · immutable
#53771 ·published 2006-05-05 21:43 UTC
rendered paste body
#ifdef BRANCH_SINGLE_STEP
        movl    PCPU(CURPCB),%ebx
        movl    $MSR_DEBUGCTLMSR,%ecx
        testl   $PCB_BRANCH_SINGLE_STEP,PCB_FLAGS(%ebx)
        jnz 1f          /*
                         * Static branch prediction should predict to not take this branch,
                         * so we'll handle the default case here and accept a misprediction
                         * if we're using branch single-stepping.
                         */

        movl    $0,%eax
        movl    $0,%edx
        wrmsr
        jmp 2f:

        /*
         * Prepare to write the DebugCtlMSR, lower part is in %eax, higher part in %edx, but not in use
         * Bit 0: If set, record last branch/exception information in the Last(Branch|Exception)(From|To)IP MSRs
         * Bit 1: If set, change semantics of the single step flag (TF) in EFLAGS to single step only on branches
         * We want both.
         */
1:
        movl    $3,%eax
        movl    $0,%edx
        wrmsr

2:
#endif