xref: /dragonfly/sys/platform/pc64/x86_64/global.s (revision e32d3244)
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	 */
52b2b3ffcdSSimon Schubert	.globl	gd_curthread, gd_npxthread, gd_reqflags, gd_common_tss
53b2b3ffcdSSimon Schubert	.set	gd_curthread,globaldata + GD_CURTHREAD
54b2b3ffcdSSimon Schubert	.set	gd_npxthread,globaldata + GD_NPXTHREAD
55b2b3ffcdSSimon Schubert	.set	gd_reqflags,globaldata + GD_REQFLAGS
56b2b3ffcdSSimon Schubert	.set	gd_common_tss,globaldata + GD_COMMON_TSS
57b2b3ffcdSSimon Schubert
58b2b3ffcdSSimon Schubert	.globl	gd_common_tssd, gd_tss_gdt
59b2b3ffcdSSimon Schubert	.set	gd_common_tssd,globaldata + GD_COMMON_TSSD
60b2b3ffcdSSimon Schubert	.set	gd_tss_gdt,globaldata + GD_TSS_GDT
61b2b3ffcdSSimon Schubert
62b2b3ffcdSSimon Schubert	.globl	gd_currentldt
63b2b3ffcdSSimon Schubert	.set	gd_currentldt,globaldata + GD_CURRENTLDT
64b2b3ffcdSSimon Schubert
65b2b3ffcdSSimon Schubert	.globl	gd_fpu_lock, gd_savefpu
66b2b3ffcdSSimon Schubert	.set	gd_fpu_lock, globaldata + GD_FPU_LOCK
67b2b3ffcdSSimon Schubert	.set	gd_savefpu, globaldata + GD_SAVEFPU
68b2b3ffcdSSimon Schubert
69b2b3ffcdSSimon Schubert	/*
70b2b3ffcdSSimon Schubert	 * The BSP version of these get setup in locore.s and pmap.c, while
71b2b3ffcdSSimon Schubert	 * the AP versions are setup in mp_machdep.c.
72b2b3ffcdSSimon Schubert	 */
73c2fb025dSMatthew Dillon	.globl  gd_cpuid, gd_cpumask, gd_other_cpus
74b2b3ffcdSSimon Schubert	.globl	gd_ss_eflags, gd_intr_nesting_level
759611ff20SSepherosa Ziehau	.globl  gd_spending, gd_ipending
76b2b3ffcdSSimon Schubert	.globl	gd_cnt, gd_private_tss
77d1368d1aSMatthew Dillon	.globl	gd_scratch_rsp
78b2b3ffcdSSimon Schubert	.globl	gd_user_fs, gd_user_gs
79433c75c3SMatthew Dillon	.globl	gd_sample_pc
80*e32d3244SMatthew Dillon	.globl	gd_sample_sp
81b2b3ffcdSSimon Schubert
82b2b3ffcdSSimon Schubert	.set    gd_cpuid,globaldata + GD_CPUID
83c2fb025dSMatthew Dillon	.set    gd_cpumask,globaldata + GD_CPUMASK
84b2b3ffcdSSimon Schubert	.set    gd_private_tss,globaldata + GD_PRIVATE_TSS
85b2b3ffcdSSimon Schubert	.set    gd_other_cpus,globaldata + GD_OTHER_CPUS
86b2b3ffcdSSimon Schubert	.set    gd_ss_eflags,globaldata + GD_SS_EFLAGS
87b2b3ffcdSSimon Schubert	.set    gd_intr_nesting_level,globaldata + GD_INTR_NESTING_LEVEL
889611ff20SSepherosa Ziehau	.set	gd_ipending,globaldata + GD_IPENDING
89b2b3ffcdSSimon Schubert	.set	gd_spending,globaldata + GD_SPENDING
90b2b3ffcdSSimon Schubert	.set	gd_cnt,globaldata + GD_CNT
91b2b3ffcdSSimon Schubert	.set	gd_scratch_rsp,globaldata + GD_SCRATCH_RSP
92b2b3ffcdSSimon Schubert	.set	gd_user_fs,globaldata + GD_USER_FS
93b2b3ffcdSSimon Schubert	.set	gd_user_gs,globaldata + GD_USER_GS
94433c75c3SMatthew Dillon	.set	gd_sample_pc,globaldata + GD_SAMPLE_PC
95*e32d3244SMatthew Dillon	.set	gd_sample_sp,globaldata + GD_SAMPLE_SP
96b2b3ffcdSSimon Schubert
97