param.h revision 96606
1107120Sjulian/*-
2107120Sjulian * Copyright (c) 2001 David E. O'Brien
3107120Sjulian * Copyright (c) 1990 The Regents of the University of California.
4107120Sjulian * All rights reserved.
5107120Sjulian *
6107120Sjulian * This code is derived from software contributed to Berkeley by
7107120Sjulian * William Jolitz.
8107120Sjulian *
9107120Sjulian * Redistribution and use in source and binary forms, with or without
10107120Sjulian * modification, are permitted provided that the following conditions
11107120Sjulian * are met:
12107120Sjulian * 1. Redistributions of source code must retain the above copyright
13107120Sjulian *    notice, this list of conditions and the following disclaimer.
14107120Sjulian * 2. Redistributions in binary form must reproduce the above copyright
15107120Sjulian *    notice, this list of conditions and the following disclaimer in the
16107120Sjulian *    documentation and/or other materials provided with the distribution.
17107120Sjulian * 3. All advertising materials mentioning features or use of this software
18107120Sjulian *    must display the following acknowledgement:
19107120Sjulian *	This product includes software developed by the University of
20107120Sjulian *	California, Berkeley and its contributors.
21107120Sjulian * 4. Neither the name of the University nor the names of its contributors
22107120Sjulian *    may be used to endorse or promote products derived from this software
23107120Sjulian *    without specific prior written permission.
24107120Sjulian *
25107120Sjulian * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26107120Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27107120Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28121054Semax * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29107120Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30107120Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31107120Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32121054Semax * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33107120Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34107120Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35121054Semax * SUCH DAMAGE.
36107120Sjulian *
37107120Sjulian *	from: @(#)param.h	5.8 (Berkeley) 6/28/91
38107120Sjulian * $FreeBSD: head/sys/arm/include/param.h 96606 2002-05-14 20:35:29Z phk $
39107120Sjulian */
40107120Sjulian
41107120Sjulian/*
42107120Sjulian * Machine dependent constants for StrongARM
43107120Sjulian */
44107120Sjulian
45107120Sjulian/*
46107120Sjulian * Round p (pointer or byte index) up to a correctly-aligned value
47107120Sjulian * for all data types (int, long, ...).   The result is unsigned int
48107120Sjulian * and must be cast to any desired pointer type.
49107120Sjulian */
50107120Sjulian#ifndef _ALIGNBYTES
51107120Sjulian#define	_ALIGNBYTES	(sizeof(int) - 1)
52107120Sjulian#endif
53128079Semax#ifndef _ALIGN
54107120Sjulian#define	_ALIGN(p)	(((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
55107120Sjulian#endif
56107120Sjulian
57107120Sjulian#ifndef	_MACHINE
58107120Sjulian#define	_MACHIN		"arm32"
59107120Sjulian#endif
60107120Sjulian#ifndef _MACHINE_ARCH
61107120Sjulian#define	_MACHINE_ARCH	"arm32"
62107120Sjulian#endif
63107120Sjulian
64107120Sjulian#ifndef _NO_NAMESPACE_POLLUTION
65107120Sjulian
66107120Sjulian#ifndef _MACHINE_PARAM_H_
67107120Sjulian#define	_MACHINE_PARAM_H_
68107120Sjulian
69107120Sjulian#ifndef MACHINE
70107120Sjulian#define	MACHINE		"arm32"
71107120Sjulian#endif
72107120Sjulian#ifndef MACHINE_ARCH
73107120Sjulian#define	MACHINE_ARCH	"arm32"
74107120Sjulian#endif
75107120Sjulian#define	MID_MACHINE	MID_ARM32
76107120Sjulian
77107120Sjulian#include <machine/cpu.h>
78107120Sjulian
79107120Sjulian/*
80107120Sjulian * OBJFORMAT_NAMES is a comma-separated list of the object formats
81107120Sjulian * that are supported on the architecture.
82107120Sjulian */
83107120Sjulian#define	OBJFORMAT_NAMES		"elf"
84107120Sjulian#define	OBJFORMAT_DEFAULT	"elf"
85107120Sjulian
86121054Semax#ifdef SMP
87107120Sjulian#define	MAXCPU		2
88107120Sjulian#else
89107120Sjulian#define	MAXCPU		1
90107120Sjulian#endif /* SMP */
91107120Sjulian
92107120Sjulian#define	ALIGNBYTES	_ALIGNBYTES
93107120Sjulian#define	ALIGN(p)	_ALIGN(p)
94107120Sjulian
95121054Semax#define	PAGE_SHIFT	12
96121054Semax#define	PAGE_SIZE	(1 << PAGE_SHIFT)	/* Page size */
97107120Sjulian#define	PAGE_MASK	(PAGE_SIZE - 1)
98121054Semax#define	NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
99121054Semax
100107120Sjulian#define	KERNBASE	0x100000	/* start of kernel virtual */
101121054Semax#define	BTOPKERNBASE	((u_long)KERNBASE >> PGSHIFT)
102121054Semax
103121054Semax#define	UPAGES		2		/* pages of u-area */
104107120Sjulian#define	USPACE		(UPAGES * PAGE_SIZE)	/* total size of u-area */
105107120Sjulian
106107120Sjulian/*
107107120Sjulian * Mach derived conversion macros
108107120Sjulian */
109107120Sjulian#define	trunc_page(x)		((x) & ~PAGE_MASK)
110107120Sjulian#define	round_page(x)		(((x) + PAGE_MASK) & ~PAGE_MASK)
111107120Sjulian#define	trunc_4mpage(x)		((unsigned)(x) & ~PDRMASK)
112107120Sjulian#define	round_4mpage(x)		((((unsigned)(x)) + PDRMASK) & ~PDRMASK)
113107120Sjulian
114107120Sjulian#define	atop(x)			((unsigned)(x) >> PAGE_SHIFT)
115107120Sjulian#define	ptoa(x)			((unsigned)(x) << PAGE_SHIFT)
116107120Sjulian
117107120Sjulian#define	arm32_btop(x)		((unsigned)(x) >> PAGE_SHIFT)
118107120Sjulian#define	arm32_ptob(x)		((unsigned)(x) << PAGE_SHIFT)
119107120Sjulian
120107120Sjulian#define	pgtok(x)		((x) * (PAGE_SIZE / 1024))
121107120Sjulian
122107120Sjulian#endif /* !_MACHINE_PARAM_H_ */
123107120Sjulian#endif /* !_NO_NAMESPACE_POLLUTION */
124107120Sjulian