Disclosed is a method of managing memory to prevent an operating system
from writing into user memory space, the method comprising providing a translation
look-aside buffer (TLB) for storing TLB entries, each said TLB entry comprising
a virtual address of a page in system memory space, a real address of said page,
a flag entry for storing a value F indicating whether said page is a user page
in said user memory space, providing a space recovery mode register comprising
a mode entry for storing a value E indicating whether the system is in a normal
mode or in a space recovery mode, said value of E set to said space recovery mode
when available free user space fall below a predetermined threshold value, and
for each said TLB entry, designating said page in system memory space as read-only
when F=0 and E=0. An alternative embodiment is also disclosed wherein no modifications
to memory structures are required.