-
Notifications
You must be signed in to change notification settings - Fork 9
/
instructions_0F00.c
95 lines (86 loc) · 1.63 KB
/
instructions_0F00.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include "instruction_defs.h"
#include "emulator_functions.h"
#include "modrm.h"
#include "io.h"
#include "gdt.h"
#include "interrupt.h"
#include "util.h"
void code_0f_00(Emulator *emu)
{
emu->eip += 2;
ModRM modrm = create_modrm();
parse_modrm(emu, &modrm);
switch (modrm.opcode)
{
/* ltr */
case 3:
set_tr(emu, get_rm16(emu, &modrm));
break;
default:
printf("Not implemented: Op: 0F00 with ModR/M Op: %d\n", modrm.opcode);
panic_exit(emu);
}
}
void code_0f_01(Emulator *emu)
{
emu->eip += 2;
ModRM modrm = create_modrm();
parse_modrm(emu, &modrm);
switch (modrm.opcode)
{
case 2:
lgdt(emu, &modrm);
break;
case 3:
lidt(emu, &modrm);
break;
default:
printf("Not implemented: Op: 0F01 with ModR/M Op: %d\n", modrm.opcode);
panic_exit(emu);
}
}
/*
* push fs: 2 bytes
* Pushes FS register to stack.
* 2 bytes: op (0F A0)
*/
void push_fs(Emulator *emu)
{
push_segment_register(emu, FS);
emu->eip += 2;
}
/*
* pop fs: 2 bytes
* Pops FS register to stack.
* 2 bytes: op (0F A1)
*/
void pop_fs(Emulator *emu)
{
pop_segment_register(emu, FS);
emu->eip += 2;
}
/*
* push gs: 2 bytes
* Pushes GS register to stack.
* 2 bytes: op (0F A8)
*/
void push_gs(Emulator *emu)
{
push_segment_register(emu, GS);
emu->eip += 2;
}
/*
* pop gs: 2 bytes
* Pops GS register to stack.
* 2 bytes: op (0F A9)
*/
void pop_gs(Emulator *emu)
{
pop_segment_register(emu, GS);
emu->eip += 2;
}