Skip to content

Commit

Permalink
Merge pull request #226 from sifive/dev_emmanuelp
Browse files Browse the repository at this point in the history
Fix test condition into metal_privilege_drop_to_mode function
  • Loading branch information
bsousi5 authored Jan 13, 2020
2 parents d8c8009 + cc9e120 commit b92526c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/privilege.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ void metal_privilege_drop_to_mode(enum metal_privilege_mode mode,
__asm__ volatile("csrr %0, mstatus" : "=r"(mstatus));

/* Set xPIE bits based on current xIE bits */
if (mstatus && (1 << METAL_MSTATUS_MIE_OFFSET)) {
if (mstatus & (1 << METAL_MSTATUS_MIE_OFFSET)) {
mstatus |= (1 << METAL_MSTATUS_MPIE_OFFSET);
} else {
mstatus &= ~(1 << METAL_MSTATUS_MPIE_OFFSET);
}
if (mstatus && (1 << METAL_MSTATUS_SIE_OFFSET)) {
if (mstatus & (1 << METAL_MSTATUS_SIE_OFFSET)) {
mstatus |= (1 << METAL_MSTATUS_SPIE_OFFSET);
} else {
mstatus &= ~(1 << METAL_MSTATUS_SPIE_OFFSET);
}
if (mstatus && (1 << METAL_MSTATUS_UIE_OFFSET)) {
if (mstatus & (1 << METAL_MSTATUS_UIE_OFFSET)) {
mstatus |= (1 << METAL_MSTATUS_UPIE_OFFSET);
} else {
mstatus &= ~(1 << METAL_MSTATUS_UPIE_OFFSET);
Expand Down

0 comments on commit b92526c

Please sign in to comment.