mirror of
https://github.com/Alukym/VMProtect-Source.git
synced 2025-06-28 07:28:09 -05:00
Initial commit
This commit is contained in:
124
core/invariant/lin_invariant_core.mak
Normal file
124
core/invariant/lin_invariant_core.mak
Normal file
@ -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)
|
3
core/invariant/lin_invariant_core32.mak
Normal file
3
core/invariant/lin_invariant_core32.mak
Normal file
@ -0,0 +1,3 @@
|
||||
ARCH := i386-linux-gnu
|
||||
ARCH_DIR := 32
|
||||
include lin_invariant_core.mak
|
3
core/invariant/lin_invariant_core64.mak
Normal file
3
core/invariant/lin_invariant_core64.mak
Normal file
@ -0,0 +1,3 @@
|
||||
ARCH := x86_64-linux-gnu
|
||||
ARCH_DIR := 64
|
||||
include lin_invariant_core.mak
|
124
core/invariant/mac_invariant_core.mak
Normal file
124
core/invariant/mac_invariant_core.mak
Normal file
@ -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)
|
3
core/invariant/mac_invariant_core32.mak
Normal file
3
core/invariant/mac_invariant_core32.mak
Normal file
@ -0,0 +1,3 @@
|
||||
ARCH := i386
|
||||
ARCH_DIR := 32
|
||||
include mac_invariant_core.mak
|
3
core/invariant/mac_invariant_core64.mak
Normal file
3
core/invariant/mac_invariant_core64.mak
Normal file
@ -0,0 +1,3 @@
|
||||
ARCH := x86_64
|
||||
ARCH_DIR := 64
|
||||
include mac_invariant_core.mak
|
92
core/invariant/precompiled.cc
Normal file
92
core/invariant/precompiled.cc
Normal file
@ -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
|
24
core/invariant/precompiled.h
Normal file
24
core/invariant/precompiled.h
Normal file
@ -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
|
1
core/invariant/precompiled_c.c
Normal file
1
core/invariant/precompiled_c.c
Normal file
@ -0,0 +1 @@
|
||||
#include "precompiled_c.h"
|
33
core/invariant/precompiled_c.h
Normal file
33
core/invariant/precompiled_c.h
Normal file
@ -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
|
Reference in New Issue
Block a user