docs: Continue work on Limine protocol spec

This commit is contained in:
mintsuki 2022-03-22 10:26:41 +01:00
parent 2fa2fb2220
commit c4f04dab95
4 changed files with 394 additions and 10 deletions

View File

@ -135,3 +135,387 @@ at least 8KiB (8192 bytes) in size. An invalid return address of 0 is pushed
to the stack before jumping to the kernel. to the stack before jumping to the kernel.
All other general purpose registers are set to 0. All other general purpose registers are set to 0.
# Feature List
Request IDs are composed of 4 64-bit unsigned integers, but the first 2 are
common to every request:
```c
#define LIMINE_COMMON_MAGIC 0xc7b1dd30df4c8b88, 0x0a82e883a194f07b
```
## Bootloader Info Feature
ID:
```c
#define LIMINE_BOOTLOADER_INFO_REQUEST { LIMINE_COMMON_MAGIC, 0xf55038d8e2a1202f, 0x279426fcf5f59740 }
```
Request:
```c
struct limine_bootloader_info_request {
uint64_t id[4];
uint64_t revision;
struct limine_bootloader_info_response *response;
};
```
Response:
```c
struct limine_bootloader_info_response {
uint64_t revision;
char *name;
char *version;
};
```
`name` and `version` are 0-terminated ASCII strings containing the name and
version of the loading bootloader.
## HHDM (Higher Half Direct Map) Feature
ID:
```c
#define LIMINE_HHDM_REQUEST { LIMINE_COMMON_MAGIC, 0x48dcf1cb8ad2b852, 0x63984e959a98244b }
```
Request:
```c
struct limine_hhdm_request {
uint64_t id[4];
uint64_t revision;
struct limine_hhdm_response *response;
};
```
Response:
```c
struct limine_hhdm_response {
uint64_t revision;
uint64_t address;
};
```
* `address` - the virtual address of the beginning of the higher half direct
map.
## Framebuffer Feature
ID:
```c
#define LIMINE_FRAMEBUFFER_REQUEST { LIMINE_COMMON_MAGIC, 0xcbfe81d7dd2d1977, 0x063150319ebc9b71 }
```
Request:
```c
struct limine_framebuffer_request {
uint64_t id[4];
uint64_t revision;
struct limine_framebuffer_response *response;
};
```
Response:
```c
struct limine_framebuffer_response {
uint64_t revision;
uint64_t framebuffer_count;
struct limine_framebuffer **framebuffers;
};
```
* `framebuffer_count` - How many framebuffers are present.
* `framebuffers` - Pointer to an array of `framebuffer_count` pointers to
`struct limine_framebuffer` structures.
```c
// Constants for `memory_model`
#define LIMINE_FRAMEBUFFER_RGB 1
struct limine_framebuffer {
void *address;
uint16_t width;
uint16_t height;
uint16_t pitch;
uint16_t bpp;
uint8_t memory_model;
uint8_t red_mask_size;
uint8_t red_mask_shift;
uint8_t green_mask_size;
uint8_t green_mask_shift;
uint8_t blue_mask_size;
uint8_t blue_mask_shift;
uint8_t unused;
uint64_t edid_size;
void *edid;
};
```
## 5-Level Paging Feature
ID:
```c
#define LIMINE_5_LEVEL_PAGING_REQUEST { LIMINE_COMMON_MAGIC, 0x94469551da9b3192, 0xebe5e86db7382888 }
```
Request:
```c
struct limine_5_level_paging_request {
uint64_t id[4];
uint64_t revision;
struct limine_5_level_paging_response *response;
};
```
Response:
```c
struct limine_5_level_paging_response {
uint64_t revision;
};
```
Notes: The presence of this request will prompt the bootloader to turn on
x86_64 5-level paging. It will not be turned on if this request is not present.
If the response pointer is non-NULL, 5-level paging is engaged.
## Entry Point Feature
ID:
```c
#define LIMINE_ENTRY_POINT_REQUEST { LIMINE_COMMON_MAGIC, 0x13d86c035a1cd3e1, 0x2b0caa89d8f3026a }
```
Request:
```c
typedef void (*limine_entry_point)(void);
struct limine_entry_point_request {
uint64_t id[4];
uint64_t revision;
struct limine_entry_point_response *response;
limine_entry_point entry;
};
```
* `entry` - The requested entry point.
Response:
```c
struct limine_entry_point_response {
uint64_t revision;
};
```
## RSDP Feature
ID:
```c
#define LIMINE_RSDP_REQUEST { LIMINE_COMMON_MAGIC, 0xc5e77b6b397e7b43, 0x27637845accdcf3c }
```
Request:
```c
struct limine_rsdp_request {
uint64_t id[4];
uint64_t revision;
struct limine_rsdp_response *response;
};
```
Response:
```c
struct limine_rsdp_response {
uint64_t revision;
void *address;
};
```
* `address` - Address of the RSDP table.
## SMBIOS Feature
ID:
```c
#define LIMINE_SMBIOS_REQUEST { LIMINE_COMMON_MAGIC, 0x9e9046f11e095391, 0xaa4a520fefbde5ee }
```
Request:
```c
struct limine_smbios_request {
uint64_t id[4];
uint64_t revision;
struct limine_smbios_response *response;
};
```
Response:
```c
struct limine_smbios_response {
uint64_t revision;
void *entry_32;
void *entry_64;
};
```
* `entry_32` - Address of the 32-bit SMBIOS entry point. NULL if not present.
* `entry_64` - Address of the 64-bit SMBIOS entry point. NULL if not present.
## EFI System Table Feature
ID:
```c
#define LIMINE_EFI_SYSTEM_TABLE_REQUEST { LIMINE_COMMON_MAGIC, 0x5ceba5163eaaf6d6, 0x0a6981610cf65fcc }
```
Request:
```c
struct limine_efi_system_table_request {
uint64_t id[4];
uint64_t revision;
struct limine_efi_system_table_response *response;
};
```
Response:
```c
struct limine_efi_system_table_response {
uint64_t revision;
void *address;
};
```
* `address` - Address of EFI system table.
## Boot Time Feature
ID:
```c
#define LIMINE_BOOT_TIME_REQUEST { LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 }
```
Request:
```c
struct limine_boot_time_request {
uint64_t id[4];
uint64_t revision;
struct limine_boot_time_response *response;
};
```
Response:
```c
struct limine_boot_time_response {
uint64_t revision;
int64_t boot_time;
};
```
* `boot_time` - The UNIX time on boot, in seconds, taken from the system RTC.
## Kernel Address Feature
ID:
```c
#define LIMINE_KERNEL_ADDRESS_REQUEST { LIMINE_COMMON_MAGIC, 0x71ba76863cc55f63, 0xb2644a48c516a487 }
```
Request:
```c
struct limine_kernel_address_request {
uint64_t id[4];
uint64_t revision;
struct limine_kernel_address_response *response;
};
```
Response:
```c
struct limine_kernel_address_response {
uint64_t revision;
uint64_t physical_base;
uint64_t virtual_base;
};
```
* `physical_base` - The physical base address of the kernel.
* `virtual_base` - The virtual base address of the kernel.
## Module Feature
ID:
```c
#define LIMINE_MODULE_REQUEST { LIMINE_COMMON_MAGIC, 0x3e7e279702be32af, 0xca1c4f3bd1280cee }
```
Request:
```c
struct limine_module_request {
uint64_t id[4];
uint64_t revision;
struct limine_module_response *response;
};
```
Response:
```c
struct limine_module_response {
uint64_t revision;
uint64_t module_count;
struct limine_module **modules;
};
```
* `module_count` - How many modules are present.
* `modules` - Pointer to an array of `module_count` pointers to
`struct limine_module` structures.
```c
struct limine_module {
uint64_t base;
uint64_t length;
char *path;
char *cmdline;
struct limine_file_location *file_location;
};
```
* `base` - The address of the module.
* `length` - The size of the module.
* `path` - The bootloader-specific path of the module.
* `cmdline` - A command line associated with the module.
* `file_location` - A pointer to the file location structure for the module.
### File Location Structure
```c
struct limine_uuid {
uint32_t a;
uint16_t b;
uint16_t c;
uint8_t d[8];
};
struct limine_file_location {
uint64_t revision;
uint64_t partition_index;
uint32_t tftp_ip;
uint32_t tftp_port;
uint32_t mbr_disk_id;
struct limine_uuid gpt_disk_uuid;
struct limine_uuid gpt_part_uuid;
struct limine_uuid part_uuid;
};
```
* `partition_index` - 1-based partition index of the volume from which the
module was loaded. If 0, it means invalid or unpartitioned.
* `tftp_ip` - If non-0, this is the IP of the TFTP server the file was loaded from.
* `tftp_port` - Likewise, but port.
* `mbr_disk_id` - If non-0, this is the ID of the disk the module was loaded
from as reported in its MBR.
* `gpt_disk_uuid` - If non-0, this is the UUID of the disk the module was
loaded from as reported in its GPT.
* `gpt_part_uuid` - If non-0, this is the UUID of the partition the module
was loaded from as reported in the GPT.
* `part_uuid` - If non-0, this is the UUID of the filesystem of the partition
the module was loaded from.

