Some minor updates:
arch_cpu: could have used the TLS_SIZE macro in one place, removed a now unused variable, assignments to tss_loaded are now booleans. thread.c: added the new fields to _dump_thread_info(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2393 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
dd8e42a8b4
commit
4fff689f48
@ -11,8 +11,8 @@
|
||||
#include <smp.h>
|
||||
#include <arch/x86/selector.h>
|
||||
#include <Errors.h>
|
||||
#include <TLS.h>
|
||||
#include <kerrors.h>
|
||||
#include <tls.h>
|
||||
|
||||
#include <stage2.h>
|
||||
|
||||
@ -62,18 +62,17 @@ arch_cpu_init2(kernel_args *ka)
|
||||
tss = malloc(sizeof(struct tss *) * ka->num_cpus);
|
||||
if (tss == NULL) {
|
||||
panic("arch_cpu_init2: could not allocate buffer for tss pointers\n");
|
||||
return ENOMEM;
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
|
||||
tss_loaded = malloc(sizeof(int) * ka->num_cpus);
|
||||
if (tss == NULL) {
|
||||
panic("arch_cpu_init2: could not allocate buffer for tss booleans\n");
|
||||
return ENOMEM;
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
memset(tss_loaded, 0, sizeof(int) * ka->num_cpus);
|
||||
|
||||
for (i = 0; i < ka->num_cpus; i++) {
|
||||
struct segment_descriptor *tss_d;
|
||||
char tss_name[16];
|
||||
region_id rid;
|
||||
|
||||
@ -82,7 +81,7 @@ arch_cpu_init2(kernel_args *ka)
|
||||
REGION_ADDR_ANY_ADDRESS, PAGE_SIZE, REGION_WIRING_WIRED, LOCK_RW|LOCK_KERNEL);
|
||||
if (rid < 0) {
|
||||
panic("arch_cpu_init2: unable to create region for tss\n");
|
||||
return ENOMEM;
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
|
||||
// initialize TSS
|
||||
@ -96,7 +95,7 @@ arch_cpu_init2(kernel_args *ka)
|
||||
// setup TLS descriptors (one for every CPU)
|
||||
|
||||
for (i = 0; i < ka->num_cpus; i++) {
|
||||
set_segment_descriptor(&gGDT[TLS_BASE_SEGMENT + i], 0, TLS_MAX_KEYS * sizeof(void *),
|
||||
set_segment_descriptor(&gGDT[TLS_BASE_SEGMENT + i], 0, TLS_SIZE,
|
||||
DT_DATA_WRITEABLE, DPL_USER);
|
||||
}
|
||||
|
||||
@ -110,11 +109,11 @@ i386_set_tss_and_kstack(addr kstack)
|
||||
int currentCPU = smp_get_current_cpu();
|
||||
|
||||
// dprintf("i386_set_kstack: kstack 0x%x, cpu %d\n", kstack, currentCPU);
|
||||
if (tss_loaded[currentCPU] == 0) {
|
||||
if (!tss_loaded[currentCPU]) {
|
||||
short seg = ((TSS_BASE_SEGMENT + currentCPU) << 3) | DPL_KERNEL;
|
||||
asm("movw %0, %%ax;"
|
||||
"ltr %%ax;" : : "r" (seg) : "eax");
|
||||
tss_loaded[currentCPU] = 1;
|
||||
tss_loaded[currentCPU] = true;
|
||||
}
|
||||
|
||||
tss[currentCPU]->sp0 = kstack;
|
||||
|
@ -519,21 +519,23 @@ _dump_thread_info(struct thread *t)
|
||||
else
|
||||
dprintf("\n");
|
||||
dprintf("sig_pending: 0x%lx\n", t->sig_pending);
|
||||
dprintf("in_kernel: %d\n", t->in_kernel);
|
||||
dprintf("sem_blocking:0x%lx\n", t->sem_blocking);
|
||||
dprintf("sem_count: 0x%x\n", t->sem_count);
|
||||
dprintf("in_kernel: %d\n", t->in_kernel);
|
||||
dprintf("sem_blocking: 0x%lx\n", t->sem_blocking);
|
||||
dprintf("sem_count: 0x%x\n", t->sem_count);
|
||||
dprintf("sem_deleted_retcode: 0x%x\n", t->sem_deleted_retcode);
|
||||
dprintf("sem_errcode: 0x%x\n", t->sem_errcode);
|
||||
dprintf("sem_flags: 0x%x\n", t->sem_flags);
|
||||
dprintf("fault_handler: 0x%lx\n", t->fault_handler);
|
||||
dprintf("args: %p\n", t->args);
|
||||
dprintf("entry: 0x%lx\n", t->entry);
|
||||
dprintf("team: %p\n", t->team);
|
||||
dprintf("sem_errcode: 0x%x\n", t->sem_errcode);
|
||||
dprintf("sem_flags: 0x%x\n", t->sem_flags);
|
||||
dprintf("fault_handler: %p\n", (void *)t->fault_handler);
|
||||
dprintf("args: %p\n", t->args);
|
||||
dprintf("entry: %p\n", (void *)t->entry);
|
||||
dprintf("team: %p\n", t->team);
|
||||
dprintf("return_code_sem: 0x%lx\n", t->return_code_sem);
|
||||
dprintf("kernel_stack_region_id: 0x%lx\n", t->kernel_stack_region_id);
|
||||
dprintf("kernel_stack_base: 0x%lx\n", t->kernel_stack_base);
|
||||
dprintf("kernel_stack_base: %p\n", (void *)t->kernel_stack_base);
|
||||
dprintf("user_stack_region_id: 0x%lx\n", t->user_stack_region_id);
|
||||
dprintf("user_stack_base: 0x%lx\n", t->user_stack_base);
|
||||
dprintf("user_stack_base: %p\n", (void *)t->user_stack_base);
|
||||
dprintf("user_local_storage: %p\n", (void *)t->user_local_storage);
|
||||
dprintf("kernel_errno: %d\n", t->kernel_errno);
|
||||
dprintf("kernel_time: %Ld\n", t->kernel_time);
|
||||
dprintf("user_time: %Ld\n", t->user_time);
|
||||
dprintf("architecture dependant section:\n");
|
||||
|
Loading…
Reference in New Issue
Block a user