xref: /dragonfly/sys/platform/vkernel64/x86_64/global.s (revision c90b3c6a8cee571a0d0f8a3255724347a9772e7e)
1/*-
2 * Copyright (c) Peter Wemm <peter@netplex.com.au>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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.
13 *
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
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: src/sys/i386/i386/globals.s,v 1.13.2.1 2000/05/16 06:58:06 dillon Exp $
27 */
28
29#include <machine/asmacros.h>
30#include <machine/pmap.h>
31
32#include "assym.s"
33
34          /*
35           * Define the layout of the per-cpu address space.  This is
36           * "constructed" in locore.s on the BSP and in mp_machdep.c for
37           * each AP.  DO NOT REORDER THESE WITHOUT UPDATING THE REST!
38           *
39           * On UP the per-cpu address space is simply placed in the data
40           * segment.
41           */
42          .data
43
44          .globl    globaldata
45          .set      globaldata,0
46
47          /*
48           * Define layout of the global data.  On SMP this lives in
49           * the per-cpu address space, otherwise it's in the data segment.
50           */
51          .globl    gd_curthread, gd_npxthread, gd_reqflags, gd_common_tss
52          .set      gd_curthread,globaldata + GD_CURTHREAD
53          .set      gd_npxthread,globaldata + GD_NPXTHREAD
54          .set      gd_reqflags,globaldata + GD_REQFLAGS
55          .set      gd_common_tss,globaldata + GD_COMMON_TSS
56
57          .globl    gd_cpumask
58          .set      gd_cpumask,globaldata + GD_CPUMASK
59
60          .globl    gd_common_tssd, gd_tss_gdt
61          .set      gd_common_tssd,globaldata + GD_COMMON_TSSD
62          .set      gd_tss_gdt,globaldata + GD_TSS_GDT
63
64          .globl    gd_currentldt
65          .set      gd_currentldt,globaldata + GD_CURRENTLDT
66
67          .globl    gd_fpu_lock, gd_savefpu
68          .set      gd_fpu_lock, globaldata + GD_FPU_LOCK
69          .set      gd_savefpu, globaldata + GD_SAVEFPU
70
71          /*
72           * The BSP version of these get setup in locore.s and pmap.c, while
73           * the AP versions are setup in mp_machdep.c.
74           */
75          .globl  gd_cpuid, gd_other_cpus
76          .globl    gd_ss_eflags, gd_intr_nesting_level
77          .globl  gd_CMAP1, gd_CMAP2, gd_CMAP3, gd_PMAP1
78          .globl  gd_CADDR1, gd_CADDR2, gd_CADDR3, gd_PADDR1
79          .globl  gd_spending, gd_ipending, gd_fpending
80          .globl    gd_cnt
81
82          .set    gd_cpuid,globaldata + GD_CPUID
83          .set    gd_other_cpus,globaldata + GD_OTHER_CPUS
84          .set    gd_ss_eflags,globaldata + GD_SS_EFLAGS
85          .set    gd_intr_nesting_level,globaldata + GD_INTR_NESTING_LEVEL
86          .set    gd_CMAP1,globaldata + GD_PRV_CMAP1
87          .set    gd_CMAP2,globaldata + GD_PRV_CMAP2
88          .set    gd_CMAP3,globaldata + GD_PRV_CMAP3
89          .set    gd_PMAP1,globaldata + GD_PRV_PMAP1
90          .set    gd_CADDR1,globaldata + GD_PRV_CADDR1
91          .set    gd_CADDR2,globaldata + GD_PRV_CADDR2
92          .set    gd_CADDR3,globaldata + GD_PRV_CADDR3
93          .set    gd_PADDR1,globaldata + GD_PRV_PADDR1
94          .set      gd_fpending,globaldata + GD_FPENDING
95          .set      gd_ipending,globaldata + GD_IPENDING
96          .set      gd_spending,globaldata + GD_SPENDING
97          .set      gd_cnt,globaldata + GD_CNT
98
99          /*
100           * This is a hack to allow us to use builtins for
101           * these functions.  We need the underscore version
102           * in situations where a function pointer is required.
103           */
104          .text
105          .globl    _bzero
106          .globl    _bcopy
107          .globl    _memcmp
108          .globl    _memmove
109          .globl    _memcpy
110
111          ALIGN_TEXT
112_bzero:
113          jmp       bzero
114
115          ALIGN_TEXT
116_bcopy:
117          jmp       bcopy
118
119          ALIGN_TEXT
120_memcmp:
121          jmp       memcmp
122
123          ALIGN_TEXT
124_memmove:
125          jmp       memmove
126
127          ALIGN_TEXT
128_memcpy:
129          jmp       memcpy
130