kernel: adjust formatting

This commit is contained in:
2026-02-19 18:57:53 +00:00
parent 6019c9307d
commit f89e3cb12c
2 changed files with 32 additions and 25 deletions

View File

@@ -36,7 +36,9 @@ void e820_scan(multiboot_memory_map_t *mmap, size_t len)
} }
printk("e820: [mem 0x%016llx-0x%016llx] %s", printk("e820: [mem 0x%016llx-0x%016llx] %s",
entry->addr, entry->addr + entry->len - 1, type); entry->addr,
entry->addr + entry->len - 1,
type);
memblock_add(entry->addr, entry->len); memblock_add(entry->addr, entry->len);
@@ -53,7 +55,12 @@ void e820_scan(multiboot_memory_map_t *mmap, size_t len)
char str_mem_total[64], str_mem_reserved[64]; char str_mem_total[64], str_mem_reserved[64];
data_size_to_string(mem_total, str_mem_total, sizeof str_mem_total); data_size_to_string(mem_total, str_mem_total, sizeof str_mem_total);
data_size_to_string(mem_reserved, str_mem_reserved, sizeof str_mem_reserved); data_size_to_string(
mem_reserved,
str_mem_reserved,
sizeof str_mem_reserved);
printk("e820: total memory: %s, hw reserved: %s", str_mem_total, str_mem_reserved); printk("e820: total memory: %s, hw reserved: %s",
str_mem_total,
str_mem_reserved);
} }

View File

@@ -332,80 +332,80 @@ IRQ 223, 255
isr_common_stub: isr_common_stub:
PUSH_REGS PUSH_REGS
mov %rsp, %rdi mov %rsp, %rdi
call isr_dispatch call isr_dispatch
POP_REGS POP_REGS
add $16, %rsp add $16, %rsp
iretq iretq
.global irq_common_stub .global irq_common_stub
.type irq_common_stub, @function .type irq_common_stub, @function
irq_common_stub: irq_common_stub:
PUSH_REGS PUSH_REGS
mov %rsp, %rdi mov %rsp, %rdi
call irq_dispatch call irq_dispatch
POP_REGS POP_REGS
add $16, %rsp add $16, %rsp
iretq iretq
.global syscall_gate .global syscall_gate
.type syscall_gate, @function .type syscall_gate, @function
.extern syscall_dispatch .extern syscall_dispatch
.type syscall_dispatch, @function .type syscall_dispatch, @function
syscall_gate: syscall_gate:
swapgs swapgs
movq %rsp, %gs:20 # GS+20 = rsp2 in the current TSS block (user stack storage) movq %rsp, %gs:20 # GS+20 = rsp2 in the current TSS block (user stack storage)
movq %gs:4, %rsp # GS+4 = rsp0 in the current TSS block (per-thread kstack) movq %gs:4, %rsp # GS+4 = rsp0 in the current TSS block (per-thread kstack)
# start building a pf_cpu_context # start building a ml_cpu_context
pushq $0x1b pushq $0x1b
pushq %gs:20 pushq %gs:20
push %r11 push %r11
push $0x23 push $0x23
push %rcx push %rcx
pushq $0 pushq $0
pushq $0x80 pushq $0x80
PUSH_REGS PUSH_REGS
mov %rsp, %rdi mov %rsp, %rdi
# switch back to user gs while in syscall_dispatch. Interrupts are enabled in syscall_dispatch, # switch back to user gs while in syscall_dispatch. Interrupts are enabled in syscall_dispatch,
# and if the task gets pre-empted, the incoming task will expect %gs to have its usermode value. # and if the task gets pre-empted, the incoming task will expect %gs to have its usermode value.
swapgs swapgs
call syscall_dispatch call syscall_dispatch
POP_REGS POP_REGS
add $16, %rsp add $16, %rsp
pop %rcx pop %rcx
add $8, %rsp add $8, %rsp
pop %r11 pop %r11
add $16, %rsp add $16, %rsp
swapgs swapgs
movq %gs:20, %rsp # GS+20 = rsp2 in the current TSS block movq %gs:20, %rsp # GS+20 = rsp2 in the current TSS block
swapgs swapgs
# back to usermode # back to usermode
sysretq sysretq
.global pf_faultptr .global pf_faultptr
.type pf_faultptr, @function .type pf_faultptr, @function
pf_faultptr: pf_faultptr:
mov %cr2, %rax mov %cr2, %rax
ret ret