luxos/SysCore/include/regs.h

101 lines
3.5 KiB
C

#ifndef _REGS_H_INCLUDED
#define _REGS_H_INCLUDED
//****************************************************************************
//**
//** regs.h
//**
//** processor register structures and declarations. This interface abstracts
//** register names behind a common, portable interface
//**
//****************************************************************************
//============================================================================
// INTERFACE REQUIRED HEADERS
//============================================================================
#include <stdint.h>
//============================================================================
// INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS
//============================================================================
//============================================================================
// INTERFACE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES
//============================================================================
//============================================================================
// INTERFACE STRUCTURES / UTILITY CLASSES
//============================================================================
//! 32 bit registers
typedef struct {
uint32_t eax, ebx, ecx, edx, esi, edi, ebp, esp, eflags;
uint8_t cflag;
} _R32BIT;
//! 16 bit registers
typedef struct {
uint16_t ax, bx, cx, dx, si, di, bp, sp, es, cs, ss, ds, flags;
uint8_t cflag;
} _R16BIT ;
//! 16 bit registers expressed in 32 bit registers
typedef struct {
uint16_t ax, axh, bx, bxh, cx, cxh, dx, dxh;
uint16_t si, di, bp, sp, es, cs, ss, ds, flags;
uint8_t cflags;
} _R16BIT32 ;
//! 8 bit registers
typedef struct {
uint8_t al, ah, bl, bh, cl, ch, dl, dh;
} _R8BIT;
//! 8 bit registers expressed in 32 bit registers
typedef struct {
uint8_t al, ah; uint16_t axh;
uint8_t bl, bh; uint16_t bxh;
uint8_t cl, ch; uint16_t cxh;
uint8_t dl, dh; uint16_t dxh;
} _R8BIT32;
//! 8 and 16 bit registers union
typedef union {
_R16BIT x;
_R8BIT h;
}_INTR16;
//! 32 bit, 16 bit and 8 bit registers union
typedef union {
_R32BIT x;
_R16BIT32 l;
_R8BIT32 h;
} _INTR32;
/* This defines what the stack looks like after an ISR was running */
typedef struct
{
unsigned int gs, fs, es, ds; /* pushed the segs last */
unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax; /* pushed by 'pusha' */
unsigned int int_no, err_code; /* our 'push byte #' and ecodes do this */
unsigned int eip, cs, eflags, useresp, ss; /* pushed by the processor automatically */
} ISR_stack_regs;
//============================================================================
// INTERFACE DATA DECLARATIONS
//============================================================================
//============================================================================
// INTERFACE FUNCTION PROTOTYPES
//============================================================================
//============================================================================
// INTERFACE OBJECT CLASS DEFINITIONS
//============================================================================
//============================================================================
// INTERFACE TRAILING HEADERS
//============================================================================
//****************************************************************************
//**
//** END regs.h
//**
//****************************************************************************
#endif