#ifdef BRANCH_SINGLE_STEP
movl PCPU(CURPCB),%ebx
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
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
2:
movl $MSR_DEBUGCTLMSR,%ecx
movl $0,%edx
wrmsr
#endif