Crashpad
Classes | Public Types | Static Public Member Functions | Public Attributes | List of all members
crashpad::CPUContextX86 Struct Reference

A context structure carrying 32-bit x86 CPU state. More...

#include "snapshot/cpu_context.h"

Classes

struct  Fsave
 
struct  Fxsave
 
union  X87OrMMXRegister
 

Public Types

using X87Register = uint8_t[10]
 
using XMMRegister = uint8_t[16]
 

Static Public Member Functions

static void FxsaveToFsave (const Fxsave &fxsave, Fsave *fsave)
 Converts an fxsave area to an fsave area. More...
 
static void FsaveToFxsave (const Fsave &fsave, Fxsave *fxsave)
 Converts an fsave area to an fxsave area. More...
 
static uint16_t FxsaveToFsaveTagWord (uint16_t fsw, uint8_t fxsave_tag, const X87OrMMXRegister st_mm[8])
 Converts x87 floating-point tag words from fxsave (abridged, 8-bit) to fsave (full, 16-bit) form. More...
 
static uint8_t FsaveToFxsaveTagWord (uint16_t fsave_tag)
 Converts x87 floating-point tag words from fsave (full, 16-bit) to fxsave (abridged, 8-bit) form. More...
 

Public Attributes

uint32_t eax
 
uint32_t ebx
 
uint32_t ecx
 
uint32_t edx
 
uint32_t edi
 
uint32_t esi
 
uint32_t ebp
 
uint32_t esp
 
uint32_t eip
 
uint32_t eflags
 
uint16_t cs
 
uint16_t ds
 
uint16_t es
 
uint16_t fs
 
uint16_t gs
 
uint16_t ss
 
Fxsave fxsave
 
uint32_t dr0
 
uint32_t dr1
 
uint32_t dr2
 
uint32_t dr3
 
uint32_t dr4
 
uint32_t dr5
 
uint32_t dr6
 
uint32_t dr7
 

Detailed Description

A context structure carrying 32-bit x86 CPU state.

Member Function Documentation

◆ FsaveToFxsave()

void crashpad::CPUContextX86::FsaveToFxsave ( const Fsave fsave,
Fxsave fxsave 
)
static

Converts an fsave area to an fxsave area.

fsave state is restricted to the x87 FPU, while fxsave state includes state related to the x87 FPU as well as state specific to SSE.

As the fsave format is a subset of the fxsave format, this operation cannot fully populate the fxsave area. Fields in fxsave that have no equivalent in fsave are set to 0, including Fxsave::mxcsr, Fxsave::mxcsr_mask, Fxsave::xmm, and Fxsave::available. FsaveToFxsaveTagWord() is used to derive Fxsave::ftw from the full 16-bit form used by fsave. Reserved fields in fxsave are set to 0.

Parameters
[in]fsaveThe fsave area to convert.
[out]fxsaveThe fxsave area to populate.
See also
FxsaveToFsave()

◆ FsaveToFxsaveTagWord()

uint8_t crashpad::CPUContextX86::FsaveToFxsaveTagWord ( uint16_t  fsave_tag)
static

Converts x87 floating-point tag words from fsave (full, 16-bit) to fxsave (abridged, 8-bit) form.

This function performs the inverse operation of FxsaveToFsaveTagWord().

Parameters
[in]fsave_tagThe full FPU tag word.
Returns
The abridged FPU tag word.

◆ FxsaveToFsave()

void crashpad::CPUContextX86::FxsaveToFsave ( const Fxsave fxsave,
Fsave fsave 
)
static

Converts an fxsave area to an fsave area.

fsave state is restricted to the x87 FPU, while fxsave state includes state related to the x87 FPU as well as state specific to SSE.

As the fxsave format is a superset of the fsave format, this operation fully populates the fsave area. fsave uses the full 16-bit form for the x87 floating-point tag word, so FxsaveToFsaveTagWord() is used to derive Fsave::ftw from the abridged 8-bit form used by fxsave. Reserved fields in fsave are set to 0.

Parameters
[in]fxsaveThe fxsave area to convert.
[out]fsaveThe fsave area to populate.
See also
FsaveToFxsave()

◆ FxsaveToFsaveTagWord()

uint16_t crashpad::CPUContextX86::FxsaveToFsaveTagWord ( uint16_t  fsw,
uint8_t  fxsave_tag,
const X87OrMMXRegister  st_mm[8] 
)
static

Converts x87 floating-point tag words from fxsave (abridged, 8-bit) to fsave (full, 16-bit) form.

fxsave stores the x87 floating-point tag word in abridged 8-bit form, and fsave stores it in full 16-bit form. Some users, notably CPUContextX86::Fsave::ftw, require the full 16-bit form, where most other contemporary code uses fxsave and thus the abridged 8-bit form found in CPUContextX86::Fxsave::ftw.

This function converts an abridged tag word to the full version by using the abridged tag word and the contents of the registers it describes. See Intel Software Developer’s Manual, Volume 2A: Instruction Set Reference A-M (253666-052), 3.2 “FXSAVE”, specifically, the notes on the abridged FTW and recreating the FSAVE format, and AMD Architecture Programmer’s Manual, Volume 2: System Programming (24593-3.24), “FXSAVE Format for x87 Tag Word”.

See also
FsaveToFxsaveTagWord()
Parameters
[in]fswThe FPU status word, used to map logical st_mm registers to their physical counterparts. This can be taken from CPUContextX86::Fxsave::fsw.
[in]fxsave_tagThe abridged FPU tag word. This can be taken from CPUContextX86::Fxsave::ftw.
[in]st_mmThe floating-point registers in logical order. This can be taken from CPUContextX86::Fxsave::st_mm.
Returns
The full FPU tag word.

The documentation for this struct was generated from the following files: