Fix FAT driver issues (FAT32 while being under 32MiB), liballoc alignment so SSE doesnt break

This commit is contained in:
2026-03-10 21:01:49 +01:00
parent 38557bab7d
commit 4b099f04f5
27 changed files with 3447 additions and 18 deletions

View File

@@ -67,7 +67,7 @@ void bootmain (void) {
device_probe_partitions (temp);
struct device* tempp0 = device_find ("TEMPp0");
vfs_create_volume ("TEMP", FS_FAT32, tempp0, true);
int x = vfs_create_volume ("TEMP", FS_FAT16, tempp0, true);
proc_pid_alloc_init ();
procgroup_pgid_alloc_init ();

View File

@@ -3,17 +3,22 @@
#define fx_save(buf) \
do { \
__asm__ volatile ("fxsave64 (%0)" ::"r"((buf)) : "memory"); \
__asm__ volatile ("fxsave64 %0" : "=m"(*(buf))::"memory"); \
} while (0)
#define fx_restore(buf) \
do { \
__asm__ volatile ("fxrstor64 (%0)" ::"r"((buf)) : "memory"); \
__asm__ volatile ("fxrstor64 %0" ::"m"(*(buf)) : "memory"); \
} while (0)
#define fx_init(buf) \
do { \
__asm__ volatile ("fninit; fxsave64 (%0)" ::"r"((buf)) : "memory"); \
memset ((buf), 0, sizeof ((buf))); \
__asm__ volatile ("fninit; fxsave64 %0" : "=m"(*(buf))::"memory"); \
uint32_t* __mxcsr = (uint32_t*)&(buf)[24]; \
*__mxcsr = 0x1F80; \
uint16_t* __fcw = (uint16_t*)&(buf)[0]; \
*__fcw = 0x037F; \
} while (0)
#endif // _KERNEL_AMD64_FX_H

View File

@@ -14,11 +14,11 @@
/* Platform-dependent process data */
struct proc_platformdata {
uint8_t fx_env[512] ALIGNED (16);
struct saved_regs regs;
uintptr_t kernel_stack;
uint64_t fs_base;
uintptr_t tls_vaddr;
uint8_t fx_env[512] ALIGNED (16);
};
#endif // _KERNEL_AMD64_PROC_H

View File

@@ -1,5 +1,4 @@
#include <device/device.h>
#include <device/dos.h>
#include <device/partdrv.h>
#include <device/partitions.h>
#include <device/pci.h>

View File

@@ -1,4 +0,0 @@
#ifndef _KERNEL_DEVICE_DOS_H
#define _KERNEL_DEVICE_DOS_H
#endif // _KERNEL_DEVICE_DOS_H

View File

@@ -1,6 +1,7 @@
#include <amd64/io.h>
#include <device/device.h>
#include <device/idedrv.h>
#include <device/partitions.h>
#include <devices.h>
#include <libk/std.h>
#include <mm/liballoc.h>
@@ -183,6 +184,8 @@ bool idedrv_init (struct device* device, void* arg) {
device->udata = idedrv;
device_probe_partitions (device);
return true;
}

View File

@@ -1,6 +1,7 @@
/* liballoc breaks when optimized too aggressively, for eg. clang's -Oz */
#pragma clang optimize off
#include <libk/align.h>
#include <limine/requests.h>
#include <mm/liballoc.h>
#include <mm/pmm.h>
@@ -240,6 +241,8 @@ static struct boundary_tag* allocate_new_tag (unsigned int size) {
}
void* malloc (size_t size) {
size = align_up (size, 16);
int index;
void* ptr;
struct boundary_tag* tag = NULL;

View File

@@ -1,6 +1,7 @@
#ifndef _LIBALLOC_H
#define _LIBALLOC_H
#include <aux/compiler.h>
#include <libk/std.h>
// If we are told to not define our own size_t, then we
@@ -38,7 +39,7 @@ struct boundary_tag {
struct boundary_tag* next; //< Linked list info.
struct boundary_tag* prev; //< Linked list info.
};
} ALIGNED (16);
/** This function is supposed to lock the memory data structures. It
* could be as simple as disabling interrupts or acquiring a spinlock.