diff --git a/headers/private/kernel/arch/sh4/cpu.h b/headers/private/kernel/arch/sh4/cpu.h index b42e34653f..6a30111da1 100644 --- a/headers/private/kernel/arch/sh4/cpu.h +++ b/headers/private/kernel/arch/sh4/cpu.h @@ -16,7 +16,6 @@ void sh4_set_kstack(addr kstack); void sh4_enter_uspace(addr entry, void *args, addr ustack_top); void sh4_set_user_pgdir(addr pgdir); void sh4_invl_page(addr va); -void sh4_switch_stack_and_call(addr stack, void (*func)(void *), void *arg); #define PAGE_SIZE 4096 #define _BIG_ENDIAN 0 diff --git a/headers/private/kernel/arch/thread.h b/headers/private/kernel/arch/thread.h index 012411fe7c..174a61c629 100644 --- a/headers/private/kernel/arch/thread.h +++ b/headers/private/kernel/arch/thread.h @@ -26,8 +26,6 @@ status_t arch_thread_init_kthread_stack(struct thread *t, void arch_thread_dump_info(void *info); status_t arch_thread_enter_userspace(struct thread *t, addr_t entry, void *args1, void *args2); -void arch_thread_switch_kstack_and_call(struct thread *t, addr_t new_kstack, - void (*func)(void *), void *arg); bool arch_on_signal_stack(struct thread *thread); status_t arch_setup_signal_frame(struct thread *t, struct sigaction *sa, diff --git a/headers/private/kernel/arch/x86/arch_cpu.h b/headers/private/kernel/arch/x86/arch_cpu.h index c3efa42d89..06fb338fbb 100644 --- a/headers/private/kernel/arch/x86/arch_cpu.h +++ b/headers/private/kernel/arch/x86/arch_cpu.h @@ -270,7 +270,6 @@ void x86_userspace_thread_exit(void); void x86_end_userspace_thread_exit(void); void x86_enter_userspace(addr_t entry, addr_t stackTop); void i386_set_tss_and_kstack(addr_t kstack); -void i386_switch_stack_and_call(addr_t stack, void (*func)(void*), void* arg); void i386_swap_pgdir(addr_t newPageDir); void i386_fnsave(void* fpuState); void i386_fxsave(void* fpuState); diff --git a/src/system/kernel/arch/arm/arch_thread.cpp b/src/system/kernel/arch/arm/arch_thread.cpp index 9f4c966acf..71618f60e9 100644 --- a/src/system/kernel/arch/arm/arch_thread.cpp +++ b/src/system/kernel/arch/arm/arch_thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007, Haiku Inc. All rights reserved. + * Copyright 2003-2010, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -11,6 +11,7 @@ * Distributed under the terms of the NewOS License. */ + #include #include @@ -113,15 +114,6 @@ arch_thread_init_tls(struct thread *thread) } -void -arch_thread_switch_kstack_and_call(struct thread *t, addr_t newKstack, - void (*func)(void *), void *arg) -{ -#warning ARM:WRITEME -// m68k_switch_stack_and_call(newKstack, func, arg); -} - - void arch_thread_context_switch(struct thread *from, struct thread *to) { diff --git a/src/system/kernel/arch/m68k/arch_asm.S b/src/system/kernel/arch/m68k/arch_asm.S index 0f87af2cd3..280b23ab25 100644 --- a/src/system/kernel/arch/m68k/arch_asm.S +++ b/src/system/kernel/arch/m68k/arch_asm.S @@ -1,11 +1,9 @@ /* - * Copyright 2006, Ingo Weinhold . - * All rights reserved. Distributed under the terms of the MIT License. - * * Copyright 2003, Travis Geiselbrecht. All rights reserved. * Distributed under the terms of the NewOS License. */ + #include #include @@ -26,7 +24,7 @@ FUNCTION(arch_int_enable_interrupts): FUNCTION_END(arch_int_enable_interrupts) -/* int arch_int_disable_interrupts(void) +/* int arch_int_disable_interrupts(void) */ FUNCTION(arch_int_disable_interrupts): clr.l %d0 @@ -41,7 +39,7 @@ FUNCTION(arch_int_disable_interrupts): FUNCTION_END(arch_int_disable_interrupts) -/* void arch_int_restore_interrupts(int oldState) +/* void arch_int_restore_interrupts(int oldState) */ FUNCTION(arch_int_restore_interrupts): move.l (4,%a7),%d0 @@ -97,7 +95,7 @@ FUNCTION(m68k_context_switch): #warning M68K: use fixed size for fsave // XXX - + frestore (%sp)+ fmovem (%sp)+,%fp0-%fp7 movem.l (%sp)+,%d0-%d7/%a0-%a7 @@ -107,21 +105,6 @@ FUNCTION(m68k_context_switch): FUNCTION_END(m68k_context_switch) -// void m68k_switch_stack_and_call(addr_t newKstack, -// void (*func)(void *), void *arg) -FUNCTION(m68k_switch_stack_and_call): -#warning M68K: check - move.l 4(%sp),%a0 // new stack - move.l 8(%sp),%a1 // func - move.l 12(%sp),%d0 // args - move.l %a0,%sp // switch the stack - move.l %d0,-(%sp) // push the argument - jsr (%a1) // call the target function -_loop: - bra _loop -FUNCTION_END(m68k_switch_stack_and_call) - - // m68k_kernel_thread_root(): parameters in r13-r15, the functions to call // (in that order). The function is used when spawing threads. It usually calls // an initialization function, the actual thread function, and a function that diff --git a/src/system/kernel/arch/m68k/arch_thread.cpp b/src/system/kernel/arch/m68k/arch_thread.cpp index e61ebe035d..8fff2e83b7 100644 --- a/src/system/kernel/arch/m68k/arch_thread.cpp +++ b/src/system/kernel/arch/m68k/arch_thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007, Haiku Inc. All rights reserved. + * Copyright 2003-2010, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -11,6 +11,7 @@ * Distributed under the terms of the NewOS License. */ + #include #include @@ -35,9 +36,6 @@ struct thread *gCurrentThread; // Helper function for thread creation, defined in arch_asm.S. extern "C" void m68k_kernel_thread_root(); -extern "C" void m68k_switch_stack_and_call(addr_t newKstack, - void (*func)(void *), void *arg); - void m68k_push_iframe(struct iframe_stack *stack, struct iframe *frame) @@ -199,14 +197,6 @@ arch_thread_init_tls(struct thread *thread) } -void -arch_thread_switch_kstack_and_call(struct thread *t, addr_t newKstack, - void (*func)(void *), void *arg) -{ - m68k_switch_stack_and_call(newKstack, func, arg); -} - - void arch_thread_context_switch(struct thread *from, struct thread *to) { diff --git a/src/system/kernel/arch/mipsel/arch_thread.cpp b/src/system/kernel/arch/mipsel/arch_thread.cpp index ce4046b120..3c25b8e37f 100644 --- a/src/system/kernel/arch/mipsel/arch_thread.cpp +++ b/src/system/kernel/arch/mipsel/arch_thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2009 Haiku Inc. All rights reserved. + * Copyright 2003-2010 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -103,14 +103,6 @@ arch_thread_init_tls(struct thread *thread) } -void -arch_thread_switch_kstack_and_call(struct thread *t, addr_t newKstack, - void (*func)(void *), void *arg) -{ -#warning IMPLEMENT arch_thread_switch_kstack_and_call -} - - void arch_thread_context_switch(struct thread *from, struct thread *to) { diff --git a/src/system/kernel/arch/ppc/arch_asm.S b/src/system/kernel/arch/ppc/arch_asm.S index ec8a454410..2a07bdc781 100644 --- a/src/system/kernel/arch/ppc/arch_asm.S +++ b/src/system/kernel/arch/ppc/arch_asm.S @@ -1,11 +1,12 @@ /* - * Copyright 2006, Ingo Weinhold . + * Copyright 2006-2010, Ingo Weinhold . * All rights reserved. Distributed under the terms of the MIT License. * * Copyright 2003, Travis Geiselbrecht. All rights reserved. * Distributed under the terms of the NewOS License. */ + #define FUNCTION(x) .global x; .type x,@function; x #define MSR_EXCEPTIONS_ENABLED 15 @@ -30,7 +31,7 @@ FUNCTION(arch_int_enable_interrupts): blr -/* int arch_int_disable_interrupts(void) +/* int arch_int_disable_interrupts(void) * r3 */ FUNCTION(arch_int_disable_interrupts): @@ -45,7 +46,7 @@ FUNCTION(arch_int_disable_interrupts): blr -/* void arch_int_restore_interrupts(int oldState) +/* void arch_int_restore_interrupts(int oldState) * r3 */ FUNCTION(arch_int_restore_interrupts): @@ -61,7 +62,7 @@ FUNCTION(arch_int_restore_interrupts): /* bool arch_int_are_interrupts_enabled(void) */ FUNCTION(arch_int_are_interrupts_enabled): mfmsr %r3 // load msr - extrwi %r3, %r3, 1, 31 - MSR_EXCEPTIONS_ENABLED + extrwi %r3, %r3, 1, 31 - MSR_EXCEPTIONS_ENABLED // mask out the EE bit blr @@ -195,7 +196,7 @@ FUNCTION(setl2cr): isync blr - + // void ppc_context_switch(addr_t *old_sp, addr_t new_sp); FUNCTION(ppc_context_switch): @@ -306,21 +307,12 @@ FUNCTION(ppc_context_switch): lfdu %f29, 8(%r1) lfdu %f30, 8(%r1) lfdu %f31, 8(%r1) - + addi %r1, %r1, 8 blr -// void ppc_switch_stack_and_call(addr_t newKstack, -// void (*func)(void *), void *arg) -FUNCTION(ppc_switch_stack_and_call): - mr %r1, %r3 // set the new stack pointer - mtctr %r4 // move the target function into CTR - mr %r3, %r5 // move the arg to this func to the new arg - bctr - - // ppc_kernel_thread_root(): parameters in r13-r15, the functions to call // (in that order). The function is used when spawing threads. It usually calls // an initialization function, the actual thread function, and a function that diff --git a/src/system/kernel/arch/ppc/arch_thread.cpp b/src/system/kernel/arch/ppc/arch_thread.cpp index 0c42445bd1..cbb0a803a9 100644 --- a/src/system/kernel/arch/ppc/arch_thread.cpp +++ b/src/system/kernel/arch/ppc/arch_thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007, Haiku Inc. All rights reserved. + * Copyright 2003-2010, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -10,6 +10,7 @@ * Distributed under the terms of the NewOS License. */ + #include #include @@ -30,9 +31,6 @@ static struct arch_thread sInitialState; // Helper function for thread creation, defined in arch_asm.S. extern "C" void ppc_kernel_thread_root(); -extern "C" void ppc_switch_stack_and_call(addr_t newKstack, void (*func)(void *), - void *arg); - void ppc_push_iframe(struct iframe_stack *stack, struct iframe *frame) @@ -169,14 +167,6 @@ arch_thread_init_tls(struct thread *thread) } -void -arch_thread_switch_kstack_and_call(struct thread *t, addr_t newKstack, - void (*func)(void *), void *arg) -{ - ppc_switch_stack_and_call(newKstack, func, arg); -} - - void arch_thread_context_switch(struct thread *t_from, struct thread *t_to) { diff --git a/src/system/kernel/arch/x86/arch_thread.cpp b/src/system/kernel/arch/x86/arch_thread.cpp index c43781c88f..c7e5123429 100644 --- a/src/system/kernel/arch/x86/arch_thread.cpp +++ b/src/system/kernel/arch/x86/arch_thread.cpp @@ -6,6 +6,7 @@ * Distributed under the terms of the NewOS License. */ + #include #include @@ -351,14 +352,6 @@ arch_thread_init_tls(struct thread *thread) } -void -arch_thread_switch_kstack_and_call(struct thread *t, addr_t new_kstack, - void (*func)(void *), void *arg) -{ - i386_switch_stack_and_call(new_kstack, func, arg); -} - - void arch_thread_context_switch(struct thread *from, struct thread *to) { diff --git a/src/system/kernel/arch/x86/arch_x86.S b/src/system/kernel/arch/x86/arch_x86.S index 6a1262945d..10ffba1d08 100644 --- a/src/system/kernel/arch/x86/arch_x86.S +++ b/src/system/kernel/arch/x86/arch_x86.S @@ -7,6 +7,7 @@ * Distributed under the terms of the NewOS License. */ + #include #include @@ -180,18 +181,6 @@ FUNCTION(x86_enter_userspace): iret FUNCTION_END(x86_enter_userspace) -/* void i386_switch_stack_and_call(addr stack, void (*func)(void *), void *arg); */ -FUNCTION(i386_switch_stack_and_call): - movl 4(%esp),%eax // new stack - movl 8(%esp),%ecx // func - movl 12(%esp),%edx // args - - movl %eax,%esp // switch the stack - pushl %edx // push the argument - call *%ecx // call the target function -_loop: - jmp _loop -FUNCTION_END(i386_switch_stack_and_call) null_idt_descr: .word 0