OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:00 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Load higher half kernel with UEFI application
PostPosted: Sun Jan 16, 2022 8:58 pm 
Offline
Member
Member
User avatar

Joined: Tue Jul 13, 2021 5:15 am
Posts: 35
Location: Metaverse
Does anyone know how to load a higher half kernel using the bootloader from poncho's UEFI bootloader?
At this moment when I try to load the kernel in the memory, EDK throws this exception:

Code:
!!!! X64 Exception Type - 0E(#PF - Page-Fault)  CPU Apic ID - 00000000 !!!!
ExceptionData - 0000000000000000  I:0 R:0 U:0 W:0 P:0 PK:0 SS:0 SGX:0
RIP  - 0000000000015E40, CS  - 0000000000000038, RFLAGS - 0000000000010006
RAX  - 0000000000000025, RCX - 0000000000000000, RDX - 00000000000003F8
RBX  - 00000000000003FD, RSP - 000000007FE6B658, RBP - 000000007FE6B690
RSI  - FFFFFFFF80032628, RDI - FFFFFFFF80032628
R8   - 0000000000000025, R9  - 0000000000000078, R10 - 000000007FBC4880
R11  - 00000000CB8F5AF3, R12 - 0000000000000000, R13 - FFFFFFFF80032628
R14  - 000000007FE6B750, R15 - 00000000000003F8
DS   - 0000000000000030, ES  - 0000000000000030, FS  - 0000000000000030
GS   - 0000000000000030, SS  - 0000000000000030
CR0  - 0000000080010033, CR2 - FFFFFFFF80032628, CR3 - 000000007FC01000
CR4  - 0000000000000668, CR8 - 0000000000000000
DR0  - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000
DR3  - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400
GDTR - 000000007FBEEA98 0000000000000047, LDTR - 0000000000000000
IDTR - 000000007F2D0018 0000000000000FFF,   TR - 0000000000000000
FXSAVE_STATE - 000000007FE6B2B0
!!!! Can't find image information. !!!!


main.c: https://github.com/Absurdponcho/PonchoOS/blob/main/gnu-efi/bootloader/main.c

Any help is welcome

_________________
The code does get a bit quirky at night.


Top
 Profile  
 
 Post subject: Re: Load higher half kernel with UEFI application
PostPosted: Mon Jan 17, 2022 2:03 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
There are three problems in this one line of code.

  • Specific addresses are not guaranteed to be free. A bootloader should never use AllocateAddress.
  • The physical addresses in the program headers are usually meaningless to a higher-half kernel. The bootloader should be using the virtual addresses.
  • Memory allocations may fail, but the bootloader assumes they will succeed.

A bootloader for a higher-half kernel should load the kernel into a free area of memory without caring about the physical address (except for alignment), then set up page tables to map that memory at the appropriate virtual address according to the program headers.

You'll have to either find a better bootloader or write one yourself.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot], Google [Bot], SanderR, SemrushBot [Bot] and 68 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group