Directly check PEB for IsDebuggerAttached
Add constexpr getters to magicdiv class so it can be used from jitted x64/dxbc Track the guest return address as well for guest/host sync, if multiple entries have the same guest stack find the first one with a matching guest retaddr. this fixes epic mickey 2 (which the previous guest-stack change had allowed to go ingame for a bit) and potentially also a crash in fable3. Break if under debugger when stackpoints are overflowed Add much more useful output for host exceptions, print out xenia_canary.exe relative offsets if exception is in module, formatmessage for ntstatus/win32err, strerror Minor d3d12 microoptimization, instead of doing SetEventOnCompletion + WaitForSingleObject do SetEventOnCompletion w/ nullptr so that the wait happens in kernel mode, avoiding two extra context switches add unimplemented kernel functions: ExAllocatePoolWithTag ObReferenceObject ObDereferenceObject has no return value. Log a message when ObDereferenceObject/Reference receive unregistered guest kernel objects gave ObLookupThreadByThreadId its correct error status hoist object_types initialization out of ObReferenceObjectByHandle Fix out parameter values on error for a few kernel funcs add note about msr to KeSetCurrentStackPointers add X_STATUS_OBJECT_TYPE_MISMATCH check for xeNtSetEvent add msr_mask field to X_KPCR
This commit is contained in:
@@ -21,6 +21,9 @@ namespace debugging {
|
||||
// The state may change at any time (attach after launch, etc), so do not
|
||||
// cache this value. Determining if the debugger is attached is expensive,
|
||||
// though, so avoid calling it frequently.
|
||||
// chrispy: no longer expensive to check on windows, we're directly using the
|
||||
// teb/peb now to find this
|
||||
|
||||
bool IsDebuggerAttached();
|
||||
|
||||
// Breaks into the debugger if it is attached.
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
namespace xe {
|
||||
namespace debugging {
|
||||
|
||||
bool IsDebuggerAttached() { return IsDebuggerPresent() ? true : false; }
|
||||
bool IsDebuggerAttached() {
|
||||
return reinterpret_cast<const bool*>(
|
||||
__readgsqword(0x60))[2]; // get BeingDebugged field of PEB
|
||||
}
|
||||
|
||||
void Break() { __debugbreak(); }
|
||||
|
||||
|
||||
@@ -664,6 +664,22 @@ struct MagicDiv {
|
||||
multiplier_ = PregenerateUint32Div(original, extradata_);
|
||||
}
|
||||
|
||||
constexpr uint32_t GetRightShift() const {
|
||||
IDivExtraInfo extra{};
|
||||
|
||||
extra.value_ = extradata_;
|
||||
return extra.info.shift_;
|
||||
}
|
||||
|
||||
constexpr bool AddFlag() const {
|
||||
IDivExtraInfo extra{};
|
||||
|
||||
extra.value_ = extradata_;
|
||||
return extra.info.shift_;
|
||||
}
|
||||
|
||||
constexpr uint32_t GetMultiplier() const { return multiplier_;
|
||||
}
|
||||
constexpr uint32_t Apply(uint32_t numerator) const {
|
||||
return ApplyUint32Div(numerator, multiplier_, extradata_);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user