1 /*-
2 * Copyright (c) Peter Wemm <peter@netplex.com.au>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
29 #include "opt_user_ldt.h"
30
31 #include <machine/asmacros.h>
32 #include <machine/pmap.h>
33
34 #include "assym.s"
35
36 #ifdef SMP
37 /*
38 * Define layout of per-cpu address space.
39 * This is "constructed" in locore.s on the BSP and in mp_machdep.c
40 * for each AP. DO NOT REORDER THESE WITHOUT UPDATING THE REST!
41 */
42 .globl _SMP_prvspace, _lapic
43 .set _SMP_prvspace,(MPPTDI << PDRSHIFT)
44 .set _lapic,_SMP_prvspace + (NPTEPG-1) * PAGE_SIZE
45
46 .globl gd_idlestack,gd_idlestack_top
47 .set gd_idlestack,PS_IDLESTACK
48 .set gd_idlestack_top,PS_IDLESTACK_TOP
49 #endif
50
51 /*
52 * Define layout of the global data. On SMP this lives in
53 * the per-cpu address space, otherwise it's in the data segment.
54 */
55 .globl globaldata
56 #ifndef SMP
57 .data
58 ALIGN_DATA
59 globaldata:
60 .space GD_SIZEOF /* in data segment */
61 #else
62 .set globaldata,0
63 #endif
64 .globl gd_curproc, gd_curpcb, gd_npxproc, gd_astpending
65 .globl gd_common_tss, gd_switchtime, gd_switchticks
66 .set gd_curproc,globaldata + GD_CURPROC
67 .set gd_astpending,globaldata + GD_ASTPENDING
68 .set gd_curpcb,globaldata + GD_CURPCB
69 .set gd_npxproc,globaldata + GD_NPXPROC
70 .set gd_common_tss,globaldata + GD_COMMON_TSS
71 .set gd_switchtime,globaldata + GD_SWITCHTIME
72 .set gd_switchticks,globaldata + GD_SWITCHTICKS
73
74 .globl gd_common_tssd, gd_tss_gdt
75 .set gd_common_tssd,globaldata + GD_COMMON_TSSD
76 .set gd_tss_gdt,globaldata + GD_TSS_GDT
77
78 #ifdef USER_LDT
79 .globl gd_currentldt
80 .set gd_currentldt,globaldata + GD_CURRENTLDT
81 #endif
82
83 #ifndef SMP
84 .globl _curproc, _curpcb, _npxproc, _astpending
85 .globl _common_tss, _switchtime, _switchticks
86 .set _curproc,globaldata + GD_CURPROC
87 .set _astpending,globaldata + GD_ASTPENDING
88 .set _curpcb,globaldata + GD_CURPCB
89 .set _npxproc,globaldata + GD_NPXPROC
90 .set _common_tss,globaldata + GD_COMMON_TSS
91 .set _switchtime,globaldata + GD_SWITCHTIME
92 .set _switchticks,globaldata + GD_SWITCHTICKS
93
94 .globl _common_tssd, _tss_gdt
95 .set _common_tssd,globaldata + GD_COMMON_TSSD
96 .set _tss_gdt,globaldata + GD_TSS_GDT
97
98 #ifdef USER_LDT
99 .globl _currentldt
100 .set _currentldt,globaldata + GD_CURRENTLDT
101 #endif
102 #endif
103
104 #ifdef SMP
105 /*
106 * The BSP version of these get setup in locore.s and pmap.c, while
107 * the AP versions are setup in mp_machdep.c.
108 */
109 .globl gd_cpuid, gd_cpu_lockid, gd_other_cpus
110 .globl gd_ss_eflags, gd_inside_intr
111 .globl gd_prv_CMAP1, gd_prv_CMAP2, gd_prv_CMAP3, gd_prv_PMAP1
112 .globl gd_prv_PMAP2
113 .globl gd_prv_CADDR1, gd_prv_CADDR2, gd_prv_CADDR3, gd_prv_PADDR1
114 .globl gd_prv_PADDR2
115
116 .set gd_cpuid,globaldata + GD_CPUID
117 .set gd_cpu_lockid,globaldata + GD_CPU_LOCKID
118 .set gd_other_cpus,globaldata + GD_OTHER_CPUS
119 .set gd_ss_eflags,globaldata + GD_SS_EFLAGS
120 .set gd_inside_intr,globaldata + GD_INSIDE_INTR
121 .set gd_prv_CMAP1,globaldata + GD_PRV_CMAP1
122 .set gd_prv_CMAP2,globaldata + GD_PRV_CMAP2
123 .set gd_prv_CMAP3,globaldata + GD_PRV_CMAP3
124 .set gd_prv_PMAP1,globaldata + GD_PRV_PMAP1
125 .set gd_prv_PMAP2,globaldata + GD_PRV_PMAP2
126 .set gd_prv_CADDR1,globaldata + GD_PRV_CADDR1
127 .set gd_prv_CADDR2,globaldata + GD_PRV_CADDR2
128 .set gd_prv_CADDR3,globaldata + GD_PRV_CADDR3
129 .set gd_prv_PADDR1,globaldata + GD_PRV_PADDR1
130 .set gd_prv_PADDR2,globaldata + GD_PRV_PADDR2
131 #endif
132
133 #if defined(SMP) || defined(APIC_IO)
134 .globl lapic_eoi, lapic_svr, lapic_tpr, lapic_irr1, lapic_ver
135 .globl lapic_icr_lo,lapic_icr_hi,lapic_isr1
136 /*
137 * Do not clutter our namespace with these unless we need them in other
138 * assembler code. The C code uses different definitions.
139 */
140 #if 0
141 .globl lapic_id,lapic_ver,lapic_tpr,lapic_apr,lapic_ppr,lapic_eoi
142 .globl lapic_ldr,lapic_dfr,lapic_svr,lapic_isr,lapic_isr0
143 .globl lapic_isr2,lapic_isr3,lapic_isr4,lapic_isr5,lapic_isr6
144 .globl lapic_isr7,lapic_tmr,lapic_tmr0,lapic_tmr1,lapic_tmr2
145 .globl lapic_tmr3,lapic_tmr4,lapic_tmr5,lapic_tmr6,lapic_tmr7
146 .globl lapic_irr,lapic_irr0,lapic_irr1,lapic_irr2,lapic_irr3
147 .globl lapic_irr4,lapic_irr5,lapic_irr6,lapic_irr7,lapic_esr
148 .globl lapic_lvtt,lapic_pcint,lapic_lvt1
149 .globl lapic_lvt2,lapic_lvt3,lapic_ticr,lapic_tccr,lapic_tdcr
150 #endif
151 .set lapic_id, _lapic + 0x020
152 .set lapic_ver, _lapic + 0x030
153 .set lapic_tpr, _lapic + 0x080
154 .set lapic_apr, _lapic + 0x090
155 .set lapic_ppr, _lapic + 0x0a0
156 .set lapic_eoi, _lapic + 0x0b0
157 .set lapic_ldr, _lapic + 0x0d0
158 .set lapic_dfr, _lapic + 0x0e0
159 .set lapic_svr, _lapic + 0x0f0
160 .set lapic_isr, _lapic + 0x100
161 .set lapic_isr0, _lapic + 0x100
162 .set lapic_isr1, _lapic + 0x110
163 .set lapic_isr2, _lapic + 0x120
164 .set lapic_isr3, _lapic + 0x130
165 .set lapic_isr4, _lapic + 0x140
166 .set lapic_isr5, _lapic + 0x150
167 .set lapic_isr6, _lapic + 0x160
168 .set lapic_isr7, _lapic + 0x170
169 .set lapic_tmr, _lapic + 0x180
170 .set lapic_tmr0, _lapic + 0x180
171 .set lapic_tmr1, _lapic + 0x190
172 .set lapic_tmr2, _lapic + 0x1a0
173 .set lapic_tmr3, _lapic + 0x1b0
174 .set lapic_tmr4, _lapic + 0x1c0
175 .set lapic_tmr5, _lapic + 0x1d0
176 .set lapic_tmr6, _lapic + 0x1e0
177 .set lapic_tmr7, _lapic + 0x1f0
178 .set lapic_irr, _lapic + 0x200
179 .set lapic_irr0, _lapic + 0x200
180 .set lapic_irr1, _lapic + 0x210
181 .set lapic_irr2, _lapic + 0x220
182 .set lapic_irr3, _lapic + 0x230
183 .set lapic_irr4, _lapic + 0x240
184 .set lapic_irr5, _lapic + 0x250
185 .set lapic_irr6, _lapic + 0x260
186 .set lapic_irr7, _lapic + 0x270
187 .set lapic_esr, _lapic + 0x280
188 .set lapic_icr_lo, _lapic + 0x300
189 .set lapic_icr_hi, _lapic + 0x310
190 .set lapic_lvtt, _lapic + 0x320
191 .set lapic_pcint, _lapic + 0x340
192 .set lapic_lvt1, _lapic + 0x350
193 .set lapic_lvt2, _lapic + 0x360
194 .set lapic_lvt3, _lapic + 0x370
195 .set lapic_ticr, _lapic + 0x380
196 .set lapic_tccr, _lapic + 0x390
197 .set lapic_tdcr, _lapic + 0x3e0
198 #endif
Cache object: c2d1c4619dda81d6578a1498a60ead2f
|