mtops.h is perfect now

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-05 00:00:00 +00:00
parent 1cc3ee8657
commit 8618025682
21 changed files with 313 additions and 202 deletions

View File

@@ -11,7 +11,7 @@ ENTRY
* it does not get converted to adr, which is the better
* alternative here.
*/
adr r1, label
ldr r1, =label
adrl r2, label
label:
ASSERT_EQ_REG(r0, r1)

View File

@@ -4,7 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "m5ops.h"
#include <lkmc/m5ops.h>
int main(int argc, char **argv) {
char action;
@@ -15,19 +15,19 @@ int main(int argc, char **argv) {
}
switch (action) {
case 'c':
m5_checkpoint();
LKMC_M5OPS_CHECKPOINT;
break;
case 'd':
m5_dumpstats();
LKMC_M5OPS_DUMPSTATS;
break;
case 'e':
m5_exit();
LKMC_M5OPS_EXIT;
break;
case 'f':
m5_fail_1();
LKMC_M5OPS_FAIL_1;
break;
case 'r':
m5_resetstats();
LKMC_M5OPS_RESETSTATS;
break;
}
return EXIT_SUCCESS;

View File

@@ -6,7 +6,7 @@
#include <random>
#include <set>
#include "m5ops.h"
#include <lkmc/m5ops.h>
int main(int argc, char **argv) {
typedef uint64_t I;
@@ -32,13 +32,13 @@ int main(int argc, char **argv) {
auto random = randoms[i];
// Heap.
m5_resetstats();
LKMC_M5OPS_RESETSTATS;
heap.emplace(random);
m5_dumpstats();
LKMC_M5OPS_DUMPSTATS;
// BST.
m5_resetstats();
LKMC_M5OPS_RESETSTATS;
bst.insert(random);
m5_dumpstats();
LKMC_M5OPS_DUMPSTATS;
}
}

View File

@@ -1,44 +0,0 @@
#ifndef M5OPS_H
#define M5OPS_H
#if defined(__arm__)
static void m5_checkpoint(void) {
__asm__ __volatile__ ("mov r0, #0; mov r1, #0; mov r2, #0; mov r3, #0; .inst 0xEE000110 | (0x43 << 16);" : : : "r0", "r1", "r2", "r3");
}
static void m5_dumpstats(void) {
__asm__ __volatile__ ("mov r0, #0; mov r1, #0; mov r2, #0; mov r3, #0; .inst 0xEE000110 | (0x41 << 16);" : : : "r0", "r1", "r2", "r3");
}
static void m5_exit() {
__asm__ __volatile__ ("mov r0, #0; mov r1, #0; .inst 0xEE000110 | (0x21 << 16);" : : : "r0", "r1");
}
static void m5_fail_1(void) {
__asm__ __volatile__ ("mov r0, #0; mov r1, #0; mov r2, #1; mov r3, #0; .inst 0xEE000110 | (0x22 << 16);" : : : "r0", "r1", "r2", "r3");
}
static void m5_resetstats(void) {
__asm__ __volatile__ ("mov r0, #0; mov r1, #0; mov r2, #0; mov r3, #0; .inst 0xEE000110 | (0x40 << 16);" : : : "r0", "r1", "r2", "r3");
}
#elif defined(__aarch64__)
static void m5_checkpoint(void) {
__asm__ __volatile__ ("mov x0, #0; mov x1, #0; .inst 0xFF000110 | (0x43 << 16);" : : : "x0", "x1");
}
static void m5_dumpstats(void) {
__asm__ __volatile__ ("mov x0, #0; mov x1, #0; .inst 0xFF000110 | (0x41 << 16);" : : : "x0", "x1");
}
static void m5_exit(void) {
__asm__ __volatile__ ("mov x0, #0; .inst 0XFF000110 | (0x21 << 16);" : : : "x0");
}
static void m5_fail_1(void) {
__asm__ __volatile__ ("mov x0, #0; mov x1, #1; .inst 0xFF000110 | (0x22 << 16);" : : : "x0", "x1");
}
static void m5_resetstats(void) {
__asm__ __volatile__ ("mov x0, #0; mov x1, #0; .inst 0XFF000110 | (0x40 << 16);" : : : "x0", "x1");
}
#else
static void m5_checkpoint(void) {}
static void m5_dumpstats(void) {}
static void m5_exit(void) {}
static void m5_fail_1(void) {}
static void m5_resetstats(void) {}
#endif
#endif