mirror of
https://github.com/Cxbx-Reloaded/unicorn.git
synced 2024-12-13 14:06:33 +00:00
Added ppc 32bit mode and added sparc mode checks to bring it in line with other archs
This commit is contained in:
parent
6f3d48077e
commit
26d3b1e7d6
@ -104,6 +104,7 @@ typedef enum uc_mode {
|
||||
UC_MODE_32 = 1 << 2, // 32-bit mode
|
||||
UC_MODE_64 = 1 << 3, // 64-bit mode
|
||||
// ppc
|
||||
UC_MODE_PPC32 = 1 << 2, // 32-bit mode (currently unsupported)
|
||||
UC_MODE_PPC64 = 1 << 3, // 64-bit mode (currently unsupported)
|
||||
UC_MODE_QPX = 1 << 4, // Quad Processing eXtensions mode (currently unsupported)
|
||||
// sparc
|
||||
|
@ -57,7 +57,7 @@ static void test_sparc(void)
|
||||
printf("Emulate SPARC code\n");
|
||||
|
||||
// Initialize emulator in Sparc mode
|
||||
err = uc_open(UC_ARCH_SPARC, UC_MODE_SPARC32, &uc);
|
||||
err = uc_open(UC_ARCH_SPARC, UC_MODE_SPARC32|UC_MODE_BIG_ENDIAN, &uc);
|
||||
if (err) {
|
||||
printf("Failed on uc_open() with error returned: %u (%s)\n",
|
||||
err, uc_strerror(err));
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <unicorn/unicorn.h>
|
||||
|
||||
#define HARDWARE_ARCHITECTURE UC_ARCH_SPARC
|
||||
#define HARDWARE_MODE UC_ARCH_SPARC32
|
||||
#define HARDWARE_MODE UC_ARCH_SPARC32|UC_MODE_BIG_ENDIAN
|
||||
|
||||
#define MEMORY_STARTING_ADDRESS 0x1000000
|
||||
#define MEMORY_SIZE 2 * 1024 * 1024
|
||||
|
4
uc.c
4
uc.c
@ -245,7 +245,9 @@ uc_err uc_open(uc_arch arch, uc_mode mode, uc_engine **result)
|
||||
|
||||
#ifdef UNICORN_HAS_SPARC
|
||||
case UC_ARCH_SPARC:
|
||||
if (mode & ~UC_MODE_SPARC_MASK) {
|
||||
if ((mode & ~UC_MODE_SPARC_MASK) ||
|
||||
!(mode & UC_MODE_BIG_ENDIAN) ||
|
||||
!(mode & (UC_MODE_SPARC32|UC_MODE_SPARC64))) {
|
||||
free(uc);
|
||||
return UC_ERR_MODE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user