Merged branch haiku/branches/developer/bonefish/optimization revision
23139 into trunk, with roughly the following changes (for details svn log the branch): * The int 99 syscall handler is now fully in assembly. * Added a sysenter/sysexit handler and use it on Pentiums that support it (via commpage). * Got rid of i386_handle_trap(). A bit of functionality was moved into the assembly handler which now uses a jump table to call C functions handling the respective interrupt. * Some optimizations to get user debugger support code out of the interrupt handling path. * Introduced a thread::flags fields which allows to skip handling of rare events (signals, user debug enabling/disabling) on the common interrupt handling path. * Got rid of the explicit iframe stack. The iframes can still be retrieved by iterating through the stack frames. * Made the commpage an architecture independent feature. It's used for the real time data stuff (instead of creating a separate area). * The x86 CPU modules can now provide processor optimized versions for common functions (currently memcpy() only). They are used in the kernel and are provided to the userland via commpage entries. * Introduced build system feature allowing easy use of C structure member offsets in assembly code. Changes after merging: * Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp (caused by refactoring and introduction of "call" debugger command). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -220,6 +220,7 @@ create_thread_struct(struct thread *inthread, const char *name,
|
||||
else
|
||||
strcpy(thread->name, "unnamed thread");
|
||||
|
||||
thread->flags = 0;
|
||||
thread->id = threadID >= 0 ? threadID : allocate_thread_id();
|
||||
thread->team = NULL;
|
||||
thread->cpu = cpu;
|
||||
@@ -408,6 +409,8 @@ create_thread(const char *name, team_id teamID, thread_entry_func entry,
|
||||
return status;
|
||||
}
|
||||
|
||||
thread->kernel_stack_top = thread->kernel_stack_base + KERNEL_STACK_SIZE;
|
||||
|
||||
state = disable_interrupts();
|
||||
GRAB_THREAD_LOCK();
|
||||
|
||||
@@ -501,6 +504,8 @@ create_thread(const char *name, team_id teamID, thread_entry_func entry,
|
||||
kill_thread(thread->id);
|
||||
}
|
||||
|
||||
user_debug_update_new_thread_flags(thread->id);
|
||||
|
||||
// copy the user entry over to the args field in the thread struct
|
||||
// the function this will call will immediately switch the thread into
|
||||
// user space.
|
||||
@@ -1058,6 +1063,7 @@ _dump_thread_info(struct thread *thread)
|
||||
strerror(thread->kernel_errno));
|
||||
kprintf("kernel_time: %Ld\n", thread->kernel_time);
|
||||
kprintf("user_time: %Ld\n", thread->user_time);
|
||||
kprintf("flags: 0x%lx\n", thread->flags);
|
||||
kprintf("architecture dependant section:\n");
|
||||
arch_thread_dump_info(&thread->arch_info);
|
||||
}
|
||||
@@ -1458,26 +1464,20 @@ thread_get_thread_struct_locked(thread_id id)
|
||||
Called in the interrupt handler code when a thread enters
|
||||
the kernel for any reason.
|
||||
Only tracks time for now.
|
||||
Interrupts are disabled.
|
||||
*/
|
||||
void
|
||||
thread_at_kernel_entry(void)
|
||||
thread_at_kernel_entry(bigtime_t now)
|
||||
{
|
||||
struct thread *thread = thread_get_current_thread();
|
||||
cpu_status state;
|
||||
bigtime_t now;
|
||||
|
||||
TRACE(("thread_atkernel_entry: entry thread %ld\n", thread->id));
|
||||
|
||||
state = disable_interrupts();
|
||||
TRACE(("thread_at_kernel_entry: entry thread %ld\n", thread->id));
|
||||
|
||||
// track user time
|
||||
now = system_time();
|
||||
thread->user_time += now - thread->last_time;
|
||||
thread->last_time = now;
|
||||
|
||||
thread->in_kernel = true;
|
||||
|
||||
restore_interrupts(state);
|
||||
}
|
||||
|
||||
|
||||
@@ -1492,7 +1492,7 @@ thread_at_kernel_exit(void)
|
||||
cpu_status state;
|
||||
bigtime_t now;
|
||||
|
||||
TRACE(("thread_atkernel_exit: exit thread %ld\n", thread->id));
|
||||
TRACE(("thread_at_kernel_exit: exit thread %ld\n", thread->id));
|
||||
|
||||
if (handle_signals(thread)) {
|
||||
state = disable_interrupts();
|
||||
@@ -1516,6 +1516,26 @@ thread_at_kernel_exit(void)
|
||||
}
|
||||
|
||||
|
||||
/*! The quick version of thread_kernel_exit(), in case no signals are pending
|
||||
and no debugging shall be done.
|
||||
Interrupts are disabled in this case.
|
||||
*/
|
||||
void
|
||||
thread_at_kernel_exit_no_signals(void)
|
||||
{
|
||||
struct thread *thread = thread_get_current_thread();
|
||||
|
||||
TRACE(("thread_at_kernel_exit_no_signals: exit thread %ld\n", thread->id));
|
||||
|
||||
thread->in_kernel = false;
|
||||
|
||||
// track kernel time
|
||||
bigtime_t now = system_time();
|
||||
thread->kernel_time += now - thread->last_time;
|
||||
thread->last_time = now;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
thread_reset_for_exec(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user