From 2dfb833f4ba5560150ae8064f5e99a9dc75026d0 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Mon, 26 May 2008 06:28:23 +0000 Subject: [PATCH] get the kernel building again (definitely doesn't work) add it to the bootmaker image git-svn-id: svn+ssh://newos.org/var/svn/newos/newos@1247 c25cc9d1-44fa-0310-b259-ad778cb1d433 --- boot/pc/x86_64/dummy.ini | 6 +++--- boot/pc/x86_64/makefile | 2 +- kernel/arch/x86_64/arch_cpu.c | 9 ++++++++- kernel/arch/x86_64/arch_interrupts.S | 4 ---- kernel/arch/x86_64/arch_thread.c | 9 +++++++-- kernel/arch/x86_64/arch_time.c | 17 +++++------------ kernel/arch/x86_64/kernel.ld | 3 +-- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/boot/pc/x86_64/dummy.ini b/boot/pc/x86_64/dummy.ini index 93b3ae2..e903f4b 100644 --- a/boot/pc/x86_64/dummy.ini +++ b/boot/pc/x86_64/dummy.ini @@ -4,9 +4,9 @@ # at 0x80000000 and then jumps to the kernel entrypoint where things # really start happening. This MUST be the first entry in the .ini # -#[kernel] -#type=elf32 -#file=build/x86_64-pc/kernel/kernel +[kernel] +type=elf64 +file=build/x86_64-pc/kernel/kernel [bootscript] type=text diff --git a/boot/pc/x86_64/makefile b/boot/pc/x86_64/makefile index db0471f..426d482 100644 --- a/boot/pc/x86_64/makefile +++ b/boot/pc/x86_64/makefile @@ -46,7 +46,7 @@ CONFIG_FILE := $(BOOT_SRCDIR)/dummy.ini $(FINAL): $(LOADER) $(OBJCOPY) -O binary $< $@ -$(FINAL).bootmaker.gz: $(TOOLS) $(CONFIG_FILE) +$(FINAL).bootmaker.gz: $(TOOLS) $(CONFIG_FILE) $(KERNEL) @echo creating $@ @$(MKDIR) @$(BOOTMAKER) --strip-debug --strip-binary $(STRIP) $(CONFIG_FILE) -o $(FINAL).bootmaker diff --git a/kernel/arch/x86_64/arch_cpu.c b/kernel/arch/x86_64/arch_cpu.c index c912ca1..0c3c42c 100644 --- a/kernel/arch/x86_64/arch_cpu.c +++ b/kernel/arch/x86_64/arch_cpu.c @@ -43,6 +43,13 @@ int arch_cpu_init(kernel_args *ka) return 0; } +int arch_cpu_init_percpu(kernel_args *ka, int curr_cpu) +{ +// detect_cpu(ka, curr_cpu); + + return 0; +} + int arch_cpu_init2(kernel_args *ka) { region_id rid; @@ -131,7 +138,7 @@ void reboot(void) { static uint16 null_idt_descr[3]; - asm("lidt %0" : : "m" (null_idt_descr)); +// asm("lidt %0" : : "m" (null_idt_descr)); asm("int $0"); for(;;); } diff --git a/kernel/arch/x86_64/arch_interrupts.S b/kernel/arch/x86_64/arch_interrupts.S index a0fa691..0dbe56b 100644 --- a/kernel/arch/x86_64/arch_interrupts.S +++ b/kernel/arch/x86_64/arch_interrupts.S @@ -93,8 +93,6 @@ int_bottom: push %r13 push %r14 push %r15 - push %ds - push %es push %fs push %gs cld @@ -103,8 +101,6 @@ int_bottom: pop %gs pop %fs - pop %es - pop %ds pop %r15 pop %r14 pop %r13 diff --git a/kernel/arch/x86_64/arch_thread.c b/kernel/arch/x86_64/arch_thread.c index 6ae3d79..0da846d 100644 --- a/kernel/arch/x86_64/arch_thread.c +++ b/kernel/arch/x86_64/arch_thread.c @@ -1,5 +1,5 @@ /* -** Copyright 2001-2004, Travis Geiselbrecht. All rights reserved. +** Copyright 2001-2008, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ #include @@ -16,6 +16,11 @@ extern void x86_64_return_from_signal(void); extern void x86_64_end_return_from_signal(void); +int arch_thread_init(kernel_args *ka) +{ + return 0; +} + int arch_proc_init_proc_struct(struct proc *p, bool kernel) { return 0; @@ -82,7 +87,7 @@ void arch_thread_switch_kstack_and_call(addr_t new_kstack, void (*func)(void *), x86_64_switch_stack_and_call(new_kstack, func, arg); } -void arch_thread_context_switch(struct thread *t_from, struct thread *t_to) +void arch_thread_context_switch(struct thread *t_from, struct thread *t_to, struct vm_translation_map_struct *new_tmap) { addr_t new_pgdir; #if 0 diff --git a/kernel/arch/x86_64/arch_time.c b/kernel/arch/x86_64/arch_time.c index fb2000e..c9fe00f 100644 --- a/kernel/arch/x86_64/arch_time.c +++ b/kernel/arch/x86_64/arch_time.c @@ -1,5 +1,5 @@ /* -** Copyright 2003-2004, Travis Geiselbrecht. All rights reserved. +** Copyright 2003-2008, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ #include @@ -9,21 +9,17 @@ #include static uint64 last_rdtsc; -static bool use_rdtsc; int arch_time_init(kernel_args *ka) { last_rdtsc = 0; - use_rdtsc = ka->arch_args.supports_rdtsc; - return 0; } void arch_time_tick(void) { - if(use_rdtsc) - last_rdtsc = x86_64_rdtsc(); + last_rdtsc = x86_64_rdtsc(); } void setup_system_time(unsigned int cv_factor) @@ -40,13 +36,10 @@ bigtime_t x86_64_cycles_to_time(uint64 cycles) bigtime_t arch_get_time_delta(void) { - if(use_rdtsc) { - // XXX race here - uint64 delta_rdtsc = x86_64_rdtsc() - last_rdtsc; + // XXX race here + uint64 delta_rdtsc = x86_64_rdtsc() - last_rdtsc; - return x86_64_cycles_to_time(delta_rdtsc); - } else - return 0; + return x86_64_cycles_to_time(delta_rdtsc); } /* MC146818 RTC code */ diff --git a/kernel/arch/x86_64/kernel.ld b/kernel/arch/x86_64/kernel.ld index c9eece4..9521cf3 100644 --- a/kernel/arch/x86_64/kernel.ld +++ b/kernel/arch/x86_64/kernel.ld @@ -5,8 +5,7 @@ ENTRY(_start) SEARCH_DIR("libgcc"); SECTIONS { -/* . = 0xffffffff80000000 + SIZEOF_HEADERS; */ - . = 0xffff800000000000 + SIZEOF_HEADERS; + . = 0xffffffff80000000 + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } -- 2.11.4.GIT