1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

Kernel: Support loading the kernel at almost arbitrary virtual addresses

This enables further work on implementing KASLR by adding relocation
support to the pre-kernel and updating the kernel to be less dependent
on specific virtual memory layouts.
This commit is contained in:
Gunnar Beutner 2021-07-26 15:10:51 +02:00 committed by Andreas Kling
parent e3d2ca6bd2
commit 57417a3d6e
20 changed files with 123 additions and 87 deletions

View file

@ -112,7 +112,6 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid)
FlatPtr base { 0 };
size_t size { 0 };
String path;
bool is_relative { true };
};
Vector<FlatPtr> stack;
@ -123,7 +122,6 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid)
.base = maybe_kernel_base.value(),
.size = 0x3fffffff,
.path = "/boot/Kernel.debug",
.is_relative = false,
});
}
@ -209,11 +207,7 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid)
continue;
}
FlatPtr adjusted_address;
if (found_region->is_relative)
adjusted_address = address - found_region->base;
else
adjusted_address = address;
FlatPtr adjusted_address = address - found_region->base;
// We're subtracting 1 from the address because this is the return address,
// i.e. it is one instruction past the call instruction.