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.11 2003/06/28 04:16:02 dillon Exp $
30 #include "opt_user_ldt.h"
32 #include <machine/asmacros.h>
33 #include <machine/pmap.h>
38 * Define the layout of the per-cpu address space. This is
39 * "constructed" in locore.s on the BSP and in mp_machdep.c for
40 * each AP. DO NOT REORDER THESE WITHOUT UPDATING THE REST!
42 * On UP the per-cpu addrses space is simply placed in the data
46 .globl _CPU_prvspace, _lapic
47 .set _CPU_prvspace,(MPPTDI << PDRSHIFT)
48 .set _lapic,_CPU_prvspace + (NPTEPG-1) * PAGE_SIZE
50 .globl gd_idlestack,gd_idlestack_top
51 .set gd_idlestack,PS_IDLESTACK
52 .set gd_idlestack_top,PS_IDLESTACK_TOP
58 * Define layout of the global data. On SMP this lives in
59 * the per-cpu address space, otherwise it's in the data segment.
61 .globl gd_curthread, gd_npxthread, gd_astpending, gd_reqpri
62 .globl gd_common_tss, gd_idlethread
63 .set gd_curthread,globaldata + GD_CURTHREAD
64 .set gd_idlethread,globaldata + GD_IDLETHREAD
65 .set gd_astpending,globaldata + GD_ASTPENDING
66 .set gd_reqpri,globaldata + GD_REQPRI
67 .set gd_npxthread,globaldata + GD_NPXTHREAD
68 .set gd_common_tss,globaldata + GD_COMMON_TSS
70 .globl gd_common_tssd, gd_tss_gdt
71 .set gd_common_tssd,globaldata + GD_COMMON_TSSD
72 .set gd_tss_gdt,globaldata + GD_TSS_GDT
76 .set gd_currentldt,globaldata + GD_CURRENTLDT
80 .globl _curthread, _npxthread, _astpending, _reqpri
81 .globl _common_tss, _idlethread
82 .set _curthread,globaldata + GD_CURTHREAD
83 .set _idlethread,globaldata + GD_IDLETHREAD
84 .set _astpending,globaldata + GD_ASTPENDING
85 .set _reqpri,globaldata + GD_REQPRI
86 .set _npxthread,globaldata + GD_NPXTHREAD
87 .set _common_tss,globaldata + GD_COMMON_TSS
89 .globl _common_tssd, _tss_gdt
90 .set _common_tssd,globaldata + GD_COMMON_TSSD
91 .set _tss_gdt,globaldata + GD_TSS_GDT
95 .set _currentldt,globaldata + GD_CURRENTLDT
100 * The BSP version of these get setup in locore.s and pmap.c, while
101 * the AP versions are setup in mp_machdep.c.
103 .globl gd_cpuid, gd_cpu_lockid, gd_other_cpus
104 .globl gd_ss_eflags, gd_inside_intr
105 .globl gd_CMAP1, gd_CMAP2, gd_CMAP3, gd_PMAP1
106 .globl gd_CADDR1, gd_CADDR2, gd_CADDR3, gd_PADDR1
108 .set gd_cpuid,globaldata + GD_CPUID
109 .set gd_cpu_lockid,globaldata + GD_CPU_LOCKID
110 .set gd_other_cpus,globaldata + GD_OTHER_CPUS
111 .set gd_ss_eflags,globaldata + GD_SS_EFLAGS
112 .set gd_inside_intr,globaldata + GD_INSIDE_INTR
113 .set gd_CMAP1,globaldata + GD_PRV_CMAP1
114 .set gd_CMAP2,globaldata + GD_PRV_CMAP2
115 .set gd_CMAP3,globaldata + GD_PRV_CMAP3
116 .set gd_PMAP1,globaldata + GD_PRV_PMAP1
117 .set gd_CADDR1,globaldata + GD_PRV_CADDR1
118 .set gd_CADDR2,globaldata + GD_PRV_CADDR2
119 .set gd_CADDR3,globaldata + GD_PRV_CADDR3
120 .set gd_PADDR1,globaldata + GD_PRV_PADDR1
123 .globl lapic_eoi, lapic_svr, lapic_tpr, lapic_irr1, lapic_ver
124 .globl lapic_icr_lo,lapic_icr_hi,lapic_isr1
126 * Do not clutter our namespace with these unless we need them in other
127 * assembler code. The C code uses different definitions.
130 .globl lapic_id,lapic_ver,lapic_tpr,lapic_apr,lapic_ppr,lapic_eoi
131 .globl lapic_ldr,lapic_dfr,lapic_svr,lapic_isr,lapic_isr0
132 .globl lapic_isr2,lapic_isr3,lapic_isr4,lapic_isr5,lapic_isr6
133 .globl lapic_isr7,lapic_tmr,lapic_tmr0,lapic_tmr1,lapic_tmr2
134 .globl lapic_tmr3,lapic_tmr4,lapic_tmr5,lapic_tmr6,lapic_tmr7
135 .globl lapic_irr,lapic_irr0,lapic_irr1,lapic_irr2,lapic_irr3
136 .globl lapic_irr4,lapic_irr5,lapic_irr6,lapic_irr7,lapic_esr
137 .globl lapic_lvtt,lapic_pcint,lapic_lvt1
138 .globl lapic_lvt2,lapic_lvt3,lapic_ticr,lapic_tccr,lapic_tdcr
140 .set lapic_id, _lapic + 0x020
141 .set lapic_ver, _lapic + 0x030
142 .set lapic_tpr, _lapic + 0x080
143 .set lapic_apr, _lapic + 0x090
144 .set lapic_ppr, _lapic + 0x0a0
145 .set lapic_eoi, _lapic + 0x0b0
146 .set lapic_ldr, _lapic + 0x0d0
147 .set lapic_dfr, _lapic + 0x0e0
148 .set lapic_svr, _lapic + 0x0f0
149 .set lapic_isr, _lapic + 0x100
150 .set lapic_isr0, _lapic + 0x100
151 .set lapic_isr1, _lapic + 0x110
152 .set lapic_isr2, _lapic + 0x120
153 .set lapic_isr3, _lapic + 0x130
154 .set lapic_isr4, _lapic + 0x140
155 .set lapic_isr5, _lapic + 0x150
156 .set lapic_isr6, _lapic + 0x160
157 .set lapic_isr7, _lapic + 0x170
158 .set lapic_tmr, _lapic + 0x180
159 .set lapic_tmr0, _lapic + 0x180
160 .set lapic_tmr1, _lapic + 0x190
161 .set lapic_tmr2, _lapic + 0x1a0
162 .set lapic_tmr3, _lapic + 0x1b0
163 .set lapic_tmr4, _lapic + 0x1c0
164 .set lapic_tmr5, _lapic + 0x1d0
165 .set lapic_tmr6, _lapic + 0x1e0
166 .set lapic_tmr7, _lapic + 0x1f0
167 .set lapic_irr, _lapic + 0x200
168 .set lapic_irr0, _lapic + 0x200
169 .set lapic_irr1, _lapic + 0x210
170 .set lapic_irr2, _lapic + 0x220
171 .set lapic_irr3, _lapic + 0x230
172 .set lapic_irr4, _lapic + 0x240
173 .set lapic_irr5, _lapic + 0x250
174 .set lapic_irr6, _lapic + 0x260
175 .set lapic_irr7, _lapic + 0x270
176 .set lapic_esr, _lapic + 0x280
177 .set lapic_icr_lo, _lapic + 0x300
178 .set lapic_icr_hi, _lapic + 0x310
179 .set lapic_lvtt, _lapic + 0x320
180 .set lapic_pcint, _lapic + 0x340
181 .set lapic_lvt1, _lapic + 0x350
182 .set lapic_lvt2, _lapic + 0x360
183 .set lapic_lvt3, _lapic + 0x370
184 .set lapic_ticr, _lapic + 0x380
185 .set lapic_tccr, _lapic + 0x390
186 .set lapic_tdcr, _lapic + 0x3e0