Removed B_EXACT_KERNEL_ADDRESS again.
Replaced "addr" with "addr_t". Header cleanups. There is no need to call set_tls_context() in arch_thread_init_tls(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7880 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
577402ea7e
commit
6ee4a2f161
@ -1,24 +1,22 @@
|
||||
/*
|
||||
** Copyright 2002-2004, The OpenBeOS Team. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
**
|
||||
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
#include <kernel.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <malloc.h>
|
||||
#include <vm.h>
|
||||
#include <debug.h>
|
||||
#include <smp.h>
|
||||
#include <arch/x86/selector.h>
|
||||
#include <Errors.h>
|
||||
#include <kerrors.h>
|
||||
#include <tls.h>
|
||||
|
||||
#include <boot/stage2.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static struct tss **tss;
|
||||
static int *tss_loaded;
|
||||
|
||||
@ -51,7 +49,7 @@ arch_cpu_init2(kernel_args *ka)
|
||||
|
||||
gGDT = (segment_descriptor *)ka->arch_args.vir_gdt;
|
||||
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "gdt", (void **)&gGDT,
|
||||
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE, B_ALREADY_WIRED,
|
||||
B_EXACT_ADDRESS, B_PAGE_SIZE, B_ALREADY_WIRED,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||
|
||||
// currently taken out of the build, because it's not yet used (and assumes
|
||||
@ -91,7 +89,7 @@ arch_cpu_init2(kernel_args *ka)
|
||||
tss[i]->ss0 = KERNEL_DATA_SEG;
|
||||
|
||||
// add TSS descriptor for this new TSS
|
||||
set_tss_descriptor(&gGDT[TSS_BASE_SEGMENT + i], (addr)tss[i], sizeof(struct tss));
|
||||
set_tss_descriptor(&gGDT[TSS_BASE_SEGMENT + i], (addr_t)tss[i], sizeof(struct tss));
|
||||
}
|
||||
|
||||
// setup TLS descriptors (one for every CPU)
|
||||
@ -106,7 +104,7 @@ arch_cpu_init2(kernel_args *ka)
|
||||
|
||||
|
||||
void
|
||||
i386_set_tss_and_kstack(addr kstack)
|
||||
i386_set_tss_and_kstack(addr_t kstack)
|
||||
{
|
||||
int currentCPU = smp_get_current_cpu();
|
||||
|
||||
@ -124,7 +122,7 @@ i386_set_tss_and_kstack(addr kstack)
|
||||
|
||||
|
||||
void
|
||||
arch_cpu_invalidate_TLB_range(addr start, addr end)
|
||||
arch_cpu_invalidate_TLB_range(addr_t start, addr_t end)
|
||||
{
|
||||
int num_pages = end/PAGE_SIZE - start/PAGE_SIZE;
|
||||
while (num_pages-- >= 0) {
|
||||
@ -135,7 +133,7 @@ arch_cpu_invalidate_TLB_range(addr start, addr end)
|
||||
|
||||
|
||||
void
|
||||
arch_cpu_invalidate_TLB_list(addr pages[], int num_pages)
|
||||
arch_cpu_invalidate_TLB_list(addr_t pages[], int num_pages)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < num_pages; i++) {
|
||||
@ -145,12 +143,12 @@ arch_cpu_invalidate_TLB_list(addr pages[], int num_pages)
|
||||
|
||||
|
||||
int
|
||||
arch_cpu_user_memcpy(void *to, const void *from, size_t size, addr *fault_handler)
|
||||
arch_cpu_user_memcpy(void *to, const void *from, size_t size, addr_t *fault_handler)
|
||||
{
|
||||
char *tmp = (char *)to;
|
||||
char *s = (char *)from;
|
||||
|
||||
*fault_handler = (addr)&&error;
|
||||
*fault_handler = (addr_t)&&error;
|
||||
|
||||
while (size--)
|
||||
*tmp++ = *s++;
|
||||
@ -165,11 +163,11 @@ error:
|
||||
|
||||
|
||||
int
|
||||
arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr *faultHandler)
|
||||
arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr_t *faultHandler)
|
||||
{
|
||||
int from_length = 0;
|
||||
|
||||
*faultHandler = (addr)&&error;
|
||||
*faultHandler = (addr_t)&&error;
|
||||
|
||||
if (size > 0) {
|
||||
to[--size] = '\0';
|
||||
@ -193,11 +191,11 @@ error:
|
||||
|
||||
|
||||
int
|
||||
arch_cpu_user_memset(void *s, char c, size_t count, addr *fault_handler)
|
||||
arch_cpu_user_memset(void *s, char c, size_t count, addr_t *fault_handler)
|
||||
{
|
||||
char *xs = (char *)s;
|
||||
|
||||
*fault_handler = (addr)&&error;
|
||||
*fault_handler = (addr_t)&&error;
|
||||
|
||||
while (count--)
|
||||
*xs++ = c;
|
||||
|
@ -6,6 +6,7 @@
|
||||
** Modified 2001/09/05 by Rob Judd<judd@ob-wan.com>
|
||||
** Modified 2002/09/28 by Marcus Overhagen <marcus@overhagen.de>
|
||||
*/
|
||||
|
||||
#include <kernel.h>
|
||||
#include <int.h>
|
||||
#include <arch/cpu.h>
|
||||
|
@ -66,7 +66,7 @@ dbg_stack_trace(int argc, char **argv)
|
||||
} else {
|
||||
uint32 eip = *((uint32 *)ebp + 1);
|
||||
const char *symbol, *image;
|
||||
addr baseAddress;
|
||||
addr_t baseAddress;
|
||||
bool exactMatch;
|
||||
|
||||
if (eip == 0 || ebp == 0)
|
||||
|
@ -2,25 +2,14 @@
|
||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
#include <kernel.h>
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <faults.h>
|
||||
#include <faults_priv.h>
|
||||
#include <vm.h>
|
||||
#include <debug.h>
|
||||
#include <console.h>
|
||||
#include <int.h>
|
||||
#include <boot/kernel_args.h>
|
||||
|
||||
#include <arch/cpu.h>
|
||||
#include <arch/int.h>
|
||||
#include <arch/faults.h>
|
||||
|
||||
#include <arch/x86/interrupts.h>
|
||||
#include <arch/x86/faults.h>
|
||||
|
||||
#include <boot/stage2.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
// XXX this module is largely outdated. Will probably be removed later.
|
||||
|
||||
int arch_faults_init(kernel_args *ka)
|
||||
|
@ -1,23 +1,15 @@
|
||||
/*
|
||||
** Copyright 2002-2004, The OpenBeOS Team. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
/*
|
||||
**
|
||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
#include <kernel.h>
|
||||
#include <vm.h>
|
||||
#include <debug.h>
|
||||
#include <console.h>
|
||||
#include <int.h>
|
||||
#include <thread.h>
|
||||
#include <smp.h>
|
||||
#include <syscalls.h>
|
||||
#include <Errors.h>
|
||||
#include <kerrors.h>
|
||||
#include <vm_priv.h>
|
||||
#include <ksyscalls.h>
|
||||
|
||||
@ -31,8 +23,6 @@
|
||||
#include <arch/x86/faults.h>
|
||||
#include <arch/x86/descriptors.h>
|
||||
|
||||
#include <boot/stage2.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_ARGS 16
|
||||
@ -195,7 +185,7 @@ i386_handle_trap(struct iframe frame)
|
||||
case 14: // page fault
|
||||
{
|
||||
unsigned int cr2;
|
||||
addr newip;
|
||||
addr_t newip;
|
||||
|
||||
asm("movl %%cr2, %0" : "=r" (cr2));
|
||||
|
||||
@ -223,7 +213,6 @@ i386_handle_trap(struct iframe frame)
|
||||
{
|
||||
uint64 retcode;
|
||||
unsigned int args[MAX_ARGS];
|
||||
int rc;
|
||||
|
||||
thread_atkernel_entry();
|
||||
#if 0
|
||||
@ -243,15 +232,11 @@ i386_handle_trap(struct iframe frame)
|
||||
** each is verified to make sure someone doesn't try to clobber it
|
||||
*/
|
||||
if (frame.ecx <= MAX_ARGS) {
|
||||
if ((addr)frame.edx >= KERNEL_BASE && (addr)frame.edx <= KERNEL_TOP) {
|
||||
retcode = ERR_VM_BAD_USER_MEMORY;
|
||||
} else {
|
||||
rc = user_memcpy(args, (void *)frame.edx, frame.ecx * sizeof(unsigned int));
|
||||
if (rc < 0)
|
||||
retcode = ERR_VM_BAD_USER_MEMORY;
|
||||
else
|
||||
ret = syscall_dispatcher(frame.eax, (void *)args, &retcode);
|
||||
}
|
||||
if (IS_KERNEL_ADDRESS(frame.edx)
|
||||
|| user_memcpy(args, (void *)frame.edx, frame.ecx * sizeof(unsigned int)) < B_OK) {
|
||||
retcode = B_BAD_ADDRESS;
|
||||
} else
|
||||
ret = syscall_dispatcher(frame.eax, (void *)args, &retcode);
|
||||
} else {
|
||||
// want to pass too many args into the system
|
||||
retcode = EINVAL;
|
||||
@ -361,7 +346,7 @@ arch_int_init2(kernel_args *ka)
|
||||
{
|
||||
idt = (desc_table *)ka->arch_args.vir_idt;
|
||||
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "idt", (void *)&idt,
|
||||
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE, B_ALREADY_WIRED,
|
||||
B_EXACT_ADDRESS, B_PAGE_SIZE, B_ALREADY_WIRED,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
/*
|
||||
** Copyright 2002-2004, The OpenBeOS Team. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
**
|
||||
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
#include <OS.h>
|
||||
#include <boot/kernel_args.h>
|
||||
#include <vm.h>
|
||||
#include <int.h>
|
||||
@ -111,10 +113,10 @@ arch_smp_init(kernel_args *ka)
|
||||
|
||||
// setup regions that represent the apic & ioapic
|
||||
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "local_apic", (void *)&apic,
|
||||
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE, B_ALREADY_WIRED,
|
||||
B_EXACT_ADDRESS, B_PAGE_SIZE, B_ALREADY_WIRED,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "ioapic", (void *)&ioapic,
|
||||
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE, B_ALREADY_WIRED,
|
||||
B_EXACT_ADDRESS, B_PAGE_SIZE, B_ALREADY_WIRED,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||
|
||||
// set up the local apic on the boot cpu
|
||||
|
@ -1,23 +1,19 @@
|
||||
/*
|
||||
** Copyright 2002-2004, The OpenBeOS Team. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
**
|
||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <kernel.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <debug.h>
|
||||
#include <vm.h>
|
||||
#include <memheap.h>
|
||||
#include <thread.h>
|
||||
#include <arch/thread.h>
|
||||
#include <arch_cpu.h>
|
||||
#include <int.h>
|
||||
#include <string.h>
|
||||
#include <Errors.h>
|
||||
#include <signal.h>
|
||||
#include <tls.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
//#define TRACE_ARCH_THREAD
|
||||
#ifdef TRACE_ARCH_THREAD
|
||||
@ -77,6 +73,7 @@ arch_thread_init_thread_struct(struct thread *t)
|
||||
// set up an initial state (stack & fpu)
|
||||
memset(&t->arch_info, 0, sizeof(t->arch_info));
|
||||
|
||||
// ToDo: note, this has to be done only once
|
||||
// let the asm function know the offset to the interrupt stack within struct thread
|
||||
// I know no better ( = static) way to tell the asm function the offset
|
||||
i386_stack_init(&((struct thread *)0)->arch_info.interrupt_stack);
|
||||
@ -146,13 +143,11 @@ arch_thread_init_tls(struct thread *thread)
|
||||
tls[TLS_BASE_ADDRESS_SLOT] = thread->user_local_storage;
|
||||
tls[TLS_THREAD_ID_SLOT] = thread->id;
|
||||
tls[TLS_ERRNO_SLOT] = 0;
|
||||
|
||||
set_tls_context(thread);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_thread_switch_kstack_and_call(struct thread *t, addr new_kstack, void (*func)(void *), void *arg)
|
||||
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);
|
||||
}
|
||||
@ -206,7 +201,7 @@ arch_thread_context_switch(struct thread *t_from, struct thread *t_to)
|
||||
panic("arch_thread_context_switch: bad pgdir 0x%lx\n", new_pgdir);
|
||||
|
||||
i386_fsave_swap(t_from->arch_info.fpu_state, t_to->arch_info.fpu_state);
|
||||
i386_context_switch(&t_from->arch_info, &t_to->arch_info, (addr)new_pgdir);
|
||||
i386_context_switch(&t_from->arch_info, &t_to->arch_info, (addr_t)new_pgdir);
|
||||
}
|
||||
|
||||
|
||||
@ -225,9 +220,9 @@ arch_thread_dump_info(void *info)
|
||||
*/
|
||||
|
||||
void
|
||||
arch_thread_enter_uspace(struct thread *t, addr entry, void *args1, void *args2)
|
||||
arch_thread_enter_uspace(struct thread *t, addr_t entry, void *args1, void *args2)
|
||||
{
|
||||
addr ustack_top = t->user_stack_base + STACK_SIZE;
|
||||
addr_t ustack_top = t->user_stack_base + STACK_SIZE;
|
||||
|
||||
TRACE(("arch_thread_enter_uspace: entry 0x%lx, args %p %p, ustack_top 0x%lx\n",
|
||||
entry, args1, args2, ustack_top));
|
||||
|
@ -5,12 +5,9 @@
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <kernel.h>
|
||||
#include <console.h>
|
||||
#include <vm.h>
|
||||
#include <vm_page.h>
|
||||
#include <vm_priv.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/vm.h>
|
||||
#include <arch/int.h>
|
||||
@ -18,8 +15,8 @@
|
||||
|
||||
#include <arch/x86/interrupts.h>
|
||||
|
||||
#define TRACE_ARCH_VM 0
|
||||
#if TRACE_ARCH_VM
|
||||
#define TRACE_ARCH_VM
|
||||
#ifdef TRACE_ARCH_VM
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
|
@ -1,27 +1,22 @@
|
||||
/*
|
||||
** Copyright 2002-2004, The OpenBeOS Team. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
**
|
||||
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
#include <kernel.h>
|
||||
#include <malloc.h>
|
||||
#include <int.h>
|
||||
#include <smp.h>
|
||||
#include <vm.h>
|
||||
#include <vm_page.h>
|
||||
#include <vm_priv.h>
|
||||
#include <debug.h>
|
||||
#include <lock.h>
|
||||
#include <OS.h>
|
||||
#include <queue.h>
|
||||
#include <string.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <Errors.h>
|
||||
#include <kerrors.h>
|
||||
|
||||
#include <arch/cpu.h>
|
||||
#include <arch/vm_translation_map.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define TRACE_VM_TMAP 0
|
||||
#if TRACE_VM_TMAP
|
||||
# define TRACE(x) dprintf x
|
||||
@ -790,27 +785,27 @@ vm_translation_map_module_init2(kernel_args *ka)
|
||||
|
||||
temp = (void *)kernel_pgdir_virt;
|
||||
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "kernel_pgdir", &temp,
|
||||
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE, B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||
B_EXACT_ADDRESS, B_PAGE_SIZE, B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||
|
||||
temp = (void *)paddr_desc;
|
||||
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "physical_page_mapping_descriptors", &temp,
|
||||
B_EXACT_KERNEL_ADDRESS, ROUNDUP(sizeof(paddr_chunk_desc) * 1024, PAGE_SIZE),
|
||||
B_EXACT_ADDRESS, ROUNDUP(sizeof(paddr_chunk_desc) * 1024, PAGE_SIZE),
|
||||
B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||
|
||||
temp = (void *)virtual_pmappings;
|
||||
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "iospace_virtual_chunk_descriptors", &temp,
|
||||
B_EXACT_KERNEL_ADDRESS, ROUNDUP(sizeof(paddr_chunk_desc *) * num_virtual_chunks, PAGE_SIZE),
|
||||
B_EXACT_ADDRESS, ROUNDUP(sizeof(paddr_chunk_desc *) * num_virtual_chunks, PAGE_SIZE),
|
||||
B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||
|
||||
temp = (void *)iospace_pgtables;
|
||||
vm_create_anonymous_region(vm_get_kernel_aspace_id(), "iospace_pgtables", &temp,
|
||||
B_EXACT_KERNEL_ADDRESS, PAGE_SIZE * (IOSPACE_SIZE / (PAGE_SIZE * 1024)),
|
||||
B_EXACT_ADDRESS, B_PAGE_SIZE * (IOSPACE_SIZE / (B_PAGE_SIZE * 1024)),
|
||||
B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
|
||||
|
||||
TRACE(("vm_translation_map_module_init2: creating iospace\n"));
|
||||
temp = (void *)IOSPACE_BASE;
|
||||
vm_create_null_region(vm_get_kernel_aspace_id(), "iospace", &temp,
|
||||
B_EXACT_KERNEL_ADDRESS, IOSPACE_SIZE);
|
||||
B_EXACT_ADDRESS, IOSPACE_SIZE);
|
||||
|
||||
TRACE(("vm_translation_map_module_init2: done\n"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user