/kernel/trunk/kernel.config |
---|
59,6 → 59,9 |
# Lazy FPU context switching |
! [(ARCH=mips32&MIPS_MACHINE!=msim&MIPS_MACHINE!=simics)|ARCH=amd64|ARCH=ia32] CONFIG_FPU_LAZY (y/n) |
# Power off on halt |
! [ARCH=ppc32] CONFIG_POWEROFF (y/n) |
## Debugging configuration directives |
# General debuging and assert checking |
/kernel/trunk/arch/ppc32/include/asm/spr.h |
---|
File deleted |
/kernel/trunk/arch/ppc32/include/asm/regname.h |
---|
189,4 → 189,8 |
#define sprg3 275 |
#define prv 287 |
/* MSR bits */ |
#define msr_ir (1 << 4) |
#define msr_dr (1 << 5) |
#endif |
/kernel/trunk/arch/ppc32/include/interrupt.h |
---|
29,6 → 29,11 |
#ifndef __ppc32_INTERRUPT_H__ |
#define __ppc32_INTERRUPT_H__ |
extern void interrupt(void); |
#define IVT_ITEMS 15 |
#define INT_OFFSET 0 |
#define VECTOR_DECREMENTER 10 |
extern void interrupt_init(void); |
#endif |
/kernel/trunk/arch/ppc32/include/drivers/cuda.h |
---|
29,8 → 29,9 |
#ifndef __CUDA_H__ |
#define __CUDA_H__ |
#include <arch/types.h> |
void cuda_init(void); |
extern void cuda_init(void); |
extern void cuda_packet(const __u8 data); |
#endif |
/kernel/trunk/arch/ppc32/Makefile.inc |
---|
62,6 → 62,7 |
arch/$(ARCH)/src/ppc32.c \ |
arch/$(ARCH)/src/dummy.s \ |
arch/$(ARCH)/src/exception.S \ |
arch/$(ARCH)/src/interrupt.c \ |
arch/$(ARCH)/src/asm.S \ |
arch/$(ARCH)/src/cpu/cpu.c \ |
arch/$(ARCH)/src/proc/scheduler.c \ |
/kernel/trunk/arch/ppc32/src/exception.S |
---|
27,7 → 27,7 |
# |
#include <arch/asm/regname.h> |
#include <arch/asm/spr.h> |
#include <arch/mm/page.h> |
.section K_UNMAPPED_TEXT_START, "ax" |
84,8 → 84,76 |
.org 0x900 |
.global exc_decrementer |
exc_decrementer: |
mtspr sprg1, sp |
subis sp, sp, 0x8000 |
subi sp, sp, 144 |
stw r0, 0(sp) |
stw r2, 4(sp) |
stw r3, 8(sp) |
stw r4, 12(sp) |
stw r5, 16(sp) |
stw r6, 20(sp) |
stw r7, 24(sp) |
stw r8, 28(sp) |
stw r9, 32(sp) |
stw r10, 36(sp) |
stw r11, 40(sp) |
stw r12, 44(sp) |
stw r13, 48(sp) |
stw r14, 52(sp) |
stw r15, 56(sp) |
stw r16, 60(sp) |
stw r17, 64(sp) |
stw r18, 68(sp) |
stw r19, 72(sp) |
stw r20, 76(sp) |
stw r21, 80(sp) |
stw r22, 84(sp) |
stw r23, 88(sp) |
stw r24, 92(sp) |
stw r25, 96(sp) |
stw r26, 100(sp) |
stw r27, 104(sp) |
stw r28, 108(sp) |
stw r29, 112(sp) |
stw r30, 116(sp) |
stw r31, 120(sp) |
mfspr r3, srr0 |
stw r3, 124(sp) |
mfspr r3, srr1 |
stw r3, 128(sp) |
mflr r3 |
stw r3, 132(sp) |
mfcr r3 |
stw r3, 136(sp) |
mfctr r3 |
stw r3, 140(sp) |
mfxer r3 |
stw r3, 144(sp) |
lis r3, exc_dispatch@ha |
addi r3, r3, exc_dispatch@l |
mtspr srr0, r3 |
mfmsr r3 |
ori r3, r3, (msr_ir | msr_dr)@l |
mtspr srr1, r3 |
lis r3, iret@ha |
addi r3, r3, iret@l |
mtlr r3 |
addis sp, sp, 0x8000 |
li r3, 10 |
rfi |
b exc_decrementer |
.org 0xa00 |
.global exc_reserved0 |
/kernel/trunk/arch/ppc32/src/asm.S |
---|
31,6 → 31,7 |
.text |
.global cpu_sleep |
.global iret |
.global memsetb |
.global memcpy |
37,6 → 38,61 |
cpu_sleep: |
b cpu_sleep |
iret: |
lwz r3, 144(sp) |
mtxer r3 |
lwz r3, 140(sp) |
mtctr r3 |
lwz r3, 136(sp) |
mtcr r3 |
lwz r3, 132(sp) |
mtlr r3 |
lwz r3, 128(sp) |
mtspr srr1, r3 |
lwz r3, 124(sp) |
mtspr srr0, r3 |
lwz r0, 0(sp) |
lwz r2, 4(sp) |
lwz r3, 8(sp) |
lwz r4, 12(sp) |
lwz r5, 16(sp) |
lwz r6, 20(sp) |
lwz r7, 24(sp) |
lwz r8, 28(sp) |
lwz r9, 32(sp) |
lwz r10, 36(sp) |
lwz r11, 40(sp) |
lwz r12, 44(sp) |
lwz r13, 48(sp) |
lwz r14, 52(sp) |
lwz r15, 56(sp) |
lwz r16, 60(sp) |
lwz r17, 64(sp) |
lwz r18, 68(sp) |
lwz r19, 72(sp) |
lwz r20, 76(sp) |
lwz r21, 80(sp) |
lwz r22, 84(sp) |
lwz r23, 88(sp) |
lwz r24, 92(sp) |
lwz r25, 96(sp) |
lwz r26, 100(sp) |
lwz r27, 104(sp) |
lwz r28, 108(sp) |
lwz r29, 112(sp) |
lwz r30, 116(sp) |
lwz r31, 120(sp) |
mfspr sp, sprg1 |
rfi |
memsetb: |
rlwimi r5, r5, 8, 16, 23 |
rlwimi r5, r5, 16, 0, 15 |
/kernel/trunk/arch/ppc32/src/boot/boot.S |
---|
27,7 → 27,6 |
# |
#include <arch/asm/regname.h> |
#include <arch/asm/spr.h> |
#include <arch/boot/boot.h> |
#include <arch/boot/memmap.h> |
/kernel/trunk/arch/ppc32/src/proc/scheduler.c |
---|
26,10 → 26,18 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <arch/mm/page.h> |
#include <proc/scheduler.h> |
#include <proc/thread.h> |
#include <arch.h> |
__address supervisor_sp; |
__address supervisor_sp_physical; |
void before_thread_runs_arch(void) |
{ |
supervisor_sp = (__address) &THREAD->kstack[THREAD_STACK_SIZE - SP_DELTA]; |
supervisor_sp_physical = KA2PA(supervisor_sp_physical); |
} |
void after_thread_ran_arch(void) |
/kernel/trunk/arch/ppc32/src/ppc32.c |
---|
30,9 → 30,13 |
#include <arch/console.h> |
#include <arch/drivers/cuda.h> |
#include <arch/mm/memory_init.h> |
#include <arch/interrupt.h> |
void arch_pre_mm_init(void) |
{ |
/* Initialize dispatch table */ |
interrupt_init(); |
ppc32_console_init(); |
cuda_init(); |
} |
/kernel/trunk/arch/ppc32/src/interrupt.c |
---|
0,0 → 1,46 |
/* |
* Copyright (C) 2006 Martin Decky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <interrupt.h> |
#include <arch/interrupt.h> |
#include <arch/types.h> |
#include <arch.h> |
#include <time/clock.h> |
#include <print.h> |
static void exception_decrementer(int n, istate_t *istate) |
{ |
clock(); |
} |
/* Initialize basic tables for exception dispatching */ |
void interrupt_init(void) |
{ |
exc_register(VECTOR_DECREMENTER, "timer", exception_decrementer); |
} |
/kernel/trunk/arch/ppc32/src/drivers/cuda.c |
---|
53,7 → 53,7 |
} |
static void cuda_packet(const __u8 data) |
void cuda_packet(const __u8 data) |
{ |
cuda[B] = cuda[B] | TIP; |
cuda[ACR] = cuda[ACR] | SR_OUT; |
69,7 → 69,8 |
void cpu_halt(void) { |
#ifdef CONFIG_POWEROFF |
cuda_packet(CUDA_POWERDOWN); |
#endif |
cpu_sleep(); |
} |
/kernel/trunk/arch/amd64/Makefile.inc |
---|
83,7 → 83,6 |
endif |
ARCH_SOURCES = \ |
arch/$(ARCH)/src/dummy.s \ |
arch/$(ARCH)/src/fpu_context.c \ |
arch/$(ARCH)/src/boot/boot.S \ |
arch/$(ARCH)/src/pm.c \ |
/kernel/trunk/arch/amd64/src/dummy.s |
---|
File deleted |