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