Implemented Boot Services
This commit is contained in:
parent
828603e9dc
commit
45c4280241
3 changed files with 639 additions and 2 deletions
88
efi_types.h
Normal file
88
efi_types.h
Normal file
|
@ -0,0 +1,88 @@
|
|||
#ifndef EFI_TYPES_H
|
||||
#define EFI_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
// Wide character
|
||||
typedef uint_least16_t char16_t;
|
||||
|
||||
// Common UEFI Data types
|
||||
typedef uint8_t BOOLEAN;
|
||||
typedef int8_t INT8;
|
||||
typedef uint8_t UINT8;
|
||||
typedef int16_t INT16;
|
||||
typedef uint16_t UINT16;
|
||||
typedef int32_t INT32;
|
||||
typedef uint32_t UINT32;
|
||||
typedef int64_t INT64;
|
||||
typedef uint64_t UINT64;
|
||||
typedef int64_t INTN;
|
||||
typedef uint64_t UINTN;
|
||||
typedef char CHAR8;
|
||||
typedef char16_t CHAR16;
|
||||
typedef void VOID;
|
||||
|
||||
typedef UINTN EFI_STATUS;
|
||||
typedef VOID *EFI_HANDLE;
|
||||
typedef VOID *EFI_EVENT;
|
||||
typedef UINT64 EFI_LBA;
|
||||
typedef UINTN EFI_TPL;
|
||||
|
||||
// https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Base.h
|
||||
#define IN
|
||||
#define OUT
|
||||
#define OPTIONAL
|
||||
#define CONST const
|
||||
|
||||
// x86_64 Microsoft calling convention
|
||||
// https://github.com/vathpela/gnu-efi/blob/master/inc/x86_64/efibind.h
|
||||
#define EFIAPI __attribute__((ms_abi))
|
||||
|
||||
// EFI Physical Address
|
||||
typedef UINT64 EFI_PHYSICAL_ADDRESS;
|
||||
|
||||
// EFI Virtual Address
|
||||
typedef UINT64 EFI_VIRTUAL_ADDRESS;
|
||||
|
||||
// Task Priority Level
|
||||
typedef UINTN EFI_TPL;
|
||||
|
||||
// EFI Status Codes
|
||||
#define EFI_SUCCESS 0
|
||||
|
||||
// Text color attributes
|
||||
#define EFI_BLACK 0x00
|
||||
#define EFI_BLUE 0x01
|
||||
#define EFI_GREEN 0x02
|
||||
#define EFI_CYAN 0x03
|
||||
#define EFI_RED 0x04
|
||||
#define EFI_MAGENTA 0x05
|
||||
#define EFI_BROWN 0x06
|
||||
#define EFI_LIGHTGRAY 0x07
|
||||
#define EFI_BRIGHT 0x08
|
||||
#define EFI_DARKGRAY (EFI_BLACK | EFI_BRIGHT) 0x08
|
||||
#define EFI_LIGHTBLUE 0x09
|
||||
#define EFI_LIGHTGREEN 0x0A
|
||||
#define EFI_LIGHTCYAN 0x0B
|
||||
#define EFI_LIGHTRED 0x0C
|
||||
#define EFI_LIGHTMAGENTA 0x0D
|
||||
#define EFI_YELLOW 0x0E
|
||||
#define EFI_WHITE 0x0F
|
||||
|
||||
// Text background colors
|
||||
#define EFI_BACKGROUND_BLACK 0x00
|
||||
#define EFI_BACKGROUND_BLUE 0x10
|
||||
#define EFI_BACKGROUND_GREEN 0x20
|
||||
#define EFI_BACKGROUND_CYAN 0x30
|
||||
#define EFI_BACKGROUND_RED 0x40
|
||||
#define EFI_BACKGROUND_MAGENTA 0x50
|
||||
#define EFI_BACKGROUND_BROWN 0x60
|
||||
#define EFI_BACKGROUND_LIGHTGRAY 0x70
|
||||
|
||||
// Converts Foreground and Background colors into a single value
|
||||
#define EFI_TEXT_ATTR(Foreground,Background) \
|
||||
((Foreground) | ((Background) << 4))
|
||||
|
||||
#endif /* EFI_TYPES_H */
|
Loading…
Add table
Add a link
Reference in a new issue