acpi: Add EBDA address sanity checks and work around bogus GCC warning

This commit is contained in:
mintsuki 2022-07-01 15:04:57 +02:00
parent 29d63d6b3e
commit f3621c7bcc
2 changed files with 16 additions and 1 deletions

View File

@ -20,3 +20,6 @@ jobs:
- name: Build the bootloader (LLVM)
run: ./bootstrap && ./configure TOOLCHAIN=llvm --enable-werror --enable-all && make all && make maintainer-clean
- name: Build the bootloader (GCC)
run: ./bootstrap && ./configure LIMINE_CC=gcc LIMINE_LD=ld LIMINE_OBJCOPY=objcopy LIMINE_OBJDUMP=objdump LIMINE_READELF=readelf --enable-werror --enable-all && make all && make maintainer-clean

View File

@ -3,8 +3,20 @@
#include <stdint.h>
#include <stddef.h>
#include <sys/cpu.h>
#define EBDA ((size_t)(*((volatile uint16_t *)0x40e)) * 16)
#define EBDA (ebda_get())
static inline uintptr_t ebda_get(void) {
uintptr_t ebda = (uintptr_t)mminw(0x40e) << 4;
// Sanity checks
if (ebda < 0x80000 || ebda >= 0xa0000) {
ebda = 0x80000;
}
return ebda;
}
struct sdt {
char signature[4];