MCPcopy Create free account
hub / github.com/Infinity-OS/infinity / switch

Method switch

src/memory/paging/mod.rs:145–161  ·  view source on GitHub ↗

Switch context

(&mut self, new_table: InactivePageTable)

Source from the content-addressed store, hash-verified

143
144 /// Switch context
145 pub fn switch(&mut self, new_table: InactivePageTable) -> InactivePageTable {
146 use x86_64::PhysicalAddress;
147 use x86_64::registers::control_regs;
148
149 // store the ond table
150 let old_table = InactivePageTable {
151 p4_frame: Frame::containing_address(control_regs::cr3().0 as usize),
152 };
153
154 // switch to the new page table
155 unsafe {
156 control_regs::cr3_write(PhysicalAddress(new_table.p4_frame.start_address() as u64));
157 }
158
159 // return the old table
160 old_table
161 }
162
163 /// Flush all the TLB table
164 pub fn flush_all(&mut self) {

Callers 1

remap_the_kernelFunction · 0.80

Calls 1

start_addressMethod · 0.45

Tested by

no test coverage detected