mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
kernel: update limine to 11 and use base revision 6
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
name=limine
|
||||
from_source=limine
|
||||
revision=1
|
||||
imagedeps="build-essential mtools nasm"
|
||||
imagedeps="build-essential mtools nasm clang lld llvm"
|
||||
|
||||
configure() {
|
||||
"${source_dir}/configure" --enable-bios-cd --enable-bios-pxe --enable-bios --enable-uefi-ia32 --enable-uefi-x86-64 --enable-uefi-cd --prefix="${prefix}"
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ FLANTERMOPTS=-DFLANTERM_FB_DISABLE_BUMP_ALLOC
|
||||
# required for mpaland printf so it doesn't compile with floating point support, which results in build failures
|
||||
PRINTFOPTS=-DPRINTF_DISABLE_SUPPORT_FLOAT
|
||||
# flanterm includes break if the headers are moved into the include dir in the tree
|
||||
FLANTERMINCDIR=$(shell pwd)/flanterm
|
||||
FLANTERMINCDIR=$(shell pwd)/flanterm/src
|
||||
UACPIINCDIR=$(shell pwd)/io/acpi/uacpi/include
|
||||
UACPIOPTS=-DUACPI_OVERRIDE_LIBC -DUACPI_KERNEL_INITIALIZATION -DUACPI_NATIVE_ALLOC_ZEROED
|
||||
KERNELCONFIG=#-DX86_64_ENABLE_E9 -DENABLE_PROFILING #-DSYSCALL_LOGGING
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <uacpi/kernel_api.h>
|
||||
|
||||
static volatile struct limine_rsdp_request rsdp_request = {
|
||||
.id = LIMINE_RSDP_REQUEST,
|
||||
.id = LIMINE_RSDP_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
|
||||
@@ -314,8 +314,8 @@ static mmuflags_t kernelflags[3] = {
|
||||
|
||||
extern volatile struct limine_memmap_request pmm_liminemap;
|
||||
|
||||
static volatile struct limine_kernel_address_request kaddrreq = {
|
||||
.id = LIMINE_KERNEL_ADDRESS_REQUEST,
|
||||
static volatile struct limine_executable_address_request kaddrreq = {
|
||||
.id = LIMINE_EXECUTABLE_ADDRESS_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
@@ -389,11 +389,13 @@ void arch_mmu_init() {
|
||||
|
||||
for (size_t i = 0; i < pmm_liminemap.response->entry_count; ++i) {
|
||||
struct limine_memmap_entry *e = pmm_liminemap.response->entries[i];
|
||||
if (e->type != LIMINE_MEMMAP_USABLE && e->type != LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE && e->type != LIMINE_MEMMAP_KERNEL_AND_MODULES && e->type != LIMINE_MEMMAP_FRAMEBUFFER)
|
||||
if (e->type != LIMINE_MEMMAP_USABLE && e->type != LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE && e->type != LIMINE_MEMMAP_EXECUTABLE_AND_MODULES && e->type != LIMINE_MEMMAP_FRAMEBUFFER)
|
||||
continue;
|
||||
|
||||
for (uint64_t i = 0; i < e->length; i += PAGE_SIZE) {
|
||||
uint64_t entry = ((e->base + i) & ADDRMASK) | ARCH_MMU_FLAGS_READ | ARCH_MMU_FLAGS_WRITE | ARCH_MMU_FLAGS_NOEXEC | ARCH_MMU_FLAGS_GLOBAL;
|
||||
if (e->type == LIMINE_MEMMAP_FRAMEBUFFER)
|
||||
entry |= ARCH_MMU_FLAGS_WC;
|
||||
__assert(add_page(FROM_HHDM(template), MAKE_HHDM((void *)(e->base + i)), entry, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,22 +12,22 @@
|
||||
|
||||
DEFINE_KERNEL_ARGUMENT(nosmp, bool);
|
||||
|
||||
static volatile struct limine_smp_request smprequest = {
|
||||
.id = LIMINE_SMP_REQUEST
|
||||
static volatile struct limine_mp_request smprequest = {
|
||||
.id = LIMINE_MP_REQUEST_ID
|
||||
};
|
||||
|
||||
// set to 1 because of the bsp
|
||||
size_t arch_smp_cpusawake = 1;
|
||||
|
||||
// for panic. if the nosmp argument is given to the kernel, this is what the APs will jump to
|
||||
static void cpuwakeuphalt(struct limine_smp_info *info) {
|
||||
static void cpuwakeuphalt(struct limine_mp_info *info) {
|
||||
asm("cli");
|
||||
for (;;) CPU_HALT();
|
||||
}
|
||||
|
||||
static long next_id = 1;
|
||||
|
||||
static void cpuwakeup(struct limine_smp_info *info) {
|
||||
static void cpuwakeup(struct limine_mp_info *info) {
|
||||
cpu_set((cpu_t *)info->extra_argument);
|
||||
|
||||
current_cpu()->internal_id = __atomic_fetch_add(&next_id, 1, __ATOMIC_SEQ_CST);
|
||||
@@ -69,7 +69,7 @@ size_t arch_smp_get_cpu_count(void) {
|
||||
if (GET_KERNEL_ARGUMENT(nosmp, bool))
|
||||
return 1;
|
||||
|
||||
struct limine_smp_response *response = smprequest.response;
|
||||
struct limine_mp_response *response = smprequest.response;
|
||||
if (response == NULL)
|
||||
return 1;
|
||||
|
||||
@@ -84,7 +84,7 @@ cpu_t *arch_smp_get_cpu_by_internal_id(long id) {
|
||||
}
|
||||
|
||||
void arch_smp_wakeup(void) {
|
||||
struct limine_smp_response *response = smprequest.response;
|
||||
struct limine_mp_response *response = smprequest.response;
|
||||
if (response == NULL) {
|
||||
// TODO try to detect the other processors manually
|
||||
printf("smp: limine smp request response not present\n");
|
||||
@@ -103,7 +103,7 @@ void arch_smp_wakeup(void) {
|
||||
smp_cpus = alloc(response->cpu_count * sizeof(cpu_t *));
|
||||
__assert(smp_cpus);
|
||||
|
||||
void (*wakeupfn)(struct limine_smp_info *) = GET_KERNEL_ARGUMENT(nosmp, bool) ? cpuwakeuphalt : cpuwakeup;
|
||||
void (*wakeupfn)(struct limine_mp_info *) = GET_KERNEL_ARGUMENT(nosmp, bool) ? cpuwakeuphalt : cpuwakeup;
|
||||
|
||||
// make the other processors jump to cpuwakeup()
|
||||
for (int i = 0; i < response->cpu_count; ++i) {
|
||||
|
||||
@@ -102,7 +102,7 @@ static void buildentry(tarentry_t *entry, void *addr) {
|
||||
}
|
||||
|
||||
static volatile struct limine_module_request modreq = {
|
||||
.id = LIMINE_MODULE_REQUEST,
|
||||
.id = LIMINE_MODULE_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#define ARCH_MMU_FLAGS_WB 0
|
||||
#define ARCH_MMU_FLAGS_WT (1 << 3)
|
||||
#define ARCH_MMU_FLAGS_UC (1 << 4)
|
||||
#define ARCH_MMU_FLAGS_WC ((1 << 12) | (1 << 3)) // PAT5 (limine sets up the 5th PAT entry as WC)
|
||||
#define ARCH_MMU_FLAGS_WC ((1 << 7) | (1 << 3)) // PAT5 (limine sets up the 5th PAT entry as WC)
|
||||
|
||||
#define PAGE_MASK 0xfffffffffffff000lu
|
||||
|
||||
|
||||
+2
-7
@@ -70,7 +70,7 @@ typedef struct {
|
||||
#define FB_TYPE_PACKED_PIXELS 0
|
||||
|
||||
volatile struct limine_framebuffer_request fb_liminereq = {
|
||||
.id = LIMINE_FRAMEBUFFER_REQUEST,
|
||||
.id = LIMINE_FRAMEBUFFER_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
@@ -153,7 +153,7 @@ static int mmap(int minor, void *addr, uintmax_t offset, int flags) {
|
||||
|
||||
memcpy(MAKE_HHDM(paddr), (void *)((uintptr_t)fbs[minor]->address + offset), size);
|
||||
|
||||
if (arch_mmu_map(current_vmm_context()->pagetable, paddr, addr, vnodeflagstommuflags(flags)) == false) {
|
||||
if (arch_mmu_map(current_vmm_context()->pagetable, paddr, addr, vnodeflagstommuflags(flags) | ARCH_MMU_FLAGS_WC) == false) {
|
||||
pmm_release(paddr);
|
||||
return ENOMEM;
|
||||
}
|
||||
@@ -257,11 +257,6 @@ void fb_init() {
|
||||
|
||||
printf("%s: %dx%d %d bpp\n", name, fb->width, fb->height, fb->bpp);
|
||||
}
|
||||
|
||||
|
||||
void *fb_map = vmm_map(NULL, fbs[0]->pitch * fbs[0]->height, VMM_FLAGS_PHYSICAL, ARCH_MMU_FLAGS_READ | ARCH_MMU_FLAGS_WRITE | ARCH_MMU_FLAGS_NOEXEC | ARCH_MMU_FLAGS_WC, FROM_HHDM(fbs[0]->address));
|
||||
__assert(fb_map);
|
||||
term_update_framebuffer(fb_map);
|
||||
}
|
||||
|
||||
INIT_ROUTINE_DEFINE(fb, INIT_ROUTINE_FLAGS_NONE, fb_init, devfs);
|
||||
|
||||
@@ -124,6 +124,7 @@ size_t pci_initmsix(pcienum_t *e) {
|
||||
#define PCI_MSI_64BIT (1 << 7)
|
||||
|
||||
size_t pci_initmsi(pcienum_t *e, int requested) {
|
||||
// TODO maybe initialize mask if applicable?
|
||||
__assert(requested == 1);
|
||||
if (e->msi.exists == false)
|
||||
return 0;
|
||||
@@ -131,6 +132,7 @@ size_t pci_initmsi(pcienum_t *e, int requested) {
|
||||
uint16_t msgctl = PCI_READ16(e, e->msi.offset + 2);
|
||||
msgctl |= PCI_MSI_ENABLE;
|
||||
msgctl &= ~(PCI_MSI_MULTIPLE_MESSAGE_SUPPORT_MASK); // no multiple message support
|
||||
|
||||
PCI_WRITE16(e, e->msi.offset + 2, msgctl);
|
||||
|
||||
pci_setcommand(e, PCI_COMMAND_IRQDISABLE, 1);
|
||||
|
||||
+17
-10
@@ -1,5 +1,5 @@
|
||||
#include <flanterm.h>
|
||||
#include <backends/fb.h>
|
||||
#include <flanterm_backends/fb.h>
|
||||
#include <limine.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@@ -11,6 +11,10 @@
|
||||
#include <kernel/init.h>
|
||||
#include <logging.h>
|
||||
|
||||
static volatile struct limine_flanterm_fb_init_params_request flanterm_request = {
|
||||
.id = LIMINE_FLANTERM_FB_INIT_PARAMS_REQUEST_ID
|
||||
};
|
||||
|
||||
extern volatile struct limine_framebuffer_request fb_liminereq;
|
||||
static size_t xs, ys, fbxs, fbys;
|
||||
bool init_done;
|
||||
@@ -70,26 +74,29 @@ void term_init() {
|
||||
uint32_t defaultbg = 0x1b1c1b;
|
||||
uint32_t defaultfg = 0xffffff;
|
||||
|
||||
// TODO add support for a background if desired by the user
|
||||
if (flanterm_request.response && flanterm_request.response->entry_count) {
|
||||
struct limine_flanterm_fb_init_params *param = flanterm_request.response->entries[0];
|
||||
term_ctx = flanterm_fb_init(internalalloc, noop, fb->address, fb->width, fb->height, fb->pitch,
|
||||
fb->red_mask_size, fb->red_mask_shift, fb->green_mask_size, fb->green_mask_shift, fb->blue_mask_size, fb->blue_mask_shift,
|
||||
param->canvas, param->ansi_colours, param->ansi_bright_colours,
|
||||
¶m->default_bg, ¶m->default_fg, ¶m->default_bg_bright, ¶m->default_fg_bright,
|
||||
param->font, param->font_width, param->font_height, param->font_spacing, param->font_scale_x, param->font_scale_y,
|
||||
param->margin, param->rotation);
|
||||
} else {
|
||||
term_ctx = flanterm_fb_init(internalalloc, noop, fb->address, fb->width, fb->height, fb->pitch,
|
||||
fb->red_mask_size, fb->red_mask_shift, fb->green_mask_size, fb->green_mask_shift, fb->blue_mask_size, fb->blue_mask_shift,
|
||||
NULL, NULL, NULL, &defaultbg, &defaultfg, NULL, NULL, NULL,
|
||||
0, 0, 1, 1, 1, 0);
|
||||
0, 0, 1, 1, 1, 0, 0);
|
||||
}
|
||||
|
||||
__assert(term_ctx);
|
||||
|
||||
xs = term_ctx->cols;
|
||||
ys = term_ctx->rows;
|
||||
flanterm_get_dimensions(term_ctx, &xs, &ys);
|
||||
fbxs = fb->width;
|
||||
fbys = fb->height;
|
||||
|
||||
MUTEX_INIT(&term_mutex);
|
||||
|
||||
logging_sethook(term_putchar);
|
||||
}
|
||||
|
||||
void term_update_framebuffer(void *fb) {
|
||||
((struct flanterm_fb_context *)fb)->framebuffer = fb;
|
||||
}
|
||||
|
||||
INIT_ROUTINE_DEFINE(term, INIT_ROUTINE_FLAGS_NONE, term_init, vmm);
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
#include <kernel/initrd.h>
|
||||
#include <kernel/scheduler.h>
|
||||
#include <kernel/term.h>
|
||||
#include <limine.h>
|
||||
|
||||
__attribute__((used)) static uint64_t base_revision[] = LIMINE_BASE_REVISION(6);
|
||||
|
||||
static cpu_t bsp_cpu;
|
||||
|
||||
|
||||
+3
-3
@@ -35,12 +35,12 @@ static section_t sections[PMM_SECTION_COUNT] = {
|
||||
};
|
||||
|
||||
static volatile struct limine_hhdm_request hhdmreq = {
|
||||
.id = LIMINE_HHDM_REQUEST,
|
||||
.id = LIMINE_HHDM_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
volatile struct limine_memmap_request pmm_liminemap = {
|
||||
.id = LIMINE_MEMMAP_REQUEST,
|
||||
.id = LIMINE_MEMMAP_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
@@ -235,7 +235,7 @@ void pmm_init() {
|
||||
for (size_t i = 0; i < pmm_liminemap.response->entry_count; ++i) {
|
||||
struct limine_memmap_entry *e = pmm_liminemap.response->entries[i];
|
||||
printf("pmm: %016p -> %016p: %d\n", e->base, e->base + e->length, e->type);
|
||||
if (e->type == LIMINE_MEMMAP_USABLE || e->type == LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE || e->type == LIMINE_MEMMAP_KERNEL_AND_MODULES) {
|
||||
if (e->type == LIMINE_MEMMAP_USABLE || e->type == LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE || e->type == LIMINE_MEMMAP_EXECUTABLE_AND_MODULES) {
|
||||
size_t sectiontop = e->base + e->length;
|
||||
if (sectiontop > top)
|
||||
top = sectiontop;
|
||||
|
||||
+4
-1
@@ -1024,10 +1024,13 @@ void vmm_init() {
|
||||
for (uint64_t i = 0; i < pmm_liminemap.response->entry_count; ++i) {
|
||||
struct limine_memmap_entry *e = pmm_liminemap.response->entries[i];
|
||||
|
||||
if (e->type != LIMINE_MEMMAP_USABLE && e->type != LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE && e->type != LIMINE_MEMMAP_KERNEL_AND_MODULES && e->type != LIMINE_MEMMAP_FRAMEBUFFER)
|
||||
if (e->type != LIMINE_MEMMAP_USABLE && e->type != LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE && e->type != LIMINE_MEMMAP_EXECUTABLE_AND_MODULES && e->type != LIMINE_MEMMAP_FRAMEBUFFER)
|
||||
continue;
|
||||
|
||||
mmuflags_t mmuflags = ARCH_MMU_FLAGS_READ | ARCH_MMU_FLAGS_WRITE | ARCH_MMU_FLAGS_NOEXEC | ARCH_MMU_FLAGS_GLOBAL;
|
||||
if (e->type == LIMINE_MEMMAP_FRAMEBUFFER)
|
||||
mmuflags |= ARCH_MMU_FLAGS_WC;
|
||||
|
||||
__assert(vmm_map(MAKE_HHDM(e->base), e->length, VMM_FLAGS_EXACT, mmuflags, NULL));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
#define TOTAL_ARGUMENTS_CHARACTER_LIMIT 4096
|
||||
|
||||
static volatile struct limine_kernel_file_request kernel_file_request = {
|
||||
.id = LIMINE_KERNEL_FILE_REQUEST,
|
||||
static volatile struct limine_executable_file_request executable_file_request = {
|
||||
.id = LIMINE_EXECUTABLE_FILE_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
@@ -43,8 +43,8 @@ static void insert_argument(const char *key, const char *value) {
|
||||
}
|
||||
|
||||
void kernel_arguments_parse(void) {
|
||||
__assert(kernel_file_request.response);
|
||||
const char *cmdline = kernel_file_request.response->kernel_file->cmdline;
|
||||
__assert(executable_file_request.response);
|
||||
const char *cmdline = executable_file_request.response->executable_file->string;
|
||||
__assert(cmdline);
|
||||
size_t length = min(strlen(cmdline), TOTAL_ARGUMENTS_CHARACTER_LIMIT);
|
||||
char temp_buffer[length + 1];
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include <logging.h>
|
||||
#include <kernel/init.h>
|
||||
|
||||
static volatile struct limine_boot_time_request timereq = {
|
||||
.id = LIMINE_BOOT_TIME_REQUEST,
|
||||
static volatile struct limine_date_at_boot_request timereq = {
|
||||
.id = LIMINE_DATE_AT_BOOT_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
@@ -135,7 +135,7 @@ void timekeeper_wait_us(time_t us) {
|
||||
|
||||
void timekeeper_early_init(void) {
|
||||
__assert(timereq.response);
|
||||
boot_unix = timereq.response->boot_time;
|
||||
boot_unix = timereq.response->timestamp;
|
||||
|
||||
current_cpu()->timekeeper_sync_isr = interrupt_allocate(timekeeper_sync_isr, ARCH_EOI, IPL_DPC);
|
||||
__assert(current_cpu()->timekeeper_sync_isr);
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ hostdeps="xgcc xbinutils"
|
||||
deps="base"
|
||||
|
||||
configure() {
|
||||
"${source_dir}/configure" --host=x86_64-astral --enable-bios-cd --enable-bios-pxe --enable-bios --enable-uefi-ia32 --enable-uefi-x86-64 --enable-uefi-cd --prefix="${prefix}"
|
||||
TOOLCHAIN_FOR_TARGET=x86_64-astral- "${source_dir}/configure" --host=x86_64-astral --enable-bios-cd --enable-bios-pxe --enable-bios --enable-uefi-ia32 --enable-uefi-x86-64 --enable-uefi-cd --prefix="${prefix}"
|
||||
}
|
||||
|
||||
build() {
|
||||
|
||||
@@ -3,14 +3,14 @@ version=0
|
||||
source_dir="kernel-src"
|
||||
allow_network="yes"
|
||||
imagedeps="wget"
|
||||
flanterm_commit="347d9cf1e3fced64aa20ab278e2fdcc834086035"
|
||||
flanterm_commit="b5038e828de1dc6c049222a3c1670f7976e6c5a3"
|
||||
|
||||
prepare() {
|
||||
rm -f include/limine.h
|
||||
rm -f io/printf.c
|
||||
rm -f include/printf.h
|
||||
rm -rf flanterm
|
||||
curl https://raw.githubusercontent.com/limine-bootloader/limine-protocol/4607d68cbdbe653885937fb3178449588addb799/include/limine.h > include/limine.h
|
||||
curl https://raw.githubusercontent.com/limine-bootloader/limine-protocol/26519f1b598564db409e50d1d84eb30642d58ba3/include/limine.h > include/limine.h
|
||||
pushd /tmp/
|
||||
wget https://github.com/mpaland/printf/archive/refs/tags/v4.0.0.tar.gz
|
||||
tar -xf v4.0.0.tar.gz
|
||||
@@ -19,5 +19,5 @@ prepare() {
|
||||
popd
|
||||
cp /tmp/printf-4.0.0/printf.c io/printf.c
|
||||
cp /tmp/printf-4.0.0/printf.h include/printf.h
|
||||
cp -r /tmp/flanterm-${flanterm_commit} flanterm
|
||||
cp -r /tmp/Flanterm-${flanterm_commit} flanterm
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
name=limine
|
||||
version=8.0.10
|
||||
version=11.0.0
|
||||
source_method=tarball
|
||||
tarball_url="https://github.com/limine-bootloader/limine/releases/download/v${version}/limine-${version}.tar.gz"
|
||||
tarball_sha512="28110a666932197c01a7c8628ad8ff532695e56d4ed7047755601ede737b256f64e6978a2627d2a90c14fea9a545302e60bf7d9a2eac897e57f7dd7aa8133dbe"
|
||||
tarball_sha512="d18ee2b657df89f29502706d3403fb69465c7e55c399c00f41504a0bc5acd8a3188bfef030cd9ea1464c450e6ca9f049b93b1262999f1d1a35fdd4b6fbc8f8f7"
|
||||
hostdeps="autoconf automake libtool pkgconfig"
|
||||
|
||||
prepare() {
|
||||
|
||||
Reference in New Issue
Block a user