limine: Add cmdline request

This commit is contained in:
mintsuki 2022-03-15 02:46:39 +01:00
parent fd2b3d696d
commit c180b59f96
3 changed files with 45 additions and 0 deletions

View File

@ -26,6 +26,21 @@ struct limine_boot_info_request {
LIMINE_PTR(struct limine_boot_info_response *) response;
};
// Command line
#define LIMINE_CMDLINE_REQUEST { LIMINE_COMMON_MAGIC, 0x859894000fc0b7d3, 0xaab4ab57e5c3e348 }
struct limine_cmdline_response {
uint64_t flags;
LIMINE_PTR(char *) cmdline;
};
struct limine_cmdline_request {
uint64_t id[4];
uint64_t flags;
LIMINE_PTR(struct limine_cmdline_response *) response;
};
// Framebuffer
#define LIMINE_FRAMEBUFFER_REQUEST { LIMINE_COMMON_MAGIC, 0xcbfe81d7dd2d1977, 0x063150319ebc9b71 }

View File

@ -214,6 +214,21 @@ FEAT_START
boot_info_request->response = reported_addr(boot_info_response);
FEAT_END
// Command line
FEAT_START
struct limine_cmdline_request *cmdline_request = get_request(LIMINE_CMDLINE_REQUEST);
if (cmdline_request == NULL) {
break; // next feature
}
struct limine_cmdline_response *cmdline_response =
ext_mem_alloc(sizeof(struct limine_cmdline_response));
cmdline_response->cmdline = reported_addr(cmdline);
cmdline_request->response = reported_addr(cmdline_response);
FEAT_END
// Framebuffer feature
FEAT_START
term_deinit();

View File

@ -19,6 +19,12 @@ static struct limine_entry_point_request entry_point_request = {
.entry = limine_main
};
__attribute__((used))
static struct limine_cmdline_request cmdline_request = {
.id = LIMINE_CMDLINE_REQUEST,
.flags = 0, .response = NULL
};
__attribute__((used))
static struct limine_boot_info_request boot_info_request = {
.id = LIMINE_BOOT_INFO_REQUEST,
@ -70,6 +76,15 @@ FEAT_START
e9_printf("Bootloader name: %s", boot_info_response->loader);
FEAT_END
FEAT_START
if (cmdline_request.response == NULL) {
e9_printf("Command line not passed");
break;
}
struct limine_cmdline_response *cmdline_response = cmdline_request.response;
e9_printf("Command line: %s", cmdline_response->cmdline);
FEAT_END
FEAT_START
if (memmap_request.response == NULL) {
e9_printf("Memory map not passed");