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> 86fc729afSOlivier Houchard 96fc729afSOlivier Houchard void cpu_halt(void); 106fc729afSOlivier Houchard void swi_vm(void *); 116fc729afSOlivier Houchard 123ce6572fSOlivier Houchard #ifdef _KERNEL 136fc729afSOlivier Houchard static __inline uint64_t 146fc729afSOlivier Houchard get_cyclecount(void) 156fc729afSOlivier Houchard { 163ce6572fSOlivier Houchard struct bintime bt; 173ce6572fSOlivier Houchard 183ce6572fSOlivier Houchard binuptime(&bt); 19eb14346aSJung-uk Kim return ((uint64_t)bt.sec << 56 | bt.frac >> 8); 203ce6572fSOlivier Houchard 216fc729afSOlivier Houchard } 223ce6572fSOlivier Houchard #endif 236fc729afSOlivier Houchard 246fc729afSOlivier Houchard #define TRAPF_USERMODE(frame) ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) 256fc729afSOlivier Houchard 266fc729afSOlivier Houchard #define TRAPF_PC(tfp) ((tfp)->tf_pc) 276fc729afSOlivier Houchard 286fc729afSOlivier Houchard #define cpu_getstack(td) ((td)->td_frame->tf_usr_sp) 296fc729afSOlivier Houchard #define cpu_setstack(td, sp) ((td)->td_frame->tf_usr_sp = (sp)) 309f1b87f1SMaxime Henrion #define cpu_spinwait() /* nothing */ 316fc729afSOlivier Houchard 326fc729afSOlivier Houchard #define ARM_NVEC 8 336fc729afSOlivier Houchard #define ARM_VEC_ALL 0xffffffff 346fc729afSOlivier Houchard 356fc729afSOlivier Houchard extern vm_offset_t vector_page; 366fc729afSOlivier Houchard 37*46231809SWarner Losh struct arm_boot_params { 38*46231809SWarner Losh register_t abp_size; /* Size of this structure */ 39*46231809SWarner Losh register_t abp_r0; /* r0 from the boot loader */ 40*46231809SWarner Losh register_t abp_r1; /* r1 from the boot loader */ 41*46231809SWarner Losh register_t abp_r2; /* r2 from the boot loader */ 42*46231809SWarner Losh register_t abp_r3; /* r3 from the boot loader */ 43*46231809SWarner Losh }; 44*46231809SWarner Losh 456fc729afSOlivier Houchard void arm_vector_init(vm_offset_t, int); 463d7d8f61SNate Lawson void fork_trampoline(void); 476fc729afSOlivier Houchard void identify_arm_cpu(void); 48*46231809SWarner Losh void *initarm(struct arm_boot_params *); 496fc729afSOlivier Houchard 506fc729afSOlivier Houchard extern char btext[]; 516fc729afSOlivier Houchard extern char etext[]; 526fc729afSOlivier Houchard int badaddr_read(void *, size_t, void *); 536fc729afSOlivier Houchard #endif /* !MACHINE_CPU_H */ 54