kern: add hardware single step extension
This commit is contained in:
@@ -186,7 +186,24 @@ namespace ams::kern::svc {
|
||||
R_UNLESS(KTargetSystem::IsDebugMode(), svc::ResultNotImplemented());
|
||||
|
||||
/* Validate the context flags. */
|
||||
R_UNLESS((context_flags | ams::svc::ThreadContextFlag_All) == ams::svc::ThreadContextFlag_All, svc::ResultInvalidEnumValue());
|
||||
#if defined(MESOSPHERE_ENABLE_HARDWARE_SINGLE_STEP)
|
||||
{
|
||||
/* Check that the flags are a subset of the allowable. */
|
||||
constexpr u32 AllFlagsMask = ams::svc::ThreadContextFlag_All | ams::svc::ThreadContextFlag_SetSingleStep | ams::svc::ThreadContextFlag_ClearSingleStep;
|
||||
R_UNLESS((context_flags | AllFlagsMask) == AllFlagsMask, svc::ResultInvalidEnumValue());
|
||||
|
||||
/* Check that thread isn't both setting and clearing single step. */
|
||||
const bool set_ss = (context_flags & ams::svc::ThreadContextFlag_SetSingleStep) != 0;
|
||||
const bool clear_ss = (context_flags & ams::svc::ThreadContextFlag_ClearSingleStep) != 0;
|
||||
|
||||
R_UNLESS(!(set_ss && clear_ss), svc::ResultInvalidEnumValue());
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* Check that the flags are a subset of the allowable. */
|
||||
R_UNLESS((context_flags | ams::svc::ThreadContextFlag_All) == ams::svc::ThreadContextFlag_All, svc::ResultInvalidEnumValue());
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Copy the thread context from userspace. */
|
||||
ams::svc::ThreadContext context;
|
||||
|
||||
Reference in New Issue
Block a user