initial import of linux support

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40356
This commit is contained in:
David Anderson
2007-01-25 09:19:38 +00:00
parent 25ed99ac60
commit 3e936bbd88
26 changed files with 203 additions and 83 deletions
+2 -4
View File
@@ -285,7 +285,7 @@ int BaseContext::HeapPop(cell_t local_addr)
addr = (cell_t *)(ctx->memory + local_addr);
cellcount = (*addr) * sizeof(cell_t);
/* check if this memory count looks valid */
if (ctx->hp - cellcount - sizeof(cell_t) != local_addr)
if ((signed)(ctx->hp - cellcount - sizeof(cell_t)) != local_addr)
{
return SP_ERROR_INVALID_ADDRESS;
}
@@ -596,8 +596,6 @@ int BaseContext::PushCellArray(cell_t *local_addr, cell_t **phys_addr, cell_t ar
int BaseContext::LocalToString(cell_t local_addr, char **addr)
{
int len = 0;
if (((local_addr >= ctx->hp) && (local_addr < ctx->sp)) || (local_addr < 0) || ((ucell_t)local_addr >= ctx->mem_size))
{
return SP_ERROR_INVALID_ADDRESS;
@@ -855,7 +853,7 @@ IPluginFunction *BaseContext::GetFunctionById(funcid_t func_id)
m_priv_funcs[func_id] = new CFunction(save, this);
pFunc = m_priv_funcs[func_id];
}
#endif 0
#endif
assert(false);
}
+3 -3
View File
@@ -10,7 +10,7 @@
#if defined WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else if defined __GNUC__
#elif defined __GNUC__
#include <sys/mman.h>
#endif
@@ -85,7 +85,7 @@ void *SourcePawnEngine::ExecAlloc(size_t size)
{
#if defined WIN32
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else if defined __GNUC__
#elif defined __GNUC__
void *base = memalign(sysconf(_SC_PAGESIZE), size);
if (mprotect(base, size, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
{
@@ -100,7 +100,7 @@ void SourcePawnEngine::ExecFree(void *address)
{
#if defined WIN32
VirtualFree(address, 0, MEM_RELEASE);
#else if defined __GNUC__
#elif defined __GNUC__
free(address);
#endif
}
+2 -2
View File
@@ -27,10 +27,10 @@ public:
virtual void ResetTrace();
virtual const char *GetLastNative(uint32_t *index);
private:
int m_Error;
const char *m_pMsg;
TracedCall *m_pStart;
TracedCall *m_pIterator;
const char *m_pMsg;
int m_Error;
uint32_t m_Native;
};
+1
View File
@@ -1,4 +1,5 @@
#include <stdio.h>
#include <string.h>
#include "PluginSys.h"
/********************