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/i386/i386/Attic/globals.s,v 1.2 2003/06/17 04:28:35 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.
61 .space GD_SIZEOF /* in data segment */
65 .globl gd_curproc, gd_curpcb, gd_npxproc, gd_astpending
66 .globl gd_common_tss, gd_switchtime, gd_switchticks
67 .set gd_curproc,globaldata + GD_CURPROC
68 .set gd_astpending,globaldata + GD_ASTPENDING
69 .set gd_curpcb,globaldata + GD_CURPCB
70 .set gd_npxproc,globaldata + GD_NPXPROC
71 .set gd_common_tss,globaldata + GD_COMMON_TSS
72 .set gd_switchtime,globaldata + GD_SWITCHTIME
73 .set gd_switchticks,globaldata + GD_SWITCHTICKS
75 .globl gd_common_tssd, gd_tss_gdt
76 .set gd_common_tssd,globaldata + GD_COMMON_TSSD
77 .set gd_tss_gdt,globaldata + GD_TSS_GDT
81 .set gd_currentldt,globaldata + GD_CURRENTLDT
85 .globl _curproc, _curpcb, _npxproc, _astpending
86 .globl _common_tss, _switchtime, _switchticks
87 .set _curproc,globaldata + GD_CURPROC
88 .set _astpending,globaldata + GD_ASTPENDING
89 .set _curpcb,globaldata + GD_CURPCB
90 .set _npxproc,globaldata + GD_NPXPROC
91 .set _common_tss,globaldata + GD_COMMON_TSS
92 .set _switchtime,globaldata + GD_SWITCHTIME
93 .set _switchticks,globaldata + GD_SWITCHTICKS
95 .globl _common_tssd, _tss_gdt
96 .set _common_tssd,globaldata + GD_COMMON_TSSD
97 .set _tss_gdt,globaldata + GD_TSS_GDT
101 .set _currentldt,globaldata + GD_CURRENTLDT
107 * The BSP version of these get setup in locore.s and pmap.c, while
108 * the AP versions are setup in mp_machdep.c.
110 .globl gd_cpuid, gd_cpu_lockid, gd_other_cpus
111 .globl gd_ss_eflags, gd_inside_intr
112 .globl gd_prv_CMAP1, gd_prv_CMAP2, gd_prv_CMAP3, gd_prv_PMAP1
113 .globl gd_prv_CADDR1, gd_prv_CADDR2, gd_prv_CADDR3, gd_prv_PADDR1
115 .set gd_cpuid,globaldata + GD_CPUID
116 .set gd_cpu_lockid,globaldata + GD_CPU_LOCKID
117 .set gd_other_cpus,globaldata + GD_OTHER_CPUS
118 .set gd_ss_eflags,globaldata + GD_SS_EFLAGS
119 .set gd_inside_intr,globaldata + GD_INSIDE_INTR
120 .set gd_prv_CMAP1,globaldata + GD_PRV_CMAP1
121 .set gd_prv_CMAP2,globaldata + GD_PRV_CMAP2
122 .set gd_prv_CMAP3,globaldata + GD_PRV_CMAP3
123 .set gd_prv_PMAP1,globaldata + GD_PRV_PMAP1
124 .set gd_prv_CADDR1,globaldata + GD_PRV_CADDR1
125 .set gd_prv_CADDR2,globaldata + GD_PRV_CADDR2
126 .set gd_prv_CADDR3,globaldata + GD_PRV_CADDR3
127 .set gd_prv_PADDR1,globaldata + GD_PRV_PADDR1
130 #if defined(SMP) || defined(APIC_IO)
131 .globl lapic_eoi, lapic_svr, lapic_tpr, lapic_irr1, lapic_ver
132 .globl lapic_icr_lo,lapic_icr_hi,lapic_isr1
134 * Do not clutter our namespace with these unless we need them in other
135 * assembler code. The C code uses different definitions.
138 .globl lapic_id,lapic_ver,lapic_tpr,lapic_apr,lapic_ppr,lapic_eoi
139 .globl lapic_ldr,lapic_dfr,lapic_svr,lapic_isr,lapic_isr0
140 .globl lapic_isr2,lapic_isr3,lapic_isr4,lapic_isr5,lapic_isr6
141 .globl lapic_isr7,lapic_tmr,lapic_tmr0,lapic_tmr1,lapic_tmr2
142 .globl lapic_tmr3,lapic_tmr4,lapic_tmr5,lapic_tmr6,lapic_tmr7
143 .globl lapic_irr,lapic_irr0,lapic_irr1,lapic_irr2,lapic_irr3
144 .globl lapic_irr4,lapic_irr5,lapic_irr6,lapic_irr7,lapic_esr
145 .globl lapic_lvtt,lapic_pcint,lapic_lvt1
146 .globl lapic_lvt2,lapic_lvt3,lapic_ticr,lapic_tccr,lapic_tdcr
148 .set lapic_id, _lapic + 0x020
149 .set lapic_ver, _lapic + 0x030
150 .set lapic_tpr, _lapic + 0x080
151 .set lapic_apr, _lapic + 0x090
152 .set lapic_ppr, _lapic + 0x0a0
153 .set lapic_eoi, _lapic + 0x0b0
154 .set lapic_ldr, _lapic + 0x0d0
155 .set lapic_dfr, _lapic + 0x0e0
156 .set lapic_svr, _lapic + 0x0f0
157 .set lapic_isr, _lapic + 0x100
158 .set lapic_isr0, _lapic + 0x100
159 .set lapic_isr1, _lapic + 0x110
160 .set lapic_isr2, _lapic + 0x120
161 .set lapic_isr3, _lapic + 0x130
162 .set lapic_isr4, _lapic + 0x140
163 .set lapic_isr5, _lapic + 0x150
164 .set lapic_isr6, _lapic + 0x160
165 .set lapic_isr7, _lapic + 0x170
166 .set lapic_tmr, _lapic + 0x180
167 .set lapic_tmr0, _lapic + 0x180
168 .set lapic_tmr1, _lapic + 0x190
169 .set lapic_tmr2, _lapic + 0x1a0
170 .set lapic_tmr3, _lapic + 0x1b0
171 .set lapic_tmr4, _lapic + 0x1c0
172 .set lapic_tmr5, _lapic + 0x1d0
173 .set lapic_tmr6, _lapic + 0x1e0
174 .set lapic_tmr7, _lapic + 0x1f0
175 .set lapic_irr, _lapic + 0x200
176 .set lapic_irr0, _lapic + 0x200
177 .set lapic_irr1, _lapic + 0x210
178 .set lapic_irr2, _lapic + 0x220
179 .set lapic_irr3, _lapic + 0x230
180 .set lapic_irr4, _lapic + 0x240
181 .set lapic_irr5, _lapic + 0x250
182 .set lapic_irr6, _lapic + 0x260
183 .set lapic_irr7, _lapic + 0x270
184 .set lapic_esr, _lapic + 0x280
185 .set lapic_icr_lo, _lapic + 0x300
186 .set lapic_icr_hi, _lapic + 0x310
187 .set lapic_lvtt, _lapic + 0x320
188 .set lapic_pcint, _lapic + 0x340
189 .set lapic_lvt1, _lapic + 0x350
190 .set lapic_lvt2, _lapic + 0x360
191 .set lapic_lvt3, _lapic + 0x370
192 .set lapic_ticr, _lapic + 0x380
193 .set lapic_tccr, _lapic + 0x390
194 .set lapic_tdcr, _lapic + 0x3e0