mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-03 15:55:37 +00:00
add architecture query (#842)
This commit is contained in:
parent
14222bd5f0
commit
3fdb2d2442
|
@ -101,6 +101,7 @@ module Common =
|
||||||
let UC_HOOK_MEM_VALID = 7168
|
let UC_HOOK_MEM_VALID = 7168
|
||||||
let UC_QUERY_MODE = 1
|
let UC_QUERY_MODE = 1
|
||||||
let UC_QUERY_PAGE_SIZE = 2
|
let UC_QUERY_PAGE_SIZE = 2
|
||||||
|
let UC_QUERY_ARCH = 3
|
||||||
|
|
||||||
let UC_PROT_NONE = 0
|
let UC_PROT_NONE = 0
|
||||||
let UC_PROT_READ = 1
|
let UC_PROT_READ = 1
|
||||||
|
|
|
@ -96,6 +96,7 @@ const (
|
||||||
HOOK_MEM_VALID = 7168
|
HOOK_MEM_VALID = 7168
|
||||||
QUERY_MODE = 1
|
QUERY_MODE = 1
|
||||||
QUERY_PAGE_SIZE = 2
|
QUERY_PAGE_SIZE = 2
|
||||||
|
QUERY_ARCH = 3
|
||||||
|
|
||||||
PROT_NONE = 0
|
PROT_NONE = 0
|
||||||
PROT_READ = 1
|
PROT_READ = 1
|
||||||
|
|
|
@ -98,6 +98,7 @@ public interface UnicornConst {
|
||||||
public static final int UC_HOOK_MEM_VALID = 7168;
|
public static final int UC_HOOK_MEM_VALID = 7168;
|
||||||
public static final int UC_QUERY_MODE = 1;
|
public static final int UC_QUERY_MODE = 1;
|
||||||
public static final int UC_QUERY_PAGE_SIZE = 2;
|
public static final int UC_QUERY_PAGE_SIZE = 2;
|
||||||
|
public static final int UC_QUERY_ARCH = 3;
|
||||||
|
|
||||||
public static final int UC_PROT_NONE = 0;
|
public static final int UC_PROT_NONE = 0;
|
||||||
public static final int UC_PROT_READ = 1;
|
public static final int UC_PROT_READ = 1;
|
||||||
|
|
|
@ -94,6 +94,7 @@ UC_HOOK_MEM_INVALID = 1008
|
||||||
UC_HOOK_MEM_VALID = 7168
|
UC_HOOK_MEM_VALID = 7168
|
||||||
UC_QUERY_MODE = 1
|
UC_QUERY_MODE = 1
|
||||||
UC_QUERY_PAGE_SIZE = 2
|
UC_QUERY_PAGE_SIZE = 2
|
||||||
|
UC_QUERY_ARCH = 3
|
||||||
|
|
||||||
UC_PROT_NONE = 0
|
UC_PROT_NONE = 0
|
||||||
UC_PROT_READ = 1
|
UC_PROT_READ = 1
|
||||||
|
|
|
@ -96,6 +96,7 @@ module Unicorn
|
||||||
UC_HOOK_MEM_VALID = 7168
|
UC_HOOK_MEM_VALID = 7168
|
||||||
UC_QUERY_MODE = 1
|
UC_QUERY_MODE = 1
|
||||||
UC_QUERY_PAGE_SIZE = 2
|
UC_QUERY_PAGE_SIZE = 2
|
||||||
|
UC_QUERY_ARCH = 3
|
||||||
|
|
||||||
UC_PROT_NONE = 0
|
UC_PROT_NONE = 0
|
||||||
UC_PROT_READ = 1
|
UC_PROT_READ = 1
|
||||||
|
|
|
@ -305,6 +305,7 @@ typedef enum uc_query_type {
|
||||||
// Dynamically query current hardware mode.
|
// Dynamically query current hardware mode.
|
||||||
UC_QUERY_MODE = 1,
|
UC_QUERY_MODE = 1,
|
||||||
UC_QUERY_PAGE_SIZE,
|
UC_QUERY_PAGE_SIZE,
|
||||||
|
UC_QUERY_ARCH,
|
||||||
} uc_query_type;
|
} uc_query_type;
|
||||||
|
|
||||||
// Opaque storage for CPU context, used with uc_context_*()
|
// Opaque storage for CPU context, used with uc_context_*()
|
||||||
|
|
5
uc.c
5
uc.c
|
@ -1155,6 +1155,11 @@ uc_err uc_query(uc_engine *uc, uc_query_type type, size_t *result)
|
||||||
return UC_ERR_OK;
|
return UC_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == UC_QUERY_ARCH) {
|
||||||
|
*result = uc->arch;
|
||||||
|
return UC_ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
switch(uc->arch) {
|
switch(uc->arch) {
|
||||||
#ifdef UNICORN_HAS_ARM
|
#ifdef UNICORN_HAS_ARM
|
||||||
case UC_ARCH_ARM:
|
case UC_ARCH_ARM:
|
||||||
|
|
Loading…
Reference in a new issue