arch: aarch64 fp context save, proper single-step

This commit is contained in:
2024-10-27 06:46:25 +02:00
parent 0daf7c677c
commit 0436381b33
40 changed files with 846 additions and 171 deletions
+7 -8
View File
@@ -443,13 +443,7 @@ impl<K: KernelTableManager, PA: PhysicalMemoryAllocator<Address = PhysicalAddres
})
}
fn user(
context: UserContextInfo, // entry: usize,
// arg: usize,
// cr3: u64,
// user_stack_sp: usize,
// fs_base: usize,
) -> Result<Self, Error> {
fn user(context: UserContextInfo) -> Result<Self, Error> {
const USER_TASK_PAGES: usize = 8;
let stack_base_phys = PA::allocate_contiguous_pages(USER_TASK_PAGES)?;
@@ -457,7 +451,12 @@ impl<K: KernelTableManager, PA: PhysicalMemoryAllocator<Address = PhysicalAddres
let mut stack = StackBuilder::new(stack_base, USER_TASK_PAGES * 0x1000);
stack.push(0x200);
let mut flags = 0x200;
if context.single_step {
flags |= 1 << 8;
}
stack.push(flags);
stack.push(context.entry as _);
stack.push(context.argument);
stack.push(context.stack_pointer);
+3
View File
@@ -89,6 +89,9 @@ impl ArchitectureImpl {
impl Architecture for ArchitectureImpl {
type PerCpuData = PerCpuData;
type CpuFeatures = CpuFeatures;
type BreakpointType = u8;
const BREAKPOINT_VALUE: Self::BreakpointType = 0xCC;
unsafe fn set_local_cpu(cpu: *mut ()) {
MSR_IA32_KERNEL_GS_BASE.set(cpu as u64);