16fc729afSOlivier Houchard /* $NetBSD: cpu.h,v 1.2 2001/02/23 21:23:52 reinoud Exp $ */ 26fc729afSOlivier Houchard /* $FreeBSD$ */ 36fc729afSOlivier Houchard 46fc729afSOlivier Houchard #ifndef MACHINE_CPU_H 56fc729afSOlivier Houchard #define MACHINE_CPU_H 66fc729afSOlivier Houchard 76fc729afSOlivier Houchard #include <machine/armreg.h> 8*64894120SIan Lepore #include <machine/frame.h> 96fc729afSOlivier Houchard 106fc729afSOlivier Houchard void cpu_halt(void); 116fc729afSOlivier Houchard void swi_vm(void *); 126fc729afSOlivier Houchard 13a29cc9a3SAndriy Gapon #ifdef _KERNEL 146fc729afSOlivier Houchard static __inline uint64_t 156fc729afSOlivier Houchard get_cyclecount(void) 166fc729afSOlivier Houchard { 173ce6572fSOlivier Houchard struct bintime bt; 183ce6572fSOlivier Houchard 193ce6572fSOlivier Houchard binuptime(&bt); 20eb14346aSJung-uk Kim return ((uint64_t)bt.sec << 56 | bt.frac >> 8); 213ce6572fSOlivier Houchard 226fc729afSOlivier Houchard } 23a29cc9a3SAndriy Gapon #endif 246fc729afSOlivier Houchard 256fc729afSOlivier Houchard #define TRAPF_USERMODE(frame) ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) 266fc729afSOlivier Houchard 276fc729afSOlivier Houchard #define TRAPF_PC(tfp) ((tfp)->tf_pc) 286fc729afSOlivier Houchard 296fc729afSOlivier Houchard #define cpu_getstack(td) ((td)->td_frame->tf_usr_sp) 306fc729afSOlivier Houchard #define cpu_setstack(td, sp) ((td)->td_frame->tf_usr_sp = (sp)) 319f1b87f1SMaxime Henrion #define cpu_spinwait() /* nothing */ 326fc729afSOlivier Houchard 336fc729afSOlivier Houchard #define ARM_NVEC 8 346fc729afSOlivier Houchard #define ARM_VEC_ALL 0xffffffff 356fc729afSOlivier Houchard 366fc729afSOlivier Houchard extern vm_offset_t vector_page; 376fc729afSOlivier Houchard 3846231809SWarner Losh struct arm_boot_params { 3946231809SWarner Losh register_t abp_size; /* Size of this structure */ 4046231809SWarner Losh register_t abp_r0; /* r0 from the boot loader */ 4146231809SWarner Losh register_t abp_r1; /* r1 from the boot loader */ 4246231809SWarner Losh register_t abp_r2; /* r2 from the boot loader */ 4346231809SWarner Losh register_t abp_r3; /* r3 from the boot loader */ 4446231809SWarner Losh }; 4546231809SWarner Losh 466fc729afSOlivier Houchard void arm_vector_init(vm_offset_t, int); 473d7d8f61SNate Lawson void fork_trampoline(void); 486fc729afSOlivier Houchard void identify_arm_cpu(void); 4946231809SWarner Losh void *initarm(struct arm_boot_params *); 506fc729afSOlivier Houchard 516fc729afSOlivier Houchard extern char btext[]; 526fc729afSOlivier Houchard extern char etext[]; 536fc729afSOlivier Houchard int badaddr_read(void *, size_t, void *); 546fc729afSOlivier Houchard #endif /* !MACHINE_CPU_H */ 55