2 * Copyright (C) 2003, 2004, 2005, 2006, 2007
3 * Robert Lougher <rob@lougher.org.uk>.
5 * This file is part of JamVM.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2,
10 * or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 /* Override default min and max heap sizes. ARM machines are
25 usually embedded, and the standard defaults are too large. */
26 #define DEFAULT_MAX_HEAP 16*MB
27 #define DEFAULT_MIN_HEAP 1*MB
30 #define HANDLER_TABLE_T static const void
32 #define HANDLER_TABLE_T void
35 #if defined(__VFP_FP__) || defined(__ARMEB__)
36 #define DOUBLE_1_BITS 0x3ff0000000000000LL
38 #define DOUBLE_1_BITS 0x000000003ff00000LL
41 #if defined(__VFP_FP__) || defined(__ARMEB__)
42 #define READ_DBL(v,p,l) v = ((u8)p[0]<<56)|((u8)p[1]<<48)|((u8)p[2]<<40) \
43 |((u8)p[3]<<32)|((u8)p[4]<<24)|((u8)p[5]<<16) \
44 |((u8)p[6]<<8)|(u8)p[7]; p+=8
46 #define READ_DBL(v,p,l) v = ((u8)p[4]<<56)|((u8)p[5]<<48)|((u8)p[6]<<40) \
47 |((u8)p[7]<<32)|((u8)p[0]<<24)|((u8)p[1]<<16) \
48 |((u8)p[2]<<8)|(u8)p[3]; p+=8
51 /* Needed for i386 -- empty here */
54 #define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val) \
56 int result, read_val; \
57 __asm__ __volatile__ (" \
59 1: swp %1, %1, [%2]; \
67 : "=&r" (result), "=&r" (read_val) \
68 : "r" (addr), "r" (old_val), "r" (new_val) \
73 #define LOCKWORD_READ(addr) \
76 __asm__ __volatile__ (" \
80 : "=&r" (read_val) : "r" (addr) : "cc"); \
84 #define LOCKWORD_WRITE(addr, new_val) \
87 __asm__ __volatile__ (" \
89 1: swp %0, %0, [%1]; \
94 : "r" (addr), "r" (new_val) \
100 #define FLUSH_CACHE(addr, length) \
102 __asm__ __volatile__ (" \
110 : "r" (addr), "r" (addr + length - 1) \
111 : "r0", "r1", "r2", "r7"); \
114 #define FLUSH_CACHE(addr, length) \
116 __asm__ __volatile__ (" \
122 : "r" (addr), "r" (addr + length - 1) \
123 : "r0", "r1", "r2"); \
127 #define MBARRIER() __asm__ __volatile__ ("" ::: "memory")
128 #define UNLOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory")
129 #define JMM_LOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory")
130 #define JMM_UNLOCK_MBARRIER() __asm__ __volatile__ ("" ::: "memory")