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_vm86.h"
30 #include "opt_user_ldt.h"
31
32 #include <machine/asmacros.h>
33 #include <machine/pmap.h>
34
35 #include "assym.s"
36
37 #ifdef SMP
38 /*
39 * Define layout of per-cpu address space.
40 * This is "constructed" in locore.s on the BSP and in mp_machdep.c
41 * for each AP. DO NOT REORDER THESE WITHOUT UPDATING THE REST!
42 */
43 .globl _SMP_prvstart
44 .set _SMP_prvstart,(MPPTDI << PDRSHIFT)
45
46 .globl globaldata,_SMP_prvpt,_lapic,_SMP_ioapic
47 .globl _prv_CPAGE1,_prv_CPAGE2,_prv_CPAGE3,_prv_PPAGE1
48 .globl _idlestack,_idlestack_top
49
50 .set globaldata,_SMP_prvstart + PS_GLOBALDATA
51 .set _SMP_prvpt,_SMP_prvstart + PS_PRVPT
52 .set _lapic,_SMP_prvstart + PS_LAPIC
53 .set _idlestack,_SMP_prvstart + PS_IDLESTACK
54 .set _idlestack_top,_SMP_prvstart + PS_IDLESTACK_TOP
55 .set _prv_CPAGE1,_SMP_prvstart + PS_CPAGE1
56 .set _prv_CPAGE2,_SMP_prvstart + PS_CPAGE2
57 .set _prv_CPAGE3,_SMP_prvstart + PS_CPAGE3
58 .set _prv_PPAGE1,_SMP_prvstart + PS_PPAGE1
59 .set _SMP_ioapic,_SMP_prvstart + PS_IOAPICS
60 #endif
61
62 /*
63 * Define layout of the global data. On SMP this lives in
64 * the per-cpu address space, otherwise it's in the data segment.
65 */
66 #ifndef SMP
67 .data
68 ALIGN_DATA
69 globaldata:
70 .space GD_SIZEOF /* in data segment */
71 #endif
72 .globl _curproc,_curpcb,_npxproc,_common_tss,_switchtime,_switchticks
73 .set _curproc,globaldata + GD_CURPROC
74 .set _curpcb,globaldata + GD_CURPCB
75 .set _npxproc,globaldata + GD_NPXPROC
76 .set _common_tss,globaldata + GD_COMMON_TSS
77 .set _switchtime,globaldata + GD_SWITCHTIME
78 .set _switchticks,globaldata + GD_SWITCHTICKS
79
80 #ifdef VM86
81 .globl _common_tssd,_private_tss,_my_tr
82 .set _common_tssd,globaldata + GD_COMMON_TSSD
83 .set _private_tss,globaldata + GD_PRIVATE_TSS
84 .set _my_tr,globaldata + GD_MY_TR
85 #endif
86
87 #ifdef USER_LDT
88 .globl _currentldt
89 .set _currentldt,globaldata + GD_CURRENTLDT
90 #endif
91
92 #ifdef SMP
93 /*
94 * The BSP version of these get setup in locore.s and pmap.c, while
95 * the AP versions are setup in mp_machdep.c.
96 */
97 .globl _cpuid,_cpu_lockid,_other_cpus,_my_idlePTD,_ss_eflags
98 .globl _prv_CMAP1,_prv_CMAP2,_prv_CMAP3,_prv_PMAP1
99 .globl _inside_intr
100
101 .set _cpuid,globaldata + GD_CPUID
102 .set _cpu_lockid,globaldata + GD_CPU_LOCKID
103 .set _other_cpus,globaldata + GD_OTHER_CPUS
104 .set _my_idlePTD,globaldata + GD_MY_IDLEPTD
105 .set _ss_eflags,globaldata + GD_SS_EFLAGS
106 .set _prv_CMAP1,globaldata + GD_PRV_CMAP1
107 .set _prv_CMAP2,globaldata + GD_PRV_CMAP2
108 .set _prv_CMAP3,globaldata + GD_PRV_CMAP3
109 .set _prv_PMAP1,globaldata + GD_PRV_PMAP1
110 .set _inside_intr,globaldata + GD_INSIDE_INTR
111 #endif
112
113 #if defined(SMP) || defined(APIC_IO)
114 .globl lapic_eoi, lapic_svr, lapic_tpr, lapic_irr1, lapic_ver
115 .globl lapic_icr_lo,lapic_icr_hi,lapic_isr1
116 /*
117 * Do not clutter our namespace with these unless we need them in other
118 * assembler code. The C code uses different definitions.
119 */
120 #if 0
121 .globl lapic_id,lapic_ver,lapic_tpr,lapic_apr,lapic_ppr,lapic_eoi
122 .globl lapic_ldr,lapic_dfr,lapic_svr,lapic_isr,lapic_isr0
123 .globl lapic_isr2,lapic_isr3,lapic_isr4,lapic_isr5,lapic_isr6
124 .globl lapic_isr7,lapic_tmr,lapic_tmr0,lapic_tmr1,lapic_tmr2
125 .globl lapic_tmr3,lapic_tmr4,lapic_tmr5,lapic_tmr6,lapic_tmr7
126 .globl lapic_irr,lapic_irr0,lapic_irr1,lapic_irr2,lapic_irr3
127 .globl lapic_irr4,lapic_irr5,lapic_irr6,lapic_irr7,lapic_esr
128 .globl lapic_lvtt,lapic_pcint,lapic_lvt1
129 .globl lapic_lvt2,lapic_lvt3,lapic_ticr,lapic_tccr,lapic_tdcr
130 #endif
131 .set lapic_id, _lapic + 0x020
132 .set lapic_ver, _lapic + 0x030
133 .set lapic_tpr, _lapic + 0x080
134 .set lapic_apr, _lapic + 0x090
135 .set lapic_ppr, _lapic + 0x0a0
136 .set lapic_eoi, _lapic + 0x0b0
137 .set lapic_ldr, _lapic + 0x0d0
138 .set lapic_dfr, _lapic + 0x0e0
139 .set lapic_svr, _lapic + 0x0f0
140 .set lapic_isr, _lapic + 0x100
141 .set lapic_isr0, _lapic + 0x100
142 .set lapic_isr1, _lapic + 0x110
143 .set lapic_isr2, _lapic + 0x120
144 .set lapic_isr3, _lapic + 0x130
145 .set lapic_isr4, _lapic + 0x140
146 .set lapic_isr5, _lapic + 0x150
147 .set lapic_isr6, _lapic + 0x160
148 .set lapic_isr7, _lapic + 0x170
149 .set lapic_tmr, _lapic + 0x180
150 .set lapic_tmr0, _lapic + 0x180
151 .set lapic_tmr1, _lapic + 0x190
152 .set lapic_tmr2, _lapic + 0x1a0
153 .set lapic_tmr3, _lapic + 0x1b0
154 .set lapic_tmr4, _lapic + 0x1c0
155 .set lapic_tmr5, _lapic + 0x1d0
156 .set lapic_tmr6, _lapic + 0x1e0
157 .set lapic_tmr7, _lapic + 0x1f0
158 .set lapic_irr, _lapic + 0x200
159 .set lapic_irr0, _lapic + 0x200
160 .set lapic_irr1, _lapic + 0x210
161 .set lapic_irr2, _lapic + 0x220
162 .set lapic_irr3, _lapic + 0x230
163 .set lapic_irr4, _lapic + 0x240
164 .set lapic_irr5, _lapic + 0x250
165 .set lapic_irr6, _lapic + 0x260
166 .set lapic_irr7, _lapic + 0x270
167 .set lapic_esr, _lapic + 0x280
168 .set lapic_icr_lo, _lapic + 0x300
169 .set lapic_icr_hi, _lapic + 0x310
170 .set lapic_lvtt, _lapic + 0x320
171 .set lapic_pcint, _lapic + 0x340
172 .set lapic_lvt1, _lapic + 0x350
173 .set lapic_lvt2, _lapic + 0x360
174 .set lapic_lvt3, _lapic + 0x370
175 .set lapic_ticr, _lapic + 0x380
176 .set lapic_tccr, _lapic + 0x390
177 .set lapic_tdcr, _lapic + 0x3e0
178 #endif
Cache object: d12e78ef49d4de0176af091ed5d9c2fb
|