1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00
kvisc/vm/pc/regs.h

112 lines
1.9 KiB
C
Raw Normal View History

2019-05-29 16:57:22 +02:00
// The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
2019-06-14 12:46:09 +02:00
// Register types
enum
{
GPR = 1 << 0, // General
CTL = 1 << 1, // Control
SEG = 1 << 2, // Segment
RES = 1 << 8, // Reserved for insternal use
SYS = 1 << 9, // Reserved for supervisor mode
};
// FLG register
enum
{
CF = 1 << 0, // Carry flag
OF = 1 << 1, // Overflow flag
ZF = 1 << 2, // Zero flag
SF = 1 << 3, // Sign flag
PF = 1 << 4, // Parity flag
DF = 1 << 5, // Direction flag
IF = 1 << 16, // Interrupts enable flag
};
// CR0 register
enum
{
UF = 1 << 15, // User-mode flag
};
struct reg_t
{
char *name;
ulong val;
ulong flags;
};
2019-05-29 16:57:22 +02:00
enum
{
2019-06-14 13:34:24 +02:00
INV = 0,
2019-06-02 16:33:28 +02:00
RIP, FLG, RBP, RSP,
2019-06-14 13:34:24 +02:00
RX0, RX1, RX2,
#define inv R(INV)
2019-06-02 16:33:28 +02:00
#define rip R(RIP)
#define flg R(FLG)
#define rbp R(RBP)
#define rsp R(RSP)
2019-05-29 16:57:22 +02:00
2019-06-02 16:33:28 +02:00
RAX, RBX, RCX, RDX,
2019-06-15 20:21:38 +02:00
RSX, RBI, RSI, RDI,
2019-06-02 16:33:28 +02:00
#define rax R(RAX)
#define rbx R(RBX)
#define rcx R(RCX)
#define rdx R(RDX)
#define rsx R(RSX)
#define rbi R(RBI)
#define rsi R(RSI)
2019-06-15 20:21:38 +02:00
#define rdi R(RDI)
2019-05-29 16:57:22 +02:00
2019-06-02 16:33:28 +02:00
NX0, NX1, NX2, NX3,
NX4, NX5, NX6, NX7,
2019-06-05 19:31:48 +02:00
#define nx0 R(NX0)
#define nx1 R(NX1)
#define nx2 R(NX2)
#define nx3 R(NX3)
2019-05-29 16:57:22 +02:00
2019-06-02 16:33:28 +02:00
AX0, AX1, AX2, AX3,
AX4, AX5, AX6, AX7,
2019-06-05 19:31:48 +02:00
#define ax0 R(AX0)
#define ax1 R(AX1)
#define ax2 R(AX2)
#define ax3 R(AX3)
#define ax4 R(AX4)
#define ax5 R(AX5)
#define ax6 R(AX6)
#define ax7 R(AX7)
2019-06-14 13:34:24 +02:00
LX0, LX1, LX2, LX3,
LX4, LX5, LX6, LX7,
2019-06-15 20:21:38 +02:00
#define lx0 R(LX0)
#define lx1 R(LX1)
#define lx2 R(LX2)
#define lx3 R(LX3)
#define lx4 R(LX4)
#define lx5 R(LX5)
#define lx6 R(LX6)
#define lx7 R(LX7)
2019-05-30 12:44:56 +02:00
2019-06-02 16:33:28 +02:00
CR0, CR1, CR2, CR3,
CR4, CR5, CR6, CR7,
#define cr0 R(CR0)
#define cr1 R(CR1)
#define cr2 R(CR2)
#define cr3 R(CR3)
2019-05-30 12:44:56 +02:00
2019-06-04 19:28:34 +02:00
SA0, SA1, SA2, SA3,
SA4, SA5, SA6, SA7,
2019-06-05 19:31:48 +02:00
#define sa0 R(SA0)
#define sa1 R(SA1)
#define sa2 R(SA2)
#define sa3 R(SA3)
2019-05-29 16:57:22 +02:00
NREGS
};