protos/limine: Specify and implement executable command line feature
diff --git a/PROTOCOL.md b/PROTOCOL.md
index 6993889f..8b55099e 100644
--- a/PROTOCOL.md
+++ b/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
diff --git a/common/protos/limine.c b/common/protos/limine.c
index 706dd7d4..99942d98 100644
--- a/common/protos/limine.c
+++ b/common/protos/limine.c
@@ -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);
diff --git a/limine.h b/limine.h
index bfcb1855..6de7dcd3 100644
--- a/limine.h
+++ b/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 }
diff --git a/test/limine.c b/test/limine.c
index 4d46aa79..f3026edf 100644
--- a/test/limine.c
+++ b/test/limine.c
@@ -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) {
