x86emul/test: add a private header

This is to avoid having to duplicate auxiliary definitions in both
source files.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Jan Beulich committed 2016-12-07 13:57:18 +01:00
1 parent e5c1b8145b
commit f4497d6b74
4 files changed
+39 -45

No files matched your search

+2 -8
View File
@@ -1,15 +1,9 @@
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <xen/xen.h>
#include <sys/mman.h>
#include "x86_emulate/x86_emulate.h"
#include "x86_emulate.h"
#include "blowfish.h"
#define verbose false /* Switch to true for far more logging. */
@@ -1373,7 +1367,7 @@ int main(int argc, char **argv)
else
printf("skipped\n");
for ( j = 0; j < sizeof(blobs) / sizeof(*blobs); j++ )
for ( j = 0; j < ARRAY_SIZE(blobs); j++ )
{
memcpy(res, blobs[j].code, blobs[j].size);
ctxt.addr_size = ctxt.sp_size = blobs[j].bitness;
+1 -33
View File
@@ -1,34 +1,8 @@
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <xen/xen.h>
#include "x86_emulate/x86_emulate.h"
#define is_canonical_address(x) (((int64_t)(x) >> 47) == ((int64_t)(x) >> 63))
#include "x86_emulate.h"
#define EFER_SCE (1 << 0)
#define EFER_LMA (1 << 10)
#define BUG() abort()
#define ASSERT_UNREACHABLE() assert(!__LINE__)
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); })
#define BUILD_BUG_ON_ZERO(cond) \
sizeof(struct { _Static_assert(!(cond), "!(" #cond ")"); })
#else
#define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); })
#define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
#endif
#define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
#define cpu_has_amd_erratum(nr) 0
#define mark_regs_dirty(r) ((void)(r))
@@ -44,10 +18,4 @@
#define get_stub(stb) ((void *)((stb).addr = (uintptr_t)(stb).buf))
#define put_stub(stb)
#define __init
#define __maybe_unused __attribute__((__unused__))
#define likely(x) __builtin_expect(!!(x), true)
#define unlikely(x) __builtin_expect(!!(x), false)
#include "x86_emulate/x86_emulate.c"
+36
View File
@@ -0,0 +1,36 @@
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <xen/xen.h>
#define BUG() abort()
#define ASSERT assert
#define ASSERT_UNREACHABLE() assert(!__LINE__)
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); })
#define BUILD_BUG_ON_ZERO(cond) \
sizeof(struct { _Static_assert(!(cond), "!(" #cond ")"); })
#else
#define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); })
#define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
#endif
#define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
#define __init
#define __maybe_unused __attribute__((__unused__))
#define likely(x) __builtin_expect(!!(x), true)
#define unlikely(x) __builtin_expect(!!(x), false)
#define is_canonical_address(x) (((int64_t)(x) >> 47) == ((int64_t)(x) >> 63))
#include "x86_emulate/x86_emulate.h"
-4
View File
@@ -23,10 +23,6 @@
#ifndef __X86_EMULATE_H__
#define __X86_EMULATE_H__
#if !defined(__XEN__) && !defined(ASSERT)
#define ASSERT assert
#endif
#define MAX_INST_LEN 15
struct x86_emulate_ctxt;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.