|
5 | 5 |
|
6 | 6 | #if LKMC_M5OPS_ENABLE
|
7 | 7 |
|
8 |
| -#if defined(__arm__) |
| 8 | +#if defined(__x86_64__) |
| 9 | + |
| 10 | +/* 0x43 is the identifier for CHECKPOINT on all archs. |
| 11 | + * |
| 12 | + * 0x040F is the magic x86 undefined instruction boilerplate to which the identifier gets added. |
| 13 | + * |
| 14 | + * D means RDI which is the first argument of a Linux C function call, |
| 15 | + * and S means RSI is the second one: these are also used by gem5 as arguments of the m5ops. |
| 16 | + */ |
| 17 | +#define LKMC_M5OPS_CHECKPOINT_ASM mov $0, %%rdi; mov $0, %%rsi; .word 0x040F; .word 0x0043 |
| 18 | +#define LKMC_M5OPS_DUMPSTATS_ASM mov $0, %%rdi; mov $0, %%rsi; .word 0x040F; .word 0x0041 |
| 19 | +#define LKMC_M5OPS_EXIT_ASM mov $0, %%rdi; .word 0x040F; .word 0x0021 |
| 20 | +#define LKMC_M5OPS_FAIL_1_ASM mov $0, %%rdi; mov $1, %%rsi; .word 0x040F; .word 0x0022 |
| 21 | +#define LKMC_M5OPS_RESETSTATS_ASM mov $0, %%rdi; mov $0, %%rsi; .word 0x040F; .word 0x0040 |
| 22 | + |
| 23 | +#define LKMC_M5OPS_CHECKPOINT __asm__ __volatile__ (".word 0x040F; .word 0x0043;" : : "D" (0), "S" (0) :) |
| 24 | +#define LKMC_M5OPS_DUMPSTATS __asm__ __volatile__ (".word 0x040F; .word 0x0041;" : : "D" (0), "S" (0) :) |
| 25 | +#define LKMC_M5OPS_EXIT __asm__ __volatile__ (".word 0x040F; .word 0x0021;" : : "D" (0) :) |
| 26 | +#define LKMC_M5OPS_FAIL_1 __asm__ __volatile__ (".word 0x040F; .word 0x0022;" : : "D" (0), "S" (1) :) |
| 27 | +#define LKMC_M5OPS_RESETSTATS __asm__ __volatile__ (".word 0x040F; .word 0x0040;" : : "D" (0), "S" (0) :) |
| 28 | + |
| 29 | +#elif defined(__arm__) |
9 | 30 |
|
10 | 31 | #define LKMC_M5OPS_CHECKPOINT_ASM mov r0, #0; mov r1, #0; mov r2, #0; mov r3, #0; .inst 0xEE000110 | (0x43 << 16)
|
11 | 32 | #define LKMC_M5OPS_DUMPSTATS_ASM mov r0, #0; mov r1, #0; mov r2, #0; mov r3, #0; .inst 0xEE000110 | (0x41 << 16)
|
|
0 commit comments