bellard | 7963856 | 2003-06-15 19:46:57 +0000 | [diff] [blame] | 1 | /* |
| 2 | * dyngen defines for micro operation code |
| 3 | * |
| 4 | * Copyright (c) 2003 Fabrice Bellard |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
Blue Swirl | 8167ee8 | 2009-07-16 20:47:01 +0000 | [diff] [blame] | 17 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
bellard | 7963856 | 2003-06-15 19:46:57 +0000 | [diff] [blame] | 18 | */ |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 19 | #if !defined(__DYNGEN_EXEC_H__) |
| 20 | #define __DYNGEN_EXEC_H__ |
| 21 | |
Stefan Weil | 7316329 | 2011-10-05 20:03:02 +0200 | [diff] [blame] | 22 | #if defined(CONFIG_TCG_INTERPRETER) |
| 23 | /* The TCG interpreter does not need a special register AREG0, |
| 24 | * but it is possible to use one by defining AREG0. |
| 25 | * On i386, register edi seems to work. */ |
| 26 | /* Run without special register AREG0 or use a value defined elsewhere. */ |
| 27 | #elif defined(__i386__) |
bellard | 7963856 | 2003-06-15 19:46:57 +0000 | [diff] [blame] | 28 | #define AREG0 "ebp" |
ths | 522777b | 2007-05-08 23:30:44 +0000 | [diff] [blame] | 29 | #elif defined(__x86_64__) |
ths | 43024c6 | 2007-02-10 18:21:04 +0000 | [diff] [blame] | 30 | #define AREG0 "r14" |
malc | e58ffeb | 2009-01-14 18:39:49 +0000 | [diff] [blame] | 31 | #elif defined(_ARCH_PPC) |
bellard | 7963856 | 2003-06-15 19:46:57 +0000 | [diff] [blame] | 32 | #define AREG0 "r27" |
ths | 522777b | 2007-05-08 23:30:44 +0000 | [diff] [blame] | 33 | #elif defined(__arm__) |
Peter Maydell | 05b922d | 2011-12-26 00:02:18 +0000 | [diff] [blame] | 34 | #define AREG0 "r6" |
aurel32 | f54b3f9 | 2008-04-12 20:14:54 +0000 | [diff] [blame] | 35 | #elif defined(__hppa__) |
| 36 | #define AREG0 "r17" |
ths | 522777b | 2007-05-08 23:30:44 +0000 | [diff] [blame] | 37 | #elif defined(__mips__) |
Stefan Weil | 60bf84c | 2010-04-09 17:28:40 +0200 | [diff] [blame] | 38 | #define AREG0 "s0" |
ths | 522777b | 2007-05-08 23:30:44 +0000 | [diff] [blame] | 39 | #elif defined(__sparc__) |
Juan Quintela | dfe5fff | 2009-07-27 16:12:40 +0200 | [diff] [blame] | 40 | #ifdef CONFIG_SOLARIS |
bellard | fdbb469 | 2006-06-14 17:32:25 +0000 | [diff] [blame] | 41 | #define AREG0 "g2" |
bellard | fdbb469 | 2006-06-14 17:32:25 +0000 | [diff] [blame] | 42 | #else |
bellard | 74ccb34 | 2006-07-18 21:23:34 +0000 | [diff] [blame] | 43 | #ifdef __sparc_v9__ |
blueswir1 | e97b640 | 2008-07-26 17:19:35 +0000 | [diff] [blame] | 44 | #define AREG0 "g5" |
bellard | 74ccb34 | 2006-07-18 21:23:34 +0000 | [diff] [blame] | 45 | #else |
bellard | 7963856 | 2003-06-15 19:46:57 +0000 | [diff] [blame] | 46 | #define AREG0 "g6" |
bellard | fdbb469 | 2006-06-14 17:32:25 +0000 | [diff] [blame] | 47 | #endif |
bellard | 74ccb34 | 2006-07-18 21:23:34 +0000 | [diff] [blame] | 48 | #endif |
ths | 522777b | 2007-05-08 23:30:44 +0000 | [diff] [blame] | 49 | #elif defined(__s390__) |
bellard | 7963856 | 2003-06-15 19:46:57 +0000 | [diff] [blame] | 50 | #define AREG0 "r10" |
ths | 522777b | 2007-05-08 23:30:44 +0000 | [diff] [blame] | 51 | #elif defined(__alpha__) |
bellard | 7963856 | 2003-06-15 19:46:57 +0000 | [diff] [blame] | 52 | /* Note $15 is the frame pointer, so anything in op-i386.c that would |
| 53 | require a frame pointer, like alloca, would probably loose. */ |
| 54 | #define AREG0 "$15" |
ths | 522777b | 2007-05-08 23:30:44 +0000 | [diff] [blame] | 55 | #elif defined(__mc68000) |
bellard | 38e584a | 2003-08-10 22:14:22 +0000 | [diff] [blame] | 56 | #define AREG0 "%a5" |
ths | 522777b | 2007-05-08 23:30:44 +0000 | [diff] [blame] | 57 | #elif defined(__ia64__) |
bellard | b8076a7 | 2005-04-07 22:20:31 +0000 | [diff] [blame] | 58 | #define AREG0 "r7" |
ths | 522777b | 2007-05-08 23:30:44 +0000 | [diff] [blame] | 59 | #else |
| 60 | #error unsupported CPU |
bellard | 7963856 | 2003-06-15 19:46:57 +0000 | [diff] [blame] | 61 | #endif |
| 62 | |
Stefan Weil | 7316329 | 2011-10-05 20:03:02 +0200 | [diff] [blame] | 63 | #if defined(AREG0) |
Andreas Färber | 9349b4f | 2012-03-14 01:38:32 +0100 | [diff] [blame] | 64 | register CPUArchState *env asm(AREG0); |
Stefan Weil | 7316329 | 2011-10-05 20:03:02 +0200 | [diff] [blame] | 65 | #else |
| 66 | /* TODO: Try env = cpu_single_env. */ |
Andreas Färber | 9349b4f | 2012-03-14 01:38:32 +0100 | [diff] [blame] | 67 | extern CPUArchState *env; |
Stefan Weil | 7316329 | 2011-10-05 20:03:02 +0200 | [diff] [blame] | 68 | #endif |
Blue Swirl | 3e45717 | 2011-07-13 12:44:15 +0000 | [diff] [blame] | 69 | |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 70 | #endif /* !defined(__DYNGEN_EXEC_H__) */ |