clang-format alignment rules

This commit is contained in:
2025-12-21 23:10:21 +01:00
parent c85cbd0c01
commit 741d0fb9b0
10 changed files with 71 additions and 62 deletions

View File

@@ -40,9 +40,10 @@ PointerAlignment: Left
DerivePointerAlignment: false DerivePointerAlignment: false
# Alignment # Alignment
AlignAfterOpenBracket: DontAlign AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignOperands: false AlignOperands: false
# Includes # Includes

View File

@@ -14,8 +14,8 @@ void bootmain (void) {
amd64_init (); amd64_init ();
pmm_init (); pmm_init ();
uacpi_setup_early_table_access ( uacpi_setup_early_table_access ((void*)uacpi_memory_buffer,
(void*)uacpi_memory_buffer, sizeof (uacpi_memory_buffer)); sizeof (uacpi_memory_buffer));
int* a = malloc (sizeof (int)); int* a = malloc (sizeof (int));
*a = 6969; *a = 6969;

View File

@@ -68,8 +68,8 @@ static void amd64_gdt_init (void) {
amd64_gdt_set (&gdt.old[2], 0, 0xFFFFF, 0x92, 0xC0); amd64_gdt_set (&gdt.old[2], 0, 0xFFFFF, 0x92, 0xC0);
amd64_gdt_set (&gdt.old[3], 0, 0xFFFFF, 0xFA, 0xA0); amd64_gdt_set (&gdt.old[3], 0, 0xFFFFF, 0xFA, 0xA0);
amd64_gdt_set (&gdt.old[4], 0, 0xFFFFF, 0xF2, 0xC0); amd64_gdt_set (&gdt.old[4], 0, 0xFFFFF, 0xF2, 0xC0);
amd64_gdt_set ( amd64_gdt_set (&gdt.tsslow, (tssbase & 0xFFFFFFFF), tsslimit,
&gdt.tsslow, (tssbase & 0xFFFFFFFF), tsslimit, TSS_PRESENT | TSS, 0); TSS_PRESENT | TSS, 0);
uint32_t tssbasehigh = (tssbase >> 32); uint32_t tssbasehigh = (tssbase >> 32);
gdt.tsshigh.limitlow = (tssbasehigh & 0xFFFF); gdt.tsshigh.limitlow = (tssbasehigh & 0xFFFF);

View File

@@ -77,8 +77,8 @@ static void amd64_init_pic (void) {
#undef IO_OP #undef IO_OP
} }
static void amd64_idt_set ( static void amd64_idt_set (volatile struct idt_entry* ent, uint64_t handler,
volatile struct idt_entry* ent, uint64_t handler, uint8_t flags) { uint8_t flags) {
ent->intrlow = (handler & 0xFFFF); ent->intrlow = (handler & 0xFFFF);
ent->kernel_cs = 0x08; // GDT_KCODE (init.c) ent->kernel_cs = 0x08; // GDT_KCODE (init.c)
ent->ist = 0; ent->ist = 0;
@@ -168,9 +168,10 @@ static void amd64_intr_exception (struct saved_regs* regs) {
"rfl=%016lx rsp=%016lx ss =%016lx\n" "rfl=%016lx rsp=%016lx ss =%016lx\n"
"cr2=%016lx cr3=%016lx rbx=%016lx\n", "cr2=%016lx cr3=%016lx rbx=%016lx\n",
regs->r15, regs->r14, regs->r13, regs->r12, regs->r11, regs->r10, regs->r15, regs->r14, regs->r13, regs->r12, regs->r11, regs->r10,
regs->r9, regs->r8, regs->rbp, regs->rdi, regs->rsi, regs->rdx, regs->rcx, regs->r9, regs->r8, regs->rbp, regs->rdi, regs->rsi, regs->rdx,
regs->rax, regs->trap, regs->error, regs->rip, regs->cs, regs->rflags, regs->rcx, regs->rax, regs->trap, regs->error, regs->rip,
regs->rsp, regs->ss, cr2, cr3, regs->rbx); regs->cs, regs->rflags, regs->rsp, regs->ss, cr2, cr3,
regs->rbx);
amd64_spin (); amd64_spin ();
} }

