mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-24 18:51:36 +01:00
m5ops: move to factored .h file
Create empty subs for unsupported archs, much less messy for callers. bst_vs_heap: create
This commit is contained in:
@@ -4,63 +4,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ENABLED 1
|
||||
#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);");
|
||||
};
|
||||
static void m5_dump_stats(void)
|
||||
{
|
||||
__asm__ __volatile__ ("mov r0, #0; mov r1, #0; mov r2, #0; mov r3, #0; .inst 0xEE000110 | (0x41 << 16);");
|
||||
};
|
||||
static void m5_exit()
|
||||
{
|
||||
__asm__ __volatile__ ("mov r0, #0; .inst 0xEE000110 | (0x21 << 16);");
|
||||
};
|
||||
static void m5_fail_1(void)
|
||||
{
|
||||
__asm__ __volatile__ ("mov r0, #0; mov r1, #0; mov r2, #1; mov r3, #0; .inst 0xEE000110 | (0x22 << 16);");
|
||||
};
|
||||
static void m5_reset_stats(void)
|
||||
{
|
||||
__asm__ __volatile__ ("mov r0, #0; mov r1, #0; mov r2, #0; mov r3, #0; .inst 0xEE000110 | (0x40 << 16);");
|
||||
};
|
||||
#elif defined(__aarch64__)
|
||||
static void m5_checkpoint(void)
|
||||
{
|
||||
__asm__ __volatile__ ("mov x0, #0; mov x1, #0; .inst 0xFF000110 | (0x43 << 16);");
|
||||
};
|
||||
static void m5_dump_stats(void)
|
||||
{
|
||||
__asm__ __volatile__ ("mov x0, #0; mov x1, #0; .inst 0xFF000110 | (0x41 << 16);");
|
||||
};
|
||||
static void m5_exit(void)
|
||||
{
|
||||
__asm__ __volatile__ ("mov x0, #0; .inst 0XFF000110 | (0x21 << 16);");
|
||||
};
|
||||
static void m5_fail_1(void)
|
||||
{
|
||||
__asm__ __volatile__ ("mov x0, #0; mov x1, #1; .inst 0xFF000110 | (0x22 << 16);");
|
||||
};
|
||||
static void m5_reset_stats(void)
|
||||
{
|
||||
__asm__ __volatile__ ("mov x0, #0; mov x1, #0; .inst 0XFF000110 | (0x40 << 16);");
|
||||
};
|
||||
#else
|
||||
#undef ENABLED
|
||||
#define ENABLED 0
|
||||
#endif
|
||||
#include "m5ops.h"
|
||||
|
||||
int main(
|
||||
#if ENABLED
|
||||
int argc, char **argv
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if ENABLED
|
||||
char action;
|
||||
if (argc > 1) {
|
||||
action = argv[1][0];
|
||||
@@ -73,7 +20,7 @@ void
|
||||
m5_checkpoint();
|
||||
break;
|
||||
case 'd':
|
||||
m5_dump_stats();
|
||||
m5_dumpstats();
|
||||
break;
|
||||
case 'e':
|
||||
m5_exit();
|
||||
@@ -82,9 +29,8 @@ void
|
||||
m5_fail_1();
|
||||
break;
|
||||
case 'r':
|
||||
m5_reset_stats();
|
||||
m5_resetstats();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user