From 23ff7c4d398d1d3f4544225c04e1142b3f24b013 Mon Sep 17 00:00:00 2001 From: twisti Date: Thu, 11 Jan 2007 22:36:29 +0000 Subject: [PATCH] * src/mm/memory.c (mem_realloc): Fixed compiler warning. --- src/mm/memory.c | 6 +- src/vm/jit/m68k/Makefile.am | 40 ++++++++++ src/vm/jit/m68k/arch.h | 91 +++++++++++++++++++++++ src/vm/jit/m68k/asmpart.S | 28 +++++++ src/vm/jit/m68k/codegen.c | 3 + src/vm/jit/m68k/codegen.h | 7 ++ src/vm/jit/m68k/emit.c | 0 src/vm/jit/m68k/machine-instr.h | 15 ++++ src/vm/jit/m68k/md.c | 15 ++++ src/vm/jit/m68k/patcher.c | 0 src/vm/jit/m68k/uclinux/Makefile.am | 56 ++++++++++++++ src/vm/jit/m68k/uclinux/md-abi.c | 0 src/vm/jit/m68k/uclinux/md-abi.h | 109 ++++++++++++++++++++++++++++ src/vm/jit/m68k/uclinux/md-asm.h | 0 src/vm/jit/m68k/uclinux/md-os.c | 0 15 files changed, 369 insertions(+), 1 deletion(-) create mode 100644 src/vm/jit/m68k/Makefile.am create mode 100644 src/vm/jit/m68k/arch.h create mode 100644 src/vm/jit/m68k/asmpart.S create mode 100644 src/vm/jit/m68k/codegen.c create mode 100644 src/vm/jit/m68k/codegen.h create mode 100644 src/vm/jit/m68k/emit.c create mode 100644 src/vm/jit/m68k/machine-instr.h create mode 100644 src/vm/jit/m68k/md.c create mode 100644 src/vm/jit/m68k/patcher.c create mode 100644 src/vm/jit/m68k/uclinux/Makefile.am create mode 100644 src/vm/jit/m68k/uclinux/md-abi.c create mode 100644 src/vm/jit/m68k/uclinux/md-abi.h create mode 100644 src/vm/jit/m68k/uclinux/md-asm.h create mode 100644 src/vm/jit/m68k/uclinux/md-os.c diff --git a/src/mm/memory.c b/src/mm/memory.c index 2eaceb741..29ccae179 100644 --- a/src/mm/memory.c +++ b/src/mm/memory.c @@ -28,7 +28,7 @@ Christian Thalinger Edwin Steiner - $Id: memory.c 6286 2007-01-10 10:03:38Z twisti $ + $Id: memory.c 7205 2007-01-11 22:36:29Z twisti $ */ @@ -309,6 +309,10 @@ void *mem_realloc(void *src, s4 len1, s4 len2) { void *dst; + /* prevent compiler warnings */ + + dst = NULL; + if (src == NULL) if (len1 != 0) vm_abort("mem_realloc: reallocating memoryblock with address NULL, length != 0"); diff --git a/src/vm/jit/m68k/Makefile.am b/src/vm/jit/m68k/Makefile.am new file mode 100644 index 000000000..ff2bce107 --- /dev/null +++ b/src/vm/jit/m68k/Makefile.am @@ -0,0 +1,40 @@ +DIST_SUBDIRS = uclinux + +SUBDIRS = $(OS_DIR) + +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir) -I$(top_builddir)/src -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR)/$(OS_DIR) +AM_CCASFLAGS = $(AM_CPPFLAGS) + +LIBS = + +#BUILT_SOURCES = offsets.h + +CLEANFILES = offsets.h + +noinst_HEADERS = \ + arch.h \ + machine-instr.h + +noinst_LTLIBRARIES = libarch.la + +if ENABLE_DISASSEMBLER +DISASS_SOURCES = \ + disass.c +endif + +libarch_la_SOURCES = \ + asmpart.S \ + codegen.c \ + codegen.h \ + $(DISASS_SOURCES) \ + emit.c \ + md.c \ + patcher.c + +libarch_la_LIBADD = \ + $(OS_DIR)/libmd.la + $(srcdir)/asmpart.S: $(top_builddir)/config.h offsets.h + +#offsets.h: $(top_builddir)/src/vm/jit/tools/genoffsets $(top_builddir)/config.h +# $(top_builddir)/src/vm/jit/tools/genoffsets > offsets.h + diff --git a/src/vm/jit/m68k/arch.h b/src/vm/jit/m68k/arch.h new file mode 100644 index 000000000..da938a421 --- /dev/null +++ b/src/vm/jit/m68k/arch.h @@ -0,0 +1,91 @@ +/* src/vm/jit/m68k/arch.h - architecture defines for m68k + + Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, + C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, + E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, + J. Wenninger, Institut f. Computersprachen - TU Wien + + This file is part of CACAO. + + 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Contact: cacao@cacaojvm.org + + Authors: Roland Lezuo + + Changes: + + $Id: arch.h 5330 2006-09-05 18:43:12Z edwin $ + +*/ + + +#ifndef _ARCH_H +#define _ARCH_H + +/*#define USE_FAKE_ATOMIC_INSTRUCTIONS 0 */ + +/* define architecture features ***********************************************/ + +#define U8_AVAILABLE 1 + +#define USEBUILTINTABLE + +#define SUPPORT_DIVISION 0 +#define SUPPORT_LONG 0 +#define SUPPORT_FLOAT 0 +#define SUPPORT_DOUBLE 0 + +#define SUPPORT_FMOD 0 +#define SUPPORT_FICVT 0 +#define SUPPORT_IFCVT 0 + +#define SUPPORT_LONG_ADD 0 +#define SUPPORT_LONG_CMP 0 +#define SUPPORT_LONG_CMP_CONST 0 +#define SUPPORT_LONG_LOGICAL 0 +#define SUPPORT_LONG_SHIFT 0 +#define SUPPORT_LONG_MUL 0 +#define SUPPORT_LONG_DIV 0 +#define SUPPORT_LONG_ICVT 0 +#define SUPPORT_LONG_FCVT 0 + +#define SUPPORT_CONST_LOGICAL 0 /* AND, OR, XOR with immediates */ +#define SUPPORT_CONST_MUL 0 /* mutiply with immediate */ + +#define SUPPORT_CONST_STORE 0 /* do we support const stores */ +#define SUPPORT_CONST_STORE_ZERO_ONLY 0 /* on some risc machines we can */ + /* only store REG_ZERO */ + +#define SPECIALMEMUSE +/* #define HAS_4BYTE_STACKSLOT */ +/* #define SUPPORT_COMBINE_INTEGER_REGISTERS */ + +#endif /* _ARCH_H */ + + +/* + * These are local overrides for various environment variables in Emacs. + * Please do not remove this and leave it at the end of the file, where + * Emacs will automagically detect them. + * --------------------------------------------------------------------- + * Local variables: + * mode: c + * indent-tabs-mode: t + * c-basic-offset: 4 + * tab-width: 4 + * End: + */ diff --git a/src/vm/jit/m68k/asmpart.S b/src/vm/jit/m68k/asmpart.S new file mode 100644 index 000000000..957160be9 --- /dev/null +++ b/src/vm/jit/m68k/asmpart.S @@ -0,0 +1,28 @@ +.globl asm_vm_call_method +.globl asm_vm_call_method_int +.globl asm_vm_call_method_long +.globl asm_vm_call_method_float +.globl asm_vm_call_method_double +.globl asm_vm_call_method_exception_handler + +.globl asm_call_jit_compiler +.globl asm_getclassvalues_atomic +.globl asm_abstractmethoderror +.globl asm_criticalsections + + +asm_vm_call_method: +asm_vm_call_method_int: +asm_vm_call_method_long: +asm_vm_call_method_float: +asm_vm_call_method_double: + +asm_vm_call_method_exception_handler: + +asm_call_jit_compiler: + +asm_getclassvalues_atomic: + +asm_abstractmethoderror: + +asm_criticalsections: diff --git a/src/vm/jit/m68k/codegen.c b/src/vm/jit/m68k/codegen.c new file mode 100644 index 000000000..3a93412bf --- /dev/null +++ b/src/vm/jit/m68k/codegen.c @@ -0,0 +1,3 @@ +void codegen(void) {} +void createnativestub(void) {} +void createcompilerstub(void) {} diff --git a/src/vm/jit/m68k/codegen.h b/src/vm/jit/m68k/codegen.h new file mode 100644 index 000000000..ba209f4f4 --- /dev/null +++ b/src/vm/jit/m68k/codegen.h @@ -0,0 +1,7 @@ +#ifndef _CODEGEN_H +#define _CODEGEN_H + +#define PATCHER_CALL_SIZE 1 +#define BRANCH_NOPS 0 + +#endif diff --git a/src/vm/jit/m68k/emit.c b/src/vm/jit/m68k/emit.c new file mode 100644 index 000000000..e69de29bb diff --git a/src/vm/jit/m68k/machine-instr.h b/src/vm/jit/m68k/machine-instr.h new file mode 100644 index 000000000..d920d138d --- /dev/null +++ b/src/vm/jit/m68k/machine-instr.h @@ -0,0 +1,15 @@ +#ifndef _MACHINE_INSTR_H +#define _MACHINE_INSTR_H + +static inline long compare_and_swap(long *p, long oldval, long newval) +{ + assert(0); + return 0; +} + +#define STORE_ORDER_BARRIER() assert(0); +#define MEMORY_BARRIER_BEFORE_ATOMIC() assert(0); +#define MEMORY_BARRIER_AFTER_ATOMIC() assert(0); +#define MEMORY_BARRIER() assert(0); + +#endif diff --git a/src/vm/jit/m68k/md.c b/src/vm/jit/m68k/md.c new file mode 100644 index 000000000..43bbdb133 --- /dev/null +++ b/src/vm/jit/m68k/md.c @@ -0,0 +1,15 @@ +void md_init(void) {} + +void md_get_method_patch_address(void) {} +void md_icacheflush(void) {} +void md_stacktrace_get_returnaddress(void) {} +void md_codegen_get_pv_from_pc(void) {} +void md_signal_handler_sigsegv(void) {} +void md_codegen_patch_branch(void) {} +void md_cacheflush(void) {} +void md_param_alloc(void) {} +void md_return_alloc(void) {} + + +int nregdescint; +int nregdescfloat; diff --git a/src/vm/jit/m68k/patcher.c b/src/vm/jit/m68k/patcher.c new file mode 100644 index 000000000..e69de29bb diff --git a/src/vm/jit/m68k/uclinux/Makefile.am b/src/vm/jit/m68k/uclinux/Makefile.am new file mode 100644 index 000000000..5207e3d3a --- /dev/null +++ b/src/vm/jit/m68k/uclinux/Makefile.am @@ -0,0 +1,56 @@ +## src/vm/jit/powerpc64/linux/Makefile.am +## +## Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, +## C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, +## E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, +## J. Wenninger, Institut f. Computersprachen - TU Wien +## +## This file is part of CACAO. +## +## 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. +## +## Contact: cacao@cacaojvm.org +## +## Authors: Christian Thalinger +## +## Changes: +## +## $Id: Makefile.am 5081 2006-07-06 13:59:01Z tbfg $ + +## Process this file with automake to produce Makefile.in + +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/vm/jit/$(ARCH_DIR) + +LIBS = + +noinst_HEADERS = \ + md-asm.h + +noinst_LTLIBRARIES = libmd.la + +libmd_la_SOURCES = \ + md-abi.c \ + md-abi.h \ + md-os.c + + +## Local variables: +## mode: Makefile +## indent-tabs-mode: t +## c-basic-offset: 4 +## tab-width: 8 +## compile-command: "automake --add-missing" +## End: diff --git a/src/vm/jit/m68k/uclinux/md-abi.c b/src/vm/jit/m68k/uclinux/md-abi.c new file mode 100644 index 000000000..e69de29bb diff --git a/src/vm/jit/m68k/uclinux/md-abi.h b/src/vm/jit/m68k/uclinux/md-abi.h new file mode 100644 index 000000000..aefc1a8c3 --- /dev/null +++ b/src/vm/jit/m68k/uclinux/md-abi.h @@ -0,0 +1,109 @@ +/* src/vm/jit/m68k/linux/md-abi.h - defines for PowerPC64 Linux ABI + + Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, + C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, + E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, + J. Wenninger, Institut f. Computersprachen - TU Wien + + This file is part of CACAO. + + 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Contact: cacao@cacaojvm.org + + Authors: Roland Lezuo + + Changes: + + $Id: md-abi.h 5940 2006-11-09 09:59:28Z tbfg $ + +*/ + + +#ifndef _MD_ABI_H +#define _MD_ABI_H + +/* preallocated registers *****************************************************/ + +/* integer registers */ + +#define REG_TOC 2 /* TOC (see function descriptors ELF ABI) */ +#define REG_RESULT 3 /* to deliver method results */ + +#define REG_PV 14 /* procedure vector, must be provided by caller */ +#define REG_METHODPTR 12 /* pointer to the place from where the procedure */ + /* vector has been fetched */ +#define REG_ITMP1 11 /* temporary register */ +#define REG_ITMP2 12 /* temporary register and method pointer */ +#define REG_ITMP3 16 /* temporary register */ + +#define REG_ITMP1_XPTR 11 /* exception pointer = temporary register 1 */ +#define REG_ITMP2_XPC 12 /* exception pc = temporary register 2 */ + +#define REG_SP 1 /* stack pointer */ +#define REG_ZERO 0 /* almost always zero: only in address calc. */ + +/* floating point registers */ + +#define REG_FRESULT 1 /* to deliver floating point method results */ +#define REG_FTMP1 16 /* temporary floating point register */ +#define REG_FTMP2 17 /* temporary floating point register */ +#define REG_FTMP3 0 /* temporary floating point register */ + +#define REG_IFTMP 16 /* temporary integer and floating point register */ + + +#define INT_REG_CNT 32 /* number of integer registers */ +#define INT_SAV_CNT 9 /* number of int callee saved registers */ +#define INT_ARG_CNT 8 /* number of int argument registers */ +#define INT_TMP_CNT 7 /* number of integer temporary registers */ +#define INT_RES_CNT 8 /* number of integer reserved registers */ + +#define FLT_REG_CNT 32 /* number of float registers */ +#define FLT_SAV_CNT 16 /* number of float callee saved registers */ +#define FLT_ARG_CNT 13 /* number of float argument registers */ +#define FLT_TMP_CNT 0 /* number of float temporary registers */ +#define FLT_RES_CNT 3 /* number of float reserved registers */ + +#define TRACE_ARGS_NUM 8 + + +/* ABI defines ****************************************************************/ + +#define LA_SIZE 48 /* linkage area size */ +#define LA_SIZE_ALIGNED 16 /* linkage area size aligned to 16-byte */ +#define LA_SIZE_IN_POINTERS (LA_SIZE / SIZEOF_VOID_P) +#define LA_LR_OFFSET 16 /* link register offset in linkage area */ +#define PA_SIZE (PA_SIZE_IN_POINTERS*8) +#define PA_SIZE_IN_POINTERS 8 /* linux/ppc64 has a minimun parameter save area size, XXX:darwin? */ + +/* #define ALIGN_FRAME_SIZE(sp) (sp) */ + +#endif /* _MD_ABI_H */ + + +/* + * These are local overrides for various environment variables in Emacs. + * Please do not remove this and leave it at the end of the file, where + * Emacs will automagically detect them. + * --------------------------------------------------------------------- + * Local variables: + * mode: c + * indent-tabs-mode: t + * c-basic-offset: 4 + * tab-width: 4 + * End: + */ diff --git a/src/vm/jit/m68k/uclinux/md-asm.h b/src/vm/jit/m68k/uclinux/md-asm.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/vm/jit/m68k/uclinux/md-os.c b/src/vm/jit/m68k/uclinux/md-os.c new file mode 100644 index 000000000..e69de29bb -- 2.25.1