diff --git a/headers/private/kernel/arch/thread.h b/headers/private/kernel/arch/thread.h index d1a27d9de1..f03f3fbb46 100644 --- a/headers/private/kernel/arch/thread.h +++ b/headers/private/kernel/arch/thread.h @@ -2,17 +2,18 @@ ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#ifndef _NEWOS_KERNEL_ARCH_THREAD_H -#define _NEWOS_KERNEL_ARCH_THREAD_H +#ifndef _KERNEL_ARCH_THREAD_H +#define _KERNEL_ARCH_THREAD_H #include int arch_team_init_team_struct(struct team *t, bool kernel); int arch_thread_init_thread_struct(struct thread *t); +void arch_thread_init_tls(struct thread *thread); void arch_thread_context_switch(struct thread *t_from, struct thread *t_to); -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)); void arch_thread_dump_info(void *info); -void arch_thread_enter_uspace(addr entry, void *args, addr ustack_top); +void arch_thread_enter_uspace(struct thread *t, addr entry, void *args); 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); @@ -25,5 +26,4 @@ void arch_check_syscall_restart(struct thread *t); // for any inline overrides #include -#endif - +#endif /* _KERNEL_ARCH_THREAD_H */ diff --git a/headers/private/kernel/arch/x86/arch_cpu.h b/headers/private/kernel/arch/x86/arch_cpu.h index f9875ae333..9bfbafaa6d 100644 --- a/headers/private/kernel/arch/x86/arch_cpu.h +++ b/headers/private/kernel/arch/x86/arch_cpu.h @@ -91,7 +91,7 @@ struct iframe { void setup_system_time(unsigned int cv_factor); void i386_context_switch(struct arch_thread *old_state, struct arch_thread *new_state, addr new_pgdir); void i386_enter_uspace(addr entry, void *args, addr ustack_top); -void i386_set_kstack(addr kstack); +void i386_set_tss_and_kstack(addr kstack); void i386_switch_stack_and_call(addr stack, void (*func)(void *), void *arg); void i386_swap_pgdir(addr new_pgdir); void i386_fsave(void *fpu_state); diff --git a/headers/private/kernel/arch/x86/descriptors.h b/headers/private/kernel/arch/x86/descriptors.h index 67be588c32..e931100a16 100644 --- a/headers/private/kernel/arch/x86/descriptors.h +++ b/headers/private/kernel/arch/x86/descriptors.h @@ -94,7 +94,7 @@ set_segment_descriptor(struct segment_descriptor *desc, addr base, uint32 limit, desc->present = 1; desc->granularity = 1; // 4 GB size (in page size steps) desc->available = 0; // system available bit is currently not used - desc->d_b = 1; + desc->d_b = 1; // 32-bit code desc->zero = 0; } diff --git a/headers/private/kernel/tls.h b/headers/private/kernel/tls.h new file mode 100644 index 0000000000..0f51ebc393 --- /dev/null +++ b/headers/private/kernel/tls.h @@ -0,0 +1,28 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ +#ifndef _KERNEL_TLS_H +#define _KERNEL_TLS_H + +#include + + +#define TLS_SIZE (TLS_MAX_KEYS * sizeof(void *)) + +enum { + TLS_BASE_ADDRESS_SLOT = 0, + // contains the address of the local storage space + + TLS_THREAD_ID_SLOT, + TLS_ERRNO_SLOT, + + // Note: these entries can safely be changed between + // releases; 3rd party code always calls tls_allocate() + // to get a free slot + + TLS_FIRST_FREE_SLOT + // the first free slot for user allocations +}; + +#endif /* _KERNEL_TLS_H */