u3: reposition guard page if needed for new roads

this works around a bug wherein the guard page
could become nonoperable if it happened to coincide
with the padding between inner roads
This commit is contained in:
Joe Bryan 2022-11-10 12:33:21 -05:00
parent 04645cbf08
commit 4a5b56eff5
3 changed files with 22 additions and 1 deletions

View File

@ -84,9 +84,14 @@
void
u3e_foul(void);
/* u3e_init(): initialize page tracking.
/* u3e_init(): initialize guard page tracking.
*/
void
u3e_init(void);
/* u3e_ward(): reposition guard page if needed.
*/
void
u3e_ward(u3_post low_p, u3_post hig_p);
#endif /* ifndef U3_EVENTS_H */

View File

@ -1097,6 +1097,8 @@ u3e_foul(void)
memset((void*)u3P.dit_w, 0xff, sizeof(u3P.dit_w));
}
/* u3e_init(): initialize guard page tracking.
*/
void
u3e_init(void)
{
@ -1104,3 +1106,15 @@ u3e_init(void)
_ce_center_guard_page();
#endif
}
/* u3e_ward(): reposition guard page if needed.
*/
void
u3e_ward(u3_post low_p, u3_post hig_p)
{
#ifdef U3_GUARD_PAGE
if ( (low_p > gar_pag_p) || (hig_p < gar_pag_p) ) {
_ce_center_guard_page();
}
#endif
}

View File

@ -803,6 +803,7 @@ u3m_leap(c3_w pad_w)
u3R->cap_p -= len_w;
rod_u = _pave_south(u3a_into(bot_p), c3_wiseof(u3a_road), len_w);
u3e_ward(rod_u->cap_p, rod_u->hat_p);
#if 0
fprintf(stderr, "leap: from north %p (cap 0x%x), to south %p\r\n",
u3R,
@ -815,6 +816,7 @@ u3m_leap(c3_w pad_w)
u3R->cap_p += len_w;
rod_u = _pave_north(u3a_into(bot_p), c3_wiseof(u3a_road), len_w);
u3e_ward(rod_u->hat_p, rod_u->cap_p);
#if 0
fprintf(stderr, "leap: from south %p (cap 0x%x), to north %p\r\n",
u3R,