add a c-only target (no WASM)
This commit is contained in:
17
targets/c-host/fail.c
Normal file
17
targets/c-host/fail.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include "lib.h"
|
||||
|
||||
int wasm_module(void);
|
||||
|
||||
MAIN() {
|
||||
int result;
|
||||
|
||||
MARKER(start_trace);
|
||||
result = wasm_module();
|
||||
MARKER(stop_trace);
|
||||
|
||||
if (result == 100) {
|
||||
MARKER(ok_marker);
|
||||
} else {
|
||||
MARKER(fail_marker);
|
||||
}
|
||||
}
|
||||
35
targets/c-host/lib.h
Normal file
35
targets/c-host/lib.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#define INLINE __attribute__((always_inline)) inline
|
||||
#define NOINLINE __attribute__((noinline))
|
||||
|
||||
#define __QUOTE(x) #x
|
||||
#define QUOTE(x) __QUOTE(x)
|
||||
|
||||
#ifndef ARCH_ASM_CLOBBER_ALL
|
||||
#define ARCH_ASM_CLOBBER_ALL "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp"
|
||||
#endif
|
||||
|
||||
#ifndef MARKER
|
||||
#define MARKER(str) \
|
||||
__asm__ volatile(QUOTE(str) ":" \
|
||||
: /* no inputs */ \
|
||||
: /* no outputs */ \
|
||||
: "memory", ARCH_ASM_CLOBBER_ALL)
|
||||
#endif
|
||||
|
||||
#ifndef MAIN
|
||||
#define MAIN() void os_main(void)
|
||||
#endif
|
||||
|
||||
#ifndef POSIX_PRINTF
|
||||
#define POSIX_PRINTF(...)
|
||||
#endif
|
||||
|
||||
typedef __UINT8_TYPE__ uint8_t;
|
||||
typedef __UINT16_TYPE__ uint16_t;
|
||||
typedef __UINT32_TYPE__ uint32_t;
|
||||
|
||||
typedef __INT8_TYPE__ int8_t;
|
||||
typedef __INT16_TYPE__ int16_t;
|
||||
typedef __INT32_TYPE__ int32_t;
|
||||
15
targets/c-host/linux.c
Normal file
15
targets/c-host/linux.c
Normal file
@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int wasm_module(void);
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int result = wasm_module();
|
||||
|
||||
if (result == 100) {
|
||||
printf("OK Marker\n");
|
||||
return 0;
|
||||
} else {
|
||||
printf("FAIL Marker\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user