genassym.cf revision 1.7
1#	$NetBSD: genassym.cf,v 1.7 2011/06/20 17:15:38 matt Exp $
2
3#-
4# Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Raytheon BBN Technologies Corp and Defense Advanced Research Projects
9# Agency and which was developed by Matt Thomas of 3am Software Foundry.
10#
11# This material is based upon work supported by the Defense Advanced Research
12# Projects Agency and Space and Naval Warfare Systems Center, Pacific, under
13# Contract No. N66001-09-C-2073.
14# Approved for Public Release, Distribution Unlimited
15#
16# Copyright (c) 2010 The NetBSD Foundation, Inc.
17# All rights reserved.
18#
19# This code is derived from software contributed to The NetBSD Foundation
20# by Matt Thomas of 3am Software Foundry.
21#
22# Redistribution and use in source and binary forms, with or without
23# modification, are permitted provided that the following conditions
24# are met:
25# 1. Redistributions of source code must retain the above copyright
26#    notice, this list of conditions and the following disclaimer.
27# 2. Redistributions in binary form must reproduce the above copyright
28#    notice, this list of conditions and the following disclaimer in the
29#    documentation and/or other materials provided with the distribution.
30#
31# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
32# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
33# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
35# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41# POSSIBILITY OF SUCH DAMAGE.
42#+
43
44include <sys/param.h>
45include <sys/bitops.h>
46
47include <uvm/uvm_extern.h>
48
49include <machine/frame.h>
50include <machine/psl.h>
51include <machine/pmap.h>
52
53include <powerpc/booke/trap.h>
54include <powerpc/booke/pte.h>
55
56define	FRAME_DEAR	offsetof(struct ktrapframe, ktf_tf.tf_dear)
57define	FRAME_ESR	offsetof(struct ktrapframe, ktf_tf.tf_esr)
58define	FRAME_MCSR	offsetof(struct ktrapframe, ktf_tf.tf_mcsr)
59define	FRAME_MCAR	offsetof(struct ktrapframe, ktf_tf.tf_mcar)
60define	FRAME_SPRG1	offsetof(struct ktrapframe, ktf_tf.tf_sprg1)
61define	FRAME_SPEFSCR	offsetof(struct ktrapframe, ktf_tf.tf_spefscr)
62
63define	CI_SAVELIFO	offsetof(struct cpu_info, ci_savearea[0])
64define	CI_PMAP_SEGTAB	offsetof(struct cpu_info, ci_pmap_segtabs[0])
65define	CI_EV_TLBMISS_SOFT offsetof(struct cpu_info, ci_ev_tlbmiss_soft.ev_count)
66
67define	PAGE_SIZE	PAGE_SIZE
68define	PAGE_MASK	PAGE_MASK
69define	PAGE_SHIFT	PAGE_SHIFT
70define	KERNEL_PID	KERNEL_PID
71define	USPACE		USPACE
72
73define	T_CRITIAL_INPUT		T_CRITIAL_INPUT
74define	T_MACHINE_CHECK		T_MACHINE_CHECK
75define	T_DSI			T_DSI
76define	T_ISI			T_ISI
77define	T_EXTERNAL_INPUT	T_EXTERNAL_INPUT
78define	T_ALIGNMENT		T_ALIGNMENT
79define	T_PROGRAM		T_PROGRAM
80define	T_FP_UNAVAILABLE	T_FP_UNAVAILABLE
81define	T_SYSTEM_CALL		T_SYSTEM_CALL
82define	T_AP_UNAVAILABLE	T_AP_UNAVAILABLE
83define	T_DECREMENTER		T_DECREMENTER
84define	T_FIXED_INTERVAL	T_FIXED_INTERVAL
85define	T_WATCHDOG		T_WATCHDOG
86define	T_DATA_TLB_ERROR	T_DATA_TLB_ERROR
87define	T_INSTRUCTION_TLB_ERROR	T_INSTRUCTION_TLB_ERROR
88define	T_DEBUG			T_DEBUG
89define	T_SPE_UNAVAILABLE	T_SPE_UNAVAILABLE
90define	T_EMBEDDED_FP_DATA	T_EMBEDDED_FP_DATA
91define	T_EMBEDDED_FP_ROUND	T_EMBEDDED_FP_ROUND
92define	T_EMBEDDED_PERF_MONITOR	T_EMBEDDED_PERF_MONITOR
93define	T_AST			T_AST
94
95define	PTE_SCALESHIFT	ilog2(sizeof(pt_entry_t))
96define	PTR_SCALESHIFT	ilog2(sizeof(void *))
97define	NSEGPG_SCALESHIFT	PAGE_SHIFT - ilog2(sizeof(void *))
98define	NPTEPG_SCALESHIFT	PAGE_SHIFT - ilog2(sizeof(pt_entry_t))
99
100define	MSR_DS		31 - ilog2(PSL_DS)
101define	MSR_IS		31 - ilog2(PSL_IS)
102