1/*
2 * Copyright 2014, General Dynamics C4 Systems
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#include <config.h>
8#include <util.h>
9#include <api/types.h>
10#include <arch/types.h>
11#include <arch/model/statedata.h>
12#include <arch/object/structures.h>
13#include <arch/machine/debug_conf.h>
14#include <linker.h>
15#include <plat/machine/hardware.h>
16
17#ifdef CONFIG_KERNEL_GLOBALS_FRAME
18/* The global frame, mapped in all address spaces */
19word_t armKSGlobalsFrame[BIT(ARMSmallPageBits) / sizeof(word_t)]
20ALIGN_BSS(BIT(ARMSmallPageBits));
21#endif /* CONFIG_KERNEL_GLOBALS_FRAME */
22
23/* The top level asid mapping table */
24asid_pool_t *armKSASIDTable[BIT(asidHighBits)];
25
26/* The hardware ASID to virtual ASID mapping table */
27asid_t armKSHWASIDTable[BIT(hwASIDBits)];
28hw_asid_t armKSNextASID;
29
30#ifndef CONFIG_ARM_HYPERVISOR_SUPPORT
31/* The global, privileged, physically-mapped PD */
32pde_t armKSGlobalPD[BIT(PD_INDEX_BITS)] ALIGN_BSS(BIT(seL4_PageDirBits));
33
34/* The global, privileged, page table. */
35pte_t armKSGlobalPT[BIT(PT_INDEX_BITS)] ALIGN_BSS(BIT(seL4_PageTableBits));
36
37#ifdef CONFIG_KERNEL_LOG_BUFFER
38pte_t armKSGlobalLogPT[BIT(PT_INDEX_BITS)] ALIGN_BSS(BIT(seL4_PageTableBits));
39#endif /* CONFIG_KERNEL_LOG_BUFFER */
40
41#else
42/* The global, hypervisor, level 1 page table */
43pdeS1_t  armHSGlobalPGD[BIT(PGD_INDEX_BITS)] ALIGN_BSS(BIT(PGD_SIZE_BITS));
44/* The global, hypervisor, level 2 page table */
45pdeS1_t  armHSGlobalPD[BIT(PT_INDEX_BITS)]   ALIGN_BSS(BIT(seL4_PageTableBits));
46/* The global, hypervisor, level 3 page table */
47pteS1_t  armHSGlobalPT[BIT(PT_INDEX_BITS)]   ALIGN_BSS(BIT(seL4_PageTableBits));
48/* Global user space mappings, which are empty as there is no hared kernel region */
49pde_t armUSGlobalPD[BIT(PD_INDEX_BITS)] ALIGN_BSS(BIT(seL4_PageDirBits));;
50#ifdef CONFIG_KERNEL_GLOBALS_FRAME
51/* User space global mappings */
52pte_t  armUSGlobalPT[BIT(PT_INDEX_BITS)]   ALIGN_BSS(BIT(seL4_PageTableBits));
53#endif /* CONFIG_KERNEL_GLOBALS_FRAME */
54/* Current VCPU */
55UP_STATE_DEFINE(vcpu_t, *armHSCurVCPU);
56/* Whether the current loaded VCPU is enabled in the hardware or not */
57UP_STATE_DEFINE(bool_t, armHSVCPUActive);
58
59#ifdef CONFIG_HAVE_FPU
60/* Whether the hyper-mode kernel is allowed to execute FPU instructions */
61UP_STATE_DEFINE(bool_t, armHSFPUEnabled);
62#endif
63
64#endif /* CONFIG_ARM_HYPERVISOR_SUPPORT */
65
66#ifdef ARM_BASE_CP14_SAVE_AND_RESTORE
67/* Null state for the Debug coprocessor's break/watchpoint registers */
68user_breakpoint_state_t armKSNullBreakpointState;
69#endif
70