2003-05-03 16:49:57 +04:00
|
|
|
/*
|
|
|
|
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
|
|
|
** Distributed under the terms of the OpenBeOS License.
|
|
|
|
*/
|
|
|
|
#ifndef _KERNEL_ARCH_PPC_CPU_H
|
|
|
|
#define _KERNEL_ARCH_PPC_CPU_H
|
|
|
|
|
2003-10-17 17:58:41 +04:00
|
|
|
|
2003-05-03 16:49:57 +04:00
|
|
|
#include <arch/ppc/thread_struct.h>
|
2003-10-17 17:58:41 +04:00
|
|
|
#include <kernel.h>
|
2003-05-03 16:49:57 +04:00
|
|
|
|
|
|
|
#define PAGE_SIZE 4096
|
|
|
|
|
|
|
|
#define _BIG_ENDIAN 1
|
|
|
|
#define _LITTLE_ENDIAN 0
|
|
|
|
|
2003-08-22 03:02:00 +04:00
|
|
|
#define ATOMIC64_FUNCS_ARE_SYSCALLS 1
|
|
|
|
|
2003-05-03 16:49:57 +04:00
|
|
|
struct iframe {
|
2003-10-17 17:58:41 +04:00
|
|
|
uint32 srr0;
|
|
|
|
uint32 srr1;
|
|
|
|
uint32 dar;
|
|
|
|
uint32 dsisr;
|
|
|
|
uint32 lr;
|
|
|
|
uint32 cr;
|
|
|
|
uint32 xer;
|
|
|
|
uint32 ctr;
|
|
|
|
uint32 r31;
|
|
|
|
uint32 r30;
|
|
|
|
uint32 r29;
|
|
|
|
uint32 r28;
|
|
|
|
uint32 r27;
|
|
|
|
uint32 r26;
|
|
|
|
uint32 r25;
|
|
|
|
uint32 r24;
|
|
|
|
uint32 r23;
|
|
|
|
uint32 r22;
|
|
|
|
uint32 r21;
|
|
|
|
uint32 r20;
|
|
|
|
uint32 r19;
|
|
|
|
uint32 r18;
|
|
|
|
uint32 r17;
|
|
|
|
uint32 r16;
|
|
|
|
uint32 r15;
|
|
|
|
uint32 r14;
|
|
|
|
uint32 r13;
|
|
|
|
uint32 r12;
|
|
|
|
uint32 r11;
|
|
|
|
uint32 r10;
|
|
|
|
uint32 r9;
|
|
|
|
uint32 r8;
|
|
|
|
uint32 r7;
|
|
|
|
uint32 r6;
|
|
|
|
uint32 r5;
|
|
|
|
uint32 r4;
|
|
|
|
uint32 r3;
|
|
|
|
uint32 r2;
|
|
|
|
uint32 r1;
|
|
|
|
uint32 r0;
|
2003-05-03 16:49:57 +04:00
|
|
|
};
|
|
|
|
|
2003-10-21 07:07:44 +04:00
|
|
|
enum machine_state {
|
|
|
|
MSR_PRIVILEGE_LEVEL = 1L << 14, // PR
|
|
|
|
MSR_FP_AVAILABLE = 1L << 13, // FP
|
|
|
|
MSR_MACHINE_CHECK_ENABLED = 1L << 12, // ME
|
|
|
|
MSR_EXCEPTION_PREFIX = 1L << 6, // IP
|
|
|
|
MSR_INST_ADDRESS_TRANSLATION = 1L << 5, // IR
|
|
|
|
MSR_DATA_ADDRESS_TRANSLATION = 1L << 4, // DR
|
|
|
|
};
|
2003-10-17 17:58:41 +04:00
|
|
|
|
|
|
|
struct block_address_translation;
|
|
|
|
|
2003-10-08 04:28:07 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern uint32 get_sdr1(void);
|
2003-10-11 22:57:35 +04:00
|
|
|
extern void set_sdr1(uint32 value);
|
|
|
|
extern uint32 get_sr(void *virtualAddress);
|
|
|
|
extern void set_sr(void *virtualAddress, uint32 value);
|
|
|
|
extern uint32 get_msr(void);
|
|
|
|
extern uint32 set_msr(uint32 value);
|
2003-10-08 04:28:07 +04:00
|
|
|
|
2003-10-17 17:58:41 +04:00
|
|
|
extern void set_ibat0(struct block_address_translation *bat);
|
|
|
|
extern void set_ibat1(struct block_address_translation *bat);
|
|
|
|
extern void set_ibat2(struct block_address_translation *bat);
|
|
|
|
extern void set_ibat3(struct block_address_translation *bat);
|
|
|
|
extern void set_dbat0(struct block_address_translation *bat);
|
|
|
|
extern void set_dbat1(struct block_address_translation *bat);
|
|
|
|
extern void set_dbat2(struct block_address_translation *bat);
|
|
|
|
extern void set_dbat3(struct block_address_translation *bat);
|
|
|
|
|
2003-10-21 07:07:44 +04:00
|
|
|
extern void get_ibat0(struct block_address_translation *bat);
|
|
|
|
extern void get_ibat1(struct block_address_translation *bat);
|
|
|
|
extern void get_ibat2(struct block_address_translation *bat);
|
|
|
|
extern void get_ibat3(struct block_address_translation *bat);
|
|
|
|
extern void get_dbat0(struct block_address_translation *bat);
|
|
|
|
extern void get_dbat1(struct block_address_translation *bat);
|
|
|
|
extern void get_dbat2(struct block_address_translation *bat);
|
|
|
|
extern void get_dbat3(struct block_address_translation *bat);
|
|
|
|
|
|
|
|
extern void reset_ibats(void);
|
|
|
|
extern void reset_dbats(void);
|
|
|
|
|
2003-10-17 17:58:41 +04:00
|
|
|
//extern void sethid0(unsigned int val);
|
|
|
|
//extern unsigned int getl2cr(void);
|
|
|
|
//extern void setl2cr(unsigned int val);
|
|
|
|
extern long long get_time_base(void);
|
|
|
|
|
|
|
|
extern void ppc_context_switch(void **_oldStackPointer, void *newStackPointer);
|
|
|
|
|
2003-10-08 04:28:07 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-10-11 22:57:35 +04:00
|
|
|
#define eieio() asm volatile("eieio")
|
2003-10-17 17:58:41 +04:00
|
|
|
#define isync() asm volatile("isync")
|
2003-10-21 07:07:44 +04:00
|
|
|
#define tlbsync() asm volatile("tlbsync")
|
2003-10-11 22:57:35 +04:00
|
|
|
|
2003-05-03 16:49:57 +04:00
|
|
|
#endif /* _KERNEL_ARCH_PPC_CPU_H */
|