mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-24 14:56:49 +03:00
misc: Move to standard C11 noreturn
This commit is contained in:
parent
97eaf2777d
commit
3402b22cb6
@ -1,9 +1,9 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <tinf.h>
|
||||
|
||||
__attribute__((noreturn))
|
||||
void entry(uint8_t *compressed_stage2, size_t stage2_size, uint8_t boot_drive, int pxe) {
|
||||
noreturn void entry(uint8_t *compressed_stage2, size_t stage2_size, uint8_t boot_drive, int pxe) {
|
||||
// The decompressor should decompress compressed_stage2 to address 0x8000.
|
||||
uint8_t *dest = (uint8_t *)0x8000;
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <lib/term.h>
|
||||
#include <lib/real.h>
|
||||
#include <lib/blib.h>
|
||||
@ -73,8 +77,7 @@ enum {
|
||||
BOOTED_FROM_CD
|
||||
};
|
||||
|
||||
__attribute__((noreturn))
|
||||
void entry(uint8_t boot_drive, int boot_from) {
|
||||
noreturn void entry(uint8_t boot_drive, int boot_from) {
|
||||
// XXX DO NOT MOVE A20 ENABLE CALL
|
||||
if (!a20_enable())
|
||||
panic(false, "Could not enable A20 line");
|
||||
|
@ -1,3 +1,6 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <lib/term.h>
|
||||
#include <lib/real.h>
|
||||
#include <lib/blib.h>
|
||||
@ -43,8 +46,7 @@ EFI_STATUS efi_main(
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((noreturn))
|
||||
void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
|
||||
noreturn void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
|
||||
gST = SystemTable;
|
||||
gBS = SystemTable->BootServices;
|
||||
gRT = SystemTable->RuntimeServices;
|
||||
@ -124,8 +126,7 @@ void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__((noreturn))
|
||||
void stage3_common(void) {
|
||||
noreturn void stage3_common(void) {
|
||||
init_flush_irqs();
|
||||
init_io_apics();
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <fs/file.h>
|
||||
#include <lib/part.h>
|
||||
#include <lib/libc.h>
|
||||
@ -48,7 +49,7 @@ int digit_to_int(char c);
|
||||
uint8_t bcd_to_int(uint8_t val);
|
||||
uint8_t int_to_bcd(uint8_t val);
|
||||
|
||||
__attribute__((noreturn)) void panic(bool allow_menu, const char *fmt, ...);
|
||||
noreturn void panic(bool allow_menu, const char *fmt, ...);
|
||||
|
||||
int pit_sleep_and_quit_on_keypress(int seconds);
|
||||
|
||||
@ -80,9 +81,9 @@ void memcpy32to64(uint64_t, uint64_t, uint64_t);
|
||||
|
||||
typedef char symbol[];
|
||||
|
||||
__attribute__((noreturn)) void stage3_common(void);
|
||||
noreturn void stage3_common(void);
|
||||
|
||||
__attribute__((noreturn)) void common_spinup(void *fnptr, int args, ...);
|
||||
noreturn void common_spinup(void *fnptr, int args, ...);
|
||||
|
||||
#define no_unwind __attribute__((section(".no_unwind")))
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <lib/print.h>
|
||||
#include <lib/real.h>
|
||||
#include <lib/trace.h>
|
||||
@ -107,7 +108,7 @@ void fallback_get_cursor_pos(size_t *x, size_t *y) {
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__((noreturn)) void panic(bool allow_menu, const char *fmt, ...) {
|
||||
noreturn void panic(bool allow_menu, const char *fmt, ...) {
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define __LIB__REAL_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdnoreturn.h>
|
||||
|
||||
#define rm_seg(x) ((uint16_t)(((int)x & 0xffff0) >> 4))
|
||||
#define rm_off(x) ((uint16_t)(((int)x & 0x0000f) >> 0))
|
||||
@ -28,6 +29,6 @@ struct rm_regs {
|
||||
|
||||
void rm_int(uint8_t int_no, struct rm_regs *out_regs, struct rm_regs *in_regs);
|
||||
|
||||
__attribute__((noreturn)) void rm_hcf(void);
|
||||
noreturn void rm_hcf(void);
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <menu.h>
|
||||
#include <lib/print.h>
|
||||
#include <lib/blib.h>
|
||||
@ -537,8 +538,8 @@ __attribute__((used))
|
||||
static uintptr_t stack_at_first_entry = 0;
|
||||
#endif
|
||||
|
||||
__attribute__((noreturn, naked))
|
||||
void menu(__attribute__((unused)) bool timeout_enabled) {
|
||||
__attribute__((naked))
|
||||
noreturn void menu(__attribute__((unused)) bool timeout_enabled) {
|
||||
#if defined (__i386__)
|
||||
asm volatile (
|
||||
"pop %eax\n\t"
|
||||
@ -592,8 +593,8 @@ extern symbol s2_data_begin;
|
||||
extern symbol s2_data_end;
|
||||
#endif
|
||||
|
||||
__attribute__((noreturn, used))
|
||||
static void _menu(bool timeout_enabled) {
|
||||
__attribute__((used))
|
||||
static noreturn void _menu(bool timeout_enabled) {
|
||||
size_t data_size = (uintptr_t)data_end - (uintptr_t)data_begin;
|
||||
#if bios == 1
|
||||
size_t s2_data_size = (uintptr_t)s2_data_end - (uintptr_t)s2_data_begin;
|
||||
@ -867,8 +868,7 @@ timeout_aborted:
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((noreturn))
|
||||
void boot(char *config) {
|
||||
noreturn void boot(char *config) {
|
||||
char *cmdline = config_get_value(config, 0, "KERNEL_CMDLINE");
|
||||
if (!cmdline) {
|
||||
cmdline = config_get_value(config, 0, "CMDLINE");
|
||||
|
@ -2,12 +2,11 @@
|
||||
#define __MENU_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
|
||||
__attribute__((noreturn))
|
||||
void menu(bool timeout_enabled);
|
||||
noreturn void menu(bool timeout_enabled);
|
||||
|
||||
__attribute__((noreturn))
|
||||
void boot(char *config);
|
||||
noreturn void boot(char *config);
|
||||
|
||||
char *config_entry_editor(const char *title, const char *orig_entry);
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <sys/gdt.h>
|
||||
|
||||
__attribute__((noreturn)) void linux_spinup(void *entry, void *boot_params) {
|
||||
noreturn void linux_spinup(void *entry, void *boot_params) {
|
||||
struct gdt_desc linux_gdt_descs[4];
|
||||
linux_gdt_descs[0] = (struct gdt_desc){0};
|
||||
linux_gdt_descs[1] = (struct gdt_desc){0};
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <protos/linux.h>
|
||||
#include <fs/file.h>
|
||||
#include <lib/libc.h>
|
||||
@ -16,7 +17,7 @@
|
||||
#include <drivers/edid.h>
|
||||
#include <drivers/vga_textmode.h>
|
||||
|
||||
__attribute__((noreturn)) void linux_spinup(void *entry, void *boot_params);
|
||||
noreturn void linux_spinup(void *entry, void *boot_params);
|
||||
|
||||
// The following definitions and struct were copied and adapted from Linux
|
||||
// kernel headers released under GPL-2.0 WITH Linux-syscall-note
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <mm/vmm.h>
|
||||
#if bios == 1
|
||||
# include <sys/idt.h>
|
||||
#endif
|
||||
|
||||
__attribute__((noreturn)) void multiboot1_spinup_32(
|
||||
uint32_t entry_point, uint32_t multiboot1_info) {
|
||||
noreturn void multiboot1_spinup_32(uint32_t entry_point, uint32_t multiboot1_info) {
|
||||
#if bios == 1
|
||||
struct idtr idtr;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <protos/multiboot1.h>
|
||||
#include <lib/libc.h>
|
||||
#include <lib/elf.h>
|
||||
@ -17,9 +18,7 @@
|
||||
#include <mm/pmm.h>
|
||||
#include <drivers/vga_textmode.h>
|
||||
|
||||
__attribute__((noreturn)) void multiboot1_spinup_32(
|
||||
uint32_t entry_point,
|
||||
uint32_t multiboot1_info);
|
||||
noreturn void multiboot1_spinup_32(uint32_t entry_point, uint32_t multiboot1_info);
|
||||
|
||||
bool multiboot1_load(char *config, char *cmdline) {
|
||||
struct file_handle *kernel_file;
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <mm/vmm.h>
|
||||
#if bios == 1
|
||||
# include <sys/idt.h>
|
||||
#endif
|
||||
|
||||
__attribute__((noreturn)) void multiboot2_spinup_32(
|
||||
uint32_t entry_point, uint32_t multiboot2_info) {
|
||||
noreturn void multiboot2_spinup_32(uint32_t entry_point, uint32_t multiboot2_info) {
|
||||
#if bios == 1
|
||||
struct idtr idtr;
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
|
||||
bool multiboot2_load(char *config, char *cmdline);
|
||||
|
||||
@ -415,7 +416,6 @@ struct multiboot_tag_load_base_addr
|
||||
uint32_t load_base_addr;
|
||||
};
|
||||
|
||||
__attribute__((noreturn)) void multiboot2_spinup_32(
|
||||
uint32_t entry_point, uint32_t multiboot1_info);
|
||||
noreturn void multiboot2_spinup_32(uint32_t entry_point, uint32_t multiboot1_info);
|
||||
|
||||
#endif
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <mm/vmm.h>
|
||||
|
||||
__attribute__((noreturn)) void stivale_spinup_32(
|
||||
noreturn void stivale_spinup_32(
|
||||
int bits, bool level5pg, bool enable_nx, uint32_t pagemap_top_lv,
|
||||
uint32_t entry_point_lo, uint32_t entry_point_hi,
|
||||
uint32_t stivale_struct_lo, uint32_t stivale_struct_hi,
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <protos/stivale.h>
|
||||
#include <lib/libc.h>
|
||||
#include <lib/elf.h>
|
||||
@ -461,13 +462,13 @@ pagemap_t stivale_build_pagemap(bool level5pg, bool unmap_null, struct elf_range
|
||||
extern symbol ImageBase;
|
||||
#endif
|
||||
|
||||
__attribute__((noreturn)) void stivale_spinup_32(
|
||||
noreturn void stivale_spinup_32(
|
||||
int bits, bool level5pg, uint32_t pagemap_top_lv,
|
||||
uint32_t entry_point_lo, uint32_t entry_point_hi,
|
||||
uint32_t stivale_struct_lo, uint32_t stivale_struct_hi,
|
||||
uint32_t stack_lo, uint32_t stack_hi, uint32_t local_gdt);
|
||||
|
||||
__attribute__((noreturn)) void stivale_spinup(
|
||||
noreturn void stivale_spinup(
|
||||
int bits, bool level5pg, pagemap_t *pagemap,
|
||||
uint64_t entry_point, uint64_t _stivale_struct, uint64_t stack,
|
||||
bool enable_nx, uint32_t local_gdt) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <mm/vmm.h>
|
||||
#include <lib/elf.h>
|
||||
|
||||
@ -13,7 +14,7 @@ bool stivale_load_by_anchor(void **_anchor, const char *magic,
|
||||
pagemap_t stivale_build_pagemap(bool level5pg, bool unmap_null, struct elf_range *ranges, size_t ranges_count,
|
||||
bool want_fully_virtual, uint64_t physical_base, uint64_t virtual_base,
|
||||
uint64_t direct_map_offset);
|
||||
__attribute__((noreturn)) void stivale_spinup(
|
||||
noreturn void stivale_spinup(
|
||||
int bits, bool level5pg, pagemap_t *pagemap,
|
||||
uint64_t entry_point, uint64_t stivale_struct, uint64_t stack,
|
||||
bool enable_nx, uint32_t local_gdt);
|
||||
|
Loading…
Reference in New Issue
Block a user