Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanups #221

Merged
merged 2 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 19 additions & 23 deletions arch/x86/boot/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,30 @@
SECTION(.text.init, "ax", 16)
GLOBAL(_start)
/* Save multiboot bootloader magic */
mov %eax, %edi
mov %ebx, %esi
mov %eax, %edi
mov %ebx, %esi

mov %cs, %ax
mov %ax, %ds

lgdt boot_gdt_ptr

xor %ax, %ax
inc %ax
lmsw %ax
mov $X86_CR0_PE, %eax
mov %eax, %cr0

ljmp $__KERN_CS32, $.Lprot_mode

.Lprot_mode:
mov $__KERN_DS32, %eax
mov %eax, %ds
mov %eax, %es
mov %eax, %gs
mov %eax, %fs
mov %eax, %ss
mov $__KERN_DS32, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %gs
mov %ax, %fs
mov %ax, %ss
mov $_boot_stack_top, %esp
mov %esp, %ebp

mov %cr4, %eax
or $(X86_CR4_PAE | X86_CR4_PSE), %eax
mov $(X86_CR4_PAE | X86_CR4_PSE), %eax
mov %eax, %cr4

mov $l4_pt_entries, %eax
Expand Down Expand Up @@ -100,17 +98,15 @@ END_FUNC(prot_to_real)

.code64
.Llong_mode:
xor %rax, %rax
mov %rax, %ds
mov %rax, %es
mov %rax, %fs
mov %rax, %gs
mov %rax, %ss

push $X86_EFLAGS_MBS
popf
xor %eax, %eax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %gs
mov %ax, %ss

cld
pushq $X86_EFLAGS_MBS
popfq

jmp kernel_start

Expand Down
4 changes: 2 additions & 2 deletions common/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ int usermode_call(user_func_t fn, void *fn_arg) {
PERCPU_OFFSET(user_stack));
}

static void echo_loop(void) {
static void __noreturn echo_loop(void) {
while (1) {
io_delay();
keyboard_process_keys();
}
}

void __naked kernel_main(void) {
void kernel_main(void) {
printk("\nKTF - Kernel Test Framework!\n\n");

if (kernel_cmdline)
Expand Down
2 changes: 1 addition & 1 deletion include/ktf.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extern bool opt_debug;

extern int usermode_call(user_func_t fn, void *fn_arg);

extern void kernel_main(void);
extern void kernel_main(void) __noreturn;
extern void test_main(void);

#endif /* __ASSEMBLY__ */
Expand Down
2 changes: 1 addition & 1 deletion smp/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static __data_init bool ap_callin;
static __data_init void *ap_new_sp;
cr3_t __data_init ap_cr3;

void __noreturn __naked ap_startup(void) {
void __noreturn ap_startup(void) {
WRITE_SP(ap_new_sp);

init_traps(ap_cpuid);
Expand Down