Some reorg.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23759 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -35,7 +35,6 @@ KernelStaticLibrary libm68k :
|
|||||||
arch_elf.cpp
|
arch_elf.cpp
|
||||||
arch_exceptions.S
|
arch_exceptions.S
|
||||||
arch_int.cpp
|
arch_int.cpp
|
||||||
arch_mmu.cpp
|
|
||||||
arch_platform.cpp
|
arch_platform.cpp
|
||||||
arch_real_time_clock.cpp
|
arch_real_time_clock.cpp
|
||||||
arch_smp.c
|
arch_smp.c
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ FUNCTION(arch_int_disable_interrupts):
|
|||||||
clr.l %d0
|
clr.l %d0
|
||||||
move %sr,%d0
|
move %sr,%d0
|
||||||
move.l %d0,%d1
|
move.l %d0,%d1
|
||||||
ori.w #%x0700,%d1
|
ori.w #0x0700,%d1
|
||||||
move %d1,%sr
|
move %d1,%sr
|
||||||
// return value: previous IPM
|
// return value: previous IPM
|
||||||
lsr.l #8,%d0
|
lsr.l #8,%d0
|
||||||
@@ -56,7 +56,7 @@ FUNCTION(arch_int_restore_interrupts):
|
|||||||
FUNCTION(arch_int_are_interrupts_enabled):
|
FUNCTION(arch_int_are_interrupts_enabled):
|
||||||
clr.l %d0
|
clr.l %d0
|
||||||
move %sr,%d1
|
move %sr,%d1
|
||||||
andi.w 0x0700,%d1
|
andi.w #0x0700,%d1
|
||||||
bne arch_int_are_interrupts_enabled_no
|
bne arch_int_are_interrupts_enabled_no
|
||||||
moveq.l #1,%d0
|
moveq.l #1,%d0
|
||||||
arch_int_are_interrupts_enabled_no:
|
arch_int_are_interrupts_enabled_no:
|
||||||
@@ -78,88 +78,37 @@ FUNCTION(get_time_base):
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
#warning M68K: checkme
|
#warning M68K: FIX m68k_context_switch
|
||||||
// void m68k_context_switch(addr_t *old_sp, addr_t new_sp);
|
// void m68k_context_switch(addr_t *old_sp, addr_t new_sp);
|
||||||
FUNCTION(m68k_context_switch):
|
FUNCTION(m68k_context_switch):
|
||||||
// save fp ?
|
// save fp ?
|
||||||
//move.w %sr,-(%sp)
|
//move.w %sr,-(%sp)
|
||||||
movem.l %d0-%d7/%a0-%a7,-(%sp)
|
movem.l %d0-%d7/%a0-%a7,-(%sp)
|
||||||
fpmovem %fp0-%fp7,-(%sp)
|
fmovem %fp0-%fp7,-(%sp)
|
||||||
fpsave -(%sp)
|
fsave -(%sp)
|
||||||
|
|
||||||
|
// XXX
|
||||||
|
|
||||||
fprestore (%sp)+
|
frestore (%sp)+
|
||||||
fpmovem (%sp)+,%fp0-%fp7
|
fmovem (%sp)+,%fp0-%fp7
|
||||||
movem.l (%sp)+,%d0-%d7/%a0-%a7
|
movem.l (%sp)+,%d0-%d7/%a0-%a7
|
||||||
//move.w (%sp)+,%sr
|
//move.w (%sp)+,%sr
|
||||||
|
|
||||||
// save the old stack pointer
|
rts
|
||||||
stwu %r1, 0(%r3)
|
|
||||||
|
|
||||||
// restore the new stack pointer
|
|
||||||
mr %r1, %r4
|
|
||||||
|
|
||||||
// restore the new regs
|
|
||||||
// LR and CR
|
|
||||||
lwz %r0, 0(%r1)
|
|
||||||
mtlr %r0
|
|
||||||
lwzu %r0, 4(%r1)
|
|
||||||
mtcr %r0
|
|
||||||
|
|
||||||
// r2, r13-31
|
|
||||||
lwzu %r2, 4(%r1)
|
|
||||||
lwzu %r13, 4(%r1)
|
|
||||||
lwzu %r14, 4(%r1)
|
|
||||||
lwzu %r15, 4(%r1)
|
|
||||||
lwzu %r16, 4(%r1)
|
|
||||||
lwzu %r17, 4(%r1)
|
|
||||||
lwzu %r18, 4(%r1)
|
|
||||||
lwzu %r19, 4(%r1)
|
|
||||||
lwzu %r20, 4(%r1)
|
|
||||||
lwzu %r21, 4(%r1)
|
|
||||||
lwzu %r22, 4(%r1)
|
|
||||||
lwzu %r23, 4(%r1)
|
|
||||||
lwzu %r24, 4(%r1)
|
|
||||||
lwzu %r25, 4(%r1)
|
|
||||||
lwzu %r26, 4(%r1)
|
|
||||||
lwzu %r27, 4(%r1)
|
|
||||||
lwzu %r28, 4(%r1)
|
|
||||||
lwzu %r29, 4(%r1)
|
|
||||||
lwzu %r30, 4(%r1)
|
|
||||||
lwzu %r31, 4(%r1)
|
|
||||||
|
|
||||||
// f13-31
|
|
||||||
lfdu %f13, 4(%r1)
|
|
||||||
lfdu %f14, 8(%r1)
|
|
||||||
lfdu %f15, 8(%r1)
|
|
||||||
lfdu %f16, 8(%r1)
|
|
||||||
lfdu %f17, 8(%r1)
|
|
||||||
lfdu %f18, 8(%r1)
|
|
||||||
lfdu %f19, 8(%r1)
|
|
||||||
lfdu %f20, 8(%r1)
|
|
||||||
lfdu %f21, 8(%r1)
|
|
||||||
lfdu %f22, 8(%r1)
|
|
||||||
lfdu %f23, 8(%r1)
|
|
||||||
lfdu %f24, 8(%r1)
|
|
||||||
lfdu %f25, 8(%r1)
|
|
||||||
lfdu %f26, 8(%r1)
|
|
||||||
lfdu %f27, 8(%r1)
|
|
||||||
lfdu %f28, 8(%r1)
|
|
||||||
lfdu %f29, 8(%r1)
|
|
||||||
lfdu %f30, 8(%r1)
|
|
||||||
lfdu %f31, 8(%r1)
|
|
||||||
|
|
||||||
addi %r1, %r1, 8
|
|
||||||
|
|
||||||
blr
|
|
||||||
|
|
||||||
|
|
||||||
// void m68k_switch_stack_and_call(addr_t newKstack,
|
// void m68k_switch_stack_and_call(addr_t newKstack,
|
||||||
// void (*func)(void *), void *arg)
|
// void (*func)(void *), void *arg)
|
||||||
FUNCTION(m68k_switch_stack_and_call):
|
FUNCTION(m68k_switch_stack_and_call):
|
||||||
mr %r1, %r3 // set the new stack pointer
|
#warning M68K: check
|
||||||
mtctr %r4 // move the target function into CTR
|
move.l 4(%sp),%a0 // new stack
|
||||||
mr %r3, %r5 // move the arg to this func to the new arg
|
move.l 8(%sp),%a1 // func
|
||||||
bctr
|
move.l 12(%sp),%d0 // args
|
||||||
|
move.l %a0,%sp // switch the stack
|
||||||
|
move.l %d0,-(%sp) // push the argument
|
||||||
|
jsr (%a1) // call the target function
|
||||||
|
_loop:
|
||||||
|
bra _loop
|
||||||
|
|
||||||
|
|
||||||
// m68k_kernel_thread_root(): parameters in r13-r15, the functions to call
|
// m68k_kernel_thread_root(): parameters in r13-r15, the functions to call
|
||||||
@@ -167,15 +116,16 @@ FUNCTION(m68k_switch_stack_and_call):
|
|||||||
// an initialization function, the actual thread function, and a function that
|
// an initialization function, the actual thread function, and a function that
|
||||||
// destroys the thread.
|
// destroys the thread.
|
||||||
FUNCTION(m68k_kernel_thread_root):
|
FUNCTION(m68k_kernel_thread_root):
|
||||||
mtlr %r13
|
#warning M68K: check
|
||||||
blrl
|
move.l 4(%sp),%a0
|
||||||
mtlr %r14
|
jsr (%a0)
|
||||||
blrl
|
move.l 8(%sp),%a0
|
||||||
mtlr %r15
|
jsr (%a0)
|
||||||
blrl
|
move.l 12(%sp),%a0
|
||||||
|
jsr (%a0)
|
||||||
|
|
||||||
// We should never get here. If we do, it's time to enter the kernel
|
// We should never get here. If we do, it's time to enter the kernel
|
||||||
// debugger (without a message at the moment).
|
// debugger (without a message at the moment).
|
||||||
li %r3, 0
|
clr.l -(%sp)
|
||||||
b kernel_debugger
|
jmp kernel_debugger
|
||||||
|
|
||||||
|
|||||||
@@ -94,11 +94,13 @@ print_iframe(struct iframe *frame)
|
|||||||
frame->pc, frame->ccr);*/
|
frame->pc, frame->ccr);*/
|
||||||
kprintf(" pc 0x%08lx sr 0x%04x\n",
|
kprintf(" pc 0x%08lx sr 0x%04x\n",
|
||||||
frame->pc, frame->sr);
|
frame->pc, frame->sr);
|
||||||
|
#if 0
|
||||||
dprintf("r0-r3: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->d0, frame->d1, frame->d2, frame->d3);
|
dprintf("r0-r3: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->d0, frame->d1, frame->d2, frame->d3);
|
||||||
dprintf("r4-r7: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->d4, frame->d5, frame->d6, frame->d7);
|
dprintf("r4-r7: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->d4, frame->d5, frame->d6, frame->d7);
|
||||||
dprintf("r8-r11: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->a0, frame->a1, frame->a2, frame->a3);
|
dprintf("r8-r11: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->a0, frame->a1, frame->a2, frame->a3);
|
||||||
dprintf("r12-r15: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->a4, frame->a5, frame->a6, frame->a7);
|
dprintf("r12-r15: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", frame->a4, frame->a5, frame->a6, frame->a7);
|
||||||
dprintf(" pc 0x%08lx sr 0x%08lx\n", frame->pc, frame->sr);
|
dprintf(" pc 0x%08lx sr 0x%08lx\n", frame->pc, frame->sr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2007, François Revol, [email protected].
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
* Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
|
|
||||||
* Distributed under the terms of the OpenBeOS License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <arch_mmu.h>
|
|
||||||
#include <arch_cpu.h>
|
|
||||||
|
|
||||||
w
|
|
||||||
void
|
|
||||||
m68k_get_page_table(page_table_entry_group **_pageTable, size_t *_size)
|
|
||||||
{
|
|
||||||
uint32 sdr1 = get_sdr1();
|
|
||||||
|
|
||||||
*_pageTable = (page_table_entry_group *)(sdr1 & 0xffff0000);
|
|
||||||
*_size = ((sdr1 & 0x1ff) + 1) << 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
m68k_set_page_table(page_table_entry_group *pageTable, size_t size)
|
|
||||||
{
|
|
||||||
set_sdr1(((uint32)pageTable & 0xffff0000) | (((size -1) >> 16) & 0x1ff));
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -277,6 +277,7 @@ static char *sM68KPlatformBuffer[sizeof(M68KAtari)];
|
|||||||
status_t
|
status_t
|
||||||
arch_platform_init(struct kernel_args *kernelArgs)
|
arch_platform_init(struct kernel_args *kernelArgs)
|
||||||
{
|
{
|
||||||
|
#warning M68K: switch platform from kernel args
|
||||||
// only Atari supported for now
|
// only Atari supported for now
|
||||||
if (true)
|
if (true)
|
||||||
sM68KPlatform = new(sM68KPlatformBuffer) M68KAtari;
|
sM68KPlatform = new(sM68KPlatformBuffer) M68KAtari;
|
||||||
|
|||||||
@@ -181,10 +181,11 @@ arch_thread_switch_kstack_and_call(struct thread *t, addr_t newKstack,
|
|||||||
void
|
void
|
||||||
arch_thread_context_switch(struct thread *t_from, struct thread *t_to)
|
arch_thread_context_switch(struct thread *t_from, struct thread *t_to)
|
||||||
{
|
{
|
||||||
|
#warning M68K: WRITEME
|
||||||
// set the new kernel stack in the EAR register.
|
// set the new kernel stack in the EAR register.
|
||||||
// this is used in the exception handler code to decide what kernel stack to
|
// 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
|
// 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));
|
//asm("mtear %0" :: "g"(t_to->kernel_stack_base + KERNEL_STACK_SIZE - 8));
|
||||||
|
|
||||||
// switch the asids if we need to
|
// switch the asids if we need to
|
||||||
if (t_to->team->address_space != NULL) {
|
if (t_to->team->address_space != NULL) {
|
||||||
|
|||||||
@@ -18,35 +18,26 @@
|
|||||||
#include <arch/timer.h>
|
#include <arch/timer.h>
|
||||||
|
|
||||||
|
|
||||||
static bigtime_t sTickRate;
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_timer_set_hardware_timer(bigtime_t timeout)
|
arch_timer_set_hardware_timer(bigtime_t timeout)
|
||||||
{
|
{
|
||||||
bigtime_t new_val_64;
|
|
||||||
|
|
||||||
if(timeout < 1000)
|
if(timeout < 1000)
|
||||||
timeout = 1000;
|
timeout = 1000;
|
||||||
|
|
||||||
new_val_64 = (timeout * sTickRate) / 1000000;
|
platform_timer_set_hardware_timer(timeout);
|
||||||
|
|
||||||
asm("mtdec %0" :: "r"((uint32)new_val_64));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arch_timer_clear_hardware_timer()
|
arch_timer_clear_hardware_timer()
|
||||||
{
|
{
|
||||||
asm("mtdec %0" :: "r"(0x7fffffff));
|
platform_timer_set_hardware_timer(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
arch_init_timer(kernel_args *ka)
|
arch_init_timer(kernel_args *ka)
|
||||||
{
|
{
|
||||||
sTickRate = ka->arch_args.time_base_frequency;
|
return platform_init_timer(ka);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
# define TRACE(x) ;
|
# define TRACE(x) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#warning M68K: WRITEME
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
arch_vm_init(kernel_args *args)
|
arch_vm_init(kernel_args *args)
|
||||||
@@ -57,6 +58,7 @@ arch_vm_init_post_area(kernel_args *args)
|
|||||||
status_t
|
status_t
|
||||||
arch_vm_init_end(kernel_args *args)
|
arch_vm_init_end(kernel_args *args)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
TRACE(("arch_vm_init_end(): %lu virtual ranges to keep:\n",
|
TRACE(("arch_vm_init_end(): %lu virtual ranges to keep:\n",
|
||||||
args->arch_args.num_virtual_ranges_to_keep));
|
args->arch_args.num_virtual_ranges_to_keep));
|
||||||
|
|
||||||
@@ -85,6 +87,7 @@ arch_vm_init_end(kernel_args *args)
|
|||||||
// Throw away any address space mappings we've inherited from the boot
|
// Throw away any address space mappings we've inherited from the boot
|
||||||
// loader and have not yet turned into an area.
|
// loader and have not yet turned into an area.
|
||||||
vm_free_unused_boot_loader_range(0, 0xffffffff - B_PAGE_SIZE + 1);
|
vm_free_unused_boot_loader_range(0, 0xffffffff - B_PAGE_SIZE + 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user