Merge remote-tracking branch 'origin/master' into feature/machine_and_kb
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
#include "codegen_ops.h"
|
#include "codegen_ops.h"
|
||||||
#include "codegen_ops_x86-64.h"
|
#include "codegen_ops_x86-64.h"
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__unix__) || defined(__APPLE__)
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -64,15 +64,10 @@ void codegen_init()
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
|
||||||
void *start;
|
|
||||||
size_t len;
|
|
||||||
long pagesize = sysconf(_SC_PAGESIZE);
|
|
||||||
long pagemask = ~(pagesize - 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if _WIN64
|
#if _WIN64
|
||||||
codeblock = VirtualAlloc(NULL, BLOCK_SIZE * sizeof(codeblock_t), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
codeblock = VirtualAlloc(NULL, BLOCK_SIZE * sizeof(codeblock_t), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
|
#elif defined(__unix__) || defined(__APPLE__)
|
||||||
|
codeblock = mmap(NULL, BLOCK_SIZE * sizeof(codeblock_t), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, 0, 0);
|
||||||
#else
|
#else
|
||||||
codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t));
|
codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t));
|
||||||
#endif
|
#endif
|
||||||
@@ -83,16 +78,6 @@ void codegen_init()
|
|||||||
|
|
||||||
for (c = 0; c < BLOCK_SIZE; c++)
|
for (c = 0; c < BLOCK_SIZE; c++)
|
||||||
codeblock[c].valid = 0;
|
codeblock[c].valid = 0;
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
|
||||||
start = (void *)((long)codeblock & pagemask);
|
|
||||||
len = ((BLOCK_SIZE * sizeof(codeblock_t)) + pagesize) & pagemask;
|
|
||||||
if (mprotect(start, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
|
|
||||||
{
|
|
||||||
perror("mprotect");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void codegen_reset()
|
void codegen_reset()
|
||||||
|
@@ -61,7 +61,7 @@
|
|||||||
#include "codegen_ops.h"
|
#include "codegen_ops.h"
|
||||||
#include "codegen_ops_x86.h"
|
#include "codegen_ops_x86.h"
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __unix__
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1173,15 +1173,10 @@ static uint32_t gen_MEM_CHECK_WRITE_L()
|
|||||||
|
|
||||||
void codegen_init()
|
void codegen_init()
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
|
||||||
void *start;
|
|
||||||
size_t len;
|
|
||||||
long pagesize = sysconf(_SC_PAGESIZE);
|
|
||||||
long pagemask = ~(pagesize - 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
codeblock = VirtualAlloc(NULL, (BLOCK_SIZE+1) * sizeof(codeblock_t), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
codeblock = VirtualAlloc(NULL, (BLOCK_SIZE+1) * sizeof(codeblock_t), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
|
#elif defined __unix__
|
||||||
|
codeblock = mmap(NULL, (BLOCK_SIZE+1) * sizeof(codeblock_t), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE, 0, 0);
|
||||||
#else
|
#else
|
||||||
codeblock = malloc((BLOCK_SIZE+1) * sizeof(codeblock_t));
|
codeblock = malloc((BLOCK_SIZE+1) * sizeof(codeblock_t));
|
||||||
#endif
|
#endif
|
||||||
@@ -1190,16 +1185,6 @@ void codegen_init()
|
|||||||
memset(codeblock, 0, (BLOCK_SIZE+1) * sizeof(codeblock_t));
|
memset(codeblock, 0, (BLOCK_SIZE+1) * sizeof(codeblock_t));
|
||||||
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
start = (void *)((long)codeblock & pagemask);
|
|
||||||
len = (((BLOCK_SIZE+1) * sizeof(codeblock_t)) + pagesize) & pagemask;
|
|
||||||
if (mprotect(start, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
|
|
||||||
{
|
|
||||||
perror("mprotect");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
block_current = BLOCK_SIZE;
|
block_current = BLOCK_SIZE;
|
||||||
block_pos = 0;
|
block_pos = 0;
|
||||||
mem_abrt_rout = (uint32_t)&codeblock[block_current].data[block_pos];
|
mem_abrt_rout = (uint32_t)&codeblock[block_current].data[block_pos];
|
||||||
|
@@ -249,6 +249,12 @@ wchar_t* plat_get_string(int i)
|
|||||||
return L"Make sure libpcap is installed and that you are on a libpcap-compatible network connection.";
|
return L"Make sure libpcap is installed and that you are on a libpcap-compatible network connection.";
|
||||||
case IDS_2114:
|
case IDS_2114:
|
||||||
return L"Unable to initialize Ghostscript";
|
return L"Unable to initialize Ghostscript";
|
||||||
|
case IDS_2063:
|
||||||
|
return L"Machine \"%hs\" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine.";
|
||||||
|
case IDS_2064:
|
||||||
|
return L"Video card \"%hs\" is not available due to missing ROMs in the roms/video directory. Switching to an available video card.";
|
||||||
|
case IDS_2128:
|
||||||
|
return L"Hardware not available";
|
||||||
}
|
}
|
||||||
return L"";
|
return L"";
|
||||||
}
|
}
|
||||||
|
@@ -1304,13 +1304,19 @@ ui_init(int nCmdShow)
|
|||||||
wincl.lpfnWndProc = MainWindowProcedure;
|
wincl.lpfnWndProc = MainWindowProcedure;
|
||||||
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
|
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
|
||||||
wincl.cbSize = sizeof(WNDCLASSEX);
|
wincl.cbSize = sizeof(WNDCLASSEX);
|
||||||
wincl.hIcon = LoadIcon(hinstance, (LPCTSTR)10);
|
wincl.hIcon = NULL;
|
||||||
wincl.hIconSm = LoadIcon(hinstance, (LPCTSTR)10);
|
wincl.hIconSm = NULL;
|
||||||
wincl.hCursor = NULL;
|
wincl.hCursor = NULL;
|
||||||
wincl.lpszMenuName = NULL;
|
wincl.lpszMenuName = NULL;
|
||||||
wincl.cbClsExtra = 0;
|
wincl.cbClsExtra = 0;
|
||||||
wincl.cbWndExtra = 0;
|
wincl.cbWndExtra = 0;
|
||||||
wincl.hbrBackground = CreateSolidBrush(RGB(0,0,0));
|
wincl.hbrBackground = CreateSolidBrush(RGB(0,0,0));
|
||||||
|
|
||||||
|
/* Load proper icons */
|
||||||
|
wchar_t path[MAX_PATH + 1] = {0};
|
||||||
|
GetModuleFileNameW(hinstance, path, MAX_PATH);
|
||||||
|
ExtractIconExW(path, 0, &wincl.hIcon, &wincl.hIconSm, 1);
|
||||||
|
|
||||||
if (! RegisterClassEx(&wincl))
|
if (! RegisterClassEx(&wincl))
|
||||||
return(2);
|
return(2);
|
||||||
wincl.lpszClassName = SUB_CLASS_NAME;
|
wincl.lpszClassName = SUB_CLASS_NAME;
|
||||||
|
Reference in New Issue
Block a user