Added missing arch_*() functions, removed the (empty) atomic_*() definitions,
since they are implemented in the libroot's os/arch directory. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3235 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,21 +8,6 @@
|
|||||||
.globl reboot
|
.globl reboot
|
||||||
reboot:
|
reboot:
|
||||||
|
|
||||||
.globl atomic_add
|
|
||||||
atomic_add:
|
|
||||||
|
|
||||||
.globl atomic_and
|
|
||||||
atomic_and:
|
|
||||||
|
|
||||||
.globl atomic_or
|
|
||||||
atomic_or:
|
|
||||||
|
|
||||||
.globl atomic_set
|
|
||||||
atomic_set:
|
|
||||||
|
|
||||||
.globl test_and_set
|
|
||||||
test_and_set:
|
|
||||||
|
|
||||||
.globl arch_int_restore_interrupts
|
.globl arch_int_restore_interrupts
|
||||||
arch_int_restore_interrupts:
|
arch_int_restore_interrupts:
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,36 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||||
** Distributed under the terms of the NewOS License.
|
** Distributed under the terms of the NewOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <vm.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <smp.h>
|
||||||
|
#include <Errors.h>
|
||||||
|
#include <kerrors.h>
|
||||||
|
#include <tls.h>
|
||||||
|
|
||||||
#include <boot/stage2.h>
|
#include <boot/stage2.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
arch_cpu_preboot_init(kernel_args *ka)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
arch_cpu_init(kernel_args *ka)
|
arch_cpu_init(kernel_args *ka)
|
||||||
{
|
{
|
||||||
|
//setup_system_time(ka->arch_args.system_time_cv_factor);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,12 +45,21 @@ arch_cpu_init2(kernel_args *ka)
|
|||||||
void
|
void
|
||||||
arch_cpu_invalidate_TLB_range(addr start, addr end)
|
arch_cpu_invalidate_TLB_range(addr start, addr end)
|
||||||
{
|
{
|
||||||
|
int num_pages = end/PAGE_SIZE - start/PAGE_SIZE;
|
||||||
|
while (num_pages-- >= 0) {
|
||||||
|
//invalidate_TLB(start);
|
||||||
|
start += PAGE_SIZE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_cpu_invalidate_TLB_list(addr pages[], int num_pages)
|
arch_cpu_invalidate_TLB_list(addr pages[], int num_pages)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < num_pages; i++) {
|
||||||
|
//invalidate_TLB(pages[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -41,82 +69,93 @@ arch_cpu_global_TLB_invalidate(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long long
|
|
||||||
system_time(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
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 *faultHandler)
|
||||||
{
|
{
|
||||||
char *tmp = (char *)to;
|
char *tmp = (char *)to;
|
||||||
char *s = (char *)from;
|
char *s = (char *)from;
|
||||||
|
|
||||||
*fault_handler = (addr)&&error;
|
*faultHandler = (addr)&&error;
|
||||||
|
|
||||||
while (size--)
|
while (size--)
|
||||||
*tmp++ = *s++;
|
*tmp++ = *s++;
|
||||||
|
|
||||||
*fault_handler = 0;
|
*faultHandler = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
*fault_handler = 0;
|
*faultHandler = 0;
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
arch_cpu_user_strcpy(char *to, const char *from, addr *fault_handler)
|
arch_cpu_user_strcpy(char *to, const char *from, addr *faultHandler)
|
||||||
{
|
{
|
||||||
*fault_handler = (addr)&&error;
|
*faultHandler = (addr)&&error;
|
||||||
|
|
||||||
while ((*to++ = *from++) != '\0')
|
while ((*to++ = *from++) != '\0')
|
||||||
;
|
;
|
||||||
|
|
||||||
*fault_handler = 0;
|
*faultHandler = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
*fault_handler = 0;
|
*faultHandler = 0;
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
arch_cpu_user_strncpy(char *to, const char *from, size_t size, addr *fault_handler)
|
arch_cpu_user_strncpy(char *to, const char *from, size_t size, addr *faultHandler)
|
||||||
{
|
{
|
||||||
*fault_handler = (addr)&&error;
|
*faultHandler = (addr)&&error;
|
||||||
|
|
||||||
|
while(size-- && (*to++ = *from++) != '\0')
|
||||||
|
;
|
||||||
|
|
||||||
|
*faultHandler = 0;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
*faultHandler = 0;
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr *faultHandler)
|
||||||
|
{
|
||||||
|
*faultHandler = (addr)&&error;
|
||||||
|
|
||||||
|
to[--size] = '\0';
|
||||||
while (size-- && (*to++ = *from++) != '\0')
|
while (size-- && (*to++ = *from++) != '\0')
|
||||||
;
|
;
|
||||||
|
|
||||||
*fault_handler = 0;
|
*faultHandler = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
*fault_handler = 0;
|
*faultHandler = 0;
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
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 *faultHandler)
|
||||||
{
|
{
|
||||||
char *xs = (char *) s;
|
char *xs = (char *)s;
|
||||||
|
|
||||||
*fault_handler = (addr)&&error;
|
*faultHandler = (addr)&&error;
|
||||||
|
|
||||||
while (count--)
|
while (count--)
|
||||||
*xs++ = c;
|
*xs++ = c;
|
||||||
|
|
||||||
*fault_handler = 0;
|
*faultHandler = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
*fault_handler = 0;
|
*faultHandler = 0;
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,4 +163,14 @@ error:
|
|||||||
void
|
void
|
||||||
arch_cpu_idle(void)
|
arch_cpu_idle(void)
|
||||||
{
|
{
|
||||||
|
switch (smp_get_num_cpus()) {
|
||||||
|
case 0:
|
||||||
|
panic("You need at least 1 CPU to run OpenBeOS\n");
|
||||||
|
case 1:
|
||||||
|
//hlt();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
** Distributed under the terms of the NewOS License.
|
** Distributed under the terms of the OpenBeOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -9,4 +9,19 @@
|
|||||||
#include <arch/debug.h>
|
#include <arch/debug.h>
|
||||||
|
|
||||||
|
|
||||||
// XXX will put stack trace and disassembly routines here
|
// ToDo: will put stack trace and disassembly routines here
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
arch_dbg_save_registers(int *regs)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
arch_dbg_init(kernel_args *ka)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,25 @@ arch_thread_init_kthread_stack(struct thread *t, int (*start_func)(void), void (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct thread *
|
||||||
|
arch_thread_get_current_thread(void)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
arch_thread_set_current_thread(struct thread *thread)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
arch_thread_init_tls(struct thread *thread)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
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 new_kstack, void (*func)(void *), void *arg)
|
||||||
{
|
{
|
||||||
@@ -53,3 +72,23 @@ arch_thread_enter_uspace(struct thread *thread, addr entry, void *arg1, void *ar
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
arch_setup_signal_frame(struct thread *thread, struct sigaction *sa, int sig, int sigMask)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int64
|
||||||
|
arch_restore_signal_frame(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
arch_check_syscall_restart(struct thread *thread)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user