Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/arch/x86/include/asm/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 2 kB image not shown  

Quelle  fsgsbase.h   Sprache: C

 
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_FSGSBASE_H
#define _ASM_FSGSBASE_H

#ifndef __ASSEMBLER__

#ifdef CONFIG_X86_64

#include <asm/msr.h>

/*
 * Read/write a task's FSBASE or GSBASE. This returns the value that
 * the FS/GS base would have (if the task were to be resumed). These
 * work on the current task or on a non-running (typically stopped
 * ptrace child) task.
 */

extern unsigned long x86_fsbase_read_task(struct task_struct *task);
extern unsigned long x86_gsbase_read_task(struct task_struct *task);
extern void x86_fsbase_write_task(struct task_struct *task, unsigned long fsbase);
extern void x86_gsbase_write_task(struct task_struct *task, unsigned long gsbase);

/* Must be protected by X86_FEATURE_FSGSBASE check. */

static __always_inline unsigned long rdfsbase(void)
{
 unsigned long fsbase;

 asm volatile("rdfsbase %0" : "=r" (fsbase) :: "memory");

 return fsbase;
}

static __always_inline unsigned long rdgsbase(void)
{
 unsigned long gsbase;

 asm volatile("rdgsbase %0" : "=r" (gsbase) :: "memory");

 return gsbase;
}

static __always_inline void wrfsbase(unsigned long fsbase)
{
 asm volatile("wrfsbase %0" :: "r" (fsbase) : "memory");
}

static __always_inline void wrgsbase(unsigned long gsbase)
{
 asm volatile("wrgsbase %0" :: "r" (gsbase) : "memory");
}

#include <asm/cpufeature.h>

/* Helper functions for reading/writing FS/GS base */

static inline unsigned long x86_fsbase_read_cpu(void)
{
 unsigned long fsbase;

 if (boot_cpu_has(X86_FEATURE_FSGSBASE))
  fsbase = rdfsbase();
 else
  rdmsrq(MSR_FS_BASE, fsbase);

 return fsbase;
}

static inline void x86_fsbase_write_cpu(unsigned long fsbase)
{
 if (boot_cpu_has(X86_FEATURE_FSGSBASE))
  wrfsbase(fsbase);
 else
  wrmsrq(MSR_FS_BASE, fsbase);
}

extern unsigned long x86_gsbase_read_cpu_inactive(void);
extern void x86_gsbase_write_cpu_inactive(unsigned long gsbase);
extern unsigned long x86_fsgsbase_read_task(struct task_struct *task,
         unsigned short selector);

#endif /* CONFIG_X86_64 */

#endif /* __ASSEMBLER__ */

#endif /* _ASM_FSGSBASE_H */

Messung V0.5
C=92 H=91 G=91

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.