misc: Implement .no_unwind section

This commit is contained in:
mintsuki 2021-12-12 18:48:36 +01:00
parent 88cd9dca7e
commit f0cda17326
12 changed files with 14 additions and 10 deletions

View File

@ -84,4 +84,6 @@ __attribute__((noreturn)) void stage3_common(void);
__attribute__((noreturn)) void common_spinup(void *fnptr, int args, ...);
#define no_unwind __attribute__((section(".no_unwind")))
#endif

View File

@ -13,9 +13,8 @@
#define SEPARATOR '\n'
extern bool *bad_config;
bool config_ready = false;
no_unwind bool bad_config = false;
static char *config_addr;
@ -80,7 +79,7 @@ static bool is_directory(char *buf, size_t limit,
case NOT_CHILD:
return false;
case INDIRECT_CHILD:
*bad_config = true;
bad_config = true;
panic(true, "config: Malformed config file. Parentless child.");
case DIRECT_CHILD:
return true;

View File

@ -6,6 +6,7 @@
#include <lib/part.h>
extern bool config_ready;
extern bool bad_config;
struct menu_entry {
char name[64];

View File

@ -41,6 +41,7 @@ SECTIONS
.stage3.data : {
*(.rodata*)
*(.full_map*)
*(.no_unwind*)
data_begin = .;
*(.data*)
limine_sys_size = . - 0x8000;

View File

@ -41,6 +41,7 @@ SECTIONS
.stage3.data : {
*(.rodata*)
*(.full_map*)
*(.no_unwind*)
data_begin = .;
*(.data*)
limine_sys_size = . - 0x8000;

View File

@ -41,6 +41,7 @@ SECTIONS
.stage3.data : {
*(.rodata*)
full_map = .;
*(.no_unwind*)
data_begin = .;
*(.data*)
limine_sys_size = . - 0x8000;

View File

@ -24,6 +24,7 @@ SECTIONS
.stage2.data : {
*.s2.o(.rodata*)
*.s2.o(.no_unwind*)
data_begin = .;
*.s2.o(.data*)
stage2_map = .;

View File

@ -38,6 +38,7 @@ SECTIONS
*(.rodata*)
*(.got.plt)
*(.got)
*(.no_unwind*)
data_begin = .;
*(.data*)
*(.sdata)

View File

@ -38,6 +38,7 @@ SECTIONS
*(.rodata*)
*(.got.plt)
*(.got)
*(.no_unwind*)
data_begin = .;
*(.data)
*(.data1)

View File

@ -38,6 +38,7 @@ SECTIONS
*(.rodata*)
*(.got.plt)
*(.got)
*(.no_unwind*)
data_begin = .;
*(.data)
*(.data1)

View File

@ -38,6 +38,7 @@ SECTIONS
*(.rodata*)
*(.got.plt)
*(.got)
*(.no_unwind*)
data_begin = .;
*(.data*)
*(.sdata)

View File

@ -583,14 +583,8 @@ static uint8_t *rewound_data;
extern symbol data_begin;
extern symbol data_end;
bool *bad_config = NULL;
__attribute__((noreturn, used))
static void _menu(bool timeout_enabled) {
if (bad_config == NULL) {
bad_config = ext_mem_alloc(1);
}
size_t data_size = (uintptr_t)data_end - (uintptr_t)data_begin;
if (rewound_memmap != NULL) {
@ -605,7 +599,7 @@ static void _menu(bool timeout_enabled) {
memcpy(rewound_data, data_begin, data_size);
}
if (*bad_config == false) {
if (bad_config == false) {
volume_iterate_parts(boot_volume,
if (!init_config_disk(_PART)) {
boot_volume = _PART;