2 * Copyright (c) Peter Wemm <peter@netplex.com.au>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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
26 * $FreeBSD: src/sys/i386/i386/globals.s,v 1.13.2.1 2000/05/16 06:58:06 dillon Exp $
27 * $DragonFly: src/sys/platform/pc32/i386/globals.s,v 1.4 2003/06/18 07:04:25 dillon Exp $
30 #include "opt_user_ldt.h"
32 #include <machine/asmacros.h>
33 #include <machine/pmap.h>
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!
43 .globl _SMP_prvspace, _lapic
44 .set _SMP_prvspace,(MPPTDI << PDRSHIFT)
45 .set _lapic,_SMP_prvspace + (NPTEPG-1) * PAGE_SIZE
47 .globl gd_idlestack,gd_idlestack_top
48 .set gd_idlestack,PS_IDLESTACK
49 .set gd_idlestack_top,PS_IDLESTACK_TOP
53 * Define layout of the global data. On SMP this lives in
54 * the per-cpu address space, otherwise it's in the data segment.
63 .space GD_SIZEOF /* in data segment */
67 .globl gd_curthread, gd_curpcb, gd_npxthread, gd_astpending
68 .globl gd_common_tss, gd_switchtime, gd_switchticks, gd_idlethread
69 .set gd_curthread,globaldata + GD_CURTHREAD
70 .set gd_idlethread,globaldata + GD_IDLETHREAD
71 .set gd_astpending,globaldata + GD_ASTPENDING
72 .set gd_curpcb,globaldata + GD_CURPCB
73 .set gd_npxthread,globaldata + GD_NPXTHREAD
74 .set gd_common_tss,globaldata + GD_COMMON_TSS
75 .set gd_switchtime,globaldata + GD_SWITCHTIME
76 .set gd_switchticks,globaldata + GD_SWITCHTICKS
78 .globl gd_common_tssd, gd_tss_gdt
79 .set gd_common_tssd,globaldata + GD_COMMON_TSSD
80 .set gd_tss_gdt,globaldata + GD_TSS_GDT
84 .set gd_currentldt,globaldata + GD_CURRENTLDT
88 .globl _curthread, _curpcb, _npxthread, _astpending
89 .globl _common_tss, _switchtime, _switchticks, _idlethread
90 .set _curthread,globaldata + GD_CURTHREAD
91 .set _idlethread,globaldata + GD_IDLETHREAD
92 .set _astpending,globaldata + GD_ASTPENDING
93 .set _curpcb,globaldata + GD_CURPCB
94 .set _npxthread,globaldata + GD_NPXTHREAD
95 .set _common_tss,globaldata + GD_COMMON_TSS
96 .set _switchtime,globaldata + GD_SWITCHTIME
97 .set _switchticks,globaldata + GD_SWITCHTICKS
99 .globl _common_tssd, _tss_gdt
100 .set _common_tssd,globaldata + GD_COMMON_TSSD
101 .set _tss_gdt,globaldata + GD_TSS_GDT
105 .set _currentldt,globaldata + GD_CURRENTLDT
111 * The BSP version of these get setup in locore.s and pmap.c, while
112 * the AP versions are setup in mp_machdep.c.
114 .globl gd_cpuid, gd_cpu_lockid, gd_other_cpus
115 .globl gd_ss_eflags, gd_inside_intr
116 .globl gd_prv_CMAP1, gd_prv_CMAP2, gd_prv_CMAP3, gd_prv_PMAP1
117 .globl gd_prv_CADDR1, gd_prv_CADDR2, gd_prv_CADDR3, gd_prv_PADDR1
119 .set gd_cpuid,globaldata + GD_CPUID
120 .set gd_cpu_lockid,globaldata + GD_CPU_LOCKID
121 .set gd_other_cpus,globaldata + GD_OTHER_CPUS
122 .set gd_ss_eflags,globaldata + GD_SS_EFLAGS
123 .set gd_inside_intr,globaldata + GD_INSIDE_INTR
124 .set gd_prv_CMAP1,globaldata + GD_PRV_CMAP1
125 .set gd_prv_CMAP2,globaldata + GD_PRV_CMAP2
126 .set gd_prv_CMAP3,globaldata + GD_PRV_CMAP3
127 .set gd_prv_PMAP1,globaldata + GD_PRV_PMAP1
128 .set gd_prv_CADDR1,globaldata + GD_PRV_CADDR1
129 .set gd_prv_CADDR2,globaldata + GD_PRV_CADDR2
130 .set gd_prv_CADDR3,globaldata + GD_PRV_CADDR3
131 .set gd_prv_PADDR1,globaldata + GD_PRV_PADDR1
134 #if defined(SMP) || defined(APIC_IO)
135 .globl lapic_eoi, lapic_svr, lapic_tpr, lapic_irr1, lapic_ver
136 .globl lapic_icr_lo,lapic_icr_hi,lapic_isr1
138 * Do not clutter our namespace with these unless we need them in other
139 * assembler code. The C code uses different definitions.
142 .globl lapic_id,lapic_ver,lapic_tpr,lapic_apr,lapic_ppr,lapic_eoi
143 .globl lapic_ldr,lapic_dfr,lapic_svr,lapic_isr,lapic_isr0
144 .globl lapic_isr2,lapic_isr3,lapic_isr4,lapic_isr5,lapic_isr6
145 .globl lapic_isr7,lapic_tmr,lapic_tmr0,lapic_tmr1,lapic_tmr2
146 .globl lapic_tmr3,lapic_tmr4,lapic_tmr5,lapic_tmr6,lapic_tmr7
147 .globl lapic_irr,lapic_irr0,lapic_irr1,lapic_irr2,lapic_irr3
148 .globl lapic_irr4,lapic_irr5,lapic_irr6,lapic_irr7,lapic_esr
149 .globl lapic_lvtt,lapic_pcint,lapic_lvt1
150 .globl lapic_lvt2,lapic_lvt3,lapic_ticr,lapic_tccr,lapic_tdcr
152 .set lapic_id, _lapic + 0x020
153 .set lapic_ver, _lapic + 0x030
154 .set lapic_tpr, _lapic + 0x080
155 .set lapic_apr, _lapic + 0x090
156 .set lapic_ppr, _lapic + 0x0a0
157 .set lapic_eoi, _lapic + 0x0b0
158 .set lapic_ldr, _lapic + 0x0d0
159 .set lapic_dfr, _lapic + 0x0e0
160 .set lapic_svr, _lapic + 0x0f0
161 .set lapic_isr, _lapic + 0x100
162 .set lapic_isr0, _lapic + 0x100
163 .set lapic_isr1, _lapic + 0x110
164 .set lapic_isr2, _lapic + 0x120
165 .set lapic_isr3, _lapic + 0x130
166 .set lapic_isr4, _lapic + 0x140
167 .set lapic_isr5, _lapic + 0x150
168 .set lapic_isr6, _lapic + 0x160
169 .set lapic_isr7, _lapic + 0x170
170 .set lapic_tmr, _lapic + 0x180
171 .set lapic_tmr0, _lapic + 0x180
172 .set lapic_tmr1, _lapic + 0x190
173 .set lapic_tmr2, _lapic + 0x1a0
174 .set lapic_tmr3, _lapic + 0x1b0
175 .set lapic_tmr4, _lapic + 0x1c0
176 .set lapic_tmr5, _lapic + 0x1d0
177 .set lapic_tmr6, _lapic + 0x1e0
178 .set lapic_tmr7, _lapic + 0x1f0
179 .set lapic_irr, _lapic + 0x200
180 .set lapic_irr0, _lapic + 0x200
181 .set lapic_irr1, _lapic + 0x210
182 .set lapic_irr2, _lapic + 0x220
183 .set lapic_irr3, _lapic + 0x230
184 .set lapic_irr4, _lapic + 0x240
185 .set lapic_irr5, _lapic + 0x250
186 .set lapic_irr6, _lapic + 0x260
187 .set lapic_irr7, _lapic + 0x270
188 .set lapic_esr, _lapic + 0x280
189 .set lapic_icr_lo, _lapic + 0x300
190 .set lapic_icr_hi, _lapic + 0x310
191 .set lapic_lvtt, _lapic + 0x320
192 .set lapic_pcint, _lapic + 0x340
193 .set lapic_lvt1, _lapic + 0x350
194 .set lapic_lvt2, _lapic + 0x360
195 .set lapic_lvt3, _lapic + 0x370
196 .set lapic_ticr, _lapic + 0x380
197 .set lapic_tccr, _lapic + 0x390
198 .set lapic_tdcr, _lapic + 0x3e0