Commit b29fe3ed48c72e6a30a29c7fbdf3b841c59551c5
1 parent
14f87098
Preliminary AIX support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5732 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
7 changed files
with
79 additions
and
4 deletions
Makefile.target
configure
... | ... | @@ -32,7 +32,7 @@ ar="ar" |
32 | 32 | make="make" |
33 | 33 | install="install" |
34 | 34 | strip="strip" |
35 | -cpu=`uname -m` | |
35 | +cpu=`test $(uname -s) = AIX && uname -p || uname -m` | |
36 | 36 | target_list="" |
37 | 37 | case "$cpu" in |
38 | 38 | i386|i486|i586|i686|i86pc|BePC) |
... | ... | @@ -68,7 +68,7 @@ case "$cpu" in |
68 | 68 | mips64) |
69 | 69 | cpu="mips64" |
70 | 70 | ;; |
71 | - "Power Macintosh"|ppc|ppc64) | |
71 | + "Power Macintosh"|ppc|ppc64|powerpc) | |
72 | 72 | cpu="powerpc" |
73 | 73 | ;; |
74 | 74 | s390*) |
... | ... | @@ -117,6 +117,7 @@ mixemu="no" |
117 | 117 | bluez="yes" |
118 | 118 | kvm="yes" |
119 | 119 | kerneldir="" |
120 | +aix="no" | |
120 | 121 | |
121 | 122 | # OS specific |
122 | 123 | targetos=`uname -s` |
... | ... | @@ -206,6 +207,10 @@ SunOS) |
206 | 207 | fi |
207 | 208 | audio_possible_drivers="oss sdl" |
208 | 209 | ;; |
210 | +AIX) | |
211 | +aix="yes" | |
212 | +make="gmake" | |
213 | +;; | |
209 | 214 | *) |
210 | 215 | audio_drv_list="oss" |
211 | 216 | audio_possible_drivers="oss alsa sdl esd pa" |
... | ... | @@ -1220,6 +1225,12 @@ if test "$darwin" = "yes" ; then |
1220 | 1225 | echo "CONFIG_DARWIN=yes" >> $config_mak |
1221 | 1226 | echo "#define CONFIG_DARWIN 1" >> $config_h |
1222 | 1227 | fi |
1228 | + | |
1229 | +if test "$aix" = "yes" ; then | |
1230 | + echo "CONFIG_AIX=yes" >> $config_mak | |
1231 | + echo "#define CONFIG_AIX 1" >> $config_h | |
1232 | +fi | |
1233 | + | |
1223 | 1234 | if test "$solaris" = "yes" ; then |
1224 | 1235 | echo "CONFIG_SOLARIS=yes" >> $config_mak |
1225 | 1236 | echo "#define HOST_SOLARIS $solarisrev" >> $config_h | ... | ... |
fpu/softfloat.h
... | ... | @@ -50,8 +50,10 @@ these four paragraphs for those parts of this code that are retained. |
50 | 50 | typedef uint8_t flag; |
51 | 51 | typedef uint8_t uint8; |
52 | 52 | typedef int8_t int8; |
53 | +#ifndef _AIX | |
53 | 54 | typedef int uint16; |
54 | 55 | typedef int int16; |
56 | +#endif | |
55 | 57 | typedef unsigned int uint32; |
56 | 58 | typedef signed int int32; |
57 | 59 | typedef uint64_t uint64; | ... | ... |
net.c
... | ... | @@ -780,6 +780,12 @@ static int tap_open(char *ifname, int ifname_size) |
780 | 780 | fcntl(fd, F_SETFL, O_NONBLOCK); |
781 | 781 | return fd; |
782 | 782 | } |
783 | +#elif defined (_AIX) | |
784 | +static int tap_open(char *ifname, int ifname_size) | |
785 | +{ | |
786 | + fprintf (stderr, "no tap on AIX\n"); | |
787 | + return -1; | |
788 | +} | |
783 | 789 | #else |
784 | 790 | static int tap_open(char *ifname, int ifname_size) |
785 | 791 | { |
... | ... | @@ -1441,6 +1447,7 @@ int net_client_init(const char *device, const char *p) |
1441 | 1447 | vlan->nb_host_devs++; |
1442 | 1448 | ret = tap_win32_init(vlan, ifname); |
1443 | 1449 | } else |
1450 | +#elif defined (_AIX) | |
1444 | 1451 | #else |
1445 | 1452 | if (!strcmp(device, "tap")) { |
1446 | 1453 | char ifname[64]; | ... | ... |
tcg/ppc/tcg-target.c
... | ... | @@ -27,6 +27,9 @@ static uint8_t *tb_ret_addr; |
27 | 27 | #ifdef __APPLE__ |
28 | 28 | #define LINKAGE_AREA_SIZE 24 |
29 | 29 | #define LR_OFFSET 8 |
30 | +#elif defined _AIX | |
31 | +#define LINKAGE_AREA_SIZE 52 | |
32 | +#define LR_OFFSET 8 | |
30 | 33 | #else |
31 | 34 | #define LINKAGE_AREA_SIZE 8 |
32 | 35 | #define LR_OFFSET 4 |
... | ... | @@ -137,6 +140,9 @@ static const int tcg_target_callee_save_regs[] = { |
137 | 140 | TCG_REG_R11, |
138 | 141 | TCG_REG_R13, |
139 | 142 | #endif |
143 | +#ifdef _AIX | |
144 | + TCG_REG_R13, | |
145 | +#endif | |
140 | 146 | TCG_REG_R14, |
141 | 147 | TCG_REG_R15, |
142 | 148 | TCG_REG_R16, |
... | ... | @@ -455,6 +461,24 @@ static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target) |
455 | 461 | } |
456 | 462 | } |
457 | 463 | |
464 | +#ifdef _AIX | |
465 | +static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg) | |
466 | +{ | |
467 | + int reg; | |
468 | + | |
469 | + if (const_arg) { | |
470 | + reg = 2; | |
471 | + tcg_out_movi (s, TCG_TYPE_I32, reg, arg); | |
472 | + } | |
473 | + else reg = arg; | |
474 | + | |
475 | + tcg_out32 (s, LWZ | RT (0) | RA (reg)); | |
476 | + tcg_out32 (s, MTSPR | RA (0) | CTR); | |
477 | + tcg_out32 (s, LWZ | RT (2) | RA (reg) | 4); | |
478 | + tcg_out32 (s, BCCTR | BO_ALWAYS | LK); | |
479 | +} | |
480 | +#endif | |
481 | + | |
458 | 482 | #if defined(CONFIG_SOFTMMU) |
459 | 483 | |
460 | 484 | #include "../../softmmu_defs.h" |
... | ... | @@ -548,7 +572,11 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) |
548 | 572 | tcg_out_movi (s, TCG_TYPE_I32, 5, mem_index); |
549 | 573 | #endif |
550 | 574 | |
575 | +#ifdef _AIX | |
576 | + tcg_out_call (s, (tcg_target_long) qemu_ld_helpers[s_bits], 1); | |
577 | +#else | |
551 | 578 | tcg_out_b (s, LK, (tcg_target_long) qemu_ld_helpers[s_bits]); |
579 | +#endif | |
552 | 580 | switch (opc) { |
553 | 581 | case 0|4: |
554 | 582 | tcg_out32 (s, EXTSB | RA (data_reg) | RS (3)); |
... | ... | @@ -766,7 +794,11 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc) |
766 | 794 | ir++; |
767 | 795 | |
768 | 796 | tcg_out_movi (s, TCG_TYPE_I32, ir, mem_index); |
797 | +#ifdef _AIX | |
798 | + tcg_out_call (s, (tcg_target_long) qemu_st_helpers[opc], 1); | |
799 | +#else | |
769 | 800 | tcg_out_b (s, LK, (tcg_target_long) qemu_st_helpers[opc]); |
801 | +#endif | |
770 | 802 | label2_ptr = s->code_ptr; |
771 | 803 | tcg_out32 (s, B); |
772 | 804 | |
... | ... | @@ -836,6 +868,16 @@ void tcg_target_qemu_prologue (TCGContext *s) |
836 | 868 | ; |
837 | 869 | frame_size = (frame_size + 15) & ~15; |
838 | 870 | |
871 | +#ifdef _AIX | |
872 | + { | |
873 | + uint32_t addr; | |
874 | + | |
875 | + /* First emit adhoc function descriptor */ | |
876 | + addr = (uint32_t) s->code_ptr + 12; | |
877 | + tcg_out32 (s, addr); /* entry point */ | |
878 | + s->code_ptr += 8; /* skip TOC and environment pointer */ | |
879 | + } | |
880 | +#endif | |
839 | 881 | tcg_out32 (s, MFSPR | RT (0) | LR); |
840 | 882 | tcg_out32 (s, STWU | RS (1) | RA (1) | (-frame_size & 0xffff)); |
841 | 883 | for (i = 0; i < ARRAY_SIZE (tcg_target_callee_save_regs); ++i) |
... | ... | @@ -1106,6 +1148,9 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args, |
1106 | 1148 | } |
1107 | 1149 | break; |
1108 | 1150 | case INDEX_op_call: |
1151 | +#ifdef _AIX | |
1152 | + tcg_out_call (s, args[0], const_args[0]); | |
1153 | +#else | |
1109 | 1154 | if (const_args[0]) { |
1110 | 1155 | tcg_out_b (s, LK, args[0]); |
1111 | 1156 | } |
... | ... | @@ -1113,6 +1158,7 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args, |
1113 | 1158 | tcg_out32 (s, MTSPR | RS (args[0]) | LR); |
1114 | 1159 | tcg_out32 (s, BCLR | BO_ALWAYS | LK); |
1115 | 1160 | } |
1161 | +#endif | |
1116 | 1162 | break; |
1117 | 1163 | case INDEX_op_jmp: |
1118 | 1164 | if (const_args[0]) { | ... | ... |
tcg/ppc/tcg-target.h
... | ... | @@ -65,11 +65,15 @@ enum { |
65 | 65 | /* used for function call generation */ |
66 | 66 | #define TCG_REG_CALL_STACK TCG_REG_R1 |
67 | 67 | #define TCG_TARGET_STACK_ALIGN 16 |
68 | -#ifdef __APPLE__ | |
68 | +#if defined __APPLE__ | |
69 | 69 | #define TCG_TARGET_CALL_STACK_OFFSET 24 |
70 | -#else | |
70 | +#elif defined _AIX | |
71 | +#define TCG_TARGET_CALL_STACK_OFFSET 52 | |
72 | +#elif defined __linux__ | |
71 | 73 | #define TCG_TARGET_CALL_ALIGN_ARGS 1 |
72 | 74 | #define TCG_TARGET_CALL_STACK_OFFSET 8 |
75 | +#else | |
76 | +#error Unsupported system | |
73 | 77 | #endif |
74 | 78 | |
75 | 79 | /* optional instructions */ | ... | ... |