mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
Kernel: Copy the kernel command line to a good location at boot
When building the kernel with -O2, we somehow ended up with the kernel command line outside of the lower 8MB of physical memory. Since we don't map that area in our initial page table setup, we would triple fault when trying to parse the command line. This patch sidesteps the issue by copying the (first 4KB of) the kernel command line to a buffer in a known safe location at boot.
This commit is contained in:
parent
4172a46fb5
commit
5100dabb96
2 changed files with 22 additions and 3 deletions
|
@ -31,6 +31,10 @@ stack_bottom:
|
|||
.skip 32768
|
||||
stack_top:
|
||||
|
||||
.global kernel_cmdline
|
||||
kernel_cmdline:
|
||||
.skip 4096
|
||||
|
||||
.section .page_tables, "aw", @nobits
|
||||
.align 4096
|
||||
.global boot_pdpt
|
||||
|
@ -93,6 +97,19 @@ start:
|
|||
cli
|
||||
cld
|
||||
|
||||
/* We don't know where the bootloader might have put the command line.
|
||||
* It might be at an inconvenient location that we're not about to map,
|
||||
* so let's just copy it to a convenient location while we have the whole
|
||||
* memory space identity-mapped anyway. :^)
|
||||
*/
|
||||
|
||||
movl %ebx, %esi
|
||||
addl $16, %esi
|
||||
movl (%esi), %esi
|
||||
movl $1024, %ecx
|
||||
movl $(kernel_cmdline - 0xc0000000), %edi
|
||||
rep movsl
|
||||
|
||||
/* clear pdpt */
|
||||
movl $(boot_pdpt - 0xc0000000), %edi
|
||||
movl $1024, %ecx
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue