Added 49 new instructions...

This commit is contained in:
xolatile 2024-07-24 07:47:32 -04:00
parent a205f9a6bb
commit fae1aedeb5
3 changed files with 55 additions and 6 deletions

View File

@ -7,9 +7,9 @@
#define IRREGULAR_BEGIN (INC)
#define IRREGULAR_END (IDIV)
#define SPECIAL_1_BEGIN (NOP)
#define SPECIAL_1_END (WAIT)
#define SPECIAL_1_END (STOSD)
#define SPECIAL_2_BEGIN (SYSENTER)
#define SPECIAL_2_END (FCOS)
#define SPECIAL_2_END (XLATB)
#define JUMP_IF_BEGIN (JO)
#define JUMP_IF_END (JG)
#define MOVE_IF_BEGIN (CMOVO)
@ -160,7 +160,8 @@ static void build_irregular (unsigned int operation, unsigned int size, unsigned
static void build_special_1 (unsigned int operation) {
const unsigned char data [] = {
0x90, 0xc3, 0xcb, 0xc9, 0xf0, 0xf4, 0x9d, 0x9c, 0x9b
0x90, 0xc3, 0xcb, 0xc9, 0xf0, 0xf4, 0x9d, 0x9c, 0x9b, 0xf8, 0xfc, 0xfa, 0xf9, 0xfd, 0xfb, 0xf5, 0x6c, 0x6d, 0x6e, 0x6f, 0x99, 0x98, 0xec, 0xed, 0xcc, 0xcf, 0xac,
0xad, 0xee, 0xef, 0xae, 0xaf, 0xaa, 0xab
};
input (1, data [operation - SPECIAL_1_BEGIN]);
@ -169,7 +170,8 @@ static void build_special_1 (unsigned int operation) {
static void build_special_2 (unsigned int operation) {
const unsigned short data [] = {
0x340f, 0x350f, 0x050f, 0x070f, 0x90f3, 0xa20f, 0x770f, 0xaa0f, 0xd0d9, 0xe0d9, 0xe1d9, 0xe4d9, 0xe5d9, 0xe8d9, 0xe9d9, 0xead9, 0xebd9, 0xecd9, 0xedd9, 0xeed9,
0xf0d9, 0xf1d9, 0xf2d9, 0xf3d9, 0xf4d9, 0xf5d9, 0xf6d9, 0xf7d9, 0xf8d9, 0xf9d9, 0xfad9, 0xfbd9, 0xfcd9, 0xfdd9, 0xfed9, 0xffd9
0xf0d9, 0xf1d9, 0xf2d9, 0xf3d9, 0xf4d9, 0xf5d9, 0xf6d9, 0xf7d9, 0xf8d9, 0xf9d9, 0xfad9, 0xfbd9, 0xfcd9, 0xfdd9, 0xfed9, 0xffd9, 0x6d66, 0x6f66, 0x9966, 0x9948,
0x9866, 0x9848, 0x080f, 0x090f, 0x0b0f, 0x060f, 0xed66, 0xcf48, 0xad66, 0xad48, 0xef66, 0x330f, 0x320f, 0x310f, 0xaf66, 0xaf48, 0xab66, 0xab48, 0x300f, 0xd748
};
input_by (1, D16, data [operation - SPECIAL_2_BEGIN]);

View File

@ -45,6 +45,31 @@ enum {
POPF, // Pop stack into flags register (16/64 bit).
PUSHF, // Push flags register onto stack (16/64 bit).
WAIT, // Check for and handle pending float exceptions.
CLC, // Clear carry flag.
CLD, // Clear direction flag.
CLI, // Clear interrupt flag.
STC, // Set carry flag.
STD, // Set direction flag.
STI, // Set interrupt flag.
CMC, // Complement carry flag.
INSB, // Input 1 byte from IO port at DX to ES:(E)DI or RDI.
INSD, // Input 4 bytes from IO port at DX to ES:(E)DI or RDI.
OUTSB, // Output 1 byte from DS:(E)SI or RSI to IO port at DX.
OUTSD, // Output 4 bytes from DS:(E)SI or RSI to IO port at DX.
CDQ, // Sign-extend EAX into EDX:EAX.
CWDE, // Sign-extend AX into EAX.
INAL,
INEAX,
INT3,
IRETD,
LODSB,
LODSD,
OUTAL,
OUTEAX,
SCASB,
SCASD,
STOSB,
STOSD,
SYSENTER, // Execute fast call to ring 0 system procedure.
SYSEXIT, // Execute fast return to ring 3 userland procedure.
SYSCALL, // Execute OS system call handler at kernel.
@ -81,6 +106,30 @@ enum {
FSCALE, // Scale st0 by st1.
FSIN, // Compute sin (st0).
FCOS, // Compure cos (st0).
INSW,
OUTSW,
CWD,
CQO,
CBW,
CDQE,
INVD,
WBINVD,
UD2,
CLTS,
INAX,
IRETQ,
LODSW,
LODSQ,
OUTAX,
RDPMC,
RDMSR,
RDTSC,
SCASW,
SCASQ,
STOSW,
STOSQ,
WRMSR,
XLATB,
ENTER, // Create a stack frame for procedure call.
CALL, // Call near, relative or absolute procedure.
IN, // Input byte from 8-bit IO port to r0.

View File

@ -13,11 +13,9 @@
"};\n" \
"int main (void) {\n" \
" unsigned int index;\n" \
" text_sector_byte = malloc (144UL * sizeof (* text_sector_byte));\n" \
" assemble ((unsigned int) (sizeof (array) / sizeof (array [0])), array);\n" \
" for (index = 0; index < text_sector_size; ++index)\n" \
" printf (\"%02X \", text_sector_byte [index]);\n" \
" free (text_sector_byte);\n" \
" return (0);\n" \
"}\n"