mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-22 19:45:35 +00:00
Merging with current msvc.
This commit is contained in:
commit
e46f86c80b
|
@ -22,6 +22,7 @@ environment:
|
|||
CYG_SETUP: setup-x86.exe
|
||||
BASH: C:\cygwin\bin\bash
|
||||
CC: gcc
|
||||
- CC: msvc
|
||||
|
||||
# Cache Cygwin/MSYS files to speed up build
|
||||
cache:
|
||||
|
@ -44,6 +45,7 @@ install:
|
|||
build_script:
|
||||
- if defined BASH (%BASH% -lc "cd $(cygpath ${APPVEYOR_BUILD_FOLDER}) && make")
|
||||
- if "%MSYSTEM%" == "MINGW64" (%BASH% -lc "cd $(cygpath ${APPVEYOR_BUILD_FOLDER}) && make -C bindings/go")
|
||||
- if "%CC%" == "msvc" (msbuild %APPVEYOR_BUILD_FOLDER%/msvc/msvc.sln)
|
||||
# make test
|
||||
#- 'cd %APPVEYOR_BUILD_FOLDER% && cd bindings\dotnet && msbuild UnicornDotNet.sln'
|
||||
# Allows RDP
|
||||
|
|
|
@ -23,7 +23,7 @@ static void machine_finalize(struct uc_struct *uc, Object *obj, void *opaque)
|
|||
static const TypeInfo machine_info = {
|
||||
TYPE_MACHINE,
|
||||
TYPE_OBJECT,
|
||||
|
||||
|
||||
sizeof(MachineClass),
|
||||
sizeof(MachineState),
|
||||
NULL,
|
||||
|
@ -31,7 +31,7 @@ static const TypeInfo machine_info = {
|
|||
machine_initfn,
|
||||
NULL,
|
||||
machine_finalize,
|
||||
|
||||
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
|
|
|
@ -282,21 +282,21 @@ Object *qdev_get_machine(struct uc_struct *uc)
|
|||
static const TypeInfo device_type_info = {
|
||||
TYPE_DEVICE,
|
||||
TYPE_OBJECT,
|
||||
|
||||
|
||||
sizeof(DeviceClass),
|
||||
sizeof(DeviceState),
|
||||
NULL,
|
||||
|
||||
|
||||
device_initfn,
|
||||
device_post_init,
|
||||
device_finalize,
|
||||
|
||||
|
||||
NULL,
|
||||
|
||||
device_class_init,
|
||||
device_class_base_init,
|
||||
NULL,
|
||||
|
||||
|
||||
true,
|
||||
};
|
||||
|
||||
|
@ -319,21 +319,21 @@ static void qbus_finalize(struct uc_struct *uc, Object *obj, void *opaque)
|
|||
static const TypeInfo bus_info = {
|
||||
TYPE_BUS,
|
||||
TYPE_OBJECT,
|
||||
|
||||
|
||||
sizeof(BusClass),
|
||||
sizeof(BusState),
|
||||
NULL,
|
||||
|
||||
|
||||
qbus_initfn,
|
||||
NULL,
|
||||
qbus_finalize,
|
||||
|
||||
|
||||
NULL,
|
||||
|
||||
bus_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
|
||||
true,
|
||||
};
|
||||
|
||||
|
|
|
@ -149,9 +149,9 @@ static void pc_machine_class_init(struct uc_struct *uc, ObjectClass *oc, void *d
|
|||
}
|
||||
|
||||
static const TypeInfo pc_machine_info = {
|
||||
TYPE_PC_MACHINE,
|
||||
TYPE_PC_MACHINE,
|
||||
TYPE_MACHINE,
|
||||
|
||||
|
||||
sizeof(PCMachineClass),
|
||||
sizeof(PCMachineState),
|
||||
NULL,
|
||||
|
@ -161,16 +161,16 @@ static const TypeInfo pc_machine_info = {
|
|||
NULL,
|
||||
|
||||
NULL,
|
||||
|
||||
|
||||
pc_machine_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
true,
|
||||
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
|
||||
// should this be added somehow?
|
||||
//.interfaces = (InterfaceInfo[]) { { } },
|
||||
};
|
||||
|
|
|
@ -164,7 +164,7 @@ void apic_init_reset(struct uc_struct *uc, DeviceState *dev)
|
|||
void apic_designate_bsp(struct uc_struct *uc, DeviceState *dev)
|
||||
{
|
||||
APICCommonState *s;
|
||||
|
||||
|
||||
if (dev == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ static void apic_common_class_init(struct uc_struct *uc, ObjectClass *klass, voi
|
|||
static const TypeInfo apic_common_type = {
|
||||
TYPE_APIC_COMMON,
|
||||
TYPE_DEVICE,
|
||||
|
||||
|
||||
sizeof(APICCommonClass),
|
||||
sizeof(APICCommonState),
|
||||
NULL,
|
||||
|
@ -257,13 +257,13 @@ static const TypeInfo apic_common_type = {
|
|||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
|
||||
NULL,
|
||||
|
||||
apic_common_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
|
||||
true,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _QEMU_ELF_H
|
||||
#define _QEMU_ELF_H
|
||||
#ifndef QEMU_ELF_H
|
||||
#define QEMU_ELF_H
|
||||
|
||||
/*
|
||||
* i386 ELF relocation types
|
||||
|
@ -537,4 +537,4 @@
|
|||
#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */
|
||||
#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */
|
||||
|
||||
#endif /* _QEMU_ELF_H */
|
||||
#endif /* QEMU_ELF_H */
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#define WEXITSTATUS(x) (x)
|
||||
#endif
|
||||
|
||||
#include "unicorn/platform.h"
|
||||
|
||||
#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
|
||||
/* [u]int_fast*_t not in <sys/int_types.h> */
|
||||
typedef unsigned char uint_fast8_t;
|
||||
|
@ -110,67 +108,6 @@ void *qemu_anon_ram_alloc(size_t size, uint64_t *align);
|
|||
void qemu_vfree(void *ptr);
|
||||
void qemu_anon_ram_free(void *ptr, size_t size);
|
||||
|
||||
#define QEMU_MADV_INVALID -1
|
||||
|
||||
#if defined(CONFIG_MADVISE)
|
||||
|
||||
#define QEMU_MADV_WILLNEED MADV_WILLNEED
|
||||
#define QEMU_MADV_DONTNEED MADV_DONTNEED
|
||||
#ifdef MADV_DONTFORK
|
||||
#define QEMU_MADV_DONTFORK MADV_DONTFORK
|
||||
#else
|
||||
#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
|
||||
#endif
|
||||
#ifdef MADV_MERGEABLE
|
||||
#define QEMU_MADV_MERGEABLE MADV_MERGEABLE
|
||||
#else
|
||||
#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
|
||||
#endif
|
||||
#ifdef MADV_UNMERGEABLE
|
||||
#define QEMU_MADV_UNMERGEABLE MADV_UNMERGEABLE
|
||||
#else
|
||||
#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
|
||||
#endif
|
||||
#ifdef MADV_DODUMP
|
||||
#define QEMU_MADV_DODUMP MADV_DODUMP
|
||||
#else
|
||||
#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
|
||||
#endif
|
||||
#ifdef MADV_DONTDUMP
|
||||
#define QEMU_MADV_DONTDUMP MADV_DONTDUMP
|
||||
#else
|
||||
#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
|
||||
#endif
|
||||
#ifdef MADV_HUGEPAGE
|
||||
#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE
|
||||
#else
|
||||
#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
|
||||
#endif
|
||||
|
||||
#elif defined(CONFIG_POSIX_MADVISE)
|
||||
|
||||
#define QEMU_MADV_WILLNEED POSIX_MADV_WILLNEED
|
||||
#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED
|
||||
#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
|
||||
|
||||
#else /* no-op */
|
||||
|
||||
#define QEMU_MADV_WILLNEED QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
|
||||
#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__HAIKU__) && defined(__i386__)
|
||||
#define FMT_pid "%ld"
|
||||
#elif defined(WIN64)
|
||||
|
@ -179,35 +116,6 @@ void qemu_anon_ram_free(void *ptr, size_t size);
|
|||
#define FMT_pid "%d"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
static inline void qemu_timersub(const struct timeval *val1,
|
||||
const struct timeval *val2,
|
||||
struct timeval *res)
|
||||
{
|
||||
res->tv_sec = val1->tv_sec - val2->tv_sec;
|
||||
if (val1->tv_usec < val2->tv_usec) {
|
||||
res->tv_sec--;
|
||||
res->tv_usec = val1->tv_usec - val2->tv_usec + 1000 * 1000;
|
||||
} else {
|
||||
res->tv_usec = val1->tv_usec - val2->tv_usec;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define qemu_timersub timersub
|
||||
#endif
|
||||
|
||||
void qemu_set_cloexec(int fd);
|
||||
|
||||
void qemu_set_version(const char *);
|
||||
const char *qemu_get_version(void);
|
||||
|
||||
void fips_set_state(bool requested);
|
||||
bool fips_get_state(void);
|
||||
|
||||
/* Get the saved exec dir.
|
||||
* Caller needs to release the returned string by g_free() */
|
||||
char *qemu_get_exec_dir(void);
|
||||
|
||||
/**
|
||||
* qemu_getauxval:
|
||||
* @type: the auxiliary vector key to lookup
|
||||
|
@ -217,6 +125,4 @@ char *qemu_get_exec_dir(void);
|
|||
*/
|
||||
unsigned long qemu_getauxval(unsigned long type);
|
||||
|
||||
void qemu_set_tty_echo(int fd, bool echo);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1095,9 +1095,9 @@ static bool unassigned_mem_accepts(void *opaque, hwaddr addr,
|
|||
const MemoryRegionOps unassigned_mem_ops = {
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
|
||||
DEVICE_NATIVE_ENDIAN,
|
||||
|
||||
|
||||
{0,0,false,unassigned_mem_accepts},
|
||||
};
|
||||
|
||||
|
@ -1875,7 +1875,7 @@ typedef QTAILQ_HEAD(queue, MemoryRegionList) MemoryRegionListHead;
|
|||
static const TypeInfo memory_region_info = {
|
||||
TYPE_MEMORY_REGION,
|
||||
TYPE_OBJECT,
|
||||
|
||||
|
||||
0,
|
||||
sizeof(MemoryRegion),
|
||||
NULL,
|
||||
|
|
|
@ -260,21 +260,21 @@ static void cpu_class_init(struct uc_struct *uc, ObjectClass *klass, void *data)
|
|||
static const TypeInfo cpu_type_info = {
|
||||
TYPE_CPU,
|
||||
TYPE_DEVICE,
|
||||
|
||||
|
||||
sizeof(CPUClass),
|
||||
sizeof(CPUState),
|
||||
NULL,
|
||||
|
||||
|
||||
cpu_common_initfn,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
|
||||
NULL,
|
||||
|
||||
|
||||
cpu_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
|
||||
true,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,14 +1,26 @@
|
|||
/* * Software MMU support * * Generate helpers used by TCG for qemu_ld/st ops
|
||||
and code load * functions. * * Included from target op helpers and exec.c. * *
|
||||
Copyright (c) 2003 Fabrice Bellard * * This library is free software; you can
|
||||
redistribute it and/or * modify it under the terms of the GNU Lesser General
|
||||
Public * License as published by the Free Software Foundation; either * version
|
||||
2 of the License, or (at your option) any later version. * * This library is
|
||||
distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY;
|
||||
without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more
|
||||
details. * * You should have received a copy of the GNU Lesser General Public *
|
||||
License along with this library; if not, see <http://www.gnu.org/licenses/>. */
|
||||
/*
|
||||
* Software MMU support
|
||||
*
|
||||
* Generate helpers used by TCG for qemu_ld/st ops and code load
|
||||
* functions.
|
||||
*
|
||||
* Included from target op helpers and exec.c.
|
||||
*
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Modified for Unicorn Engine by Nguyen Anh Quynh, 2015 */
|
||||
|
||||
#include "qemu/timer.h"
|
||||
|
|
|
@ -1,432 +0,0 @@
|
|||
/*
|
||||
* Arm "Angel" semihosting syscalls
|
||||
*
|
||||
* Copyright (c) 2005, 2007 CodeSourcery.
|
||||
* Written by Paul Brook.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "cpu.h"
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
#include "qemu.h"
|
||||
|
||||
#define ARM_ANGEL_HEAP_SIZE (128 * 1024 * 1024)
|
||||
#else
|
||||
#include "qemu-common.h"
|
||||
#include "hw/arm/arm.h"
|
||||
#endif
|
||||
|
||||
#define TARGET_SYS_OPEN 0x01
|
||||
#define TARGET_SYS_CLOSE 0x02
|
||||
#define TARGET_SYS_WRITEC 0x03
|
||||
#define TARGET_SYS_WRITE0 0x04
|
||||
#define TARGET_SYS_WRITE 0x05
|
||||
#define TARGET_SYS_READ 0x06
|
||||
#define TARGET_SYS_READC 0x07
|
||||
#define TARGET_SYS_ISTTY 0x09
|
||||
#define TARGET_SYS_SEEK 0x0a
|
||||
#define TARGET_SYS_FLEN 0x0c
|
||||
#define TARGET_SYS_TMPNAM 0x0d
|
||||
#define TARGET_SYS_REMOVE 0x0e
|
||||
#define TARGET_SYS_RENAME 0x0f
|
||||
#define TARGET_SYS_CLOCK 0x10
|
||||
#define TARGET_SYS_TIME 0x11
|
||||
#define TARGET_SYS_SYSTEM 0x12
|
||||
#define TARGET_SYS_ERRNO 0x13
|
||||
#define TARGET_SYS_GET_CMDLINE 0x15
|
||||
#define TARGET_SYS_HEAPINFO 0x16
|
||||
#define TARGET_SYS_EXIT 0x18
|
||||
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
#define GDB_O_RDONLY 0x000
|
||||
#define GDB_O_WRONLY 0x001
|
||||
#define GDB_O_RDWR 0x002
|
||||
#define GDB_O_APPEND 0x008
|
||||
#define GDB_O_CREAT 0x200
|
||||
#define GDB_O_TRUNC 0x400
|
||||
#define GDB_O_BINARY 0
|
||||
|
||||
static int open_modeflags[12] = {
|
||||
O_RDONLY,
|
||||
O_RDONLY | O_BINARY,
|
||||
O_RDWR,
|
||||
O_RDWR | O_BINARY,
|
||||
O_WRONLY | O_CREAT | O_TRUNC,
|
||||
O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
|
||||
O_RDWR | O_CREAT | O_TRUNC,
|
||||
O_RDWR | O_CREAT | O_TRUNC | O_BINARY,
|
||||
O_WRONLY | O_CREAT | O_APPEND,
|
||||
O_WRONLY | O_CREAT | O_APPEND | O_BINARY,
|
||||
O_RDWR | O_CREAT | O_APPEND,
|
||||
O_RDWR | O_CREAT | O_APPEND | O_BINARY
|
||||
};
|
||||
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
static inline uint32_t set_swi_errno(TaskState *ts, uint32_t code)
|
||||
{
|
||||
if (code == (uint32_t)-1)
|
||||
ts->swi_errno = errno;
|
||||
return code;
|
||||
}
|
||||
#else
|
||||
static inline uint32_t set_swi_errno(CPUARMState *env, uint32_t code)
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
#include "exec/softmmu-semi.h"
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
static target_ulong syscall_err;
|
||||
#endif
|
||||
|
||||
/* Read the input value from the argument block; fail the semihosting
|
||||
* call if the memory read fails.
|
||||
*/
|
||||
#define GET_ARG(n) do { \
|
||||
if (get_user_ual(arg ## n, args + (n) * 4)) { \
|
||||
return (uint32_t)-1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
ram_addr_t ram_size = 0x10000; // qq
|
||||
|
||||
#define SET_ARG(n, val) put_user_ual(val, args + (n) * 4)
|
||||
uint32_t do_arm_semihosting(CPUARMState *env)
|
||||
{
|
||||
ARMCPU *cpu = arm_env_get_cpu(env);
|
||||
CPUState *cs = CPU(cpu);
|
||||
target_ulong args;
|
||||
target_ulong arg0, arg1, arg2;
|
||||
char * s;
|
||||
int nr;
|
||||
uint32_t ret;
|
||||
uint32_t len;
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
TaskState *ts = cs->opaque;
|
||||
#else
|
||||
CPUARMState *ts = env;
|
||||
#endif
|
||||
|
||||
nr = env->regs[0];
|
||||
args = env->regs[1];
|
||||
switch (nr) {
|
||||
case TARGET_SYS_OPEN:
|
||||
GET_ARG(0);
|
||||
GET_ARG(1);
|
||||
GET_ARG(2);
|
||||
s = lock_user_string(arg0);
|
||||
if (!s) {
|
||||
/* FIXME - should this error code be -TARGET_EFAULT ? */
|
||||
return (uint32_t)-1;
|
||||
}
|
||||
if (arg1 >= 12) {
|
||||
unlock_user(s, arg0, 0);
|
||||
return (uint32_t)-1;
|
||||
}
|
||||
if (strcmp(s, ":tt") == 0) {
|
||||
int result_fileno = arg1 < 4 ? STDIN_FILENO : STDOUT_FILENO;
|
||||
unlock_user(s, arg0, 0);
|
||||
return result_fileno;
|
||||
}
|
||||
ret = set_swi_errno(ts, open(s, open_modeflags[arg1], 0644));
|
||||
unlock_user(s, arg0, 0);
|
||||
return ret;
|
||||
case TARGET_SYS_CLOSE:
|
||||
GET_ARG(0);
|
||||
return set_swi_errno(ts, close(arg0));
|
||||
case TARGET_SYS_WRITEC:
|
||||
{
|
||||
char c;
|
||||
|
||||
if (get_user_u8(c, args))
|
||||
/* FIXME - should this error code be -TARGET_EFAULT ? */
|
||||
return (uint32_t)-1;
|
||||
/* Write to debug console. stderr is near enough. */
|
||||
return write(STDERR_FILENO, &c, 1);
|
||||
}
|
||||
case TARGET_SYS_WRITE0:
|
||||
if (!(s = lock_user_string(args)))
|
||||
/* FIXME - should this error code be -TARGET_EFAULT ? */
|
||||
return (uint32_t)-1;
|
||||
len = strlen(s);
|
||||
ret = write(STDERR_FILENO, s, len);
|
||||
unlock_user(s, args, 0);
|
||||
return ret;
|
||||
case TARGET_SYS_WRITE:
|
||||
GET_ARG(0);
|
||||
GET_ARG(1);
|
||||
GET_ARG(2);
|
||||
len = arg2;
|
||||
s = lock_user(VERIFY_READ, arg1, len, 1);
|
||||
if (!s) {
|
||||
/* FIXME - should this error code be -TARGET_EFAULT ? */
|
||||
return (uint32_t)-1;
|
||||
}
|
||||
ret = set_swi_errno(ts, write(arg0, s, len));
|
||||
unlock_user(s, arg1, 0);
|
||||
if (ret == (uint32_t)-1)
|
||||
return -1;
|
||||
return len - ret;
|
||||
case TARGET_SYS_READ:
|
||||
GET_ARG(0);
|
||||
GET_ARG(1);
|
||||
GET_ARG(2);
|
||||
len = arg2;
|
||||
s = lock_user(VERIFY_WRITE, arg1, len, 0);
|
||||
if (!s) {
|
||||
/* FIXME - should this error code be -TARGET_EFAULT ? */
|
||||
return (uint32_t)-1;
|
||||
}
|
||||
do {
|
||||
ret = set_swi_errno(ts, read(arg0, s, len));
|
||||
} while (ret == -1 && errno == EINTR);
|
||||
unlock_user(s, arg1, len);
|
||||
if (ret == (uint32_t)-1)
|
||||
return -1;
|
||||
return len - ret;
|
||||
case TARGET_SYS_READC:
|
||||
/* XXX: Read from debug console. Not implemented. */
|
||||
return 0;
|
||||
case TARGET_SYS_ISTTY:
|
||||
GET_ARG(0);
|
||||
return isatty(arg0);
|
||||
case TARGET_SYS_SEEK:
|
||||
GET_ARG(0);
|
||||
GET_ARG(1);
|
||||
ret = set_swi_errno(ts, lseek(arg0, arg1, SEEK_SET));
|
||||
if (ret == (uint32_t)-1)
|
||||
return -1;
|
||||
return 0;
|
||||
case TARGET_SYS_FLEN:
|
||||
GET_ARG(0);
|
||||
struct stat buf;
|
||||
ret = set_swi_errno(ts, fstat(arg0, &buf));
|
||||
if (ret == (uint32_t)-1)
|
||||
return -1;
|
||||
return buf.st_size;
|
||||
case TARGET_SYS_TMPNAM:
|
||||
/* XXX: Not implemented. */
|
||||
return -1;
|
||||
case TARGET_SYS_REMOVE:
|
||||
GET_ARG(0);
|
||||
GET_ARG(1);
|
||||
s = lock_user_string(arg0);
|
||||
if (!s) {
|
||||
/* FIXME - should this error code be -TARGET_EFAULT ? */
|
||||
return (uint32_t)-1;
|
||||
}
|
||||
ret = set_swi_errno(ts, remove(s));
|
||||
unlock_user(s, arg0, 0);
|
||||
return ret;
|
||||
case TARGET_SYS_RENAME:
|
||||
GET_ARG(0);
|
||||
GET_ARG(1);
|
||||
GET_ARG(2);
|
||||
//GET_ARG(3);
|
||||
char *s2;
|
||||
s = lock_user_string(arg0);
|
||||
s2 = lock_user_string(arg2);
|
||||
if (!s || !s2)
|
||||
/* FIXME - should this error code be -TARGET_EFAULT ? */
|
||||
ret = (uint32_t)-1;
|
||||
else
|
||||
ret = set_swi_errno(ts, rename(s, s2));
|
||||
if (s2)
|
||||
unlock_user(s2, arg2, 0);
|
||||
if (s)
|
||||
unlock_user(s, arg0, 0);
|
||||
return ret;
|
||||
case TARGET_SYS_CLOCK:
|
||||
return clock() / (CLOCKS_PER_SEC / 100);
|
||||
case TARGET_SYS_TIME:
|
||||
return set_swi_errno(ts, time(NULL));
|
||||
case TARGET_SYS_SYSTEM:
|
||||
GET_ARG(0);
|
||||
GET_ARG(1);
|
||||
s = lock_user_string(arg0);
|
||||
if (!s) {
|
||||
/* FIXME - should this error code be -TARGET_EFAULT ? */
|
||||
return (uint32_t)-1;
|
||||
}
|
||||
ret = set_swi_errno(ts, system(s));
|
||||
unlock_user(s, arg0, 0);
|
||||
return ret;
|
||||
case TARGET_SYS_ERRNO:
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
return ts->swi_errno;
|
||||
#else
|
||||
return syscall_err;
|
||||
#endif
|
||||
case TARGET_SYS_GET_CMDLINE:
|
||||
{
|
||||
/* Build a command-line from the original argv.
|
||||
*
|
||||
* The inputs are:
|
||||
* * arg0, pointer to a buffer of at least the size
|
||||
* specified in arg1.
|
||||
* * arg1, size of the buffer pointed to by arg0 in
|
||||
* bytes.
|
||||
*
|
||||
* The outputs are:
|
||||
* * arg0, pointer to null-terminated string of the
|
||||
* command line.
|
||||
* * arg1, length of the string pointed to by arg0.
|
||||
*/
|
||||
|
||||
char *output_buffer;
|
||||
size_t input_size;
|
||||
size_t output_size;
|
||||
int status = 0;
|
||||
GET_ARG(0);
|
||||
GET_ARG(1);
|
||||
input_size = arg1;
|
||||
/* Compute the size of the output string. */
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
output_size = strlen(ts->boot_info->kernel_filename)
|
||||
+ 1 /* Separating space. */
|
||||
+ strlen(ts->boot_info->kernel_cmdline)
|
||||
+ 1; /* Terminating null byte. */
|
||||
#else
|
||||
unsigned int i;
|
||||
|
||||
output_size = ts->info->arg_end - ts->info->arg_start;
|
||||
if (!output_size) {
|
||||
/* We special-case the "empty command line" case (argc==0).
|
||||
Just provide the terminating 0. */
|
||||
output_size = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (output_size > input_size) {
|
||||
/* Not enough space to store command-line arguments. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Adjust the command-line length. */
|
||||
if (SET_ARG(1, output_size - 1)) {
|
||||
/* Couldn't write back to argument block */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Lock the buffer on the ARM side. */
|
||||
output_buffer = lock_user(VERIFY_WRITE, arg0, output_size, 0);
|
||||
if (!output_buffer) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Copy the command-line arguments. */
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
pstrcpy(output_buffer, output_size, ts->boot_info->kernel_filename);
|
||||
pstrcat(output_buffer, output_size, " ");
|
||||
pstrcat(output_buffer, output_size, ts->boot_info->kernel_cmdline);
|
||||
#else
|
||||
if (output_size == 1) {
|
||||
/* Empty command-line. */
|
||||
output_buffer[0] = '\0';
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (copy_from_user(output_buffer, ts->info->arg_start,
|
||||
output_size)) {
|
||||
status = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Separate arguments by white spaces. */
|
||||
for (i = 0; i < output_size - 1; i++) {
|
||||
if (output_buffer[i] == 0) {
|
||||
output_buffer[i] = ' ';
|
||||
}
|
||||
}
|
||||
out:
|
||||
#endif
|
||||
/* Unlock the buffer on the ARM side. */
|
||||
unlock_user(output_buffer, arg0, output_size);
|
||||
|
||||
return status;
|
||||
}
|
||||
case TARGET_SYS_HEAPINFO:
|
||||
{
|
||||
uint32_t *ptr;
|
||||
uint32_t limit;
|
||||
GET_ARG(0);
|
||||
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
/* Some C libraries assume the heap immediately follows .bss, so
|
||||
allocate it using sbrk. */
|
||||
if (!ts->heap_limit) {
|
||||
abi_ulong ret;
|
||||
|
||||
ts->heap_base = do_brk(0);
|
||||
limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE;
|
||||
/* Try a big heap, and reduce the size if that fails. */
|
||||
for (;;) {
|
||||
ret = do_brk(limit);
|
||||
if (ret >= limit) {
|
||||
break;
|
||||
}
|
||||
limit = (ts->heap_base >> 1) + (limit >> 1);
|
||||
}
|
||||
ts->heap_limit = limit;
|
||||
}
|
||||
|
||||
ptr = lock_user(VERIFY_WRITE, arg0, 16, 0);
|
||||
if (!ptr) {
|
||||
/* FIXME - should this error code be -TARGET_EFAULT ? */
|
||||
return (uint32_t)-1;
|
||||
}
|
||||
ptr[0] = tswap32(ts->heap_base);
|
||||
ptr[1] = tswap32(ts->heap_limit);
|
||||
ptr[2] = tswap32(ts->stack_base);
|
||||
ptr[3] = tswap32(0); /* Stack limit. */
|
||||
unlock_user(ptr, arg0, 16);
|
||||
#else
|
||||
limit = ram_size;
|
||||
ptr = lock_user(VERIFY_WRITE, arg0, 16, 0);
|
||||
if (!ptr) {
|
||||
/* FIXME - should this error code be -TARGET_EFAULT ? */
|
||||
return (uint32_t)-1;
|
||||
}
|
||||
/* TODO: Make this use the limit of the loaded application. */
|
||||
ptr[0] = tswap32(limit / 2);
|
||||
ptr[1] = tswap32(limit);
|
||||
ptr[2] = tswap32(limit); /* Stack base */
|
||||
ptr[3] = tswap32(0); /* Stack limit. */
|
||||
unlock_user(ptr, arg0, 16);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
case TARGET_SYS_EXIT:
|
||||
//gdb_exit(env, 0);
|
||||
exit(0);
|
||||
default:
|
||||
fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr);
|
||||
cpu_dump_state(cs, stderr, fprintf, 0);
|
||||
abort();
|
||||
}
|
||||
}
|
|
@ -1842,7 +1842,7 @@ static void x86_register_cpudef_type(struct uc_struct *uc, X86CPUDefinition *def
|
|||
TypeInfo ti = {
|
||||
typename,
|
||||
TYPE_X86_CPU,
|
||||
|
||||
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
|
@ -1850,9 +1850,9 @@ static void x86_register_cpudef_type(struct uc_struct *uc, X86CPUDefinition *def
|
|||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
|
||||
def,
|
||||
|
||||
|
||||
x86_cpu_cpudef_class_init,
|
||||
};
|
||||
|
||||
|
@ -2604,21 +2604,21 @@ void x86_cpu_register_types(void *opaque)
|
|||
const TypeInfo x86_cpu_type_info = {
|
||||
TYPE_X86_CPU,
|
||||
TYPE_CPU,
|
||||
|
||||
|
||||
sizeof(X86CPUClass),
|
||||
sizeof(X86CPU),
|
||||
opaque,
|
||||
|
||||
|
||||
x86_cpu_initfn,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
|
||||
NULL,
|
||||
|
||||
x86_cpu_common_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
|
||||
true,
|
||||
};
|
||||
|
||||
|
|
|
@ -759,7 +759,6 @@ void helper_fprem1(CPUX86State *env)
|
|||
st1 = floatx80_to_double(env, ST1);
|
||||
|
||||
if (isinf(st0) || isnan(st0) || isnan(st1) || (st1 == 0.0)) {
|
||||
|
||||
ST0 = double_to_floatx80(env, NAN); /* NaN */
|
||||
env->fpus &= ~0x4700; /* (C3,C2,C1,C0) <-- 0000 */
|
||||
return;
|
||||
|
|
|
@ -486,27 +486,27 @@ void helper_svm_check_intercept_param(CPUX86State *env, uint32_t type,
|
|||
if (likely(!(env->hflags & HF_SVMI_MASK))) {
|
||||
return;
|
||||
}
|
||||
if( (int32_t)type >= SVM_EXIT_READ_CR0 && type <= SVM_EXIT_READ_CR0 + 8 ) {
|
||||
if ( (int32_t)type >= SVM_EXIT_READ_CR0 && type <= SVM_EXIT_READ_CR0 + 8 ) {
|
||||
if (env->intercept_cr_read & (1 << (type - SVM_EXIT_READ_CR0))) {
|
||||
helper_vmexit(env, type, param);
|
||||
}
|
||||
} else if( type >= SVM_EXIT_WRITE_CR0 && type <= SVM_EXIT_WRITE_CR0 + 8 ) {
|
||||
} else if ( type >= SVM_EXIT_WRITE_CR0 && type <= SVM_EXIT_WRITE_CR0 + 8 ) {
|
||||
if (env->intercept_cr_write & (1 << (type - SVM_EXIT_WRITE_CR0))) {
|
||||
helper_vmexit(env, type, param);
|
||||
}
|
||||
} else if( type >= SVM_EXIT_READ_DR0 && type <= SVM_EXIT_READ_DR0 + 7 ) {
|
||||
} else if ( type >= SVM_EXIT_READ_DR0 && type <= SVM_EXIT_READ_DR0 + 7 ) {
|
||||
if (env->intercept_dr_read & (1 << (type - SVM_EXIT_READ_DR0))) {
|
||||
helper_vmexit(env, type, param);
|
||||
}
|
||||
} else if( type >= SVM_EXIT_WRITE_DR0 && type <= SVM_EXIT_WRITE_DR0 + 7 ) {
|
||||
} else if ( type >= SVM_EXIT_WRITE_DR0 && type <= SVM_EXIT_WRITE_DR0 + 7 ) {
|
||||
if (env->intercept_dr_write & (1 << (type - SVM_EXIT_WRITE_DR0))) {
|
||||
helper_vmexit(env, type, param);
|
||||
}
|
||||
} else if( type >= SVM_EXIT_EXCP_BASE && type <= SVM_EXIT_EXCP_BASE + 31 ) {
|
||||
} else if ( type >= SVM_EXIT_EXCP_BASE && type <= SVM_EXIT_EXCP_BASE + 31 ) {
|
||||
if (env->intercept_exceptions & (1 << (type - SVM_EXIT_EXCP_BASE))) {
|
||||
helper_vmexit(env, type, param);
|
||||
}
|
||||
} else if( type == SVM_EXIT_MSR ) {
|
||||
} else if ( type == SVM_EXIT_MSR ) {
|
||||
if (env->intercept & (1ULL << (SVM_EXIT_MSR - SVM_EXIT_INTR))) {
|
||||
/* FIXME: this should be read in at vmrun (faster this way?) */
|
||||
uint64_t addr = ldq_phys(cs->as, env->vm_vmcb +
|
||||
|
@ -515,14 +515,14 @@ void helper_svm_check_intercept_param(CPUX86State *env, uint32_t type,
|
|||
uint32_t t0, t1;
|
||||
|
||||
uint32_t ecx = (uint32_t)env->regs[R_ECX];
|
||||
if( (int32_t)ecx >= 0 && ecx <= 0x1fff ) {
|
||||
if ( (int32_t)ecx >= 0 && ecx <= 0x1fff ) {
|
||||
t0 = (env->regs[R_ECX] * 2) % 8;
|
||||
t1 = (env->regs[R_ECX] * 2) / 8;
|
||||
} else if( ecx >= 0xc0000000 && ecx <= 0xc0001fff ) {
|
||||
} else if ( ecx >= 0xc0000000 && ecx <= 0xc0001fff ) {
|
||||
t0 = (8192 + env->regs[R_ECX] - 0xc0000000) * 2;
|
||||
t1 = (t0 / 8);
|
||||
t0 %= 8;
|
||||
} else if( ecx >= 0xc0010000 && ecx <= 0xc0011fff ) {
|
||||
} else if ( ecx >= 0xc0010000 && ecx <= 0xc0011fff ) {
|
||||
t0 = (16384 + env->regs[R_ECX] - 0xc0010000) * 2;
|
||||
t1 = (t0 / 8);
|
||||
t0 %= 8;
|
||||
|
|
|
@ -1000,38 +1000,38 @@ static CCPrepare gen_prepare_eflags_c(DisasContext *s, TCGv reg)
|
|||
t1 = gen_ext_tl(tcg_ctx, cpu_tmp0, cpu_cc_src, size, false);
|
||||
t0 = gen_ext_tl(tcg_ctx, reg, cpu_cc_dst, size, false);
|
||||
add_sub:
|
||||
return ccprepare_make(TCG_COND_LTU, t0,t1, 0,-1, true,false);
|
||||
return ccprepare_make(TCG_COND_LTU, t0, t1, 0, -1, true, false);
|
||||
|
||||
case CC_OP_LOGICB: case CC_OP_LOGICW: case CC_OP_LOGICL: case CC_OP_LOGICQ:
|
||||
case CC_OP_CLR:
|
||||
return ccprepare_make(TCG_COND_NEVER, 0,0, 0,-1, false,false);
|
||||
return ccprepare_make(TCG_COND_NEVER, 0, 0, 0, -1, false, false);
|
||||
|
||||
case CC_OP_INCB: case CC_OP_INCW: case CC_OP_INCL: case CC_OP_INCQ:
|
||||
case CC_OP_DECB: case CC_OP_DECW: case CC_OP_DECL: case CC_OP_DECQ:
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src,0, 0,-1, false,true );
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src, 0, 0, -1, false, true);
|
||||
|
||||
case CC_OP_SHLB: case CC_OP_SHLW: case CC_OP_SHLL: case CC_OP_SHLQ:
|
||||
/* (CC_SRC >> (DATA_BITS - 1)) & 1 */
|
||||
size = s->cc_op - CC_OP_SHLB;
|
||||
shift = (8 << size) - 1;
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src,0, 0,(target_ulong)(1 << shift), false,false);
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src, 0, 0, (target_ulong)(1 << shift), false, false);
|
||||
|
||||
case CC_OP_MULB: case CC_OP_MULW: case CC_OP_MULL: case CC_OP_MULQ:
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src,0, 0,-1, false,false );
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src, 0, 0, -1, false, false);
|
||||
|
||||
case CC_OP_BMILGB: case CC_OP_BMILGW: case CC_OP_BMILGL: case CC_OP_BMILGQ:
|
||||
size = s->cc_op - CC_OP_BMILGB;
|
||||
t0 = gen_ext_tl(tcg_ctx, reg, cpu_cc_src, size, false);
|
||||
return ccprepare_make(TCG_COND_EQ, t0,0, 0,-1, false,false);
|
||||
return ccprepare_make(TCG_COND_EQ, t0, 0, 0, -1, false, false);
|
||||
|
||||
case CC_OP_ADCX:
|
||||
case CC_OP_ADCOX:
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_dst,0, 0,-1, false,true);
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_dst, 0, 0, -1, false, true);
|
||||
|
||||
case CC_OP_EFLAGS:
|
||||
case CC_OP_SARB: case CC_OP_SARW: case CC_OP_SARL: case CC_OP_SARQ:
|
||||
/* CC_SRC & 1 */
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src,0, 0,CC_C, false,false);
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src, 0, 0, CC_C, false, false);
|
||||
|
||||
default:
|
||||
/* The need to compute only C from CC_OP_DYNAMIC is important
|
||||
|
@ -1039,7 +1039,7 @@ static CCPrepare gen_prepare_eflags_c(DisasContext *s, TCGv reg)
|
|||
gen_update_cc_op(s);
|
||||
gen_helper_cc_compute_c(tcg_ctx, reg, cpu_cc_dst, cpu_cc_src,
|
||||
cpu_cc_src2, cpu_cc_op);
|
||||
return ccprepare_make(TCG_COND_NE, reg,0, 0,-1, false,true);
|
||||
return ccprepare_make(TCG_COND_NE, reg, 0, 0, -1, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ static CCPrepare gen_prepare_eflags_p(DisasContext *s, TCGv reg)
|
|||
TCGv cpu_cc_src = *(TCGv *)tcg_ctx->cpu_cc_src;
|
||||
|
||||
gen_compute_eflags(s);
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src,0, 0,CC_P, false,false);
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src, 0, 0, CC_P, false, false);
|
||||
}
|
||||
|
||||
/* compute eflags.S to reg */
|
||||
|
@ -1068,14 +1068,14 @@ static CCPrepare gen_prepare_eflags_s(DisasContext *s, TCGv reg)
|
|||
case CC_OP_ADCX:
|
||||
case CC_OP_ADOX:
|
||||
case CC_OP_ADCOX:
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src,0, 0,CC_S, false,false);
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src, 0, 0, CC_S, false, false);
|
||||
case CC_OP_CLR:
|
||||
return ccprepare_make(TCG_COND_NEVER, 0,0, 0,-1, false,false);
|
||||
return ccprepare_make(TCG_COND_NEVER, 0, 0, 0, -1, false, false);
|
||||
default:
|
||||
{
|
||||
TCGMemOp size = (s->cc_op - CC_OP_ADDB) & 3;
|
||||
TCGv t0 = gen_ext_tl(tcg_ctx, reg, cpu_cc_dst, size, true);
|
||||
return ccprepare_make(TCG_COND_LT, t0,0, 0,-1, false,false);
|
||||
return ccprepare_make(TCG_COND_LT, t0, 0, 0, -1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1090,12 +1090,12 @@ static CCPrepare gen_prepare_eflags_o(DisasContext *s, TCGv reg)
|
|||
switch (s->cc_op) {
|
||||
case CC_OP_ADOX:
|
||||
case CC_OP_ADCOX:
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src2,0, 0,-1, false,true);
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src2, 0, 0, -1, false, true);
|
||||
case CC_OP_CLR:
|
||||
return ccprepare_make(TCG_COND_NEVER, 0,0, 0,-1, false,false);
|
||||
return ccprepare_make(TCG_COND_NEVER, 0, 0, 0, -1, false, false);
|
||||
default:
|
||||
gen_compute_eflags(s);
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src,0, 0,CC_O, false,false );
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src, 0, 0, CC_O, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1114,14 +1114,14 @@ static CCPrepare gen_prepare_eflags_z(DisasContext *s, TCGv reg)
|
|||
case CC_OP_ADCX:
|
||||
case CC_OP_ADOX:
|
||||
case CC_OP_ADCOX:
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src,0, 0,CC_Z, false,false);
|
||||
return ccprepare_make(TCG_COND_NE, cpu_cc_src, 0, 0, CC_Z, false, false);
|
||||
case CC_OP_CLR:
|
||||
return ccprepare_make(TCG_COND_ALWAYS, 0,0, 0,-1, false,false);
|
||||
return ccprepare_make(TCG_COND_ALWAYS, 0, 0, 0, -1, false, false);
|
||||
default:
|
||||
{
|
||||
TCGMemOp size = (s->cc_op - CC_OP_ADDB) & 3;
|
||||
TCGv t0 = gen_ext_tl(tcg_ctx, reg, cpu_cc_dst, size, false);
|
||||
return ccprepare_make(TCG_COND_EQ, t0,0, 0,-1, false,false);
|
||||
return ccprepare_make(TCG_COND_EQ, t0, 0, 0, -1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1152,7 +1152,7 @@ static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg)
|
|||
tcg_gen_mov_tl(tcg_ctx, cpu_tmp4, cpu_cc_srcT);
|
||||
gen_extu(tcg_ctx, size, cpu_tmp4);
|
||||
t0 = gen_ext_tl(tcg_ctx, cpu_tmp0, cpu_cc_src, size, false);
|
||||
cc = ccprepare_make(TCG_COND_LEU, cpu_tmp4,t0, 0,-1, true,false);
|
||||
cc = ccprepare_make(TCG_COND_LEU, cpu_tmp4, t0, 0, -1, true, false);
|
||||
break;
|
||||
|
||||
case JCC_L:
|
||||
|
@ -1164,7 +1164,7 @@ static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg)
|
|||
tcg_gen_mov_tl(tcg_ctx, cpu_tmp4, cpu_cc_srcT);
|
||||
gen_exts(tcg_ctx, size, cpu_tmp4);
|
||||
t0 = gen_ext_tl(tcg_ctx, cpu_tmp0, cpu_cc_src, size, true);
|
||||
cc = ccprepare_make(cond, cpu_tmp4,t0, 0,-1, true,false);
|
||||
cc = ccprepare_make(cond, cpu_tmp4, t0, 0, -1, true, false);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1187,7 +1187,7 @@ static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg)
|
|||
break;
|
||||
case JCC_BE:
|
||||
gen_compute_eflags(s);
|
||||
cc = ccprepare_make(TCG_COND_NE, cpu_cc_src,0, 0,CC_Z | CC_C, false,false);
|
||||
cc = ccprepare_make(TCG_COND_NE, cpu_cc_src, 0, 0, CC_Z | CC_C, false, false);
|
||||
break;
|
||||
case JCC_S:
|
||||
cc = gen_prepare_eflags_s(s, reg);
|
||||
|
@ -1202,7 +1202,7 @@ static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg)
|
|||
}
|
||||
tcg_gen_shri_tl(tcg_ctx, reg, cpu_cc_src, 4); /* CC_O -> CC_S */
|
||||
tcg_gen_xor_tl(tcg_ctx, reg, reg, cpu_cc_src);
|
||||
cc = ccprepare_make(TCG_COND_NE, reg,0, 0,CC_S, false,false);
|
||||
cc = ccprepare_make(TCG_COND_NE, reg, 0, 0, CC_S, false, false);
|
||||
break;
|
||||
default:
|
||||
case JCC_LE:
|
||||
|
@ -1212,7 +1212,7 @@ static CCPrepare gen_prepare_cc(DisasContext *s, int b, TCGv reg)
|
|||
}
|
||||
tcg_gen_shri_tl(tcg_ctx, reg, cpu_cc_src, 4); /* CC_O -> CC_S */
|
||||
tcg_gen_xor_tl(tcg_ctx, reg, reg, cpu_cc_src);
|
||||
cc = ccprepare_make(TCG_COND_NE, reg,0, 0,CC_S | CC_Z, false,false);
|
||||
cc = ccprepare_make(TCG_COND_NE, reg, 0, 0, CC_S | CC_Z, false, false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -3016,7 +3016,7 @@ typedef void (*SSEFunc_0_eppt)(TCGContext *s, TCGv_ptr env, TCGv_ptr reg_a, TCGv
|
|||
static const SSEFunc_0_epp sse_op_table1[256][4] = {
|
||||
// filler: 0x00 - 0x0e
|
||||
{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},
|
||||
|
||||
|
||||
/* 3DNow! extensions */
|
||||
{ SSE_DUMMY }, /* femms */
|
||||
{ SSE_DUMMY }, /* pf. . . */
|
||||
|
@ -3030,10 +3030,10 @@ static const SSEFunc_0_epp sse_op_table1[256][4] = {
|
|||
{ gen_helper_punpckhdq_xmm, gen_helper_punpckhqdq_xmm },
|
||||
{ SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* movhps, movhpd, movshdup */
|
||||
{ SSE_SPECIAL, SSE_SPECIAL }, /* movhps, movhpd */
|
||||
|
||||
|
||||
// filler: 0x18 - 0x27
|
||||
{0},{0},{0},{0},{0},{0},{0},{0}, {0},{0},{0},{0},{0},{0},{0},{0},
|
||||
|
||||
|
||||
/* pure SSE operations */
|
||||
{ SSE_SPECIAL, SSE_SPECIAL }, /* movaps, movapd */
|
||||
{ SSE_SPECIAL, SSE_SPECIAL }, /* movaps, movapd */
|
||||
|
@ -3043,18 +3043,18 @@ static const SSEFunc_0_epp sse_op_table1[256][4] = {
|
|||
{ SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* cvtps2pi, cvtpd2pi, cvtsd2si, cvtss2si */
|
||||
{ gen_helper_ucomiss, gen_helper_ucomisd },
|
||||
{ gen_helper_comiss, gen_helper_comisd },
|
||||
|
||||
|
||||
// filler: 0x30 - 0x37
|
||||
{0},{0},{0},{0},{0},{0},{0},{0},
|
||||
|
||||
|
||||
/* SSSE3, SSE4, MOVBE, CRC32, BMI1, BMI2, ADX. */
|
||||
{ SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL },
|
||||
{0}, // filler: 0x39
|
||||
{ SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL },
|
||||
|
||||
|
||||
// filler: 0x3b - 0x4f
|
||||
{0},{0},{0},{0},{0}, {0},{0},{0},{0},{0},{0},{0},{0}, {0},{0},{0},{0},{0},{0},{0},{0},
|
||||
|
||||
|
||||
/* pure SSE operations */
|
||||
{ SSE_SPECIAL, SSE_SPECIAL }, /* movmskps, movmskpd */
|
||||
SSE_FOP(sqrt),
|
||||
|
@ -3109,14 +3109,14 @@ static const SSEFunc_0_epp sse_op_table1[256][4] = {
|
|||
{ NULL, gen_helper_hsubpd, NULL, gen_helper_hsubps },
|
||||
{ SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* movd, movd, , movq */
|
||||
{ SSE_SPECIAL, SSE_SPECIAL, SSE_SPECIAL }, /* movq, movdqa, movdqu */
|
||||
|
||||
|
||||
// filler: 0x80 - 0xc1
|
||||
{0},{0},{0},{0},{0},{0},{0},{0}, {0},{0},{0},{0},{0},{0},{0},{0},
|
||||
{0},{0},{0},{0},{0},{0},{0},{0}, {0},{0},{0},{0},{0},{0},{0},{0},
|
||||
{0},{0},{0},{0},{0},{0},{0},{0}, {0},{0},{0},{0},{0},{0},{0},{0},
|
||||
{0},{0},{0},{0},{0},{0},{0},{0}, {0},{0},{0},{0},{0},{0},{0},{0},
|
||||
{0},{0},
|
||||
|
||||
|
||||
SSE_FOP(cmpeq),
|
||||
|
||||
// filler: 0xc3
|
||||
|
@ -3125,13 +3125,13 @@ static const SSEFunc_0_epp sse_op_table1[256][4] = {
|
|||
/* MMX ops and their SSE extensions */
|
||||
{ SSE_SPECIAL, SSE_SPECIAL }, /* pinsrw */
|
||||
{ SSE_SPECIAL, SSE_SPECIAL }, /* pextrw */
|
||||
|
||||
|
||||
{ (SSEFunc_0_epp)gen_helper_shufps,
|
||||
(SSEFunc_0_epp)gen_helper_shufpd }, /* XXX: casts */
|
||||
|
||||
// filler: 0xc7 - 0xcf
|
||||
{0}, {0},{0},{0},{0},{0},{0},{0},{0},
|
||||
|
||||
|
||||
/* MMX ops and their SSE extensions */
|
||||
{ NULL, gen_helper_addsubpd, NULL, gen_helper_addsubps },
|
||||
MMX_OP2(psrlw),
|
||||
|
@ -3419,7 +3419,7 @@ static const struct SSEOpHelper_epp sse_op_table6[256] = {
|
|||
SSE41_OP(pmulld),
|
||||
SSE41_OP(phminposuw),
|
||||
// filler: 0x42 - 0xda
|
||||
{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0}, {{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},
|
||||
{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0}, {{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},
|
||||
{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0}, {{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},
|
||||
{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0}, {{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},
|
||||
{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0}, {{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},{{0},0},
|
||||
|
@ -4848,16 +4848,14 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
|
|||
|
||||
if( (b >= 0x50 && b <= 0x5a) ||
|
||||
(b >= 0x5c && b <= 0x5f) ||
|
||||
b == 0xc2 )
|
||||
{
|
||||
b == 0xc2 ) {
|
||||
/* Most sse scalar operations. */
|
||||
if (b1 == 2) {
|
||||
sz = 2;
|
||||
} else if (b1 == 3) {
|
||||
sz = 3;
|
||||
}
|
||||
}
|
||||
else if( b == 0x2e || /* ucomis[sd] */
|
||||
} else if( b == 0x2e || /* ucomis[sd] */
|
||||
b == 0x2f ) /* comis[sd] */
|
||||
{
|
||||
if (b1 == 0) {
|
||||
|
@ -8458,7 +8456,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s,
|
|||
s->prefix &= ~(PREFIX_REPZ | PREFIX_REPNZ | PREFIX_DATA);
|
||||
case 0x110: case 0x111: case 0x112: case 0x113: case 0x114: case 0x115: case 0x116: case 0x117: //case 0x110 ... 0x117:
|
||||
case 0x128: case 0x129: case 0x12a: case 0x12b: case 0x12c: case 0x12d: case 0x12e: case 0x12f: //case 0x128 ... 0x12f:
|
||||
case 0x138: case 0x139: case 0x13a:
|
||||
case 0x138: case 0x139: case 0x13a:
|
||||
// case 0x150 ... 0x179:
|
||||
case 0x150: case 0x151: case 0x152: case 0x153: case 0x154: case 0x155: case 0x156: case 0x157:
|
||||
case 0x158: case 0x159: case 0x15a: case 0x15b: case 0x15c: case 0x15d: case 0x15e: case 0x15f:
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* m68k/ColdFire Semihosting syscall interface
|
||||
*
|
||||
* Copyright (c) 2005-2007 CodeSourcery.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "cpu.h"
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
#include "qemu.h"
|
||||
#define SEMIHOSTING_HEAP_SIZE (128 * 1024 * 1024)
|
||||
#else
|
||||
#include "qemu-common.h"
|
||||
#include "exec/softmmu-semi.h"
|
||||
#endif
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
#define HOSTED_EXIT 0
|
||||
#define HOSTED_INIT_SIM 1
|
||||
#define HOSTED_OPEN 2
|
||||
#define HOSTED_CLOSE 3
|
||||
#define HOSTED_READ 4
|
||||
#define HOSTED_WRITE 5
|
||||
#define HOSTED_LSEEK 6
|
||||
#define HOSTED_RENAME 7
|
||||
#define HOSTED_UNLINK 8
|
||||
#define HOSTED_STAT 9
|
||||
#define HOSTED_FSTAT 10
|
||||
#define HOSTED_GETTIMEOFDAY 11
|
||||
#define HOSTED_ISATTY 12
|
||||
#define HOSTED_SYSTEM 13
|
||||
|
||||
static void translate_stat(CPUM68KState *env, target_ulong addr, struct stat *s)
|
||||
{
|
||||
}
|
||||
|
||||
static void m68k_semi_return_u32(CPUM68KState *env, uint32_t ret, uint32_t err)
|
||||
{
|
||||
target_ulong args = env->dregs[1];
|
||||
if (put_user_u32(ret, args) ||
|
||||
put_user_u32(err, args + 4)) {
|
||||
/* The m68k semihosting ABI does not provide any way to report this
|
||||
* error to the guest, so the best we can do is log it in qemu.
|
||||
* It is always a guest error not to pass us a valid argument block.
|
||||
*/
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "m68k-semihosting: return value "
|
||||
"discarded because argument block not writable\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void m68k_semi_return_u64(CPUM68KState *env, uint64_t ret, uint32_t err)
|
||||
{
|
||||
target_ulong args = env->dregs[1];
|
||||
if (put_user_u32(ret >> 32, args) ||
|
||||
put_user_u32(ret, args + 4) ||
|
||||
put_user_u32(err, args + 8)) {
|
||||
/* No way to report this via m68k semihosting ABI; just log it */
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "m68k-semihosting: return value "
|
||||
"discarded because argument block not writable\n");
|
||||
}
|
||||
}
|
||||
|
||||
static int m68k_semi_is_fseek;
|
||||
|
||||
static void m68k_semi_cb(CPUState *cs, target_ulong ret, target_ulong err)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs->uc, cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
|
||||
if (m68k_semi_is_fseek) {
|
||||
/* FIXME: We've already lost the high bits of the fseek
|
||||
return value. */
|
||||
m68k_semi_return_u64(env, ret, err);
|
||||
m68k_semi_is_fseek = 0;
|
||||
} else {
|
||||
m68k_semi_return_u32(env, ret, err);
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the input value from the argument block; fail the semihosting
|
||||
* call if the memory read fails.
|
||||
*/
|
||||
#define GET_ARG(n) do { \
|
||||
if (get_user_ual(arg ## n, args + (n) * 4)) { \
|
||||
result = -1; \
|
||||
errno = EFAULT; \
|
||||
goto failed; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
void do_m68k_semihosting(CPUM68KState *env, int nr)
|
||||
{
|
||||
}
|
|
@ -20,6 +20,27 @@
|
|||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 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
|
||||
>>>>>>> unicorn-engine/msvc
|
||||
#include <unicorn/unicorn.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -3,6 +3,27 @@
|
|||
|
||||
/* Sample code to demonstrate how to emulate ARM code */
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 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
|
||||
>>>>>>> unicorn-engine/msvc
|
||||
#include <unicorn/unicorn.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -3,6 +3,27 @@
|
|||
|
||||
/* Sample code to demonstrate how to emulate ARM64 code */
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 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
|
||||
>>>>>>> unicorn-engine/msvc
|
||||
#include <unicorn/unicorn.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
>>>>>>> unicorn-engine/msvc
|
||||
#include <unicorn/unicorn.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -3,6 +3,27 @@
|
|||
|
||||
/* Sample code to demonstrate how to emulate m68k code */
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 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
|
||||
>>>>>>> unicorn-engine/msvc
|
||||
#include <unicorn/unicorn.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -3,6 +3,27 @@
|
|||
|
||||
/* Sample code to demonstrate how to emulate Mips code (big endian) */
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 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
|
||||
>>>>>>> unicorn-engine/msvc
|
||||
#include <unicorn/unicorn.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -3,6 +3,27 @@
|
|||
|
||||
/* Sample code to demonstrate how to emulate Sparc code */
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 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
|
||||
>>>>>>> unicorn-engine/msvc
|
||||
#include <unicorn/unicorn.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -20,10 +20,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
|
||||
#include <unicorn/unicorn.h>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
#include <assert.h>
|
||||
>>>>>>> unicorn-engine/msvc
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
<<<<<<< HEAD
|
||||
#
|
||||
=======
|
||||
|
||||
>>>>>>> unicorn-engine/msvc
|
||||
#pragma pack(push, 1)
|
||||
struct SegmentDescriptor {
|
||||
union {
|
||||
|
|
|
@ -3,6 +3,27 @@
|
|||
|
||||
/* Sample code to trace code with Linux code with syscall */
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// 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
|
||||
>>>>>>> unicorn-engine/msvc
|
||||
#include <unicorn/unicorn.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#include <sys/types.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <assert.h>
|
||||
|
||||
#include <unicorn/unicorn.h>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#include <sys/types.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@ Test for uc_emu_stop() in code hook not always stopping the emu at the current i
|
|||
|
||||
// posix specific
|
||||
#else // _MSC_VER
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
#include "pthread.h"
|
||||
#endif // _MSC_VER
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "unicorn/platform.h"
|
||||
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
static void hook_block(uc_engine *uc, uint64_t address, uint32_t size, void *user_data) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <stdio.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
uint64_t starts[] = {0x10000000, 0x110004000ll};
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#define __STDC_FORMAT_MACROS
|
||||
#include "unicorn/platform.h"
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
*/
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include "unicorn/platform.h"
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#define __STDC_FORMAT_MACROS
|
||||
#include "unicorn/platform.h"
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "unicorn/platform.h"
|
||||
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
*/
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include "unicorn/platform.h"
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
*/
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include "unicorn/platform.h"
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
// posix specific
|
||||
#else // _MSC_VER
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
// posix specific
|
||||
#else // _MSC_VER
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
// posix specific
|
||||
#else // _MSC_VER
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
// posix specific
|
||||
#else // _MSC_VER
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
// posix specific
|
||||
#else // _MSC_VER
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
// posix specific
|
||||
#else // _MSC_VER
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
// posix specific
|
||||
#else // _MSC_VER
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
#include "pthread.h"
|
||||
#endif // _MSC_VER
|
||||
|
|
|
@ -27,8 +27,6 @@ but that the code hook is just not occurring.
|
|||
|
||||
// posix specific
|
||||
#else // _MSC_VER
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
|
|
@ -18,9 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "unicorn/platform.h"
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
|
|
|
@ -20,9 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include "unicorn/platform.h"
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
|
|
@ -18,9 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
*/
|
||||
|
||||
#include "unicorn/platform.h"
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
#define ADDRESS 0x1000000
|
||||
|
|
|
@ -33,8 +33,6 @@ background.
|
|||
|
||||
// posix specific
|
||||
#else // _MSC_VER
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
#include "pthread.h"
|
||||
#endif // _MSC_VER
|
||||
|
|
|
@ -9,8 +9,6 @@ call to uc_emu_start(). See issue #78 for more details:
|
|||
https://github.com/unicorn-engine/unicorn/issues/78
|
||||
*/
|
||||
|
||||
#include "unicorn/platform.h"
|
||||
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#include <unicorn/unicorn.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "unicorn/platform.h"
|
||||
|
||||
/**
|
||||
* Assert that err matches expect
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "unicorn_test.h"
|
||||
#include <stdio.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/unicorn.h"
|
||||
|
||||
uint64_t trunc_page(uint64_t addr)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// emulation by counts of instruction code
|
||||
//
|
||||
#include "unicorn_test.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/unicorn.h"
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "unicorn_test.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/unicorn.h"
|
||||
|
||||
/* Called before every test to set up a new instance */
|
||||
static int setup(void **state)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "unicorn_test.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/unicorn.h"
|
||||
|
||||
#define OK(x) uc_assert_success(x)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Test PC change during the callback. by Nguyen Anh Quynh, 2016
|
||||
#include "unicorn_test.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/unicorn.h"
|
||||
|
||||
#define OK(x) uc_assert_success(x)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/unicorn.h"
|
||||
|
||||
#define RIP_NEXT_TO_THE_SELFMODIFY_OPCODE (1)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "unicorn_test.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/unicorn.h"
|
||||
|
||||
#define OK(x) uc_assert_success(x)
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include "unicorn/platform.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
#include "unicorn_test.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "unicorn/platform.h"
|
||||
#include "unicorn/unicorn.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "unicorn_test.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "unicorn_test.h"
|
||||
#include "unicorn/platform.h"
|
||||
#include "unicorn/unicorn.h"
|
||||
|
||||
/*
|
||||
Two tests here for software paging
|
||||
|
|
Loading…
Reference in a new issue