segment.h (c4755613a1339ea77dbb15de75c9f74217209265) segment.h (ffebbaedc8616cffe648202e364dce6a045d65a2)
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/*

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

219
220/* Bitmask of exception vectors which push an error code on the stack: */
221#define EXCEPTION_ERRCODE_MASK 0x00027d00
222
223#define GDT_SIZE (GDT_ENTRIES*8)
224#define GDT_ENTRY_TLS_ENTRIES 3
225#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES* 8)
226
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/*

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

219
220/* Bitmask of exception vectors which push an error code on the stack: */
221#define EXCEPTION_ERRCODE_MASK 0x00027d00
222
223#define GDT_SIZE (GDT_ENTRIES*8)
224#define GDT_ENTRY_TLS_ENTRIES 3
225#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES* 8)
226
227#ifdef CONFIG_X86_64
228
229/* Bit size and mask of CPU number stored in the per CPU data (and TSC_AUX) */
230#define VDSO_CPU_SIZE 12
231#define VDSO_CPU_MASK 0xfff
232
233#ifndef __ASSEMBLY__
234
235/* Helper functions to store/load CPU and node numbers */
236
237static inline unsigned long vdso_encode_cpu_node(int cpu, unsigned long node)
238{
239 return ((node << VDSO_CPU_SIZE) | cpu);
240}
241
242static inline void vdso_read_cpu_node(unsigned *cpu, unsigned *node)
243{
244 unsigned int p;
245
246 /*
247 * Load CPU and node number from GDT. LSL is faster than RDTSCP
248 * and works on all CPUs. This is volatile so that it orders
249 * correctly with respect to barrier() and to keep GCC from cleverly
250 * hoisting it out of the calling function.
251 *
252 * If RDPID is available, use it.
253 */
254 alternative_io ("lsl %[seg],%[p]",
255 ".byte 0xf3,0x0f,0xc7,0xf8", /* RDPID %eax/rax */
256 X86_FEATURE_RDPID,
257 [p] "=a" (p), [seg] "r" (__CPU_NUMBER_SEG));
258
259 if (cpu)
260 *cpu = (p & VDSO_CPU_MASK);
261 if (node)
262 *node = (p >> VDSO_CPU_SIZE);
263}
264
265#endif /* !__ASSEMBLY__ */
266#endif /* CONFIG_X86_64 */
267
227#ifdef __KERNEL__
228
229/*
230 * early_idt_handler_array is an array of entry points referenced in the
231 * early IDT. For simplicity, it's a real array with one entry point
232 * every nine bytes. That leaves room for an optional 'push $0' if the
233 * vector has no error code (two bytes), a 'push $vector_number' (two
234 * bytes), and a jump to the common entry code (up to five bytes).

--- 105 unchanged lines hidden ---
268#ifdef __KERNEL__
269
270/*
271 * early_idt_handler_array is an array of entry points referenced in the
272 * early IDT. For simplicity, it's a real array with one entry point
273 * every nine bytes. That leaves room for an optional 'push $0' if the
274 * vector has no error code (two bytes), a 'push $vector_number' (two
275 * bytes), and a jump to the common entry code (up to five bytes).

--- 105 unchanged lines hidden ---