You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I posted this in a comment but it deserves its own post as I have questions.
I had this issue which creeps up when I change to certain resolutions causing boot loops but sometimes undefined behavior in the kernel and it took me a while to figure this out but the first page at address 0 is already allocated causing the AllocatePages to fail. I assume it's reserved by the bootloader for itself? I have unallocated it and after that it allocates fine but then you are overwriting memory which also causes boot failures or problems in the kernel.
What does work is changing this line to:
Elf64_Addr segment = phdr->p_paddr;
to
Elf64_Addr segment = phdr->p_paddr + 0x1000;
Now the kernel boots fine and everything works except interrupts. To fix this and I am not happy with this fix is in the kernel kernelUtil.cpp change:
interrupt->SetOffset((uint64_t)handler);
to
interrupt->SetOffset((uint64_t)handler + 0x1000);
I do not want to have to add this offset to certain things inside the kernel.
Is there any way to tell the compiler or linker to account for this 0x1000 offset and remap the addresses?
I am sure there is a way I just don't know how.
If there is another solution let me know.
The text was updated successfully, but these errors were encountered:
It looks like the solution to above is not the changes I suggested above but rather change the kernel.ld script by adding this line:
. = 0x1000; just before _KernelStart = .;
I posted this in a comment but it deserves its own post as I have questions.
I had this issue which creeps up when I change to certain resolutions causing boot loops but sometimes undefined behavior in the kernel and it took me a while to figure this out but the first page at address 0 is already allocated causing the AllocatePages to fail. I assume it's reserved by the bootloader for itself? I have unallocated it and after that it allocates fine but then you are overwriting memory which also causes boot failures or problems in the kernel.
What does work is changing this line to:
Elf64_Addr segment = phdr->p_paddr;
to
Elf64_Addr segment = phdr->p_paddr + 0x1000;
This starts loading the kernel at page 2.
Then change:
void (KernelStart)(BootInfo) = ((attribute((sysv_abi)) void ()(BootInfo) ) header.e_entry);
to
void (KernelStart)(BootInfo) = ((attribute((sysv_abi)) void ()(BootInfo) ) header.e_entry + 0x1000);
This loads the kernel from page 2.
Now the kernel boots fine and everything works except interrupts. To fix this and I am not happy with this fix is in the kernel kernelUtil.cpp change:
interrupt->SetOffset((uint64_t)handler);
to
interrupt->SetOffset((uint64_t)handler + 0x1000);
I do not want to have to add this offset to certain things inside the kernel.
Is there any way to tell the compiler or linker to account for this 0x1000 offset and remap the addresses?
I am sure there is a way I just don't know how.
If there is another solution let me know.
The text was updated successfully, but these errors were encountered: