xref: /freebsd/sys/arm/include/cpu.h (revision 7d99ab9fd0cc2c1ce2ecef0ed6d0672c2a50b0cb)
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 
9 void	cpu_halt(void);
10 void	swi_vm(void *);
11 
12 #ifdef _KERNEL
13 static __inline uint64_t
14 get_cyclecount(void)
15 {
16 	struct bintime bt;
17 
18 	binuptime(&bt);
19 	return ((uint64_t)bt.sec << 56 | bt.frac >> 8);
20 
21 }
22 #endif
23 
24 #define TRAPF_USERMODE(frame)	((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE)
25 
26 #define TRAPF_PC(tfp)		((tfp)->tf_pc)
27 
28 #define cpu_getstack(td)	((td)->td_frame->tf_usr_sp)
29 #define cpu_setstack(td, sp)	((td)->td_frame->tf_usr_sp = (sp))
30 #define cpu_spinwait()		/* nothing */
31 
32 #define ARM_NVEC		8
33 #define ARM_VEC_ALL		0xffffffff
34 
35 extern vm_offset_t vector_page;
36 
37 struct arm_boot_params {
38 	register_t	abp_size;	/* Size of this structure */
39 	register_t	abp_r0;		/* r0 from the boot loader */
40 	register_t	abp_r1;		/* r1 from the boot loader */
41 	register_t	abp_r2;		/* r2 from the boot loader */
42 	register_t	abp_r3;		/* r3 from the boot loader */
43 };
44 
45 void	arm_vector_init(vm_offset_t, int);
46 void	fork_trampoline(void);
47 void	identify_arm_cpu(void);
48 void	*initarm(struct arm_boot_params *);
49 
50 extern char btext[];
51 extern char etext[];
52 int badaddr_read(void *, size_t, void *);
53 #endif /* !MACHINE_CPU_H */
54