- missing ppc stub
- kernel_m68K almost links now, jsut bails out on the linker script... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26096 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
38ff098d80
commit
1fd024be6a
@ -15,6 +15,9 @@
|
||||
|
||||
#define SR_IP_MASK 0x0700
|
||||
#define SR_S 0x2000
|
||||
#define M68K_SR_T_MASK 0xC000
|
||||
#define M68K_SR_T0 14
|
||||
#define M68K_SR_T1 15
|
||||
|
||||
#ifndef _ASSEMBLER
|
||||
|
||||
|
@ -25,6 +25,7 @@ struct m68k_vm_ops {
|
||||
status_t (*arch_vm_translation_map_early_map)(kernel_args *ka, addr_t virtualAddress, addr_t physicalAddress,
|
||||
uint8 attributes, addr_t (*get_free_page)(kernel_args *));
|
||||
status_t (*arch_vm_translation_map_early_query)(addr_t va, addr_t *out_physical);
|
||||
void (*m68k_set_pgdir)(void *);
|
||||
#if 0 /* ppc stuff only ? */
|
||||
status_t (*m68k_map_address_range)(addr_t virtualAddress, addr_t physicalAddress,
|
||||
size_t size);
|
||||
@ -33,5 +34,17 @@ struct m68k_vm_ops {
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern struct m68k_vm_ops *get_vm_ops();
|
||||
|
||||
extern void *m68k_translation_map_get_pgdir(vm_translation_map *map);
|
||||
extern void m68k_set_pgdir(void *rt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ARCH_M68K_VM_H */
|
||||
|
@ -10,12 +10,28 @@
|
||||
|
||||
#include <arch_030_mmu.h>
|
||||
|
||||
#define ARCH_M68K_MMU_TYPE MMU_68030
|
||||
#define ARCH_M68K_MMU_TYPE 68030
|
||||
|
||||
#include "arch_vm_translation_map_impl.cpp"
|
||||
|
||||
static void
|
||||
set_pgdir(void *rt)
|
||||
{
|
||||
long_page_directory_entry entry;
|
||||
*(uint64 *)&entry = DFL_PAGEENT_VAL;
|
||||
entry.type = DT_ROOT;
|
||||
entry.addr = TA_TO_PREA(((addr_t)rt));
|
||||
|
||||
asm volatile( \
|
||||
"pmove (%0),%%srp\n" \
|
||||
"pmove (%0),%%crp\n" \
|
||||
: : "a"((uint64 *)&entry));
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct m68k_vm_ops m68030_vm_ops = {
|
||||
m68k_translation_map_get_pgdir,
|
||||
_m68k_translation_map_get_pgdir,
|
||||
m68k_vm_translation_map_init_map,
|
||||
m68k_vm_translation_map_init_kernel_map_post_sem,
|
||||
m68k_vm_translation_map_init,
|
||||
@ -23,6 +39,7 @@ struct m68k_vm_ops m68030_vm_ops = {
|
||||
m68k_vm_translation_map_init_post_sem,
|
||||
m68k_vm_translation_map_early_map,
|
||||
/*m68k_vm_translation_map_*/early_query,
|
||||
set_pgdir,
|
||||
#if 0
|
||||
m68k_map_address_range,
|
||||
m68k_unmap_address_range,
|
||||
|
@ -19,6 +19,9 @@
|
||||
* Slow, using spinlocks...
|
||||
*/
|
||||
|
||||
#warning M68K: detect 060 here
|
||||
#if 0
|
||||
|
||||
static spinlock atomic_lock = 0;
|
||||
|
||||
int64
|
||||
@ -241,3 +244,4 @@ access_violation:
|
||||
// XXX kill application
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
@ -14,18 +14,12 @@
|
||||
#include <smp.h>
|
||||
|
||||
|
||||
// user syscall assembly stubs
|
||||
extern "C" void _user_syscall_int(void);
|
||||
extern unsigned int _user_syscall_int_end;
|
||||
extern "C" void _user_syscall_sysenter(void);
|
||||
extern unsigned int _user_syscall_sysenter_end;
|
||||
|
||||
|
||||
status_t
|
||||
arch_commpage_init(void)
|
||||
{
|
||||
panic("WRITEME");
|
||||
return B_NO_INIT;
|
||||
/* no optimized memcpy or anything yet */
|
||||
/* we don't use it for syscall yet either */
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,16 @@ arch_cpu_preboot_init_percpu(kernel_args *args, int curr_cpu)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_cpu_init_percpu(kernel_args *args, int curr_cpu)
|
||||
{
|
||||
//detect_cpu(curr_cpu);
|
||||
|
||||
// we only support one anyway...
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_cpu_init(kernel_args *args)
|
||||
{
|
||||
|
@ -18,7 +18,9 @@
|
||||
#include <boot/stage2.h>
|
||||
#include <kernel.h>
|
||||
#include <thread.h>
|
||||
#include <vm_address_space.h>
|
||||
#include <vm_types.h>
|
||||
#include <arch_vm.h>
|
||||
//#include <arch/vm_translation_map.h>
|
||||
|
||||
#include <string.h>
|
||||
@ -90,6 +92,28 @@ m68k_get_user_iframe(void)
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
m68k_next_page_directory(struct thread *from, struct thread *to)
|
||||
{
|
||||
if (from->team->address_space != NULL && to->team->address_space != NULL) {
|
||||
// they are both user space threads
|
||||
if (from->team == to->team) {
|
||||
// dont change the pgdir, same address space
|
||||
return NULL;
|
||||
}
|
||||
// switching to a new address space
|
||||
return m68k_translation_map_get_pgdir(&to->team->address_space->translation_map);
|
||||
} else if (from->team->address_space == NULL && to->team->address_space == NULL) {
|
||||
// they must both be kernel space threads
|
||||
return NULL;
|
||||
} else if (to->team->address_space == NULL) {
|
||||
// the one we're switching to is kernel space
|
||||
return m68k_translation_map_get_pgdir(&vm_kernel_address_space()->translation_map);
|
||||
}
|
||||
|
||||
return m68k_translation_map_get_pgdir(&to->team->address_space->translation_map);
|
||||
}
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
@ -181,24 +205,17 @@ arch_thread_switch_kstack_and_call(struct thread *t, addr_t newKstack,
|
||||
|
||||
|
||||
void
|
||||
arch_thread_context_switch(struct thread *t_from, struct thread *t_to)
|
||||
arch_thread_context_switch(struct thread *from, struct thread *to)
|
||||
{
|
||||
#warning M68K: WRITEME
|
||||
// set the new kernel stack in the EAR register.
|
||||
// this is used in the exception handler code to decide what kernel stack to
|
||||
// switch to if the exception had happened when the processor was in user mode
|
||||
//asm("mtear %0" :: "g"(t_to->kernel_stack_base + KERNEL_STACK_SIZE - 8));
|
||||
addr_t newPageDirectory;
|
||||
|
||||
// switch the asids if we need to
|
||||
if (t_to->team->address_space != NULL) {
|
||||
// the target thread has is user space
|
||||
if (t_from->team != t_to->team) {
|
||||
// switching to a new address space
|
||||
m68k_translation_map_change_asid(&t_to->team->address_space->translation_map);
|
||||
}
|
||||
}
|
||||
newPageDirectory = (addr_t)m68k_next_page_directory(from, to);
|
||||
|
||||
m68k_context_switch(&t_from->arch_info.sp, t_to->arch_info.sp);
|
||||
if ((newPageDirectory % B_PAGE_SIZE) != 0)
|
||||
panic("arch_thread_context_switch: bad pgdir 0x%lx\n", newPageDirectory);
|
||||
#warning M68K: export from arch_vm.c
|
||||
m68k_set_pgdir(newPageDirectory);
|
||||
m68k_context_switch(&from->arch_info.sp, to->arch_info.sp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <arch/user_debugger.h>
|
||||
|
||||
|
||||
#warning M68K: WRITEME
|
||||
void
|
||||
arch_clear_team_debug_info(struct arch_team_debug_info *info)
|
||||
{
|
||||
@ -39,6 +40,28 @@ arch_destroy_thread_debug_info(struct arch_thread_debug_info *info)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_update_thread_single_step()
|
||||
{
|
||||
if (struct iframe* frame = m68k_get_user_iframe()) {
|
||||
struct thread* thread = thread_get_current_thread();
|
||||
|
||||
// set/clear T1 in SR depending on if single stepping is desired
|
||||
// T1 T0
|
||||
// 0 0 no tracing
|
||||
// 0 1 trace on flow
|
||||
// 1 0 single step
|
||||
// 1 1 undef
|
||||
if (thread->debug_info.flags & B_THREAD_DEBUG_SINGLE_STEP) {
|
||||
frame->cpu.sr &= ~(M68K_SR_T_MASK);
|
||||
frame->cpu.sr |= (1 << M68K_SR_T1);
|
||||
} else {
|
||||
frame->cpu.sr &= ~(M68K_SR_T_MASK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_set_debug_cpu_state(const struct debug_cpu_state *cpuState)
|
||||
{
|
||||
@ -78,3 +101,8 @@ arch_clear_watchpoint(void *address)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
bool
|
||||
arch_has_breakpoints(struct arch_team_debug_info *info)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <boot/kernel_args.h>
|
||||
|
||||
#include <vm.h>
|
||||
#include <vm_types.h>
|
||||
#include <arch/vm.h>
|
||||
#include <arch_mmu.h>
|
||||
|
||||
@ -103,6 +104,8 @@ arch_vm_init_post_modules(kernel_args *args)
|
||||
void
|
||||
arch_vm_aspace_swap(vm_address_space *aspace)
|
||||
{
|
||||
m68k_set_pgdir(m68k_translation_map_get_pgdir(
|
||||
&aspace->translation_map));
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,7 +33,8 @@ extern struct m68k_vm_ops m68030_vm_ops;
|
||||
//extern struct m68k_vm_ops m68030_vm_ops;
|
||||
//extern struct m68k_vm_ops m68030_vm_ops;
|
||||
|
||||
static m68k_vm_ops *get_vm_ops()
|
||||
#warning M68K: use a static!
|
||||
m68k_vm_ops *get_vm_ops()
|
||||
{
|
||||
int mmu = arch_mmu_type;
|
||||
|
||||
@ -126,6 +127,11 @@ arch_vm_translation_map_early_query(addr_t va, addr_t *out_physical)
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
void
|
||||
m68k_set_pgdir(void *rt)
|
||||
{
|
||||
return get_vm_ops()->m68k_set_pgdir(rt);
|
||||
}
|
||||
#if 0
|
||||
|
||||
status_t
|
||||
|
@ -132,8 +132,9 @@ static status_t put_physical_page_tmap(addr_t va);
|
||||
static void flush_tmap(vm_translation_map *map);
|
||||
|
||||
|
||||
#warning M68K: RENAME
|
||||
static void *
|
||||
m68k_translation_map_get_pgdir(vm_translation_map *map)
|
||||
_m68k_translation_map_get_pgdir(vm_translation_map *map)
|
||||
{
|
||||
return map->arch_data->rtdir_phys;
|
||||
}
|
||||
|
@ -36,6 +36,12 @@ arch_destroy_thread_debug_info(struct arch_thread_debug_info *info)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_update_thread_single_step()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_set_debug_cpu_state(const struct debug_cpu_state *cpuState)
|
||||
{
|
||||
@ -75,3 +81,8 @@ arch_clear_watchpoint(void *address)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
bool
|
||||
arch_has_breakpoints(struct arch_team_debug_info *info)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user