Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 46 lines (36 sloc) 1.199 kb
02d7e98 @nelhage Added a driver program and fixed a bunch of bugs. I think the basic
authored
1 #ifndef __BEMU_H__
2 #define __BEMU_H__
3
4 #include <sys/mman.h>
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <sys/types.h>
8 #include <sys/stat.h>
9 #include <unistd.h>
10 #include <fcntl.h>
11 #include <string.h>
feabdde @nelhage First pass at binary translation. We seem to correctly translate all
authored
12 #include <stdarg.h>
02d7e98 @nelhage Added a driver program and fixed a bunch of bugs. I think the basic
authored
13
4e78284 @nelhage Make %ebp point at CPU, not CPU.regs
authored
14 #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
15
02d7e98 @nelhage Added a driver program and fixed a bunch of bugs. I think the basic
authored
16 #ifdef DEBUG
2193954 @nelhage Allow for two levels of logging output.
authored
17 #define LOG_(lev, fmt, ...) do { \
18 if(DEBUG >= lev) \
19 printf("%s:%d: " fmt "\n", __FILE__, __LINE__, ## __VA_ARGS__); \
20 } while (0)
eb69575 @nelhage ASSERT(): abort() on failure to assist debugging.
authored
21 #define ASSERT(x) if(!(x)) {LOG("FAILED ASSERT : %s", #x); abort();}
02d7e98 @nelhage Added a driver program and fixed a bunch of bugs. I think the basic
authored
22 #else
2193954 @nelhage Allow for two levels of logging output.
authored
23 #define LOG_(lev, fmt, ...)
421e35a @nelhage bemu.h: Define ASSERT for non-debug builds
authored
24 #define ASSERT(x)
02d7e98 @nelhage Added a driver program and fixed a bunch of bugs. I think the basic
authored
25 #endif
26
2193954 @nelhage Allow for two levels of logging output.
authored
27 #define LOG(fmt, ...) LOG_(1, fmt, ## __VA_ARGS__)
28 #define LOG0(fmt, ...) LOG_(0, fmt, ## __VA_ARGS__)
29 #define LOG1(fmt, ...) LOG_(1, fmt, ## __VA_ARGS__)
30
3155f3c @nelhage Make panic() log file and line number
authored
31 #define panic(fmt, ...) __panic(__FILE__, __LINE__, fmt, ## __VA_ARGS__);
4817b75 @nelhage Clean up -Wwrite-strings warnings.
authored
32 void __panic(const char *file, int line, const char *fmt, ...) __attribute__((noreturn));
02d7e98 @nelhage Added a driver program and fixed a bunch of bugs. I think the basic
authored
33
0dc8151 @nelhage Compile with -Wall and fix all the warnings it reports.
authored
34 #define UNUSED __attribute__((unused))
35
7af1779 @nelhage Add support for profiling the executed program by opcode.
authored
36 extern int profile_instructions;
37
eaefcef @nelhage Make emulated code sandbox memory acesses as well.
authored
38 #include "bdecode.h"
39 #include "bcpu.h"
40 #include "x86.h"
41 #include "bt.h"
42 #include "bclock.h"
43 #include "bconsole.h"
44
02d7e98 @nelhage Added a driver program and fixed a bunch of bugs. I think the basic
authored
45 #endif
Something went wrong with that request. Please try again.