]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
add jit-arch-generic.h and jit-arch-x86.h files
authorAleksey Demakov <ademakov@gmail.com>
Mon, 25 Sep 2006 06:56:36 +0000 (06:56 +0000)
committerAleksey Demakov <ademakov@gmail.com>
Mon, 25 Sep 2006 06:56:36 +0000 (06:56 +0000)
include/jit/jit-arch-generic.h [new file with mode: 0644]
include/jit/jit-arch-x86.h [new file with mode: 0644]

diff --git a/include/jit/jit-arch-generic.h b/include/jit/jit-arch-generic.h
new file mode 100644 (file)
index 0000000..9bc45a9
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * jit-arch-generic.h - Architecture-specific definitions.
+ *
+ * Copyright (C) 2006  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef        _JIT_ARCH_GENERIC_H
+#define        _JIT_ARCH_GENERIC_H
+
+/*
+ * If defined _JIT_ARCH_GET_CURRENT_FRAME() macro assigns the current frame
+ * pointer to the supplied argument that has to be a void pointer.
+ */
+#undef _JIT_ARCH_GET_CURRENT_FRAME
+
+#endif /* _JIT_ARCH_GENERIC_H */
diff --git a/include/jit/jit-arch-x86.h b/include/jit/jit-arch-x86.h
new file mode 100644 (file)
index 0000000..aa2b34d
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * jit-arch-x86.h - Architecture-specific definitions.
+ *
+ * Copyright (C) 2006  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef        _JIT_ARCH_X86_H
+#define        _JIT_ARCH_X86_H
+
+/*
+ * If defined _JIT_ARCH_GET_CURRENT_FRAME() macro assigns the current frame
+ * pointer to the supplied argument that has to be a void pointer.
+ */
+#if defined(__GNUC__)
+#define _JIT_ARCH_GET_CURRENT_FRAME(f)         \
+       asm("movl %%ebp, %0" : "=g" (f))
+#elif defined(_MSC_VER) && defined(_M_IX86)
+#define        _JIT_ARCH_GET_CURRENT_FRAME(f)          \
+       do {                                    \
+               __asm                           \
+               {                               \
+                       mov dword ptr f, ebp    \
+               }                               \
+       } while(0)
+#else
+#undef _JIT_ARCH_GET_CURRENT_FRAME
+#endif
+
+#endif /* _JIT_ARCH_X86_H */