xref: /freebsd/sys/arm/include/cpu.h (revision b2478843a943a6d248802299b430aa623bf3ea9b)
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>
864894120SIan 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 
38*b2478843SAndrew Turner /*
39*b2478843SAndrew Turner  * Params passed into initarm. If you change the size of this you will
40*b2478843SAndrew Turner  * need to update locore.S to allocate more memory on the stack before
41*b2478843SAndrew Turner  * it calls initarm.
42*b2478843SAndrew Turner  */
4346231809SWarner Losh struct arm_boot_params {
4446231809SWarner Losh 	register_t	abp_size;	/* Size of this structure */
4546231809SWarner Losh 	register_t	abp_r0;		/* r0 from the boot loader */
4646231809SWarner Losh 	register_t	abp_r1;		/* r1 from the boot loader */
4746231809SWarner Losh 	register_t	abp_r2;		/* r2 from the boot loader */
4846231809SWarner Losh 	register_t	abp_r3;		/* r3 from the boot loader */
49313857e9SAndrew Turner 	vm_offset_t	abp_physaddr;	/* The kernel physical address */
50*b2478843SAndrew Turner 	vm_offset_t	abp_pagetable;	/* The early page table */
5146231809SWarner Losh };
5246231809SWarner Losh 
536fc729afSOlivier Houchard void	arm_vector_init(vm_offset_t, int);
543d7d8f61SNate Lawson void	fork_trampoline(void);
556fc729afSOlivier Houchard void	identify_arm_cpu(void);
5646231809SWarner Losh void	*initarm(struct arm_boot_params *);
576fc729afSOlivier Houchard 
586fc729afSOlivier Houchard extern char btext[];
596fc729afSOlivier Houchard extern char etext[];
606fc729afSOlivier Houchard int badaddr_read(void *, size_t, void *);
616fc729afSOlivier Houchard #endif /* !MACHINE_CPU_H */
62