Skip to content

Commit

Permalink
Fix granule setting order in realm creation
Browse files Browse the repository at this point in the history
Signed-off-by: Sangwan Kwon <[email protected]>
  • Loading branch information
bitboom committed Aug 17, 2023
1 parent a02bfb6 commit 5c1c2da
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions rmm/monitor/src/rmi/realm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ pub fn set_event_handler(mainloop: &mut Mainloop) {
let mm = rmm.mm;

// get the lock for granule.
let mut granule = get_granule_if!(arg[0], GranuleState::Delegated)?;
let rd = granule.content_mut::<Rd>();
let mut rd_granule = get_granule_if!(arg[0], GranuleState::Delegated)?;
let rd = rd_granule.content_mut::<Rd>();
mm.map(arg[0], true);

// read params
Expand All @@ -41,12 +41,11 @@ pub fn set_event_handler(mainloop: &mut Mainloop) {
ret[1] = id;
})?;

// set Rd state only when everything goes well.
set_granule(&mut granule, GranuleState::RD)?;
let mut rtt_granule = get_granule_if!(rd.rtt_base(), GranuleState::Delegated)?;
set_granule(&mut rtt_granule, GranuleState::RTT)?;

let rd = granule.content::<Rd>();
let mut granule = get_granule_if!(rd.rtt_base(), GranuleState::Delegated)?;
set_granule(&mut granule, GranuleState::RTT)?;
// set Rd state only when everything goes well.
set_granule(&mut rd_granule, GranuleState::RD)?;

Ok(())
});
Expand Down

0 comments on commit 5c1c2da

Please sign in to comment.