factor/vm/segments.hpp

31 lines
617 B
C++
Raw Normal View History

namespace factor {
2009-05-04 02:46:13 -04:00
inline cell align_page(cell a) { return align(a, getpagesize()); }
/* segments set up guard pages to check for under/overflow.
size must be a multiple of the page size */
2009-05-04 05:50:24 -04:00
struct segment {
cell start;
cell size;
cell end;
segment(cell size, bool executable_p);
~segment();
2010-03-27 07:33:28 -04:00
bool underflow_p(cell addr) {
return addr >= (start - getpagesize()) && addr < start;
}
2010-03-27 07:33:28 -04:00
bool overflow_p(cell addr) {
return addr >= end && addr < (end + getpagesize());
}
bool in_segment_p(cell addr) {
return addr >= start && addr < end;
}
void set_border_locked(bool locked);
};
2009-05-04 02:46:13 -04:00
}