Add support for boot command line options.

This commit is contained in:
Martin Whitaker
2021-12-23 14:08:02 +00:00
parent ad6c7d0455
commit 733919966d
5 changed files with 121 additions and 40 deletions

View File

@@ -7,7 +7,7 @@
* the Linux boot_params struct, although we only define the fields we are
* interested in.
*
* Copyright (C) 2020 Martin Whitaker.
* Copyright (C) 2020-2021 Martin Whitaker.
*/
#include <stdint.h>
@@ -94,9 +94,13 @@ typedef struct {
uint8_t e820_entries;
uint8_t unused4[0x214 - 0x1e9];
uint32_t code32_start;
uint8_t unused5[0x2d0 - 0x218];
uint8_t unused5[0x228 - 0x218];
uint32_t cmd_line_ptr;
uint8_t unused6[0x238 - 0x22c];
uint32_t cmd_line_size;
uint8_t unused7[0x2d0 - 0x23c];
e820_entry_t e820_map[E820_MAP_SIZE];
uint8_t unused6[0xeec - 0xd00];
uint8_t unused8[0xeec - 0xd00];
} __attribute__((packed)) boot_params_t;
#endif /* BOOTPARAMS_H */

View File

@@ -9,7 +9,7 @@
// boot_params struct. A pointer to this block is passed to the main program,
// for compatiblity with the Linux 32-bit boot protocol.
//
// Copyright (C) 2020 Martin Whitaker.
// Copyright (C) 2020-2021 Martin Whitaker.
//
// Derived from memtest86+ setup.S and head.S:
//
@@ -162,6 +162,13 @@ do_setup:
movl %eax, (BOOT_PARAMS_START + 0x214)
# Copy cmd_line_ptr and cmd_line_size to the boot_params struct.
movl (cmd_line_ptr - setup), %eax
movl %eax, (BOOT_PARAMS_START + 0x228)
movl (cmd_line_size - setup), %eax
movl %eax, (BOOT_PARAMS_START + 0x238)
# Switch to protected mode.
movl %cr0, %eax