Added MIPS support and projects for all samples.

This commit is contained in:
xorstream
2017-01-23 01:05:08 +11:00
parent 1756ae770b
commit 72a497bc14
55 changed files with 3295 additions and 772 deletions

View File

@ -20,30 +20,7 @@
#define __STDC_FORMAT_MACROS
// windows specific includes
#ifdef _MSC_VER
#include <io.h>
#include <windows.h>
#define PRIx64 "llX"
#ifdef DYNLOAD
#include "unicorn_dynload.h"
#else // DYNLOAD
#include <unicorn/unicorn.h>
#ifdef _WIN64
#pragma comment(lib, "unicorn_staload64.lib")
#else // _WIN64
#pragma comment(lib, "unicorn_staload.lib")
#endif // _WIN64
#endif // DYNLOAD
// posix specific includes
#else // _MSC_VER
#include "unicorn/platform.h"
#include "unicorn/platform.h"
#include <unicorn/unicorn.h>
#endif // _MSC_VER
// common includes
#include <string.h>
#include <stdlib.h>
#include <string.h>

View File

@ -3,28 +3,8 @@
/* Sample code to demonstrate how to emulate ARM code */
// windows specific
#ifdef _MSC_VER
#include <io.h>
#include <windows.h>
#define PRIx64 "llX"
#ifdef DYNLOAD
#include "unicorn_dynload.h"
#else // DYNLOAD
#include <unicorn/unicorn.h>
#ifdef _WIN64
#pragma comment(lib, "unicorn_staload64.lib")
#else // _WIN64
#pragma comment(lib, "unicorn_staload.lib")
#endif // _WIN64
#endif // DYNLOAD
// posix specific
#else // _MSC_VER
#include "unicorn/platform.h"
#include "unicorn/platform.h"
#include <unicorn/unicorn.h>
#endif // _MSC_VER
#include <string.h>
// code to be emulated

View File

@ -3,28 +3,8 @@
/* Sample code to demonstrate how to emulate ARM64 code */
// windows specific
#ifdef _MSC_VER
#include <io.h>
#include <windows.h>
#define PRIx64 "llX"
#ifdef DYNLOAD
#include "unicorn_dynload.h"
#else // DYNLOAD
#include <unicorn/unicorn.h>
#ifdef _WIN64
#pragma comment(lib, "unicorn_staload64.lib")
#else // _WIN64
#pragma comment(lib, "unicorn_staload.lib")
#endif // _WIN64
#endif // DYNLOAD
// posix specific
#else // _MSC_VER
#include "unicorn/platform.h"
#include "unicorn/platform.h"
#include <unicorn/unicorn.h>
#endif // _MSC_VER
#include <string.h>
// code to be emulated

View File

@ -1,7 +1,8 @@
#include "unicorn/platform.h"
#include <stdio.h>
#include <string.h>
#include <unicorn/unicorn.h>
#include <string.h>
#include <stdio.h>
int syscall_abi[] = {
UC_X86_REG_RAX, UC_X86_REG_RDI, UC_X86_REG_RSI, UC_X86_REG_RDX,

View File

@ -3,28 +3,9 @@
/* Sample code to demonstrate how to emulate m68k code */
// windows specific
#ifdef _MSC_VER
#include <io.h>
#include <windows.h>
#define PRIx64 "llX"
#ifdef DYNLOAD
#include "unicorn_dynload.h"
#else // DYNLOAD
#include <unicorn/unicorn.h>
#ifdef _WIN64
#pragma comment(lib, "unicorn_staload64.lib")
#else // _WIN64
#pragma comment(lib, "unicorn_staload.lib")
#endif // _WIN64
#endif // DYNLOAD
#include <string.h>
// posix specific
#else // _MSC_VER
#include "unicorn/platform.h"
#include "unicorn/platform.h"
#include <unicorn/unicorn.h>
#endif // _MSC_VER
// code to be emulated
#define M68K_CODE "\x76\xed" // movq #-19, %d3

View File

@ -3,28 +3,8 @@
/* Sample code to demonstrate how to emulate Mips code (big endian) */
// windows specific
#ifdef _MSC_VER
#include <io.h>
#include <windows.h>
#define PRIx64 "llX"
#ifdef DYNLOAD
#include "unicorn_dynload.h"
#else // DYNLOAD
#include <unicorn/unicorn.h>
#ifdef _WIN64
#pragma comment(lib, "unicorn_staload64.lib")
#else // _WIN64
#pragma comment(lib, "unicorn_staload.lib")
#endif // _WIN64
#endif // DYNLOAD
// posix specific
#else // _MSC_VER
#include "unicorn/platform.h"
#include "unicorn/platform.h"
#include <unicorn/unicorn.h>
#endif // _MSC_VER
#include <string.h>
// code to be emulated

View File

@ -3,28 +3,8 @@
/* Sample code to demonstrate how to emulate Sparc code */
// windows specific
#ifdef _MSC_VER
#include <io.h>
#include <windows.h>
#define PRIx64 "llX"
#ifdef DYNLOAD
#include "unicorn_dynload.h"
#else // DYNLOAD
#include <unicorn/unicorn.h>
#ifdef _WIN64
#pragma comment(lib, "unicorn_staload64.lib")
#else // _WIN64
#pragma comment(lib, "unicorn_staload.lib")
#endif // _WIN64
#endif // DYNLOAD
// posix specific
#else // _MSC_VER
#include "unicorn/platform.h"
#include "unicorn/platform.h"
#include <unicorn/unicorn.h>
#endif // _MSC_VER
#include <string.h>
// code to be emulated

View File

@ -20,12 +20,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <unicorn/unicorn.h>
#include "unicorn/platform.h"
#include <assert.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include "unicorn/platform.h"
#
#pragma pack(push, 1)
struct SegmentDescriptor {
union {
@ -164,8 +162,9 @@ static void gdt_demo()
uc_err err;
uint8_t buf[128];
uc_x86_mmr gdtr;
/*
int i;
/*
bits 32
push dword 0x01234567
@ -183,7 +182,7 @@ static void gdt_demo()
struct SegmentDescriptor *gdt = (struct SegmentDescriptor*)calloc(31, sizeof(struct SegmentDescriptor));
int r_esp = stack_address + 0x1000; // initial esp
int r_esp = (int)stack_address + 0x1000; // initial esp
int r_cs = 0x73;
int r_ss = 0x88; //ring 0
int r_ds = 0x7b;
@ -267,7 +266,6 @@ static void gdt_demo()
err = uc_mem_read(uc, r_esp - 8, buf, 8);
uc_assert_success(err);
int i;
for (i = 0; i < 8; i++) {
fprintf(stderr, "%02x", buf[i]);
}

View File

@ -3,30 +3,7 @@
/* Sample code to trace code with Linux code with syscall */
// windows specific
#ifdef _MSC_VER
#include <io.h>
#include <windows.h>
#define PRIx64 "llX"
#ifdef DYNLOAD
#include "unicorn_dynload.h"
#else // DYNLOAD
#include <unicorn/unicorn.h>
#ifdef _WIN64
#pragma comment(lib, "unicorn_staload64.lib")
#else // _WIN64
#pragma comment(lib, "unicorn_staload.lib")
#endif // _WIN64
#endif // DYNLOAD
// posix specific
#else // _MSC_VER
#include "unicorn/platform.h"
#include "unicorn/platform.h"
#include <unicorn/unicorn.h>
#endif // _MSC_VER
// common includes
#include <string.h>