Skip to content
Snippets Groups Projects
Verified Commit f7d28190 authored by tracer-ics2018's avatar tracer-ics2018 Committed by Recolic Keghart
Browse files

> Manual commit: Fixed reg.h bug.

U201614531
recolic
Linux RECOLICPC 5.4.2-arch1-1 #1 SMP PREEMPT Thu, 05 Dec 2019 12:29:40 +0000 x86_64 GNU/Linux
 00:41:29 up 2 days,  7:59,  1 user,  load average: 3.60, 4.50, 3.61
496b55efe62eef0d86968bc914082bf4134d2102
parent 072a2e13
No related branches found
No related tags found
No related merge requests found
......@@ -14,21 +14,22 @@ enum { R_AL, R_CL, R_DL, R_BL, R_AH, R_CH, R_DH, R_BH };
* For more details about the register encoding scheme, see i386 manual.
*/
typedef struct {
struct {
typedef union {
union {
uint32_t _32;
uint16_t _16;
uint8_t _8[2];
} gpr[8];
} gpr[9];
/* Do NOT change the order of the GPRs' definitions. */
/* In NEMU, rtlreg_t is exactly uint32_t. This makes RTL instructions
* in PA2 able to directly access these registers.
*/
rtlreg_t eax, ecx, edx, ebx, esp, ebp, esi, edi;
vaddr_t eip;
struct {
rtlreg_t eax, ecx, edx, ebx, esp, ebp, esi, edi;
vaddr_t eip;
};
} CPU_state;
......@@ -57,4 +58,5 @@ static inline const char* reg_name(int index, int width) {
}
}
#endif
......@@ -8,7 +8,15 @@ const char *regsl[] = {"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"};
const char *regsw[] = {"ax", "cx", "dx", "bx", "sp", "bp", "si", "di"};
const char *regsb[] = {"al", "cl", "dl", "bl", "ah", "ch", "dh", "bh"};
inline void rcpu_bootstrap_check_1() {
assert(sizeof(rtlreg_t) == sizeof(uint32_t));
assert(sizeof(vaddr_t) == sizeof(uint32_t));
printf("Recolic bootstrap test %s passed.\n", __FILE__);
}
void reg_test() {
rcpu_bootstrap_check_1();
srand(time(0));
uint32_t sample[8];
uint32_t eip_sample = rand();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment