xref: /dragonfly/sys/platform/pc64/x86_64/global.s (revision c693df0e)
1b2b3ffcdSSimon Schubert/*-
2b2b3ffcdSSimon Schubert * Copyright (c) Peter Wemm <peter@netplex.com.au>
3b2b3ffcdSSimon Schubert * Copyright (c) 2008 The DragonFly Project.
4b2b3ffcdSSimon Schubert * All rights reserved.
5b2b3ffcdSSimon Schubert *
6b2b3ffcdSSimon Schubert * Redistribution and use in source and binary forms, with or without
7b2b3ffcdSSimon Schubert * modification, are permitted provided that the following conditions
8b2b3ffcdSSimon Schubert * are met:
9b2b3ffcdSSimon Schubert * 1. Redistributions of source code must retain the above copyright
10b2b3ffcdSSimon Schubert *    notice, this list of conditions and the following disclaimer.
11b2b3ffcdSSimon Schubert * 2. Redistributions in binary form must reproduce the above copyright
12b2b3ffcdSSimon Schubert *    notice, this list of conditions and the following disclaimer in the
13b2b3ffcdSSimon Schubert *    documentation and/or other materials provided with the distribution.
14b2b3ffcdSSimon Schubert *
15b2b3ffcdSSimon Schubert * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16b2b3ffcdSSimon Schubert * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17b2b3ffcdSSimon Schubert * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18b2b3ffcdSSimon Schubert * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19b2b3ffcdSSimon Schubert * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20b2b3ffcdSSimon Schubert * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21b2b3ffcdSSimon Schubert * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22b2b3ffcdSSimon Schubert * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23b2b3ffcdSSimon Schubert * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24b2b3ffcdSSimon Schubert * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25b2b3ffcdSSimon Schubert * SUCH DAMAGE.
26b2b3ffcdSSimon Schubert *
27b2b3ffcdSSimon Schubert * $FreeBSD: src/sys/i386/i386/globals.s,v 1.13.2.1 2000/05/16 06:58:06 dillon Exp $
28b2b3ffcdSSimon Schubert */
29b2b3ffcdSSimon Schubert
30b2b3ffcdSSimon Schubert#include <machine/asmacros.h>
31b2b3ffcdSSimon Schubert#include <machine/pmap.h>
32b2b3ffcdSSimon Schubert
33b2b3ffcdSSimon Schubert#include "assym.s"
34b2b3ffcdSSimon Schubert
35b2b3ffcdSSimon Schubert	/*
36b2b3ffcdSSimon Schubert	 * Define the layout of the per-cpu address space.  This is
37b2b3ffcdSSimon Schubert	 * "constructed" in locore.s on the BSP and in mp_machdep.c for
38b2b3ffcdSSimon Schubert	 * each AP.  DO NOT REORDER THESE WITHOUT UPDATING THE REST!
39b2b3ffcdSSimon Schubert	 *
40b2b3ffcdSSimon Schubert	 * On UP the per-cpu address space is simply placed in the data
41b2b3ffcdSSimon Schubert	 * segment.
42b2b3ffcdSSimon Schubert	 */
43b2b3ffcdSSimon Schubert	.data
44b2b3ffcdSSimon Schubert
45b2b3ffcdSSimon Schubert	.globl	globaldata
46b2b3ffcdSSimon Schubert	.set	globaldata,0
47b2b3ffcdSSimon Schubert
48b2b3ffcdSSimon Schubert	/*
49b2b3ffcdSSimon Schubert	 * Define layout of the global data.  On SMP this lives in
50b2b3ffcdSSimon Schubert	 * the per-cpu address space, otherwise it's in the data segment.
51b2b3ffcdSSimon Schubert	 */
52*c693df0eSMatthew Dillon	.globl	gd_trampoline, gd_debug1, gd_debug2
53b2b3ffcdSSimon Schubert	.globl	gd_curthread, gd_npxthread, gd_reqflags, gd_common_tss
544611d87fSMatthew Dillon	.set	gd_trampoline,globaldata + GD_TRAMPOLINE
55*c693df0eSMatthew Dillon	.set	gd_debug1,globaldata + GD_DEBUG1
56*c693df0eSMatthew Dillon	.set	gd_debug2,globaldata + GD_DEBUG2
57b2b3ffcdSSimon Schubert	.set	gd_curthread,globaldata + GD_CURTHREAD
58b2b3ffcdSSimon Schubert	.set	gd_npxthread,globaldata + GD_NPXTHREAD
59b2b3ffcdSSimon Schubert	.set	gd_reqflags,globaldata + GD_REQFLAGS
60b2b3ffcdSSimon Schubert	.set	gd_common_tss,globaldata + GD_COMMON_TSS
61b2b3ffcdSSimon Schubert
62b2b3ffcdSSimon Schubert	.globl	gd_common_tssd, gd_tss_gdt
63b2b3ffcdSSimon Schubert	.set	gd_common_tssd,globaldata + GD_COMMON_TSSD
64b2b3ffcdSSimon Schubert	.set	gd_tss_gdt,globaldata + GD_TSS_GDT
65b2b3ffcdSSimon Schubert
66b2b3ffcdSSimon Schubert	.globl	gd_currentldt
67b2b3ffcdSSimon Schubert	.set	gd_currentldt,globaldata + GD_CURRENTLDT
68b2b3ffcdSSimon Schubert
69b2b3ffcdSSimon Schubert	.globl	gd_fpu_lock, gd_savefpu
70b2b3ffcdSSimon Schubert	.set	gd_fpu_lock, globaldata + GD_FPU_LOCK
71b2b3ffcdSSimon Schubert	.set	gd_savefpu, globaldata + GD_SAVEFPU
72b2b3ffcdSSimon Schubert
7330c6fbb5SMatthew Dillon	.globl	gd_ireserved
7430c6fbb5SMatthew Dillon	.set	gd_ireserved, globaldata + GD_IRESERVED
7530c6fbb5SMatthew Dillon
76b2b3ffcdSSimon Schubert	/*
77b2b3ffcdSSimon Schubert	 * The BSP version of these get setup in locore.s and pmap.c, while
78b2b3ffcdSSimon Schubert	 * the AP versions are setup in mp_machdep.c.
79b2b3ffcdSSimon Schubert	 */
80c2fb025dSMatthew Dillon	.globl  gd_cpuid, gd_cpumask, gd_other_cpus
81b2b3ffcdSSimon Schubert	.globl	gd_ss_eflags, gd_intr_nesting_level
829611ff20SSepherosa Ziehau	.globl  gd_spending, gd_ipending
83b2b3ffcdSSimon Schubert	.globl	gd_cnt, gd_private_tss
84b2b3ffcdSSimon Schubert	.globl	gd_user_fs, gd_user_gs
85433c75c3SMatthew Dillon	.globl	gd_sample_pc
86e32d3244SMatthew Dillon	.globl	gd_sample_sp
87e47e3dbaSMatthew Dillon	.globl	gd_npoll
88ee89e80bSMatthew Dillon	.globl	gd_cpumask_simple
89ee89e80bSMatthew Dillon	.globl	gd_cpumask_offset
90b2b3ffcdSSimon Schubert
91b2b3ffcdSSimon Schubert	.set    gd_cpuid,globaldata + GD_CPUID
92c2fb025dSMatthew Dillon	.set    gd_cpumask,globaldata + GD_CPUMASK
93b2b3ffcdSSimon Schubert	.set    gd_private_tss,globaldata + GD_PRIVATE_TSS
94b2b3ffcdSSimon Schubert	.set    gd_other_cpus,globaldata + GD_OTHER_CPUS
95b2b3ffcdSSimon Schubert	.set    gd_ss_eflags,globaldata + GD_SS_EFLAGS
96b2b3ffcdSSimon Schubert	.set    gd_intr_nesting_level,globaldata + GD_INTR_NESTING_LEVEL
979611ff20SSepherosa Ziehau	.set	gd_ipending,globaldata + GD_IPENDING
98b2b3ffcdSSimon Schubert	.set	gd_spending,globaldata + GD_SPENDING
99b2b3ffcdSSimon Schubert	.set	gd_cnt,globaldata + GD_CNT
100b2b3ffcdSSimon Schubert	.set	gd_user_fs,globaldata + GD_USER_FS
101b2b3ffcdSSimon Schubert	.set	gd_user_gs,globaldata + GD_USER_GS
102433c75c3SMatthew Dillon	.set	gd_sample_pc,globaldata + GD_SAMPLE_PC
103e32d3244SMatthew Dillon	.set	gd_sample_sp,globaldata + GD_SAMPLE_SP
104e47e3dbaSMatthew Dillon	.set	gd_npoll,globaldata + GD_NPOLL
105ee89e80bSMatthew Dillon	.set	gd_cpumask_simple,globaldata + GD_CPUMASK_SIMPLE
106ee89e80bSMatthew Dillon	.set	gd_cpumask_offset,globaldata + GD_CPUMASK_OFFSET
107b2b3ffcdSSimon Schubert
108