Skip to content

duefi.h

RedstoneShell edited this page Oct 10, 2026 · 1 revision

DUEFI_H

WARNING: This ASM Code use 2 ABI for calls Microsoft ABI x64 & System V, MS ABI for UEFI, System V for code, customize at own risk Linking by #include <duefi.h>, compiling by adding duefi.o in linker.

ddir_entry

Structure that contains data about file at disk in FAT32 filesystem.

typedef struct ddir_entry {
  u64 file_size; // Size of file
  u64 name_len; // Lenght of name in buffer
  u32 name[0xF8]; // File name buffer
} ddir_entry_t

uefi_load_file(const path: u16*, buf: void*, size: u64): u64

Load file data in buffer buf, path is null-term string cast to u16 str[] = { 'T', 'E', .., 0 }, size is size of buffer buf (sizeof(buf)). Returns readed bytes of EFI_STATUS.

uefi_list_dir(const path: u16*, buf: ddir_entry_t*, max: u64): u64

List every .elf files in dir, path is null-term string cast to u16 str[] = { 'T', 'E', .., 0 }, buf is buffer, max is maximal count of elements. Returns 0 at success

uefi_get_system_table(out_system_table: void**): u64

Returns 0 at success, 2 at invalid parameter, 14 if not found. In first arg returns pointer to table

uefi_get_configuration_table(const guid: u8*, out_table: void**): u64

Returns 0 at success, 2 at invalid parameter, 14 if not found. In first arg you receiver Required GUID in UEFI, in second you get pointer to struct

uefi_get_acpi_rsdp(out_rsdp: void**): u64

Returns 0 at success, 2 at invalid parameter. In first arg you get pointer at struct.

uefi_stall(microseconds: u64): void

Stop CPU at X mcs.

uefi_write_file(const path: u16*, buf: void*, size: u64): u64

Write data from buf to file, path is null-term string cast to u16 str[] = { 'T', 'E', .., 0 }, size is size of buffer buf (sizeof(buf)). Returns 0 at success

uefi_get_total_ram(BootServices: void*): u64

Returns total RAM in bytes. In first arg you receive BootServices.

uefi_locate_handle_blockio(BootServices: void*, buffer: void*, size: u64*): u64

In first arg you receive BootServices. buffer is buffer for handles, size is size/pointer at count. Returns EFI_STATUS.

uefi_handle_protocol_blockio(BootServices: void*, buffer: void*, iface: void**): u64

In first arg you receive BootServices. buffer is handle of device, iface is pointer fore saving interface. Returns EFI_STATUS.

Clone this wiki locally