zephyr/arch/x86/include/gdt.h
Andrew Boie 81f61bb1be x86: make GDT setup optional
For some security scenarios the GDT may already be setup and locked,
in which case the kernel trying to set it again could lead to problems.

Change-Id: I727c1d213479f46a4bb6f0c04a9096131e10b3e7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-26 19:32:03 +00:00

79 lines
2.1 KiB
C

/*
* Copyright (c) 2011-2012, 2014 Wind River Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief IA-32 Global Descriptor Table (GDT) definitions
*
* This file provides definitions for the Global Descriptor Table (GDT) for the
* IA-32 architecture.
*/
#ifndef _GDT_H
#define _GDT_H
#include <arch/x86/arch.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASMLANGUAGE
#include <stdint.h>
#include <toolchain.h>
/* a generic GDT entry structure definition */
typedef struct s_gdtDesc {
uint16_t limitLowerWord; /* bits 0:15 of segment limit */
uint16_t baseAdrsLowerWord; /* bits 0:15 of segment base address */
uint8_t baseAdrsMidByte; /* bits 16:23 of segment base address */
uint8_t descType; /* descriptor type fields */
uint8_t limitUpperByte; /* bits 16:19 of limit + more type fields */
uint8_t baseAdrsUpperByte; /* bits 24:31 of segment base address */
} tGdtDesc;
/*
* structure definition for the GDT "header"
* (does not include the GDT entries).
* The structure is packed to force the structure to appear "as is".
* Unfortunately, this appears to remove any alignment restrictions
* so the aligned attribute is used.
*/
typedef struct __packed s_gdtHeader
{
uint16_t limit; /* GDT limit */
tGdtDesc *pEntries; /* pointer to the GDT entries */
} tGdtHeader __aligned(4);
/* externs */
#ifdef CONFIG_SET_GDT
/* This is either the ROM-based GDT in crt0.S or RAM-based in gdt.c,
* depending on CONFIG_GDT_DYNAMIC
*/
extern tGdtHeader _gdt;
#endif
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* _GDT_H */