View File

@@ -1,8 +1,8 @@
#ifndef _KERNEL_AUX_COMPILER_H #ifndef _KERNEL_AUX_COMPILER_H
#define _KERNEL_AUX_COMPILER_H #define _KERNEL_AUX_COMPILER_H
#define PACKED __attribute__((packed)) #define PACKED __attribute__ ((packed))
#define ALIGNED(N) __attribute__((aligned((N)))) #define ALIGNED(N) __attribute__ ((aligned ((N))))
#define SECTION(name) __attribute__((section(name))) #define SECTION(name) __attribute__ ((section (name)))
#endif // _KERNEL_AUX_COMPILER_H #endif // _KERNEL_AUX_COMPILER_H

View File

@@ -226,8 +226,9 @@ static inline struct boundary_tag* split_tag (struct boundary_tag* tag) {
unsigned int remainder = unsigned int remainder =
tag->real_size - sizeof (struct boundary_tag) - tag->size; tag->real_size - sizeof (struct boundary_tag) - tag->size;
struct boundary_tag* new_tag = (struct boundary_tag*)((uintptr_t)tag + struct boundary_tag* new_tag =
sizeof (struct boundary_tag) + tag->size); (struct boundary_tag*)((uintptr_t)tag + sizeof (struct boundary_tag) +
tag->size);
new_tag->magic = LIBALLOC_MAGIC; new_tag->magic = LIBALLOC_MAGIC;
new_tag->real_size = remainder; new_tag->real_size = remainder;
@@ -417,8 +418,8 @@ void free (void* ptr) {
#ifdef DEBUG #ifdef DEBUG
l_inuse -= tag->size; l_inuse -= tag->size;
printf ( printf ("free: %x, %i, %i\n", ptr, (int)l_inuse / 1024,
"free: %x, %i, %i\n", ptr, (int)l_inuse / 1024, (int)l_allocated / 1024); (int)l_allocated / 1024);
#endif #endif
// MELT LEFT... // MELT LEFT...

View File

@@ -21,9 +21,15 @@ void pmm_init (void) {
size_t region = 0; size_t region = 0;
for (size_t i = 0; i < memmap->entry_count; i++) { for (size_t i = 0; i < memmap->entry_count; i++) {
struct limine_memmap_entry* entry = memmap->entries[i]; struct limine_memmap_entry* entry = memmap->entries[i];
static const char* entry_strings[] = {"usable", "reserved", static const char* entry_strings[] = {"usable",
"acpi reclaimable", "acpi nvs", "bad memory", "bootloader reclaimable", "reserved",
"executable and modules", "framebuffer", "acpi tables"}; "acpi reclaimable",
"acpi nvs",
"bad memory",
"bootloader reclaimable",
"executable and modules",
"framebuffer",
"acpi tables"};
DEBUG ("memmap entry: %-25s %p (%zu bytes)\n", entry_strings[entry->type], DEBUG ("memmap entry: %-25s %p (%zu bytes)\n", entry_strings[entry->type],
entry->base, entry->length); entry->base, entry->length);
@@ -81,8 +87,8 @@ void pmm_init (void) {
* Find free space for a block range. For every bit of the bitmap, we test nblks bits forward. * Find free space for a block range. For every bit of the bitmap, we test nblks bits forward.
* bm_test_region helps us out, because it automatically does range checks. See comments there. * bm_test_region helps us out, because it automatically does range checks. See comments there.
*/ */
static size_t pmm_find_free_space ( static size_t pmm_find_free_space (struct pmm_region* pmm_region,
struct pmm_region* pmm_region, size_t nblks) { size_t nblks) {
for (size_t bit = 0; bit < pmm_region->bm.nbits; bit++) { for (size_t bit = 0; bit < pmm_region->bm.nbits; bit++) {
if (bm_test_region (&pmm_region->bm, bit, nblks)) { if (bm_test_region (&pmm_region->bm, bit, nblks)) {
continue; continue;