aboutsummaryrefslogtreecommitdiff
path: root/core/invariant
diff options
context:
space:
mode:
authorjmpoep <OriginalEntryPoint@qq.com>2023-12-07 16:51:07 +0800
committerjmpoep <OriginalEntryPoint@qq.com>2023-12-07 16:51:07 +0800
commit28008a746a31abb7909dd86cb0cd413ac8943b0b (patch)
treea30b74b8cad548048c3c1551d652828ab76fa9bd /core/invariant
downloadvmprotect-3.5.1-master.tar
vmprotect-3.5.1-master.tar.gz
vmprotect-3.5.1-master.tar.bz2
vmprotect-3.5.1-master.zip
first commitHEADmaster
Diffstat (limited to 'core/invariant')
-rw-r--r--core/invariant/lin_invariant_core.mak124
-rw-r--r--core/invariant/lin_invariant_core32.mak3
-rw-r--r--core/invariant/lin_invariant_core64.mak3
-rw-r--r--core/invariant/mac_invariant_core.mak124
-rw-r--r--core/invariant/mac_invariant_core32.mak3
-rw-r--r--core/invariant/mac_invariant_core64.mak3
-rw-r--r--core/invariant/precompiled.cc92
-rw-r--r--core/invariant/precompiled.h24
-rw-r--r--core/invariant/precompiled_c.c1
-rw-r--r--core/invariant/precompiled_c.h33
10 files changed, 410 insertions, 0 deletions
diff --git a/core/invariant/lin_invariant_core.mak b/core/invariant/lin_invariant_core.mak
new file mode 100644
index 0000000..a3fd0b7
--- /dev/null
+++ b/core/invariant/lin_invariant_core.mak
@@ -0,0 +1,124 @@
+SOURCES := \
+ $(addprefix ../../third-party/tinyxml/, \
+ tinyxml.cpp \
+ tinyxmlparser.cpp \
+ tinyxmlerr.cpp) \
+ $(addprefix ../../third-party/scintilla/, \
+ XPM.cxx \
+ WordList.cxx \
+ ViewStyle.cxx \
+ UniConversion.cxx \
+ StyleContext.cxx \
+ Style.cxx \
+ Selection.cxx \
+ ScintillaBase.cxx \
+ RunStyles.cxx \
+ RESearch.cxx \
+ PropSetSimple.cxx \
+ PositionCache.cxx \
+ PerLine.cxx \
+ LineMarker.cxx \
+ LexerSimple.cxx \
+ LexerModule.cxx \
+ LexerBase.cxx \
+ LexLua.cxx \
+ KeyMap.cxx \
+ Indicator.cxx \
+ ExternalLexer.cxx \
+ Editor.cxx \
+ Document.cxx \
+ Decoration.cxx \
+ ContractionState.cxx \
+ CharacterSet.cxx \
+ CharClassify.cxx \
+ CellBuffer.cxx \
+ Catalogue.cxx \
+ CaseFolder.cxx \
+ CaseConvert.cxx \
+ CallTip.cxx \
+ AutoComplete.cxx \
+ Accessor.cxx)
+
+SOURCES_C := \
+ $(addprefix ../../third-party/demangle/, \
+ cp-demangle.c \
+ undname.c \
+ unmangle.c) \
+ $(addprefix ../../third-party/lzma/, \
+ Alloc.c \
+ LzFind.c \
+ LzmaEnc.c) \
+ $(addprefix ../../third-party/lua/, \
+ lapi.c \
+ lauxlib.c \
+ lstate.c \
+ ldebug.c \
+ lzio.c \
+ llex.c \
+ lctype.c \
+ lvm.c \
+ ldump.c \
+ ltm.c \
+ lstring.c \
+ lundump.c \
+ lobject.c \
+ lparser.c \
+ lcode.c \
+ lmem.c \
+ ltable.c \
+ ldo.c \
+ lgc.c \
+ lfunc.c \
+ linit.c \
+ lopcodes.c \
+ loadlib.c \
+ ltablib.c \
+ lstrlib.c \
+ liolib.c \
+ lmathlib.c \
+ loslib.c \
+ lbaselib.c \
+ lbitlib.c \
+ lcorolib.c \
+ ldblib.c)
+
+PROJECT := invariant_core
+TARGET := $(PROJECT).a
+BIN_DIR := ../../bin/$(ARCH_DIR)
+TMP_DIR := ../../tmp/lin/$(PROJECT)/$(ARCH_DIR)/ICORE
+DEFINES := -DSCI_NAMESPACE -DTIXML_USE_STL -DSPV_LIBRARY -DSCI_LEXER -DSPV_LIBRARY -D_7ZIP_ST -DLUA_USE_MKSTEMP -DFFI_BUILDING -DLUA_USE_POSIX
+CFLAGS := -Wno-deprecated-declarations
+LFLAGS :=
+LIBS :=
+OBJCOMP :=
+
+TMP_DIR_CORE_INVAR := $(TMP_DIR)/CORE_INVAR
+TMP_DIR_CORE_INVAR_C := $(TMP_DIR)/CORE_INVAR_C
+
+OBJECTS_CORE_INVAR := $(addsuffix .o, $(addprefix $(TMP_DIR_CORE_INVAR)/, $(SOURCES)))
+OBJECTS_CORE_INVAR_C := $(addsuffix .o, $(addprefix $(TMP_DIR_CORE_INVAR_C)/, $(SOURCES_C)))
+
+OBJECTS := $(OBJECTS_CORE_INVAR) $(OBJECTS_CORE_INVAR_C)
+
+PCH_DIR := $(TMP_DIR_CORE_INVAR)
+
+PCH_C := $(TMP_DIR_CORE_INVAR_C)/precompiled_c.h.gch
+
+$(PCH_C): precompiled_c.h $(TMP_DIR_CORE_INVAR_C)/.sentinel
+ $(CC) $(CFLAGS) $(INCFLAGS) -x c-header precompiled_c.c -o $(PCH_C)
+
+include ../../lin_common.mak
+
+clean:
+ -$(DEL_FILE) $(abspath $(OBJECTS))
+ -$(DEL_FILE) $(PCH_CPP) $(PCH_C)
+ -$(DEL_FILE) $(BIN_TARGET)
+
+$(TMP_DIR_CORE_INVAR)/%.o: % $(PCH_CPP) $(TMP_DIR_CORE_INVAR)/%/../.sentinel
+ $(CXX) -c -include-pch $(PCH_CPP) $(CXXFLAGS) $(INCFLAGS) -o $(abspath $@) $(abspath $<)
+
+$(TMP_DIR_CORE_INVAR_C)/%.o: % $(PCH_C) $(TMP_DIR_CORE_INVAR_C)/%/../.sentinel
+ $(CC) -c -include-pch $(PCH_C) $(CFLAGS) $(INCFLAGS) -o $(abspath $@) $(abspath $<)
+
+$(BIN_TARGET): $(OBJECTS) $(BIN_DIR)/.sentinel $(OBJCOMP)
+ ar $(SLIBFLAGS) $(BIN_TARGET) $(abspath $(OBJECTS)) $(OBJCOMP)
diff --git a/core/invariant/lin_invariant_core32.mak b/core/invariant/lin_invariant_core32.mak
new file mode 100644
index 0000000..b2d292f
--- /dev/null
+++ b/core/invariant/lin_invariant_core32.mak
@@ -0,0 +1,3 @@
+ARCH := i386-linux-gnu
+ARCH_DIR := 32
+include lin_invariant_core.mak
diff --git a/core/invariant/lin_invariant_core64.mak b/core/invariant/lin_invariant_core64.mak
new file mode 100644
index 0000000..2ecbadf
--- /dev/null
+++ b/core/invariant/lin_invariant_core64.mak
@@ -0,0 +1,3 @@
+ARCH := x86_64-linux-gnu
+ARCH_DIR := 64
+include lin_invariant_core.mak
diff --git a/core/invariant/mac_invariant_core.mak b/core/invariant/mac_invariant_core.mak
new file mode 100644
index 0000000..b27e685
--- /dev/null
+++ b/core/invariant/mac_invariant_core.mak
@@ -0,0 +1,124 @@
+SOURCES := \
+ $(addprefix ../../third-party/tinyxml/, \
+ tinyxml.cpp \
+ tinyxmlparser.cpp \
+ tinyxmlerr.cpp) \
+ $(addprefix ../../third-party/scintilla/, \
+ XPM.cxx \
+ WordList.cxx \
+ ViewStyle.cxx \
+ UniConversion.cxx \
+ StyleContext.cxx \
+ Style.cxx \
+ Selection.cxx \
+ ScintillaBase.cxx \
+ RunStyles.cxx \
+ RESearch.cxx \
+ PropSetSimple.cxx \
+ PositionCache.cxx \
+ PerLine.cxx \
+ LineMarker.cxx \
+ LexerSimple.cxx \
+ LexerModule.cxx \
+ LexerBase.cxx \
+ LexLua.cxx \
+ KeyMap.cxx \
+ Indicator.cxx \
+ ExternalLexer.cxx \
+ Editor.cxx \
+ Document.cxx \
+ Decoration.cxx \
+ ContractionState.cxx \
+ CharacterSet.cxx \
+ CharClassify.cxx \
+ CellBuffer.cxx \
+ Catalogue.cxx \
+ CaseFolder.cxx \
+ CaseConvert.cxx \
+ CallTip.cxx \
+ AutoComplete.cxx \
+ Accessor.cxx)
+
+SOURCES_C := \
+ $(addprefix ../../third-party/demangle/, \
+ cp-demangle.c \
+ undname.c \
+ unmangle.c) \
+ $(addprefix ../../third-party/lzma/, \
+ Alloc.c \
+ LzFind.c \
+ LzmaEnc.c) \
+ $(addprefix ../../third-party/lua/, \
+ lapi.c \
+ lauxlib.c \
+ lstate.c \
+ ldebug.c \
+ lzio.c \
+ llex.c \
+ lctype.c \
+ lvm.c \
+ ldump.c \
+ ltm.c \
+ lstring.c \
+ lundump.c \
+ lobject.c \
+ lparser.c \
+ lcode.c \
+ lmem.c \
+ ltable.c \
+ ldo.c \
+ lgc.c \
+ lfunc.c \
+ linit.c \
+ lopcodes.c \
+ loadlib.c \
+ ltablib.c \
+ lstrlib.c \
+ liolib.c \
+ lmathlib.c \
+ loslib.c \
+ lbaselib.c \
+ lbitlib.c \
+ lcorolib.c \
+ ldblib.c)
+
+PROJECT := invariant_core
+TARGET := $(PROJECT).a
+BIN_DIR := ../../bin/$(ARCH_DIR)
+TMP_DIR := ../../tmp/mac/$(PROJECT)/$(ARCH_DIR)/ICORE
+DEFINES := -DSCI_NAMESPACE -DTIXML_USE_STL -DSPV_LIBRARY -DSCI_LEXER -DSPV_LIBRARY -D_7ZIP_ST -DFFI_BUILDING -DLUA_USE_POSIX
+CFLAGS := -Wno-deprecated-declarations
+LFLAGS :=
+LIBS :=
+OBJCOMP :=
+
+TMP_DIR_CORE_INVAR := $(TMP_DIR)/CORE_INVAR
+TMP_DIR_CORE_INVAR_C := $(TMP_DIR)/CORE_INVAR_C
+
+OBJECTS_CORE_INVAR := $(addsuffix .o, $(addprefix $(TMP_DIR_CORE_INVAR)/, $(SOURCES)))
+OBJECTS_CORE_INVAR_C := $(addsuffix .o, $(addprefix $(TMP_DIR_CORE_INVAR_C)/, $(SOURCES_C)))
+
+OBJECTS := $(OBJECTS_CORE_INVAR) $(OBJECTS_CORE_INVAR_C)
+
+PCH_DIR := $(TMP_DIR_CORE_INVAR)
+
+PCH_C := $(TMP_DIR_CORE_INVAR_C)/precompiled_c.h.gch
+
+$(PCH_C): precompiled_c.h $(TMP_DIR_CORE_INVAR_C)/.sentinel
+ $(CC) $(CFLAGS) $(INCFLAGS) -x c-header precompiled_c.c -o $(PCH_C)
+
+include ../../mac_common.mak
+
+clean:
+ -$(DEL_FILE) $(abspath $(OBJECTS))
+ -$(DEL_FILE) $(PCH_CPP) $(PCH_C)
+ -$(DEL_FILE) $(BIN_TARGET)
+
+$(TMP_DIR_CORE_INVAR)/%.o: % $(PCH_CPP) $(TMP_DIR_CORE_INVAR)/%/../.sentinel
+ $(CXX) -c -include-pch $(PCH_CPP) $(CXXFLAGS) $(INCFLAGS) -o $(abspath $@) $(abspath $<)
+
+$(TMP_DIR_CORE_INVAR_C)/%.o: % $(PCH_C) $(TMP_DIR_CORE_INVAR_C)/%/../.sentinel
+ $(CC) -c -include-pch $(PCH_C) $(CFLAGS) $(INCFLAGS) -o $(abspath $@) $(abspath $<)
+
+$(BIN_TARGET): $(OBJECTS) $(BIN_DIR)/.sentinel $(OBJCOMP)
+ libtool $(SLIBFLAGS) -o $(BIN_TARGET) $(abspath $(OBJECTS)) $(OBJCOMP)
diff --git a/core/invariant/mac_invariant_core32.mak b/core/invariant/mac_invariant_core32.mak
new file mode 100644
index 0000000..77d5f72
--- /dev/null
+++ b/core/invariant/mac_invariant_core32.mak
@@ -0,0 +1,3 @@
+ARCH := i386
+ARCH_DIR := 32
+include mac_invariant_core.mak
diff --git a/core/invariant/mac_invariant_core64.mak b/core/invariant/mac_invariant_core64.mak
new file mode 100644
index 0000000..cd8c42f
--- /dev/null
+++ b/core/invariant/mac_invariant_core64.mak
@@ -0,0 +1,3 @@
+ARCH := x86_64
+ARCH_DIR := 64
+include mac_invariant_core.mak
diff --git a/core/invariant/precompiled.cc b/core/invariant/precompiled.cc
new file mode 100644
index 0000000..9664b9d
--- /dev/null
+++ b/core/invariant/precompiled.cc
@@ -0,0 +1,92 @@
+#include "precompiled.h"
+
+#ifdef CHECKED
+const int PATTERN = 0xAA;
+void *mynew(size_t s)
+{
+ uint8_t *ptr = (uint8_t *)malloc(s + 8);
+ if(ptr)
+ {
+ memset(ptr, PATTERN, s + 8);
+ return ptr + 4;
+ } else
+ {
+ abort();
+ }
+ return NULL;
+}
+
+void *operator new(size_t s) //throw(std::bad_alloc)
+{
+ return mynew(s);
+}
+
+void *operator new[](std::size_t s) //throw(std::bad_alloc)
+{
+ return mynew(s);
+}
+
+void *operator new(size_t s, const std::nothrow_t &) throw()
+{
+ return mynew(s);
+}
+
+void *operator new[](size_t s, const std::nothrow_t &) throw()
+{
+ return mynew(s);
+}
+
+void mydelete(void *p)
+{
+ if(p)
+ {
+ uint8_t *realp = (uint8_t *)p - 4;
+#ifdef VMP_GNU
+ size_t s = malloc_usable_size(realp);
+#else
+ size_t s = _msize(realp);
+#endif
+ uint8_t *endp = realp + s;
+ for(int i = 0; i < 4; i++)
+ {
+ bool needAbort = false;
+ if(realp[i] != PATTERN)
+ {
+ std::cout << "Heap underflow at " << p << std::endl;
+ needAbort = true;
+ }
+ if(*--endp != PATTERN)
+ {
+ std::cout << "Heap overflow at " << p << std::endl;
+ needAbort = true;
+ }
+ if(needAbort)
+ {
+ abort();
+ }
+ }
+ memset(realp, 0x55, s);
+ free(realp);
+ }
+
+}
+void operator delete(void *p) throw()
+{
+ mydelete(p);
+}
+void operator delete[](void *p) throw()
+{
+ mydelete(p);
+}
+
+void operator delete[](void *p, const std::nothrow_t &) throw()
+{
+ mydelete(p);
+}
+
+void operator delete(void *p, const std::nothrow_t &) throw()
+{
+ mydelete(p);
+}
+
+#endif \ No newline at end of file
diff --git a/core/invariant/precompiled.h b/core/invariant/precompiled.h
new file mode 100644
index 0000000..f333638
--- /dev/null
+++ b/core/invariant/precompiled.h
@@ -0,0 +1,24 @@
+#pragma once
+#ifndef ICORE_PCH
+#define ICORE_PCH
+
+#include "../../runtime/precommon.h"
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <assert.h>
+#include <iostream>
+#include <sstream>
+#include <stdarg.h>
+#include <vector>
+#include <cstring>
+#include <math.h>
+#include <map>
+#include <memory>
+#include <stdexcept>
+
+#ifndef SCI_LEXER
+#error "Please define SCI_LEXER macro for syntax highlighter"
+#endif
+
+#endif //ICORE_PCH \ No newline at end of file
diff --git a/core/invariant/precompiled_c.c b/core/invariant/precompiled_c.c
new file mode 100644
index 0000000..c4abf16
--- /dev/null
+++ b/core/invariant/precompiled_c.c
@@ -0,0 +1 @@
+#include "precompiled_c.h" \ No newline at end of file
diff --git a/core/invariant/precompiled_c.h b/core/invariant/precompiled_c.h
new file mode 100644
index 0000000..73156fa
--- /dev/null
+++ b/core/invariant/precompiled_c.h
@@ -0,0 +1,33 @@
+#pragma once
+#ifndef ICORE_C_PCH
+#define ICORE_C_PCH
+
+#include "../../runtime/precommon.h"
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <assert.h>
+#include <setjmp.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <limits.h>
+#include <errno.h>
+#include <locale.h>
+#include <math.h>
+#include <time.h>
+#include <float.h>
+
+#ifdef _WIN32
+#ifdef WIN_DRIVER
+#include <windef.h>
+#else
+#include <windows.h>
+#endif
+#endif
+
+#ifdef VMP_GNU
+#else
+#include <process.h>
+#endif
+
+#endif //ICORE_C_PCH \ No newline at end of file