mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-27 07:20:33 +00:00
Merge branch 'next' of https://github.com/07151129/capstone into 07151129-next
This commit is contained in:
commit
06ab24f9b5
6
Makefile
6
Makefile
@ -45,6 +45,12 @@ endif
|
||||
|
||||
ifeq ($(CAPSTONE_HAS_OSXKERNEL), yes)
|
||||
CFLAGS += -DCAPSTONE_HAS_OSXKERNEL
|
||||
SDKROOT ?= $(shell xcodebuild -version -sdk macosx Path)
|
||||
CFLAGS += -mmacosx-version-min=10.5 \
|
||||
-isysroot$(SDKROOT) \
|
||||
-I$(SDKROOT)/System/Library/Frameworks/Kernel.framework/Headers \
|
||||
-mkernel \
|
||||
-fno-builtin
|
||||
endif
|
||||
|
||||
CFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
|
||||
|
@ -73,3 +73,10 @@ CAPSTONE_STATIC ?= yes
|
||||
# a shared library.
|
||||
|
||||
CAPSTONE_SHARED ?= yes
|
||||
|
||||
################################################################################
|
||||
# Change 'CAPSTONE_HAS_OSXKERNEL = no' to 'CAPSTONE_HAS_OSXKERNEL = yes' to
|
||||
# enable OS X kernel embedding support. If 'CAPSTONE_USE_SYS_DYN_MEM = yes',
|
||||
# then kern_os_* functions are used for memory management.
|
||||
|
||||
CAPSTONE_HAS_OSXKERNEL ?= no
|
||||
|
16
cs.c
16
cs.c
@ -83,12 +83,28 @@ static void archs_enable(void)
|
||||
unsigned int all_arch = 0;
|
||||
|
||||
#ifdef CAPSTONE_USE_SYS_DYN_MEM
|
||||
#ifndef CAPSTONE_HAS_OSXKERNEL
|
||||
cs_malloc_t cs_mem_malloc = malloc;
|
||||
cs_calloc_t cs_mem_calloc = calloc;
|
||||
cs_realloc_t cs_mem_realloc = realloc;
|
||||
cs_free_t cs_mem_free = free;
|
||||
cs_vsnprintf_t cs_vsnprintf = vsnprintf;
|
||||
#else
|
||||
extern void* kern_os_malloc(size_t size);
|
||||
extern void kern_os_free(void* addr);
|
||||
extern void* kern_os_realloc(void* addr, size_t nsize);
|
||||
|
||||
static void* cs_kern_os_calloc(size_t num, size_t size) {
|
||||
return kern_os_malloc(num * size); // malloc bzeroes the buffer
|
||||
}
|
||||
|
||||
cs_malloc_t cs_mem_malloc = kern_os_malloc;
|
||||
cs_calloc_t cs_mem_calloc = cs_kern_os_calloc;
|
||||
cs_realloc_t cs_mem_realloc = kern_os_realloc;
|
||||
cs_free_t cs_mem_free = kern_os_free;
|
||||
cs_vsnprintf_t cs_vsnprintf = vsnprintf;
|
||||
#endif
|
||||
#else
|
||||
cs_malloc_t cs_mem_malloc = NULL;
|
||||
cs_calloc_t cs_mem_calloc = NULL;
|
||||
cs_realloc_t cs_mem_realloc = NULL;
|
||||
|
1
make.sh
1
make.sh
@ -143,6 +143,7 @@ case "$TARGET" in
|
||||
"ios_armv7" ) build_iOS armv7 $*;;
|
||||
"ios_armv7s" ) build_iOS armv7s $*;;
|
||||
"ios_arm64" ) build_iOS arm64 $*;;
|
||||
"osx-kernel" ) CAPSTONE_USE_SYS_DYN_MEM=yes CAPSTONE_HAS_OSXKERNEL=yes CAPSTONE_ARCHS=x86 CAPSTONE_SHARED=no CAPSTONE_BUILD_CORE_ONLY=yes build $*;;
|
||||
* )
|
||||
echo "Usage: $0 ["`grep '^ "' $0 | cut -d '"' -f 2 | tr "\\n" "|"`"]"
|
||||
exit 1;;
|
||||
|
Loading…
Reference in New Issue
Block a user