xref: /freebsd/sys/arm/include/cpu.h (revision 5dd76dd0cc19450133aa379ce0ce4a68ae07fb39)
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 struct arm_boot_params {
39 	register_t	abp_size;	/* Size of this structure */
40 	register_t	abp_r0;		/* r0 from the boot loader */
41 	register_t	abp_r1;		/* r1 from the boot loader */
42 	register_t	abp_r2;		/* r2 from the boot loader */
43 	register_t	abp_r3;		/* r3 from the boot loader */
44 };
45 
46 void	arm_vector_init(vm_offset_t, int);
47 void	fork_trampoline(void);
48 void	identify_arm_cpu(void);
49 void	*initarm(struct arm_boot_params *);
50 
51 extern char btext[];
52 extern char etext[];
53 int badaddr_read(void *, size_t, void *);
54 #endif /* !MACHINE_CPU_H */
55