segment.h (3eb66e91a25497065c5322b1268cbc3953642227) segment.h (81ff2c37f9e5d77593928df0536d86443195fd64)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_SEGMENT_H
3#define _ASM_X86_SEGMENT_H
4
5#include <linux/const.h>
6#include <asm/alternative.h>
7
8/*

--- 17 unchanged lines hidden (view full) ---

26#define __BOOT_TSS (GDT_ENTRY_BOOT_TSS*8)
27
28/*
29 * Bottom two bits of selector give the ring
30 * privilege level
31 */
32#define SEGMENT_RPL_MASK 0x3
33
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_SEGMENT_H
3#define _ASM_X86_SEGMENT_H
4
5#include <linux/const.h>
6#include <asm/alternative.h>
7
8/*

--- 17 unchanged lines hidden (view full) ---

26#define __BOOT_TSS (GDT_ENTRY_BOOT_TSS*8)
27
28/*
29 * Bottom two bits of selector give the ring
30 * privilege level
31 */
32#define SEGMENT_RPL_MASK 0x3
33
34/*
35 * When running on Xen PV, the actual privilege level of the kernel is 1,
36 * not 0. Testing the Requested Privilege Level in a segment selector to
37 * determine whether the context is user mode or kernel mode with
38 * SEGMENT_RPL_MASK is wrong because the PV kernel's privilege level
39 * matches the 0x3 mask.
40 *
41 * Testing with USER_SEGMENT_RPL_MASK is valid for both native and Xen PV
42 * kernels because privilege level 2 is never used.
43 */
44#define USER_SEGMENT_RPL_MASK 0x2
45
34/* User mode is privilege level 3: */
35#define USER_RPL 0x3
36
37/* Bit 2 is Table Indicator (TI): selects between LDT or GDT */
38#define SEGMENT_TI_MASK 0x4
39/* LDT segment has TI set ... */
40#define SEGMENT_LDT 0x4
41/* ... GDT has it cleared */

--- 339 unchanged lines hidden ---
46/* User mode is privilege level 3: */
47#define USER_RPL 0x3
48
49/* Bit 2 is Table Indicator (TI): selects between LDT or GDT */
50#define SEGMENT_TI_MASK 0x4
51/* LDT segment has TI set ... */
52#define SEGMENT_LDT 0x4
53/* ... GDT has it cleared */

--- 339 unchanged lines hidden ---