mirror of
https://github.com/limine-bootloader/limine
synced 2025-02-18 01:54:22 +03:00
misc: Rename UEFI and BIOS define macros
This commit is contained in:
parent
1d325927d7
commit
c44f514738
@ -63,8 +63,7 @@ ifeq ($(TARGET),bios)
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-mno-80387 \
|
||||
-Dbios=1 \
|
||||
-Duefi=0
|
||||
-DBIOS
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),uefi-x86-64)
|
||||
@ -79,8 +78,7 @@ ifeq ($(TARGET),uefi-x86-64)
|
||||
-mno-sse \
|
||||
-mno-sse2 \
|
||||
-mno-red-zone \
|
||||
-Dbios=0 \
|
||||
-Duefi=1 \
|
||||
-DUEFI \
|
||||
-DGNU_EFI_USE_MS_ABI \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/x86_64'
|
||||
@ -94,8 +92,7 @@ ifeq ($(TARGET),uefi-ia32)
|
||||
-mtune=generic \
|
||||
-mabi=sysv \
|
||||
-mno-80387 \
|
||||
-Dbios=0 \
|
||||
-Duefi=1 \
|
||||
-DUEFI \
|
||||
-DGNU_EFI_USE_MS_ABI \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/ia32'
|
||||
@ -106,8 +103,7 @@ ifeq ($(TARGET),uefi-aarch64)
|
||||
-fpie \
|
||||
-mtune=generic \
|
||||
-mgeneral-regs-only \
|
||||
-Dbios=0 \
|
||||
-Duefi=1 \
|
||||
-DUEFI \
|
||||
-DGNU_EFI_USE_MS_ABI \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc' \
|
||||
-I'$(call SHESCAPE,$(BUILDDIR))/limine-efi/inc/aarch64'
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <lib/part.h>
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
|
||||
#include <efi.h>
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include <stdalign.h>
|
||||
#include <drivers/disk.h>
|
||||
#include <lib/libc.h>
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
# include <lib/real.h>
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
#include <lib/misc.h>
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
#define MAX_VOLUMES 64
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
struct bios_drive_params {
|
||||
uint16_t buf_size;
|
||||
@ -263,7 +263,7 @@ void disk_create_index(void) {
|
||||
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
|
||||
int disk_read_sectors(struct volume *volume, void *buf, uint64_t block, size_t count) {
|
||||
EFI_STATUS status;
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <lib/libc.h>
|
||||
#include <lib/print.h>
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
#include <lib/real.h>
|
||||
|
||||
@ -45,7 +45,7 @@ success:
|
||||
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
|
||||
#include <efi.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef __DRIVERS__GOP_H__
|
||||
#define __DRIVERS__GOP_H__
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
void serial_out(uint8_t b);
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
int serial_in(void);
|
||||
#endif
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
#include <drivers/serial.h>
|
||||
#include <sys/cpu.h>
|
||||
#include <lib/misc.h>
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
|
||||
static bool serial_initialised = false;
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
static EFI_SERIAL_IO_PROTOCOL *serial_protocol;
|
||||
#endif
|
||||
|
||||
@ -19,7 +19,7 @@ static void serial_initialise(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
EFI_STATUS status;
|
||||
|
||||
EFI_GUID serial_guid = EFI_SERIAL_IO_PROTOCOL_GUID;
|
||||
@ -32,7 +32,7 @@ static void serial_initialise(void) {
|
||||
serial_protocol->Reset(serial_protocol);
|
||||
#endif
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
// Init com1
|
||||
outb(0x3f8 + 3, 0x00);
|
||||
outb(0x3f8 + 1, 0x00);
|
||||
@ -48,7 +48,7 @@ static void serial_initialise(void) {
|
||||
}
|
||||
|
||||
void serial_out(uint8_t b) {
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
if (efi_boot_services_exited) {
|
||||
return;
|
||||
}
|
||||
@ -56,16 +56,16 @@ void serial_out(uint8_t b) {
|
||||
|
||||
serial_initialise();
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
UINTN bsize = 1;
|
||||
serial_protocol->Write(serial_protocol, &bsize, &b);
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
while ((inb(0x3f8 + 5) & 0x20) == 0);
|
||||
outb(0x3f8, b);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
int serial_in(void) {
|
||||
serial_initialise();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
struct volume *boot_volume;
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
bool stage3_loaded = false;
|
||||
static bool stage3_found = false;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
void stage3_common(void);
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
extern symbol __image_base;
|
||||
|
||||
noreturn void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
|
||||
|
@ -540,7 +540,7 @@ struct file_handle *ext2_open(struct volume *part, const char *path) {
|
||||
handle->close = (void *)ext2_close;
|
||||
handle->size = ret->size;
|
||||
handle->vol = part;
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
handle->efi_part_handle = part->efi_part_handle;
|
||||
#endif
|
||||
|
||||
|
@ -507,7 +507,7 @@ struct file_handle *fat32_open(struct volume *part, const char *path) {
|
||||
handle->close = (void *)fat32_close;
|
||||
handle->size = ret->size_bytes;
|
||||
handle->vol = part;
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
handle->efi_part_handle = part->efi_part_handle;
|
||||
#endif
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <lib/part.h>
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
|
||||
@ -23,7 +23,7 @@ struct file_handle {
|
||||
void (*read)(void *fd, void *buf, uint64_t loc, uint64_t count);
|
||||
void (*close)(void *fd);
|
||||
uint64_t size;
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
EFI_HANDLE efi_part_handle;
|
||||
#endif
|
||||
bool pxe;
|
||||
|
@ -49,7 +49,7 @@ struct file_handle *fopen(struct volume *part, const char *filename) {
|
||||
|
||||
struct file_handle *ret;
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
if (part->pxe) {
|
||||
if ((ret = tftp_open(0, 69, filename)) == NULL) {
|
||||
return NULL;
|
||||
|
@ -280,7 +280,7 @@ struct file_handle *iso9660_open(struct volume *vol, const char *path) {
|
||||
handle->close = (void *)iso9660_close;
|
||||
handle->size = ret->size;
|
||||
handle->vol = vol;
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
handle->efi_part_handle = vol->efi_part_handle;
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,7 @@ uint8_t acpi_checksum(void *ptr, size_t size) {
|
||||
return sum;
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
void *acpi_get_rsdp(void) {
|
||||
size_t ebda = EBDA;
|
||||
@ -78,7 +78,7 @@ void acpi_get_smbios(void **smbios32, void **smbios64) {
|
||||
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
|
||||
#include <efi.h>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#define EBDA (ebda_get())
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
static inline uintptr_t ebda_get(void) {
|
||||
uintptr_t ebda = (uintptr_t)mminw(0x40e) << 4;
|
||||
|
||||
|
@ -41,7 +41,7 @@ int init_config_disk(struct volume *part) {
|
||||
return init_config(config_size);
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
int init_config_pxe(void) {
|
||||
struct file_handle *f;
|
||||
if ((f = tftp_open(0, 69, "limine.cfg")) == NULL) {
|
||||
|
@ -10,9 +10,9 @@ bool fb_init(struct fb_info *ret,
|
||||
uint64_t target_width, uint64_t target_height, uint16_t target_bpp) {
|
||||
bool r;
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
r = init_vbe(ret, target_width, target_height, target_bpp);
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
r = init_gop(ret, target_width, target_height, target_bpp);
|
||||
#endif
|
||||
|
||||
|
@ -602,7 +602,7 @@ static char *last_config = NULL;
|
||||
|
||||
bool gterm_init(char *config, size_t *_rows, size_t *_cols, size_t width, size_t height) {
|
||||
if (current_video_mode >= 0
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
&& current_video_mode != 0x03
|
||||
#endif
|
||||
&& fbinfo.default_res == true
|
||||
@ -619,7 +619,7 @@ bool gterm_init(char *config, size_t *_rows, size_t *_cols, size_t width, size_t
|
||||
}
|
||||
|
||||
if (current_video_mode >= 0
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
&& current_video_mode != 0x03
|
||||
#endif
|
||||
&& fbinfo.framebuffer_width == width
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <fs/file.h>
|
||||
#include <mm/pmm.h>
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
EFI_SYSTEM_TABLE *gST;
|
||||
EFI_BOOT_SERVICES *gBS;
|
||||
EFI_RUNTIME_SERVICES *gRT;
|
||||
@ -166,7 +166,7 @@ uint32_t hex2bin(uint8_t *str, uint32_t size) {
|
||||
return value;
|
||||
}
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
|
||||
no_unwind bool efi_boot_services_exited = false;
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include <fs/file.h>
|
||||
#include <lib/part.h>
|
||||
#include <lib/libc.h>
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
extern EFI_SYSTEM_TABLE *gST;
|
||||
extern EFI_BOOT_SERVICES *gBS;
|
||||
extern EFI_RUNTIME_SERVICES *gRT;
|
||||
@ -29,7 +29,7 @@ extern const char bsd_2_clause[];
|
||||
|
||||
extern struct volume *boot_volume;
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
extern bool stage3_loaded;
|
||||
#endif
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <lib/print.h>
|
||||
#include <lib/real.h>
|
||||
#include <lib/trace.h>
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
#include <lib/misc.h>
|
||||
@ -30,7 +30,7 @@ noreturn void panic(bool allow_menu, const char *fmt, ...) {
|
||||
is_nested = true;
|
||||
|
||||
if (
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
stage3_loaded == true &&
|
||||
#endif
|
||||
term_backend == NOT_READY) {
|
||||
@ -43,11 +43,11 @@ nested:
|
||||
term_fallback();
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
if (stage3_loaded) {
|
||||
#endif
|
||||
print("\033[31mPANIC\033[37;1m\033[0m: ");
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
} else {
|
||||
print("PANIC: ");
|
||||
}
|
||||
@ -60,7 +60,7 @@ nested:
|
||||
print_stacktrace(NULL);
|
||||
|
||||
if (
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
stage3_loaded == true &&
|
||||
#endif
|
||||
allow_menu == true) {
|
||||
@ -77,10 +77,10 @@ nested:
|
||||
gBS->Exit(efi_image_handle, EFI_ABORTED, 0, NULL);
|
||||
*/
|
||||
} else {
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
print("Press CTRL+ALT+DEL to reboot.");
|
||||
rm_hcf();
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
print("System halted.");
|
||||
for (;;) {
|
||||
#if defined (__x86_64__) || defined (__i386__)
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <lib/guid.h>
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#define END_OF_TABLE (-3)
|
||||
|
||||
struct volume {
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
EFI_HANDLE efi_handle;
|
||||
EFI_HANDLE efi_part_handle;
|
||||
EFI_BLOCK_IO *block_io;
|
||||
@ -22,7 +22,7 @@ struct volume {
|
||||
bool unique_sector_valid;
|
||||
uint64_t unique_sector;
|
||||
uint32_t unique_sector_crc32;
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
int drive;
|
||||
#endif
|
||||
|
||||
@ -68,7 +68,7 @@ int part_get(struct volume *part, struct volume *volume, int partition);
|
||||
struct volume *volume_get_by_guid(struct guid *guid);
|
||||
struct volume *volume_get_by_fslabel(char *fslabel);
|
||||
struct volume *volume_get_by_coord(bool optical, int drive, int partition);
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
struct volume *volume_get_by_bios_drive(int drive);
|
||||
#endif
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <stdint.h>
|
||||
#include <lib/part.h>
|
||||
#include <drivers/disk.h>
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
# include <lib/real.h>
|
||||
#endif
|
||||
#include <lib/libc.h>
|
||||
@ -198,10 +198,10 @@ static int gpt_get_part(struct volume *ret, struct volume *volume, int partition
|
||||
if (!memcmp(&entry.unique_partition_guid, &empty_guid, sizeof(struct guid)))
|
||||
return NO_PARTITION;
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
ret->efi_handle = volume->efi_handle;
|
||||
ret->block_io = volume->block_io;
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
ret->drive = volume->drive;
|
||||
#endif
|
||||
ret->fastest_xfer_size = volume->fastest_xfer_size;
|
||||
@ -320,10 +320,10 @@ static int mbr_get_logical_part(struct volume *ret, struct volume *extended_part
|
||||
if (entry.type == 0)
|
||||
return NO_PARTITION;
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
ret->efi_handle = extended_part->efi_handle;
|
||||
ret->block_io = extended_part->block_io;
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
ret->drive = extended_part->drive;
|
||||
#endif
|
||||
ret->fastest_xfer_size = extended_part->fastest_xfer_size;
|
||||
@ -374,10 +374,10 @@ static int mbr_get_part(struct volume *ret, struct volume *volume, int partition
|
||||
|
||||
struct volume extended_part = {0};
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
extended_part.efi_handle = volume->efi_handle;
|
||||
extended_part.block_io = volume->block_io;
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
extended_part.drive = volume->drive;
|
||||
#endif
|
||||
extended_part.fastest_xfer_size = volume->fastest_xfer_size;
|
||||
@ -402,10 +402,10 @@ static int mbr_get_part(struct volume *ret, struct volume *volume, int partition
|
||||
if (entry.type == 0)
|
||||
return NO_PARTITION;
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
ret->efi_handle = volume->efi_handle;
|
||||
ret->block_io = volume->block_io;
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
ret->drive = volume->drive;
|
||||
#endif
|
||||
ret->fastest_xfer_size = volume->fastest_xfer_size;
|
||||
@ -493,7 +493,7 @@ struct volume *volume_get_by_coord(bool optical, int drive, int partition) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
struct volume *volume_get_by_bios_drive(int drive) {
|
||||
for (size_t i = 0; i < volume_index_i; i++) {
|
||||
if (volume_index[i]->drive == drive) {
|
||||
|
@ -5,13 +5,13 @@
|
||||
#include <lib/misc.h>
|
||||
#include <lib/term.h>
|
||||
#include <lib/libc.h>
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
#include <lib/real.h>
|
||||
#endif
|
||||
#include <sys/cpu.h>
|
||||
#include <drivers/serial.h>
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
static void s2_print(const char *s, size_t len) {
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
struct rm_regs r = {0};
|
||||
@ -199,11 +199,11 @@ void vprint(const char *fmt, va_list args) {
|
||||
}
|
||||
|
||||
out:
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
if (stage3_loaded) {
|
||||
#endif
|
||||
term_write((uint64_t)(uintptr_t)print_buf, print_buf_i);
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
} else {
|
||||
s2_print(print_buf, print_buf_i);
|
||||
}
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include <lib/misc.h>
|
||||
#include <lib/term.h>
|
||||
#include <lib/print.h>
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
# include <lib/real.h>
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
#include <drivers/serial.h>
|
||||
@ -24,7 +24,7 @@ int getchar(void) {
|
||||
|
||||
int getchar_internal(uint8_t scancode, uint8_t ascii, uint32_t shift_state) {
|
||||
switch (scancode) {
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
case 0x44:
|
||||
return GETCHAR_F10;
|
||||
case 0x4b:
|
||||
@ -47,7 +47,7 @@ int getchar_internal(uint8_t scancode, uint8_t ascii, uint32_t shift_state) {
|
||||
return GETCHAR_PGDOWN;
|
||||
case 0x01:
|
||||
return GETCHAR_ESCAPE;
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
case SCAN_F10:
|
||||
return GETCHAR_F10;
|
||||
case SCAN_LEFT:
|
||||
@ -98,7 +98,7 @@ int getchar_internal(uint8_t scancode, uint8_t ascii, uint32_t shift_state) {
|
||||
return ascii;
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
int _pit_sleep_and_quit_on_keypress(uint32_t ticks);
|
||||
|
||||
static int input_sequence(void) {
|
||||
@ -194,7 +194,7 @@ again:
|
||||
}
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
static int input_sequence(bool ext,
|
||||
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *exproto,
|
||||
EFI_SIMPLE_TEXT_IN_PROTOCOL *sproto) {
|
||||
|
@ -15,10 +15,10 @@
|
||||
#define GETCHAR_F10 (-19)
|
||||
#define GETCHAR_ESCAPE (-20)
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
# define GETCHAR_RCTRL 0x4
|
||||
# define GETCHAR_LCTRL GETCHAR_RCTRL
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
# define GETCHAR_RCTRL EFI_RIGHT_CONTROL_PRESSED
|
||||
# define GETCHAR_LCTRL EFI_LEFT_CONTROL_PRESSED
|
||||
#endif
|
||||
|
@ -32,7 +32,7 @@ void term_vbe(char *config, size_t width, size_t height) {
|
||||
}
|
||||
|
||||
if (!gterm_init(config, &term_rows, &term_cols, width, height)) {
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
// Failed to set VBE properly, default to text mode
|
||||
term_textmode();
|
||||
#endif
|
||||
@ -138,7 +138,7 @@ void term_reinit(void) {
|
||||
term_autoflush = true;
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
void term_textmode(void) {
|
||||
term_deinit();
|
||||
|
||||
|
@ -42,7 +42,7 @@ void (*term_full_refresh)(void);
|
||||
|
||||
// --- fallback ---
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
static void fallback_raw_putchar(uint8_t c) {
|
||||
struct rm_regs r = {0};
|
||||
r.eax = 0x0e00 | c;
|
||||
@ -87,7 +87,7 @@ static void fallback_get_cursor_pos(size_t *x, size_t *y) {
|
||||
*y = r.edx >> 8;
|
||||
}
|
||||
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
static int cursor_x = 0, cursor_y = 0;
|
||||
|
||||
static void fallback_raw_putchar(uint8_t c) {
|
||||
@ -137,12 +137,12 @@ static void fallback_get_cursor_pos(size_t *x, size_t *y) {
|
||||
#endif
|
||||
|
||||
void term_fallback(void) {
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
if (!efi_boot_services_exited) {
|
||||
gST->ConOut->Reset(gST->ConOut, false);
|
||||
gST->ConOut->SetMode(gST->ConOut, 0);
|
||||
cursor_x = cursor_y = 0;
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
fallback_clear(true);
|
||||
#endif
|
||||
term_notready();
|
||||
@ -151,7 +151,7 @@ void term_fallback(void) {
|
||||
set_cursor_pos = fallback_set_cursor_pos;
|
||||
get_cursor_pos = fallback_get_cursor_pos;
|
||||
term_backend = FALLBACK;
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <lib/time.h>
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
# include <lib/real.h>
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
#include <lib/misc.h>
|
||||
@ -26,7 +26,7 @@ static uint64_t get_unix_epoch(uint8_t seconds, uint8_t minutes, uint8_t hours,
|
||||
return (jdn_diff * (60 * 60 * 24)) + hours * 3600 + minutes * 60 + seconds;
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
uint64_t time(void) {
|
||||
struct rm_regs r;
|
||||
|
||||
@ -60,7 +60,7 @@ again:
|
||||
}
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
uint64_t time(void) {
|
||||
EFI_TIME time;
|
||||
gRT->GetTime(&time, NULL);
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include <fs/file.h>
|
||||
#include <mm/pmm.h>
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
extern symbol stage2_map;
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
extern symbol __image_base;
|
||||
#endif
|
||||
|
||||
@ -19,12 +19,12 @@ extern symbol full_map;
|
||||
static char *trace_address(size_t *off, size_t addr) {
|
||||
char *limine_map;
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
if (!stage3_loaded)
|
||||
limine_map = stage2_map;
|
||||
else
|
||||
limine_map = full_map;
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
limine_map = full_map;
|
||||
|
||||
addr -= (size_t)__image_base;
|
||||
|
@ -141,7 +141,7 @@ static struct file_handle *uri_fslabel_dispatch(char *fslabel, char *path) {
|
||||
return fopen(volume, path);
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
static struct file_handle *uri_tftp_dispatch(char *root, char *path) {
|
||||
uint32_t ip;
|
||||
if (!strcmp(root, "")) {
|
||||
@ -162,7 +162,7 @@ static struct file_handle *uri_tftp_dispatch(char *root, char *path) {
|
||||
#endif
|
||||
|
||||
static struct file_handle *uri_boot_dispatch(char *s_part, char *path) {
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
if (boot_volume->pxe)
|
||||
return uri_tftp_dispatch(s_part, path);
|
||||
#endif
|
||||
@ -217,7 +217,7 @@ struct file_handle *uri_open(char *uri) {
|
||||
ret = uri_guid_dispatch(root, path);
|
||||
} else if (!strcmp(resource, "fslabel")) {
|
||||
ret = uri_fslabel_dispatch(root, path);
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
} else if (!strcmp(resource, "tftp")) {
|
||||
ret = uri_tftp_dispatch(root, path);
|
||||
#endif
|
||||
|
@ -537,40 +537,40 @@ static size_t print_tree(const char *shift, size_t level, size_t base_index, siz
|
||||
static struct memmap_entry *rewound_memmap = NULL;
|
||||
static size_t rewound_memmap_entries = 0;
|
||||
static uint8_t *rewound_data;
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
static uint8_t *rewound_s2_data;
|
||||
#endif
|
||||
|
||||
extern symbol data_begin;
|
||||
extern symbol data_end;
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
extern symbol s2_data_begin;
|
||||
extern symbol s2_data_end;
|
||||
#endif
|
||||
|
||||
noreturn void _menu(bool timeout_enabled) {
|
||||
size_t data_size = (uintptr_t)data_end - (uintptr_t)data_begin;
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
size_t s2_data_size = (uintptr_t)s2_data_end - (uintptr_t)s2_data_begin;
|
||||
#endif
|
||||
|
||||
if (rewound_memmap != NULL) {
|
||||
memcpy(data_begin, rewound_data, data_size);
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
memcpy(s2_data_begin, rewound_s2_data, s2_data_size);
|
||||
#endif
|
||||
memcpy(memmap, rewound_memmap, rewound_memmap_entries * sizeof(struct memmap_entry));
|
||||
memmap_entries = rewound_memmap_entries;
|
||||
} else {
|
||||
rewound_data = ext_mem_alloc(data_size);
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
rewound_s2_data = ext_mem_alloc(s2_data_size);
|
||||
#endif
|
||||
rewound_memmap = ext_mem_alloc(256 * sizeof(struct memmap_entry));
|
||||
memcpy(rewound_memmap, memmap, memmap_entries * sizeof(struct memmap_entry));
|
||||
rewound_memmap_entries = memmap_entries;
|
||||
memcpy(rewound_data, data_begin, data_size);
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
memcpy(rewound_s2_data, s2_data_begin, s2_data_size);
|
||||
#endif
|
||||
}
|
||||
@ -655,9 +655,9 @@ noreturn void _menu(bool timeout_enabled) {
|
||||
}
|
||||
|
||||
// If there is GRAPHICS config key and the value is "yes", enable graphics
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
char *graphics = config_get_value(NULL, 0, "GRAPHICS");
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
char *graphics = "yes";
|
||||
#endif
|
||||
|
||||
@ -671,7 +671,7 @@ reterm:
|
||||
|
||||
term_vbe(NULL, req_width, req_height);
|
||||
} else {
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
term_textmode();
|
||||
#endif
|
||||
}
|
||||
@ -825,7 +825,7 @@ timeout_aborted:
|
||||
}
|
||||
if (term_backend == NOT_READY) {
|
||||
term_vbe(NULL, 0, 0);
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
if (term_backend == NOT_READY) {
|
||||
term_textmode();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ void pmm_randomise_memory(void) {
|
||||
if (memmap[i].type != MEMMAP_USABLE)
|
||||
continue;
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
// We're not going to randomise memory above 4GiB from protected mode,
|
||||
// are we?
|
||||
if (memmap[i].base >= 0x100000000) {
|
||||
|
@ -29,12 +29,12 @@ struct meminfo {
|
||||
|
||||
struct meminfo mmap_get_info(size_t mmap_count, struct memmap_entry *mmap);
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
extern struct memmap_entry memmap[];
|
||||
extern size_t memmap_entries;
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
extern struct memmap_entry *memmap;
|
||||
extern size_t memmap_entries;
|
||||
#endif
|
||||
@ -58,7 +58,7 @@ void *conv_mem_alloc(size_t count);
|
||||
|
||||
void pmm_free(void *ptr, size_t length);
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
void pmm_release_uefi_mem(void);
|
||||
#endif
|
||||
|
||||
|
@ -7,13 +7,13 @@
|
||||
#include <lib/misc.h>
|
||||
#include <lib/libc.h>
|
||||
#include <lib/print.h>
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
extern symbol bss_end;
|
||||
#endif
|
||||
|
||||
@ -47,14 +47,14 @@ void *conv_mem_alloc(size_t count) {
|
||||
}
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
#define memmap_max_entries ((size_t)512)
|
||||
|
||||
struct memmap_entry memmap[memmap_max_entries];
|
||||
size_t memmap_entries = 0;
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
static size_t memmap_max_entries;
|
||||
|
||||
struct memmap_entry *memmap;
|
||||
@ -221,12 +221,12 @@ del_mm1:
|
||||
*_count = count;
|
||||
}
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
static void pmm_reclaim_uefi_mem(struct memmap_entry *m, size_t *_count);
|
||||
#endif
|
||||
|
||||
struct memmap_entry *get_memmap(size_t *entries) {
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
pmm_reclaim_uefi_mem(memmap, &memmap_entries);
|
||||
#endif
|
||||
|
||||
@ -239,7 +239,7 @@ struct memmap_entry *get_memmap(size_t *entries) {
|
||||
return memmap;
|
||||
}
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
void init_memmap(void) {
|
||||
for (size_t i = 0; i < e820_entries; i++) {
|
||||
if (memmap_entries == memmap_max_entries) {
|
||||
@ -279,7 +279,7 @@ void init_memmap(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
extern symbol __image_base;
|
||||
extern symbol __image_end;
|
||||
|
||||
@ -515,14 +515,14 @@ void pmm_release_uefi_mem(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
struct memmap_entry *get_raw_memmap(size_t *entry_count) {
|
||||
*entry_count = e820_entries;
|
||||
return e820_map;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
struct memmap_entry *get_raw_memmap(size_t *entry_count) {
|
||||
pmm_reclaim_uefi_mem(untouched_memmap, &untouched_memmap_entries);
|
||||
*entry_count = untouched_memmap_entries;
|
||||
|
@ -14,11 +14,11 @@
|
||||
#include <sys/idt.h>
|
||||
#include <drivers/vga_textmode.h>
|
||||
#include <mm/pmm.h>
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
# include <efi.h>
|
||||
#endif
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
__attribute__((noinline, section(".realmode")))
|
||||
noreturn static void spinup(uint8_t drive) {
|
||||
@ -187,7 +187,7 @@ void bios_chainload_volume(struct volume *p) {
|
||||
spinup(p->drive);
|
||||
}
|
||||
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
|
||||
noreturn void chainload(char *config) {
|
||||
char *image_path = config_get_value(config, 0, "IMAGE_PATH");
|
||||
|
@ -5,12 +5,12 @@
|
||||
|
||||
noreturn void chainload(char *config);
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
#include <fs/file.h>
|
||||
noreturn void efi_chainload_file(char *config, struct file_handle *image);
|
||||
#endif
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
#include <lib/part.h>
|
||||
void bios_chainload_volume(struct volume *v);
|
||||
#endif
|
||||
|
@ -7,14 +7,14 @@
|
||||
#include <lib/print.h>
|
||||
#include <lib/part.h>
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
static void try(char *config, struct volume *v) {
|
||||
(void)config;
|
||||
bios_chainload_volume(v);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
static void try(char *config, struct volume *v) {
|
||||
for (int i = 0; i <= v->max_partition + 1; i++) {
|
||||
struct file_handle *image;
|
||||
|
@ -515,7 +515,7 @@ FEAT_START
|
||||
FEAT_END
|
||||
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
// EFI system table feature
|
||||
FEAT_START
|
||||
struct limine_efi_system_table_request *est_request = get_request(LIMINE_EFI_SYSTEM_TABLE_REQUEST);
|
||||
@ -539,7 +539,7 @@ FEAT_START
|
||||
break; // next feature
|
||||
}
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
struct limine_dtb_response *dtb_response =
|
||||
ext_mem_alloc(sizeof(struct limine_dtb_response));
|
||||
|
||||
@ -858,7 +858,7 @@ FEAT_END
|
||||
pagemap = build_pagemap(want_5lv, ranges, ranges_count,
|
||||
physical_base, virtual_base, direct_map_offset);
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
efi_exit_boot_services();
|
||||
#endif
|
||||
|
||||
@ -994,7 +994,7 @@ FEAT_END
|
||||
term_runtime = true;
|
||||
|
||||
#if defined (__x86_64__) || defined (__i386__)
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
// If we're going 64, we might as well call this BIOS interrupt
|
||||
// to tell the BIOS that we are entering Long Mode, since it is in
|
||||
// the specification.
|
||||
|
@ -499,7 +499,7 @@ noreturn void linux_load(char *config, char *cmdline) {
|
||||
|
||||
struct screen_info *screen_info = &boot_params->screen_info;
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
{
|
||||
char *textmode_str = config_get_value(config, 0, "TEXTMODE");
|
||||
bool textmode = textmode_str != NULL && strcmp(textmode_str, "yes") == 0;
|
||||
@ -516,13 +516,13 @@ noreturn void linux_load(char *config, char *cmdline) {
|
||||
parse_resolution(&req_width, &req_height, &req_bpp, resolution);
|
||||
|
||||
struct fb_info fbinfo;
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
gop_force_16 = true;
|
||||
#endif
|
||||
if (!fb_init(&fbinfo, req_width, req_height, req_bpp)) {
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
panic(true, "linux: Unable to set video mode");
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
set_textmode:;
|
||||
size_t rows, cols;
|
||||
init_vga_textmode(&rows, &cols, false);
|
||||
@ -556,7 +556,7 @@ set_textmode:;
|
||||
|
||||
if (fbinfo.framebuffer_addr > (uint64_t)0xffffffff) {
|
||||
screen_info->capabilities |= VIDEO_CAPABILITY_64BIT_BASE;
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
screen_info->orig_video_isVGA = VIDEO_TYPE_EFI;
|
||||
#endif
|
||||
}
|
||||
@ -577,7 +577,7 @@ set_textmode:;
|
||||
///////////////////////////////////////
|
||||
// UEFI
|
||||
///////////////////////////////////////
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
efi_exit_boot_services();
|
||||
|
||||
#if defined (__x86_64__)
|
||||
|
@ -313,9 +313,9 @@ noreturn void multiboot1_load(char *config, char *cmdline) {
|
||||
|
||||
struct fb_info fbinfo;
|
||||
if (!fb_init(&fbinfo, req_width, req_height, req_bpp)) {
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
panic(true, "multiboot1: Failed to set video mode");
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
size_t rows, cols;
|
||||
init_vga_textmode(&rows, &cols, false);
|
||||
|
||||
@ -341,7 +341,7 @@ noreturn void multiboot1_load(char *config, char *cmdline) {
|
||||
multiboot1_info->fb_blue_mask_shift = fbinfo.blue_mask_shift;
|
||||
}
|
||||
} else {
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
print("multiboot1: Warning: Cannot use text mode with UEFI\n");
|
||||
struct fb_info fbinfo;
|
||||
if (!fb_init(&fbinfo, 0, 0, 0)) {
|
||||
@ -359,7 +359,7 @@ noreturn void multiboot1_load(char *config, char *cmdline) {
|
||||
multiboot1_info->fb_green_mask_shift = fbinfo.green_mask_shift;
|
||||
multiboot1_info->fb_blue_mask_size = fbinfo.blue_mask_size;
|
||||
multiboot1_info->fb_blue_mask_shift = fbinfo.blue_mask_shift;
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
size_t rows, cols;
|
||||
init_vga_textmode(&rows, &cols, false);
|
||||
|
||||
@ -374,9 +374,9 @@ noreturn void multiboot1_load(char *config, char *cmdline) {
|
||||
|
||||
multiboot1_info->flags |= (1 << 12);
|
||||
} else {
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
panic(true, "multiboot1: Cannot use text mode with UEFI.");
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
size_t rows, cols;
|
||||
init_vga_textmode(&rows, &cols, false);
|
||||
#endif
|
||||
@ -387,7 +387,7 @@ noreturn void multiboot1_load(char *config, char *cmdline) {
|
||||
void *reloc_stub = ext_mem_alloc(reloc_stub_size);
|
||||
memcpy(reloc_stub, multiboot_reloc_stub, reloc_stub_size);
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
efi_exit_boot_services();
|
||||
#endif
|
||||
|
||||
|
@ -46,7 +46,7 @@ static size_t get_multiboot2_info_size(
|
||||
ALIGN_UP(smbios_tag_size, MULTIBOOT_TAG_ALIGN) + // SMBIOS
|
||||
ALIGN_UP(sizeof(struct multiboot_tag_basic_meminfo), MULTIBOOT_TAG_ALIGN) + // basic memory info
|
||||
ALIGN_UP(sizeof(struct multiboot_tag_mmap) + sizeof(struct multiboot_mmap_entry) * 256, MULTIBOOT_TAG_ALIGN) + // MMAP
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
ALIGN_UP(sizeof(struct multiboot_tag_efi_mmap) + (efi_desc_size * 256), MULTIBOOT_TAG_ALIGN) + // EFI MMAP
|
||||
#if defined (__i386__)
|
||||
ALIGN_UP(sizeof(struct multiboot_tag_efi32), MULTIBOOT_TAG_ALIGN) + // EFI system table 32
|
||||
@ -133,7 +133,7 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
case MULTIBOOT_TAG_TYPE_MMAP:
|
||||
case MULTIBOOT_TAG_TYPE_SMBIOS:
|
||||
case MULTIBOOT_TAG_TYPE_BASIC_MEMINFO:
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
case MULTIBOOT_TAG_TYPE_EFI_MMAP:
|
||||
#if defined (__i386__)
|
||||
case MULTIBOOT_TAG_TYPE_EFI32:
|
||||
@ -466,7 +466,7 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
//////////////////////////////////////////////
|
||||
// Create EFI image handle tag
|
||||
//////////////////////////////////////////////
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
{
|
||||
#if defined (__i386__)
|
||||
struct multiboot_tag_efi64_ih *tag = (struct multiboot_tag_efi64_ih *)(mb2_info + info_idx);
|
||||
@ -507,7 +507,7 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
|
||||
struct fb_info fbinfo;
|
||||
if (!fb_init(&fbinfo, req_width, req_height, req_bpp)) {
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
size_t rows, cols;
|
||||
init_vga_textmode(&rows, &cols, false);
|
||||
|
||||
@ -517,7 +517,7 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
tag->common.framebuffer_height = rows;
|
||||
tag->common.framebuffer_bpp = 16;
|
||||
tag->common.framebuffer_type = MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT;
|
||||
#elif uefi == 1
|
||||
#elif defined (UEFI)
|
||||
panic(true, "multiboot2: Failed to set video mode");
|
||||
#endif
|
||||
} else {
|
||||
@ -536,7 +536,7 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
tag->framebuffer_blue_mask_size = fbinfo.blue_mask_size;
|
||||
}
|
||||
} else {
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
print("multiboot2: Warning: Cannot use text mode with UEFI\n");
|
||||
struct fb_info fbinfo;
|
||||
if (!fb_init(&fbinfo, 0, 0, 0)) {
|
||||
@ -555,7 +555,7 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
tag->framebuffer_green_mask_size = fbinfo.green_mask_size;
|
||||
tag->framebuffer_blue_field_position = fbinfo.blue_mask_shift;
|
||||
tag->framebuffer_blue_mask_size = fbinfo.blue_mask_size;
|
||||
#elif bios == 1
|
||||
#elif defined (BIOS)
|
||||
size_t rows, cols;
|
||||
init_vga_textmode(&rows, &cols, false);
|
||||
|
||||
@ -653,7 +653,7 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
//////////////////////////////////////////////
|
||||
// Create EFI system table info tag
|
||||
//////////////////////////////////////////////
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
{
|
||||
#if defined (__i386__)
|
||||
uint32_t size = sizeof(struct multiboot_tag_efi32);
|
||||
@ -679,7 +679,7 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
void *reloc_stub = ext_mem_alloc(reloc_stub_size);
|
||||
memcpy(reloc_stub, multiboot_reloc_stub, reloc_stub_size);
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
efi_exit_boot_services();
|
||||
#endif
|
||||
|
||||
@ -735,7 +735,7 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||
//////////////////////////////////////////////
|
||||
// Create EFI memory map tag
|
||||
//////////////////////////////////////////////
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
{
|
||||
if ((efi_mmap_size / efi_desc_size) > 256) {
|
||||
panic(false, "multiboot2: too many EFI memory map entries");
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
#include <lib/print.h>
|
||||
#include <lib/real.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
#include <pxe/tftp.h>
|
||||
#include <pxe/pxe.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <lib/trace.h>
|
||||
#include <lib/print.h>
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
static const char *exception_names[] = {
|
||||
"Division by 0",
|
||||
|
@ -63,7 +63,7 @@ static struct gdt_desc gdt_descs[] = {
|
||||
}
|
||||
};
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
__attribute__((section(".realmode")))
|
||||
#endif
|
||||
struct gdtr gdt = {
|
||||
@ -74,7 +74,7 @@ struct gdtr gdt = {
|
||||
#endif
|
||||
};
|
||||
|
||||
#if uefi == 1
|
||||
#if defined (UEFI)
|
||||
void init_gdt(void) {
|
||||
struct gdt_desc *gdt_copy = ext_mem_alloc(sizeof(gdt_descs));
|
||||
memcpy(gdt_copy, gdt_descs, sizeof(gdt_descs));
|
||||
|
@ -37,7 +37,7 @@ struct idt_entry {
|
||||
|
||||
#endif
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
extern struct idtr idt;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <sys/idt.h>
|
||||
#include <lib/misc.h>
|
||||
|
||||
#if bios == 1
|
||||
#if defined (BIOS)
|
||||
|
||||
static struct idt_entry idt_entries[32];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user