diff --git a/src/system/kernel/arch/m68k/Jamfile b/src/system/kernel/arch/m68k/Jamfile index bae5105719..ed4d43632d 100644 --- a/src/system/kernel/arch/m68k/Jamfile +++ b/src/system/kernel/arch/m68k/Jamfile @@ -35,7 +35,6 @@ KernelStaticLibrary libm68k : arch_elf.cpp arch_exceptions.S arch_int.cpp - arch_mmu.cpp arch_platform.cpp arch_real_time_clock.cpp arch_smp.c diff --git a/src/system/kernel/arch/m68k/arch_asm.S b/src/system/kernel/arch/m68k/arch_asm.S index 39eeb0f103..4673531a9d 100644 --- a/src/system/kernel/arch/m68k/arch_asm.S +++ b/src/system/kernel/arch/m68k/arch_asm.S @@ -30,7 +30,7 @@ FUNCTION(arch_int_disable_interrupts): clr.l %d0 move %sr,%d0 move.l %d0,%d1 - ori.w #%x0700,%d1 + ori.w #0x0700,%d1 move %d1,%sr // return value: previous IPM lsr.l #8,%d0 @@ -56,7 +56,7 @@ FUNCTION(arch_int_restore_interrupts): FUNCTION(arch_int_are_interrupts_enabled): clr.l %d0 move %sr,%d1 - andi.w 0x0700,%d1 + andi.w #0x0700,%d1 bne arch_int_are_interrupts_enabled_no moveq.l #1,%d0 arch_int_are_interrupts_enabled_no: @@ -78,88 +78,37 @@ FUNCTION(get_time_base): rts -#warning M68K: checkme +#warning M68K: FIX m68k_context_switch // void m68k_context_switch(addr_t *old_sp, addr_t new_sp); FUNCTION(m68k_context_switch): // save fp ? //move.w %sr,-(%sp) movem.l %d0-%d7/%a0-%a7,-(%sp) - fpmovem %fp0-%fp7,-(%sp) - fpsave -(%sp) + fmovem %fp0-%fp7,-(%sp) + fsave -(%sp) + + // XXX - fprestore (%sp)+ - fpmovem (%sp)+,%fp0-%fp7 + frestore (%sp)+ + fmovem (%sp)+,%fp0-%fp7 movem.l (%sp)+,%d0-%d7/%a0-%a7 //move.w (%sp)+,%sr - // save the old stack pointer - 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 + rts // void m68k_switch_stack_and_call(addr_t newKstack, // void (*func)(void *), void *arg) FUNCTION(m68k_switch_stack_and_call): - mr %r1, %r3 // set the new stack pointer - mtctr %r4 // move the target function into CTR - mr %r3, %r5 // move the arg to this func to the new arg - bctr +#warning M68K: check + move.l 4(%sp),%a0 // new stack + move.l 8(%sp),%a1 // func + 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 @@ -167,15 +116,16 @@ FUNCTION(m68k_switch_stack_and_call): // an initialization function, the actual thread function, and a function that // destroys the thread. FUNCTION(m68k_kernel_thread_root): - mtlr %r13 - blrl - mtlr %r14 - blrl - mtlr %r15 - blrl +#warning M68K: check + move.l 4(%sp),%a0 + jsr (%a0) + move.l 8(%sp),%a0 + jsr (%a0) + move.l 12(%sp),%a0 + jsr (%a0) // We should never get here. If we do, it's time to enter the kernel // debugger (without a message at the moment). - li %r3, 0 - b kernel_debugger + clr.l -(%sp) + jmp kernel_debugger diff --git a/src/system/kernel/arch/m68k/arch_int.cpp b/src/system/kernel/arch/m68k/arch_int.cpp index 21ae690678..c60755dadb 100644 --- a/src/system/kernel/arch/m68k/arch_int.cpp +++ b/src/system/kernel/arch/m68k/arch_int.cpp @@ -94,11 +94,13 @@ print_iframe(struct iframe *frame) frame->pc, frame->ccr);*/ kprintf(" pc 0x%08lx sr 0x%04x\n", 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("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("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); +#endif } diff --git a/src/system/kernel/arch/m68k/arch_mmu.cpp b/src/system/kernel/arch/m68k/arch_mmu.cpp deleted file mode 100644 index 50096ed88c..0000000000 --- a/src/system/kernel/arch/m68k/arch_mmu.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2007, François Revol, revol@free.fr. - * Distributed under the terms of the MIT License. - * - * Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. - * Distributed under the terms of the OpenBeOS License. - */ - - -#include -#include - -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)); -} - diff --git a/src/system/kernel/arch/m68k/arch_platform.cpp b/src/system/kernel/arch/m68k/arch_platform.cpp index ba2d327789..93c7f49195 100644 --- a/src/system/kernel/arch/m68k/arch_platform.cpp +++ b/src/system/kernel/arch/m68k/arch_platform.cpp @@ -277,6 +277,7 @@ static char *sM68KPlatformBuffer[sizeof(M68KAtari)]; status_t arch_platform_init(struct kernel_args *kernelArgs) { +#warning M68K: switch platform from kernel args // only Atari supported for now if (true) sM68KPlatform = new(sM68KPlatformBuffer) M68KAtari; diff --git a/src/system/kernel/arch/m68k/arch_thread.c b/src/system/kernel/arch/m68k/arch_thread.c index 579594a0c3..ed667cf637 100644 --- a/src/system/kernel/arch/m68k/arch_thread.c +++ b/src/system/kernel/arch/m68k/arch_thread.c @@ -181,10 +181,11 @@ 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) { +#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)); + //asm("mtear %0" :: "g"(t_to->kernel_stack_base + KERNEL_STACK_SIZE - 8)); // switch the asids if we need to if (t_to->team->address_space != NULL) { diff --git a/src/system/kernel/arch/m68k/arch_timer.c b/src/system/kernel/arch/m68k/arch_timer.c index a687c65d49..72ab1204c8 100644 --- a/src/system/kernel/arch/m68k/arch_timer.c +++ b/src/system/kernel/arch/m68k/arch_timer.c @@ -18,35 +18,26 @@ #include -static bigtime_t sTickRate; - - void arch_timer_set_hardware_timer(bigtime_t timeout) { - bigtime_t new_val_64; - if(timeout < 1000) timeout = 1000; - - new_val_64 = (timeout * sTickRate) / 1000000; - - asm("mtdec %0" :: "r"((uint32)new_val_64)); + + platform_timer_set_hardware_timer(timeout); } void arch_timer_clear_hardware_timer() { - asm("mtdec %0" :: "r"(0x7fffffff)); + platform_timer_set_hardware_timer(timeout); } int arch_init_timer(kernel_args *ka) { - sTickRate = ka->arch_args.time_base_frequency; - - return 0; + return platform_init_timer(ka); } diff --git a/src/system/kernel/arch/m68k/arch_vm.cpp b/src/system/kernel/arch/m68k/arch_vm.cpp index 5414630bf0..74ea5f0f4e 100644 --- a/src/system/kernel/arch/m68k/arch_vm.cpp +++ b/src/system/kernel/arch/m68k/arch_vm.cpp @@ -26,6 +26,7 @@ # define TRACE(x) ; #endif +#warning M68K: WRITEME status_t arch_vm_init(kernel_args *args) @@ -57,6 +58,7 @@ arch_vm_init_post_area(kernel_args *args) status_t arch_vm_init_end(kernel_args *args) { +#if 0 TRACE(("arch_vm_init_end(): %lu virtual ranges to keep:\n", 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 // loader and have not yet turned into an area. vm_free_unused_boot_loader_range(0, 0xffffffff - B_PAGE_SIZE + 1); +#endif return B_OK; }