[SOLVED] passing UEFI runtime services to kernel?
Posted: Fri Nov 27, 2020 4:45 pm
I've been attempting to add reboot functionality to my OS, which at first I thought shouldn't be trivial. I read somewhere that if you pass the Runtime Services to the kernel, you can use the ResetSystem function to reboot the system.
So, I set off to create the necessary structs, enums, declarations, and such to pass the RuntimeServices structure to the kernel. I've been translating types and creating types, however I've had one issue. Namely, the EFIAPI attribute.
I originally thought it was a defined type, but upon closer research it turns out to be EFI compiler magic. I don't know what to replace this keyword with, if anything at all.
Here is an example
UEFI header:
Kernel header:
Source code: https://github.com/microNET-OS/microCOR ... ext-output
I have EfiApi defined as nothing, just a valueless macro. It compiles, though when calling UEFI functions it triple faults, I assume due to the lack of EFI calling convention. Anyone know how I could fix this?
So, I set off to create the necessary structs, enums, declarations, and such to pass the RuntimeServices structure to the kernel. I've been translating types and creating types, however I've had one issue. Namely, the EFIAPI attribute.
I originally thought it was a defined type, but upon closer research it turns out to be EFI compiler magic. I don't know what to replace this keyword with, if anything at all.
Here is an example
UEFI header:
Code: Select all
typedef
EFI_STATUS
(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (
IN UINTN MemoryMapSize,
IN UINTN DescriptorSize,
IN UINT32 DescriptorVersion,
IN EFI_MEMORY_DESCRIPTOR *VirtualMap
);
Code: Select all
typedef
uint64_t
(EfiApi *Efi_Set_Virtual_Address_Map) (
uint64_t MemoryMapSize,
uint64_t DescriptorSize,
uint64_t DescriptorVersion,
Memory_Map_Descriptor *VirtualMap
);
I have EfiApi defined as nothing, just a valueless macro. It compiles, though when calling UEFI functions it triple faults, I assume due to the lack of EFI calling convention. Anyone know how I could fix this?