VM: Refactor segments.hpp to Factor style
parent
b2929acff6
commit
b1ccfa2194
|
@ -1,35 +1,26 @@
|
||||||
namespace factor
|
namespace factor {
|
||||||
{
|
|
||||||
|
|
||||||
inline cell align_page(cell a)
|
inline cell align_page(cell a) { return align(a, getpagesize()); }
|
||||||
{
|
|
||||||
return align(a,getpagesize());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* segments set up guard pages to check for under/overflow.
|
/* segments set up guard pages to check for under/overflow.
|
||||||
size must be a multiple of the page size */
|
size must be a multiple of the page size */
|
||||||
struct segment {
|
struct segment {
|
||||||
cell start;
|
cell start;
|
||||||
cell size;
|
cell size;
|
||||||
cell end;
|
cell end;
|
||||||
|
|
||||||
explicit segment(cell size, bool executable_p);
|
explicit segment(cell size, bool executable_p);
|
||||||
~segment();
|
~segment();
|
||||||
|
|
||||||
bool underflow_p(cell addr)
|
bool underflow_p(cell addr) {
|
||||||
{
|
return (addr >= start - getpagesize() && addr < start);
|
||||||
return (addr >= start - getpagesize() && addr < start);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool overflow_p(cell addr)
|
bool overflow_p(cell addr) {
|
||||||
{
|
return (addr >= end && addr < end + getpagesize());
|
||||||
return (addr >= end && addr < end + getpagesize());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool in_segment_p(cell addr)
|
bool in_segment_p(cell addr) { return (addr >= start && addr < end); }
|
||||||
{
|
|
||||||
return (addr >= start && addr < end);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue