xref: /freebsd/sys/arm/include/cpu.h (revision 3d7d8f614b0ca3553ac91a3243fbf5018103ab62)
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);
193ce6572fSOlivier Houchard 	return (bt.frac ^ bt.sec);
203ce6572fSOlivier Houchard 
216fc729afSOlivier Houchard }
223ce6572fSOlivier Houchard #endif
236fc729afSOlivier Houchard 
246fc729afSOlivier Houchard #define CPU_CONSDEV 1
256fc729afSOlivier Houchard #define CPU_ADJKERNTZ           2       /* int: timezone offset (seconds) */
266fc729afSOlivier Houchard #define CPU_DISRTCSET           3       /* int: disable resettodr() call */
276fc729afSOlivier Houchard #define CPU_BOOTINFO            4       /* struct: bootinfo */
286fc729afSOlivier Houchard #define CPU_WALLCLOCK           5       /* int: indicates wall CMOS clock */
296fc729afSOlivier Houchard #define CPU_MAXID               6       /* number of valid machdep ids */
306fc729afSOlivier Houchard 
316fc729afSOlivier Houchard 
326fc729afSOlivier Houchard #define CLKF_USERMODE(frame)    ((frame->if_spsr & PSR_MODE) == PSR_USR32_MODE)
336fc729afSOlivier Houchard 
346fc729afSOlivier Houchard #define TRAPF_USERMODE(frame)	((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE)
356fc729afSOlivier Houchard #define CLKF_PC(frame)          (frame->if_pc)
366fc729afSOlivier Houchard 
376fc729afSOlivier Houchard #define TRAPF_PC(tfp)		((tfp)->tf_pc)
386fc729afSOlivier Houchard 
396fc729afSOlivier Houchard #define cpu_getstack(td)        ((td)->td_frame->tf_usr_sp)
406fc729afSOlivier Houchard #define cpu_setstack(td, sp)    ((td)->td_frame->tf_usr_sp = (sp))
419f1b87f1SMaxime Henrion #define cpu_spinwait()		/* nothing */
426fc729afSOlivier Houchard 
436fc729afSOlivier Houchard #define ARM_NVEC		8
446fc729afSOlivier Houchard #define ARM_VEC_ALL		0xffffffff
456fc729afSOlivier Houchard 
466fc729afSOlivier Houchard extern vm_offset_t vector_page;
476fc729afSOlivier Houchard 
486fc729afSOlivier Houchard void	arm_vector_init(vm_offset_t, int);
493d7d8f61SNate Lawson void	fork_trampoline(void);
506fc729afSOlivier Houchard void	identify_arm_cpu(void);
513d7d8f61SNate Lawson void	*initarm(void *, void *);
526fc729afSOlivier Houchard 
536fc729afSOlivier Houchard extern char btext[];
546fc729afSOlivier Houchard extern char etext[];
556fc729afSOlivier Houchard int badaddr_read (void *, size_t, void *);
566fc729afSOlivier Houchard #endif /* !MACHINE_CPU_H */
57