Skip to content

Commit

Permalink
Adding clarifying comments suggested during walkthrough with JPH.
Browse files Browse the repository at this point in the history
  • Loading branch information
rptb1 committed Mar 31, 2023
1 parent 8a01218 commit 8421f4f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions code/shield.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ static void shieldFlushEntries(Shield shield)
Seg seg = shieldDequeue(shield, i);
if (!SegIsSynced(seg)) {
shieldSetPM(shield, seg, SegSM(seg));
/* If the segment has a different mode from the previous run, or
it's not contiguous with the previous run, then set the OS
protection on the previous run, and start a new run. */
if (SegSM(seg) != mode || SegBase(seg) != limit) {
if (base != NULL) {
AVER(base < limit);
Expand All @@ -461,6 +464,7 @@ static void shieldFlushEntries(Shield shield)
limit = SegLimit(seg);
}
}
/* Set the OS protection on the last run, if there is one. */
if (base != NULL) {
AVER(base < limit);
ProtSet(base, limit, mode);
Expand Down

0 comments on commit 8421f4f

Please sign in to comment.