View File

@ -23,8 +23,8 @@ struct limine_uuid {
struct limine_file_location { struct limine_file_location {
uint64_t revision; uint64_t revision;
uint64_t partition_index; uint64_t partition_index;
uint32_t pxe_ip; uint32_t tftp_ip;
uint32_t pxe_port; uint32_t tftp_port;
uint32_t mbr_disk_id; uint32_t mbr_disk_id;
struct limine_uuid gpt_disk_uuid; struct limine_uuid gpt_disk_uuid;
struct limine_uuid gpt_part_uuid; struct limine_uuid gpt_part_uuid;

View File

@ -43,8 +43,8 @@ static struct limine_file_location get_file_loc(struct file_handle *file) {
struct limine_file_location ret = {0}; struct limine_file_location ret = {0};
if (file->pxe) { if (file->pxe) {
ret.pxe_ip = file->pxe_ip; ret.tftp_ip = file->pxe_ip;
ret.pxe_port = file->pxe_port; ret.tftp_port = file->pxe_port;
return ret; return ret;
} }

View File

@ -98,12 +98,12 @@ static char *get_memmap_type(uint64_t type) {
static void print_file_loc(struct limine_file_location *file_location) { static void print_file_loc(struct limine_file_location *file_location) {
e9_printf("Loc->Revision: %d", file_location->revision); e9_printf("Loc->Revision: %d", file_location->revision);
e9_printf("Loc->PartIndex: %d", file_location->partition_index); e9_printf("Loc->PartIndex: %d", file_location->partition_index);
e9_printf("Loc->PXEIP: %d.%d.%d.%d", e9_printf("Loc->TFTPIP: %d.%d.%d.%d",
(file_location->pxe_ip & (0xff << 0)) >> 0, (file_location->tftp_ip & (0xff << 0)) >> 0,
(file_location->pxe_ip & (0xff << 8)) >> 8, (file_location->tftp_ip & (0xff << 8)) >> 8,
(file_location->pxe_ip & (0xff << 16)) >> 16, (file_location->tftp_ip & (0xff << 16)) >> 16,
(file_location->pxe_ip & (0xff << 24)) >> 24); (file_location->tftp_ip & (0xff << 24)) >> 24);
e9_printf("Loc->PXEPort: %d", file_location->pxe_port); e9_printf("Loc->TFTPPort: %d", file_location->tftp_port);
e9_printf("Loc->MBRDiskId: %x", file_location->mbr_disk_id); e9_printf("Loc->MBRDiskId: %x", file_location->mbr_disk_id);
e9_printf("Loc->GPTDiskUUID: %x-%x-%x-%x", e9_printf("Loc->GPTDiskUUID: %x-%x-%x-%x",
file_location->gpt_disk_uuid.a, file_location->gpt_disk_uuid.a,