mirror of
https://codeberg.org/Limine/Limine
synced 2026-01-26 13:14:28 +00:00
protos/limine: Specify and implement executable command line feature
This commit is contained in:
parent
278881c72f
commit
99738edd07
31
PROTOCOL.md
31
PROTOCOL.md
@ -455,6 +455,34 @@ struct limine_bootloader_info_response {
|
||||
`name` and `version` are 0-terminated ASCII strings containing the name and
|
||||
version of the loading bootloader.
|
||||
|
||||
### Executable Command Line Feature
|
||||
|
||||
ID:
|
||||
```c
|
||||
#define LIMINE_EXECUTABLE_CMDLINE_REQUEST { LIMINE_COMMON_MAGIC, 0x4b161536e598651e, 0xb390ad4a2f1f303a }
|
||||
```
|
||||
|
||||
Request:
|
||||
```c
|
||||
struct limine_executable_cmdline_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
struct limine_executable_cmdline_response *response;
|
||||
};
|
||||
```
|
||||
|
||||
Response:
|
||||
```c
|
||||
struct limine_executable_cmdline_response {
|
||||
uint64_t revision;
|
||||
char *cmdline;
|
||||
};
|
||||
```
|
||||
|
||||
`cmdline` is a 0-terminated ASCII string containing the command line associated with the
|
||||
booted executable. This is equivalent to the `string` member of the `executable_file` structure of the
|
||||
Executable File feature.
|
||||
|
||||
### Firmware Type Feature
|
||||
|
||||
ID:
|
||||
@ -1032,7 +1060,8 @@ struct limine_executable_file_response {
|
||||
```
|
||||
|
||||
* `executable_file` - Pointer to the `struct limine_file` structure (see below)
|
||||
for the executable file.
|
||||
for the executable file. The `string` member is equivalent to the `cmdline` value as reported by
|
||||
the Executable Command Line feature.
|
||||
|
||||
### Module Feature
|
||||
|
||||
|
||||
@ -908,6 +908,21 @@ FEAT_START
|
||||
bootloader_info_request->response = reported_addr(bootloader_info_response);
|
||||
FEAT_END
|
||||
|
||||
// Executable Command Line feature
|
||||
FEAT_START
|
||||
struct limine_executable_cmdline_request *executable_cmdline_request = get_request(LIMINE_EXECUTABLE_CMDLINE_REQUEST);
|
||||
if (executable_cmdline_request == NULL) {
|
||||
break; // next feature
|
||||
}
|
||||
|
||||
struct limine_executable_cmdline_response *executable_cmdline_response =
|
||||
ext_mem_alloc(sizeof(struct limine_executable_cmdline_response));
|
||||
|
||||
executable_cmdline_response->cmdline = reported_addr(cmdline);
|
||||
|
||||
executable_cmdline_request->response = reported_addr(executable_cmdline_response);
|
||||
FEAT_END
|
||||
|
||||
// Firmware type feature
|
||||
FEAT_START
|
||||
struct limine_firmware_type_request *firmware_type_request = get_request(LIMINE_FIRMWARE_TYPE_REQUEST);
|
||||
|
||||
15
limine.h
15
limine.h
@ -118,6 +118,21 @@ struct limine_bootloader_info_request {
|
||||
LIMINE_PTR(struct limine_bootloader_info_response *) response;
|
||||
};
|
||||
|
||||
/* Executable command line */
|
||||
|
||||
#define LIMINE_EXECUTABLE_CMDLINE_REQUEST { LIMINE_COMMON_MAGIC, 0x4b161536e598651e, 0xb390ad4a2f1f303a }
|
||||
|
||||
struct limine_executable_cmdline_response {
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(char *) cmdline;
|
||||
};
|
||||
|
||||
struct limine_executable_cmdline_request {
|
||||
uint64_t id[4];
|
||||
uint64_t revision;
|
||||
LIMINE_PTR(struct limine_executable_cmdline_response *) response;
|
||||
};
|
||||
|
||||
/* Firmware type */
|
||||
|
||||
#define LIMINE_FIRMWARE_TYPE_REQUEST { LIMINE_COMMON_MAGIC, 0x8c2f75d90bef28a8, 0x7045a4688eac00c3 }
|
||||
|
||||
@ -34,6 +34,12 @@ static volatile struct limine_bootloader_info_request bootloader_info_request =
|
||||
.revision = 0, .response = NULL
|
||||
};
|
||||
|
||||
__attribute__((section(".limine_requests")))
|
||||
static volatile struct limine_executable_cmdline_request executable_cmdline_request = {
|
||||
.id = LIMINE_EXECUTABLE_CMDLINE_REQUEST,
|
||||
.revision = 0, .response = NULL
|
||||
};
|
||||
|
||||
__attribute__((section(".limine_requests")))
|
||||
static volatile struct limine_firmware_type_request firmware_type_request = {
|
||||
.id = LIMINE_FIRMWARE_TYPE_REQUEST,
|
||||
@ -307,6 +313,17 @@ FEAT_START
|
||||
e9_printf("Bootloader version: %s", bootloader_info_response->version);
|
||||
FEAT_END
|
||||
|
||||
FEAT_START
|
||||
e9_printf("");
|
||||
if (executable_cmdline_request.response == NULL) {
|
||||
e9_printf("Executable command line not passed");
|
||||
break;
|
||||
}
|
||||
struct limine_executable_cmdline_response *executable_cmdline_response = executable_cmdline_request.response;
|
||||
e9_printf("Executable command line feature, revision %d", executable_cmdline_response->revision);
|
||||
e9_printf("Command line: %s", executable_cmdline_response->cmdline);
|
||||
FEAT_END
|
||||
|
||||
FEAT_START
|
||||
e9_printf("");
|
||||
if (firmware_type_request.response == NULL) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user