WIP: Copy usermode stack

This commit is contained in:
Jeremy Soller 2016-09-13 21:27:27 -06:00
parent 3f9012b931
commit 6e16298e71
4 changed files with 67 additions and 9 deletions

View file

@ -101,6 +101,36 @@ impl Memory {
self.flags = new_flags;
}
pub fn replace(&mut self, new_start: VirtualAddress, flush: bool) {
let mut active_table = unsafe { ActivePageTable::new() };
let mut flush_all = false;
for page in self.pages() {
active_table.unmap(page);
if flush {
//active_table.flush(page);
flush_all = true;
}
}
self.start = new_start;
for page in self.pages() {
active_table.map(page, self.flags);
if flush {
//active_table.flush(page);
flush_all = true;
}
}
if flush_all {
active_table.flush_all();
}
}
pub fn resize(&mut self, new_size: usize, flush: bool, clear: bool) {
let mut active_table = unsafe { ActivePageTable::new() };