cpu/psr(chore): minor change

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2024-06-11 23:29:05 +05:30
parent 441665abad
commit 8b80f818c6
2 changed files with 2 additions and 4 deletions

View File

@@ -115,7 +115,6 @@ class Psr {
private: private:
static constexpr uint32_t PSR_CLEAR_RESERVED = 0xF00000FF; static constexpr uint32_t PSR_CLEAR_RESERVED = 0xF00000FF;
static constexpr uint32_t PSR_CLEAR_MODE = 0xFFFFFFE0;
uint32_t psr; uint32_t psr;
}; };

View File

@@ -1,6 +1,5 @@
#include "cpu/psr.hh" #include "cpu/psr.hh"
#include "util/bits.hh" #include "util/bits.hh"
#include "util/log.hh"
namespace matar { namespace matar {
Psr::Psr(uint32_t raw) Psr::Psr(uint32_t raw)
@@ -18,12 +17,12 @@ Psr::set_all(uint32_t raw) {
Mode Mode
Psr::mode() const { Psr::mode() const {
return static_cast<Mode>(psr & ~PSR_CLEAR_MODE); return static_cast<Mode>(psr & 0b11111);
} }
void void
Psr::set_mode(Mode mode) { Psr::set_mode(Mode mode) {
psr &= PSR_CLEAR_MODE; psr &= 0b00000;
psr |= static_cast<uint32_t>(mode); psr |= static_cast<uint32_t>(mode);
} }