While consistent use of rounding mode for computing GC_faulted entries
is ok, the proper way of getting page number of an address is just to
clear the lowest bits of the latter.
* checksums.c (GC_record_fault, GC_was_faulted): Do not round-up when
computing page.
* checksums.c (GC_record_fault): Add assertion that GC_page_size is
initialized.
void GC_record_fault(struct hblk * h)
{
- word page = ROUNDUP_PAGESIZE((word)h);
+ word page = (word)h & ~(GC_page_size - 1);
+ GC_ASSERT(GC_page_size != 0);
if (GC_n_faulted >= NSUMS) ABORT("write fault log overflowed");
GC_faulted[GC_n_faulted++] = page;
}
STATIC GC_bool GC_was_faulted(struct hblk *h)
{
size_t i;
- word page = ROUNDUP_PAGESIZE((word)h);
+ word page = (word)h & ~(GC_page_size - 1);
for (i = 0; i < GC_n_faulted; ++i) {
if (GC_faulted[i] == page) return TRUE;