So basically I am trying to re-implement a memory protection technique, with the description like this:
- A 256M segment is reserved for application code and
- A 512M segment is reserved for some special data (can't be modified during runtime)
- ...
%fs
register is used to access the 512M memory of special data.
I am thinking to leverage some segmentation based protection on 32bit x86, however, I am trapped in the first step, how to reserve some memory for the special data mentioned above ?
So basically what i am trying to do is very similar with Google's Native Client, I quote some thing for its wiki.
The x86-32 implementation of Native Client is notable for its novel sandboxing method which makes use of the x86 architecture's rarely used segmentation facility.
Native Client sets up x86 segments to restrict the memory range that the sandboxed code can access.
Could anyone give me some help on this issue ?
VirtualAlloc
will not reserve memory at any adress.