Commit 2a3135c9 authored by David Schleef's avatar David Schleef

Merge codemem functions into one source file

parent 3080bbd7
......@@ -88,16 +88,15 @@ fi
case "${host_os}" in
mingw*|cygwin*)
CODEMEM_BACKEND=win32
AC_DEFINE(HAVE_CODEMEM_MALLOC, 1, [Use malloc to allocate code for execution])
;;
linux*|darwin*|solaris*|netbsd*|freebsd*|openbsd*)
CODEMEM_BACKEND=linux
AC_DEFINE(HAVE_CODEMEM_MMAP, 1, [Use mmap to allocate code for execution])
;;
*)
AC_ERROR([no code allocation backend])
;;
esac
AC_SUBST(CODEMEM_BACKEND)
AC_DEFINE(ORC_EXPORTS, 1, [Defined for compiling internal code])
......
......@@ -12,6 +12,7 @@ liborc_@ORC_MAJORMINOR@_la_SOURCES = \
orc.c \
orcexecutor.c \
orcrule.c \
orccodemem.c \
orcprogram.c \
orcprogram-arm.c \
orcprogram-c.c \
......@@ -28,8 +29,6 @@ liborc_@ORC_MAJORMINOR@_la_SOURCES = \
x86.c \
arm.c
liborc_@ORC_MAJORMINOR@_la_SOURCES += orcprogram-@CODEMEM_BACKEND@.c
if HAVE_I386
liborc_@ORC_MAJORMINOR@_la_SOURCES += orccpu-x86.c
else
......
......@@ -15,6 +15,7 @@
#define SIZE 65536
#ifdef HAVE_CODEMEM_MMAP
void
orc_program_allocate_codemem (OrcProgram *program)
{
......@@ -53,4 +54,18 @@ orc_program_allocate_codemem (OrcProgram *program)
program->code_size = SIZE;
program->codeptr = program->code;
}
#endif
#ifdef HAVE_CODEMEM_MALLOC
void
orc_program_allocate_codemem (OrcProgram *program)
{
/* Now you know why Windows has viruses */
program->code = malloc(SIZE);
program->code_exec = program->code;
program->code_size = SIZE;
program->codeptr = program->code;
}
#endif
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <orc/orcprogram.h>
#define SIZE 65536
void
orc_program_allocate_codemem (OrcProgram *program)
{
/* Now you know why Windows has viruses */
program->code = malloc(SIZE);
program->code_exec = program->code;
program->code_size = SIZE;
program->codeptr = program->code;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment