From c182223b6eb8839fa8d33c2f8049a9a3817e75b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 3 May 2003 16:15:41 +0000 Subject: [PATCH] Updated core/arch/ppc section to be up-to-date again. Note, this only let it build again; it doesn't work yet at all (pretty similar to NewOS change 1772). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3161 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/arch/ppc/Jamfile | 19 ++++++++ src/kernel/core/arch/ppc/arch_cpu.c | 21 ++++---- src/kernel/core/arch/ppc/arch_dbg_console.c | 26 +++++++--- src/kernel/core/arch/ppc/arch_debug.c | 9 ++-- src/kernel/core/arch/ppc/arch_elf.c | 36 ++++++++++++++ src/kernel/core/arch/ppc/arch_faults.c | 6 ++- src/kernel/core/arch/ppc/arch_int.c | 23 ++++++--- src/kernel/core/arch/ppc/arch_smp.c | 23 +++++---- src/kernel/core/arch/ppc/arch_thread.c | 34 +++++++++---- src/kernel/core/arch/ppc/arch_timer.c | 17 +++++-- src/kernel/core/arch/ppc/arch_vm.c | 23 +++++++-- .../core/arch/ppc/arch_vm_translation_map.c | 48 +++++++++++++++---- src/kernel/core/arch/ppc/kernel.ld | 44 ++++++++++++++--- 13 files changed, 261 insertions(+), 68 deletions(-) create mode 100644 src/kernel/core/arch/ppc/Jamfile create mode 100644 src/kernel/core/arch/ppc/arch_elf.c diff --git a/src/kernel/core/arch/ppc/Jamfile b/src/kernel/core/arch/ppc/Jamfile new file mode 100644 index 0000000000..7314e7f02b --- /dev/null +++ b/src/kernel/core/arch/ppc/Jamfile @@ -0,0 +1,19 @@ +SubDir OBOS_TOP src kernel core arch ppc ; + +KernelStaticLibrary libppc : + <$(SOURCE_GRIST)>arch_cpu.c + <$(SOURCE_GRIST)>arch_dbg_console.c + <$(SOURCE_GRIST)>arch_debug.c + <$(SOURCE_GRIST)>arch_elf.c + <$(SOURCE_GRIST)>arch_faults.c + <$(SOURCE_GRIST)>arch_int.c + <$(SOURCE_GRIST)>arch_smp.c + <$(SOURCE_GRIST)>arch_thread.c + <$(SOURCE_GRIST)>arch_timer.c + <$(SOURCE_GRIST)>arch_vm.c + <$(SOURCE_GRIST)>arch_vm_translation_map.c + <$(SOURCE_GRIST)>arch_asm.S +# <$(SOURCE_GRIST)>arch_interrupts.S + : + -fno-pic -Wno-unused + ; diff --git a/src/kernel/core/arch/ppc/arch_cpu.c b/src/kernel/core/arch/ppc/arch_cpu.c index 3838611f80..dbcaf5f064 100755 --- a/src/kernel/core/arch/ppc/arch_cpu.c +++ b/src/kernel/core/arch/ppc/arch_cpu.c @@ -3,8 +3,9 @@ ** Distributed under the terms of the NewOS License. */ -#include -#include + +#include +#include #include @@ -59,11 +60,11 @@ arch_cpu_user_memcpy(void *to, const void *from, size_t size, addr *fault_handle *tmp++ = *s++; *fault_handler = 0; - return 0; + error: *fault_handler = 0; - return ERR_VM_BAD_USER_MEMORY; + return B_BAD_ADDRESS; } @@ -76,11 +77,11 @@ arch_cpu_user_strcpy(char *to, const char *from, addr *fault_handler) ; *fault_handler = 0; - return 0; + error: *fault_handler = 0; - return ERR_VM_BAD_USER_MEMORY; + return B_BAD_ADDRESS; } @@ -93,11 +94,11 @@ arch_cpu_user_strncpy(char *to, const char *from, size_t size, addr *fault_handl ; *fault_handler = 0; - return 0; + error: *fault_handler = 0; - return ERR_VM_BAD_USER_MEMORY; + return B_BAD_ADDRESS; } @@ -112,11 +113,11 @@ arch_cpu_user_memset(void *s, char c, size_t count, addr *fault_handler) *xs++ = c; *fault_handler = 0; - return 0; + error: *fault_handler = 0; - return ERR_VM_BAD_USER_MEMORY; + return B_BAD_ADDRESS; } diff --git a/src/kernel/core/arch/ppc/arch_dbg_console.c b/src/kernel/core/arch/ppc/arch_dbg_console.c index 5c44ffedab..ae64fd0ed8 100755 --- a/src/kernel/core/arch/ppc/arch_dbg_console.c +++ b/src/kernel/core/arch/ppc/arch_dbg_console.c @@ -2,29 +2,43 @@ ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#include + + +#include #include -int arch_dbg_con_init(kernel_args *ka) +#include + + +int +arch_dbg_con_init(kernel_args *ka) { return 0; } -char arch_dbg_con_read() + +char +arch_dbg_con_read() { return 0; } -static void _arch_dbg_con_putch(const char c) + +static void +_arch_dbg_con_putch(const char c) { } -char arch_dbg_con_putch(const char c) + +char +arch_dbg_con_putch(const char c) { return c; } -void arch_dbg_con_puts(const char *s) + +void +arch_dbg_con_puts(const char *s) { } diff --git a/src/kernel/core/arch/ppc/arch_debug.c b/src/kernel/core/arch/ppc/arch_debug.c index c602109b2b..a739cd71aa 100755 --- a/src/kernel/core/arch/ppc/arch_debug.c +++ b/src/kernel/core/arch/ppc/arch_debug.c @@ -2,8 +2,11 @@ ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#include -#include -#include + + +#include +#include +#include + // XXX will put stack trace and disassembly routines here diff --git a/src/kernel/core/arch/ppc/arch_elf.c b/src/kernel/core/arch/ppc/arch_elf.c new file mode 100644 index 0000000000..73e9865106 --- /dev/null +++ b/src/kernel/core/arch/ppc/arch_elf.c @@ -0,0 +1,36 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include + +#include +#include + +#define ELF_TRACE 0 +#if ELF_TRACE +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + + +int +arch_elf_relocate_rel(struct elf_image_info *image, const char *sym_prepend, + struct elf_image_info *resolve_image, struct Elf32_Rel *rel, int rel_len) +{ + dprintf("arch_elf_relocate_rel: not supported on PPC\n"); + return B_ERROR; +} + + +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) +{ + dprintf("arch_elf_relocate_rela: not supported on PPC\n"); + return B_ERROR; +} + diff --git a/src/kernel/core/arch/ppc/arch_faults.c b/src/kernel/core/arch/ppc/arch_faults.c index 67698c01a5..bea483a18f 100755 --- a/src/kernel/core/arch/ppc/arch_faults.c +++ b/src/kernel/core/arch/ppc/arch_faults.c @@ -2,9 +2,13 @@ ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ + + #include -int arch_faults_init(kernel_args *ka) + +int +arch_faults_init(kernel_args *ka) { return 0; } diff --git a/src/kernel/core/arch/ppc/arch_int.c b/src/kernel/core/arch/ppc/arch_int.c index 16b36a8e35..bc74d33c6a 100755 --- a/src/kernel/core/arch/ppc/arch_int.c +++ b/src/kernel/core/arch/ppc/arch_int.c @@ -2,31 +2,42 @@ ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ + + #include +#include -#include -bool arch_int_is_interrupts_enabled(void) +bool +arch_int_is_interrupts_enabled(void) { return true; } -void arch_int_enable_io_interrupt(int irq) + +void +arch_int_enable_io_interrupt(int irq) { return; } -void arch_int_disable_io_interrupt(int irq) + +void +arch_int_disable_io_interrupt(int irq) { return; } -int arch_int_init(kernel_args *ka) + +int +arch_int_init(kernel_args *ka) { return 0; } -int arch_int_init2(kernel_args *ka) + +int +arch_int_init2(kernel_args *ka) { return 0; } diff --git a/src/kernel/core/arch/ppc/arch_smp.c b/src/kernel/core/arch/ppc/arch_smp.c index e4970229d1..a94271f9c3 100755 --- a/src/kernel/core/arch/ppc/arch_smp.c +++ b/src/kernel/core/arch/ppc/arch_smp.c @@ -2,26 +2,31 @@ ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ + + +#include + #include -#include -#include +#include +#include -int arch_smp_init(kernel_args *ka) + +int +arch_smp_init(kernel_args *ka) { return 0; } -int arch_smp_get_current_cpu() -{ - return 0; -} -void arch_smp_send_ici(int target_cpu) +void +arch_smp_send_ici(int target_cpu) { panic("called arch_smp_send_ici!\n"); } -void arch_smp_send_broadcast_ici() + +void +arch_smp_send_broadcast_ici() { panic("called arch_smp_send_broadcast_ici\n"); } diff --git a/src/kernel/core/arch/ppc/arch_thread.c b/src/kernel/core/arch/ppc/arch_thread.c index 27d490755b..62b7f9d552 100755 --- a/src/kernel/core/arch/ppc/arch_thread.c +++ b/src/kernel/core/arch/ppc/arch_thread.c @@ -2,38 +2,54 @@ ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#include -#include + + +#include +#include #include -int arch_proc_init_proc_struct(struct proc *p, bool kernel) + +int +arch_team_init_team_struct(struct team *team, bool kernel) { return 0; } -int arch_thread_init_thread_struct(struct thread *t) + +int +arch_thread_init_thread_struct(struct thread *t) { return 0; } -int arch_thread_initialize_kthread_stack(struct thread *t, int (*start_func)(void), void (*entry_func)(void), void (*exit_func)(void)) + +int +arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void), void (*entry_func)(void), void (*exit_func)(void)) { return 0; } -void arch_thread_switch_kstack_and_call(struct thread *t, addr new_kstack, void (*func)(void *), void *arg) + +void +arch_thread_switch_kstack_and_call(struct thread *t, addr new_kstack, void (*func)(void *), void *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) { } -void arch_thread_dump_info(void *info) + +void +arch_thread_dump_info(void *info) { } -void arch_thread_enter_uspace(addr entry, addr ustack_top) + +void +arch_thread_enter_uspace(struct thread *thread, addr entry, void *arg1, void *arg2) { } diff --git a/src/kernel/core/arch/ppc/arch_timer.c b/src/kernel/core/arch/ppc/arch_timer.c index dfa3e87971..2a4a44d14e 100755 --- a/src/kernel/core/arch/ppc/arch_timer.c +++ b/src/kernel/core/arch/ppc/arch_timer.c @@ -2,20 +2,27 @@ ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ + + #include -#include +#include +#include -#include -void arch_timer_set_hardware_timer(time_t timeout) +void +arch_timer_set_hardware_timer(bigtime_t timeout) { } -void arch_timer_clear_hardware_timer() + +void +arch_timer_clear_hardware_timer() { } -int arch_init_timer(kernel_args *ka) + +int +arch_init_timer(kernel_args *ka) { return 0; } diff --git a/src/kernel/core/arch/ppc/arch_vm.c b/src/kernel/core/arch/ppc/arch_vm.c index 564d75897c..7e29c15a16 100755 --- a/src/kernel/core/arch/ppc/arch_vm.c +++ b/src/kernel/core/arch/ppc/arch_vm.c @@ -2,21 +2,36 @@ ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#include + + +#include #include +#include -int arch_vm_init(kernel_args *ka) + +int +arch_vm_init(kernel_args *ka) { return 0; } -int arch_vm_init2(kernel_args *ka) + +int +arch_vm_init2(kernel_args *ka) { return 0; } -int arch_vm_init_endvm(kernel_args *ka) + +int +arch_vm_init_endvm(kernel_args *ka) { return 0; } + +void +arch_vm_aspace_swap(vm_address_space *aspace) +{ +} + diff --git a/src/kernel/core/arch/ppc/arch_vm_translation_map.c b/src/kernel/core/arch/ppc/arch_vm_translation_map.c index 4e97941fea..ca3a97a7e9 100755 --- a/src/kernel/core/arch/ppc/arch_vm_translation_map.c +++ b/src/kernel/core/arch/ppc/arch_vm_translation_map.c @@ -2,10 +2,13 @@ ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#include -#include + + +#include +#include #include + static int lock_tmap(vm_translation_map *map) { return 0; @@ -46,16 +49,34 @@ static int protect_tmap(vm_translation_map *map, addr base, addr top, unsigned i return -1; } -static int get_physical_page_tmap(addr pa, addr *va, int flags) + +static int +clear_flags_tmap(vm_translation_map *map, addr va, unsigned int flags) { return 0; } -static int put_physical_page_tmap(addr va) + +static void +flush_tmap(vm_translation_map *map) +{ +} + + +static int +get_physical_page_tmap(addr pa, addr *va, int flags) { return 0; } + +static int +put_physical_page_tmap(addr va) +{ + return 0; +} + + static vm_translation_map_ops tmap_ops = { destroy_tmap, lock_tmap, @@ -65,26 +86,35 @@ static vm_translation_map_ops tmap_ops = { query_tmap, get_mapped_size_tmap, protect_tmap, + clear_flags_tmap, + flush_tmap, get_physical_page_tmap, put_physical_page_tmap }; -int vm_translation_map_create(vm_translation_map *new_map, bool kernel) + +int +vm_translation_map_create(vm_translation_map *new_map, bool kernel) { return 0; } -int vm_translation_map_module_init(kernel_args *ka) + +int +vm_translation_map_module_init(kernel_args *ka) { return 0; } -void vm_translation_map_module_init_post_sem(kernel_args *ka) + +void +vm_translation_map_module_init_post_sem(kernel_args *ka) { - return 0; } -int vm_translation_map_module_init2(kernel_args *ka) + +int +vm_translation_map_module_init2(kernel_args *ka) { return 0; } diff --git a/src/kernel/core/arch/ppc/kernel.ld b/src/kernel/core/arch/ppc/kernel.ld index f44b23950d..db33dc3b7d 100755 --- a/src/kernel/core/arch/ppc/kernel.ld +++ b/src/kernel/core/arch/ppc/kernel.ld @@ -7,12 +7,35 @@ SECTIONS { . = 0x80000000 + SIZEOF_HEADERS; - /* text/read-only data */ - .text : { *(.text .gnu.linkonce.t.*) } + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0x9090 + .plt : { *(.plt) } - __ctor_list = .; - .ctors : { *(.ctors) } - __ctor_end = .; + /* text/read-only data */ + .text : { *(.text .gnu.linkonce.t.*) } =0x9090 .rodata : { *(.rodata) } @@ -21,6 +44,15 @@ SECTIONS __data_start = .; .data : { *(.data .gnu.linkonce.d.*) } + __ctor_list = .; + .ctors : { *(.ctors) } + __ctor_end = .; + __dtor_list = .; + .dtors : { *(.dtors) } + __dtor_end = .; + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* unintialized data (in same segment as writable data) */ __bss_start = .; .bss : { *(.bss) } @@ -29,5 +61,5 @@ SECTIONS _end = . ; /* Strip unnecessary stuff */ - /DISCARD/ : { *(.comment .note .eh_frame .dtors) } + /DISCARD/ : { *(.comment .note .eh_frame) } }