kern: fix bugs caused by UB + transition to -Os

This commit is contained in:
Michael Scire
2020-12-01 18:41:44 -08:00
parent 95bbb20cb0
commit 4ce3778d87
4 changed files with 49 additions and 45 deletions

View File

@@ -42,7 +42,7 @@ namespace ams::kern {
u32 prev_intr_state;
public:
ALWAYS_INLINE KScopedInterruptDisable() : prev_intr_state(KInterruptManager::DisableInterrupts()) { /* ... */ }
~KScopedInterruptDisable() { KInterruptManager::RestoreInterrupts(prev_intr_state); }
ALWAYS_INLINE ~KScopedInterruptDisable() { KInterruptManager::RestoreInterrupts(prev_intr_state); }
};
class KScopedInterruptEnable {
@@ -52,7 +52,7 @@ namespace ams::kern {
u32 prev_intr_state;
public:
ALWAYS_INLINE KScopedInterruptEnable() : prev_intr_state(KInterruptManager::EnableInterrupts()) { /* ... */ }
~KScopedInterruptEnable() { KInterruptManager::RestoreInterrupts(prev_intr_state); }
ALWAYS_INLINE ~KScopedInterruptEnable() { KInterruptManager::RestoreInterrupts(prev_intr_state); }
};
}