diff --git a/headers/private/kernel/arch/cpu.h b/headers/private/kernel/arch/cpu.h index 57fe19a384..969a9c7bff 100644 --- a/headers/private/kernel/arch/cpu.h +++ b/headers/private/kernel/arch/cpu.h @@ -8,7 +8,7 @@ #include #include -#include +#include #define PAGE_ALIGN(x) (((x) + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1)) diff --git a/headers/private/kernel/arch/dbg_console.h b/headers/private/kernel/arch/dbg_console.h index fa0480df49..35be3ce5ba 100644 --- a/headers/private/kernel/arch/dbg_console.h +++ b/headers/private/kernel/arch/dbg_console.h @@ -2,15 +2,14 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#ifndef _NEWOS_KERNEL_ARCH_DBG_CONSOLE -#define _NEWOS_KERNEL_ARCH_DBG_CONSOLE +#ifndef KERNEL_DBG_CONSOLE_H +#define KERNEL_DBG_CONSOLE_H -#include +struct kernel_args; char arch_dbg_con_read(void); char arch_dbg_con_putch(char c); void arch_dbg_con_puts(const char *s); -int arch_dbg_con_init(kernel_args *ka); - -#endif +int arch_dbg_con_init(struct kernel_args *ka); +#endif /* KERNEL_DBG_CONSOLE_H */ diff --git a/headers/private/kernel/arch/debug.h b/headers/private/kernel/arch/debug.h index 14c43bd8f6..4ad968ce6d 100644 --- a/headers/private/kernel/arch/debug.h +++ b/headers/private/kernel/arch/debug.h @@ -6,5 +6,6 @@ #define _KERNEL_ARCH_DEBUG_H int arch_dbg_init(kernel_args *ka); +void arch_dbg_save_registers(int *); #endif /* _KERNEL_ARCH_DEBUG_H */ diff --git a/headers/private/kernel/arch/elf.h b/headers/private/kernel/arch/elf.h index 130ce3362e..181b59e7a0 100644 --- a/headers/private/kernel/arch/elf.h +++ b/headers/private/kernel/arch/elf.h @@ -14,6 +14,6 @@ extern int arch_elf_relocate_rel(struct elf_image_info *image, const char *sym_p extern int arch_elf_relocate_rela(struct elf_image_info *image, const char *sym_prepend, struct elf_image_info *resolve_image, struct Elf32_Rela *rel, int rel_len); -//#include +#include #endif /* _KERNEL_ARCH_ELF_H */ diff --git a/headers/private/kernel/arch/faults.h b/headers/private/kernel/arch/faults.h index 3356a0b53b..505b5abec5 100644 --- a/headers/private/kernel/arch/faults.h +++ b/headers/private/kernel/arch/faults.h @@ -2,13 +2,12 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#ifndef _NEWOS_KERNEL_ARCH_FAULTS -#define _NEWOS_KERNEL_ARCH_FAULTS +#ifndef KERNEL_ARCH_FAULTS_H +#define KERNEL_ARCH_FAULTS_H -#include +struct kernel_args; int faults_init(kernel_args *ka); int arch_faults_init(kernel_args *ka); -#endif - +#endif /* KERNEL_ARCH_FAULTS_H */ diff --git a/headers/private/kernel/arch/int.h b/headers/private/kernel/arch/int.h index 21ab56d9ae..3841afd7a3 100644 --- a/headers/private/kernel/arch/int.h +++ b/headers/private/kernel/arch/int.h @@ -2,11 +2,10 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#ifndef _NEWOS_KERNEL_ARCH_INT_H -#define _NEWOS_KERNEL_ARCH_INT_H +#ifndef KERNEL_ARCH_INT_H +#define KERNEL_ARCH_INT_H -#include -#include +#include int arch_int_init(kernel_args *ka); int arch_int_init2(kernel_args *ka); @@ -18,5 +17,4 @@ void arch_int_enable_io_interrupt(int irq); void arch_int_disable_io_interrupt(int irq); bool arch_int_is_interrupts_enabled(void); -#endif - +#endif /* KERNEL_ARCH_INT_H */ diff --git a/headers/private/kernel/arch/smp.h b/headers/private/kernel/arch/smp.h index 995a1f9f42..945dd53b17 100644 --- a/headers/private/kernel/arch/smp.h +++ b/headers/private/kernel/arch/smp.h @@ -2,18 +2,20 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#ifndef _NEWOS_KERNEL_ARCH_SMP_H -#define _NEWOS_KERNEL_ARCH_SMP_H +#ifndef KERNEL_ARCH_SMP_H +#define KERNEL_ARCH_SMP_H + #include -#include + +struct kernel_args; + // must match MAX_BOOT_CPUS in stage2.h #define SMP_MAX_CPUS MAX_BOOT_CPUS -int arch_smp_init(kernel_args *ka); +int arch_smp_init(struct kernel_args *ka); void arch_smp_send_ici(int target_cpu); void arch_smp_send_broadcast_ici(void); -#endif - +#endif /* KERNEL_ARCH_SMP_H */ diff --git a/headers/private/kernel/arch/sparc/stand.h b/headers/private/kernel/arch/sparc/stand.h index 34cb2de057..e84234c41c 100644 --- a/headers/private/kernel/arch/sparc/stand.h +++ b/headers/private/kernel/arch/sparc/stand.h @@ -37,7 +37,6 @@ */ #include -#include #include #ifdef __STDC__ #include diff --git a/headers/private/kernel/arch/thread.h b/headers/private/kernel/arch/thread.h index d3329735eb..ada448c425 100644 --- a/headers/private/kernel/arch/thread.h +++ b/headers/private/kernel/arch/thread.h @@ -2,8 +2,8 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#ifndef _KERNEL_ARCH_THREAD_H -#define _KERNEL_ARCH_THREAD_H +#ifndef KERNEL_ARCH_THREAD_H +#define KERNEL_ARCH_THREAD_H #include @@ -16,8 +16,13 @@ void arch_thread_dump_info(void *info); void arch_thread_enter_uspace(struct thread *t, addr entry, void *args1, void *args2); void arch_thread_switch_kstack_and_call(struct thread *t, addr new_kstack, void (*func)(void *), void *arg); -//struct thread *arch_thread_get_current_thread(void); -//void arch_thread_set_current_thread(struct thread *t); +// ToDo: doing this this way is an ugly hack - please fix me! +// (those functions are "static inline" for x86 - since +// "extern inline" doesn't work for "gcc -g"...) +#ifndef ARCH_x86 +struct thread *arch_thread_get_current_thread(void); +void arch_thread_set_current_thread(struct thread *t); +#endif void arch_setup_signal_frame(struct thread *t, struct sigaction *sa, int sig, int sig_mask); int64 arch_restore_signal_frame(void); @@ -26,4 +31,4 @@ void arch_check_syscall_restart(struct thread *t); // for any inline overrides #include -#endif /* _KERNEL_ARCH_THREAD_H */ +#endif /* KERNEL_ARCH_THREAD_H */ diff --git a/headers/private/kernel/arch/thread_struct.h b/headers/private/kernel/arch/thread_struct.h index bd50bd7c19..783af66278 100644 --- a/headers/private/kernel/arch/thread_struct.h +++ b/headers/private/kernel/arch/thread_struct.h @@ -2,8 +2,8 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#ifndef _NEWOS_KERNEL_ARCH_THREAD_STRUCT_H -#define _NEWOS_KERNEL_ARCH_THREAD_STRUCT_H +#ifndef KERNEL_ARCH_THREAD_STRUCT_H +#define KERNEL_ARCH_THREAD_STRUCT_H #ifdef ARCH_x86 #include @@ -27,5 +27,4 @@ #include #endif -#endif - +#endif /* KERNEL_ARCH_THREAD_STRUCT_H */ diff --git a/headers/private/kernel/arch/timer.h b/headers/private/kernel/arch/timer.h index 11a4b293ef..d5ef94d164 100644 --- a/headers/private/kernel/arch/timer.h +++ b/headers/private/kernel/arch/timer.h @@ -2,14 +2,16 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#ifndef _NEWOS_KERNEL_ARCH_TIMER_H -#define _NEWOS_KERNEL_ARCH_TIMER_H +#ifndef KERNEL_ARCH_TIMER_H +#define KERNEL_ARCH_TIMER_H + +#include + +struct kernel_args; -#include void arch_timer_set_hardware_timer(bigtime_t timeout); void arch_timer_clear_hardware_timer(void); -int arch_init_timer(kernel_args *ka); - -#endif +int arch_init_timer(struct kernel_args *ka); +#endif /* KERNEL_ARCH_TIMER_H */ diff --git a/headers/private/kernel/arch/vm.h b/headers/private/kernel/arch/vm.h index ac640dc506..7c127d9e3f 100644 --- a/headers/private/kernel/arch/vm.h +++ b/headers/private/kernel/arch/vm.h @@ -2,16 +2,17 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#ifndef _NEWOS_KERNEL_ARCH_VM_H -#define _NEWOS_KERNEL_ARCH_VM_H +#ifndef KERNEL_ARCH_VM_H +#define KERNEL_ARCH_VM_H -#include #include -int arch_vm_init(kernel_args *ka); -int arch_vm_init2(kernel_args *ka); -int arch_vm_init_endvm(kernel_args *ka); +struct kernel_args; + + +int arch_vm_init(struct kernel_args *ka); +int arch_vm_init2(struct kernel_args *ka); +int arch_vm_init_endvm(struct kernel_args *ka); void arch_vm_aspace_swap(vm_address_space *aspace); -#endif - +#endif /* KERNEL_ARCH_VM_H */ diff --git a/headers/private/kernel/arch/vm_translation_map.h b/headers/private/kernel/arch/vm_translation_map.h index 191895e22c..20e9471bc6 100644 --- a/headers/private/kernel/arch/vm_translation_map.h +++ b/headers/private/kernel/arch/vm_translation_map.h @@ -2,13 +2,16 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#ifndef _NEWOS_KERNEL_ARCH_VM_TRANSLATION_MAP_H -#define _NEWOS_KERNEL_ARCH_VM_TRANSLATION_MAP_H +#ifndef KERNEL_ARCH_VM_TRANSLATION_MAP_H +#define KERNEL_ARCH_VM_TRANSLATION_MAP_H + #include -#include #include +struct kernel_args; + + typedef struct vm_translation_map_struct { struct vm_translation_map_struct *next; struct vm_translation_map_ops_struct *ops; @@ -34,15 +37,16 @@ typedef struct vm_translation_map_ops_struct { } vm_translation_map_ops; int vm_translation_map_create(vm_translation_map *new_map, bool kernel); -int vm_translation_map_module_init(kernel_args *ka); -int vm_translation_map_module_init2(kernel_args *ka); -void vm_translation_map_module_init_post_sem(kernel_args *ka); +int vm_translation_map_module_init(struct kernel_args *ka); +int vm_translation_map_module_init2(struct kernel_args *ka); +void vm_translation_map_module_init_post_sem(struct kernel_args *ka); // quick function to map a page in regardless of map context. Used in VM initialization, // before most vm data structures exist -int vm_translation_map_quick_map(kernel_args *ka, addr va, addr pa, unsigned int attributes, addr (*get_free_page)(kernel_args *)); +int vm_translation_map_quick_map(struct kernel_args *ka, addr va, addr pa, + unsigned int attributes, addr (*get_free_page)(kernel_args *)); // quick function to return the physical pgdir of a mapping, needed for a context switch addr vm_translation_map_get_pgdir(vm_translation_map *map); -#endif +#endif /* KERNEL_VM_TRANSLATION_MAP_H */