1 /* $NetBSD: cpu.h,v 1.2 2001/02/23 21:23:52 reinoud Exp $ */ 2 /* $FreeBSD$ */ 3 4 #ifndef MACHINE_CPU_H 5 #define MACHINE_CPU_H 6 7 #include <machine/armreg.h> 8 #include <machine/frame.h> 9 10 void cpu_halt(void); 11 void swi_vm(void *); 12 13 #ifdef _KERNEL 14 static __inline uint64_t 15 get_cyclecount(void) 16 { 17 struct bintime bt; 18 19 binuptime(&bt); 20 return ((uint64_t)bt.sec << 56 | bt.frac >> 8); 21 22 } 23 #endif 24 25 #define TRAPF_USERMODE(frame) ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) 26 27 #define TRAPF_PC(tfp) ((tfp)->tf_pc) 28 29 #define cpu_getstack(td) ((td)->td_frame->tf_usr_sp) 30 #define cpu_setstack(td, sp) ((td)->td_frame->tf_usr_sp = (sp)) 31 #define cpu_spinwait() /* nothing */ 32 33 #define ARM_NVEC 8 34 #define ARM_VEC_ALL 0xffffffff 35 36 extern vm_offset_t vector_page; 37 38 /* 39 * Params passed into initarm. If you change the size of this you will 40 * need to update locore.S to allocate more memory on the stack before 41 * it calls initarm. 42 */ 43 struct arm_boot_params { 44 register_t abp_size; /* Size of this structure */ 45 register_t abp_r0; /* r0 from the boot loader */ 46 register_t abp_r1; /* r1 from the boot loader */ 47 register_t abp_r2; /* r2 from the boot loader */ 48 register_t abp_r3; /* r3 from the boot loader */ 49 vm_offset_t abp_physaddr; /* The kernel physical address */ 50 vm_offset_t abp_pagetable; /* The early page table */ 51 }; 52 53 void arm_vector_init(vm_offset_t, int); 54 void fork_trampoline(void); 55 void identify_arm_cpu(void); 56 void *initarm(struct arm_boot_params *); 57 58 extern char btext[]; 59 extern char etext[]; 60 int badaddr_read(void *, size_t, void *); 61 #endif /* !MACHINE_CPU_H */ 62