Commit de83cd02e0124536e05e6ad1fd5e4dc783156dab
1 parent
6380ab5e
arm emulation support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@246 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
5 changed files
with
98 additions
and
26 deletions
Changelog
1 | 1 | version 0.3: |
2 | + | |
3 | + - initial support for ARM emulation | |
2 | 4 | - added fnsave, frstor, fnstenv, fldenv FPU instructions |
3 | 5 | - added FPU register save in signal emulation |
4 | 6 | - ARM port |
7 | + - Sparc and Alpha ports work on the regression test | |
8 | + - generic ioctl number conversion | |
9 | + - fixed ioctl type conversion | |
5 | 10 | |
6 | 11 | version 0.2: |
7 | 12 | ... | ... |
Makefile
... | ... | @@ -86,24 +86,38 @@ LDFLAGS+=-p |
86 | 86 | main.o: CFLAGS+=-p |
87 | 87 | endif |
88 | 88 | |
89 | -OBJS= elfload.o main.o syscall.o mmap.o signal.o vm86.o path.o | |
89 | +OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o | |
90 | +ifeq ($(TARGET_ARCH), i386) | |
91 | +OBJS+= vm86.o | |
92 | +endif | |
90 | 93 | SRCS:= $(OBJS:.o=.c) |
91 | 94 | OBJS+= libqemu.a |
92 | 95 | |
93 | -LIBOBJS+=thunk.o translate-i386.o op-i386.o helper-i386.o exec-i386.o exec.o | |
96 | +# cpu emulator library | |
97 | +LIBOBJS=thunk.o exec.o translate.o cpu-exec.o | |
98 | + | |
99 | +ifeq ($(TARGET_ARCH), i386) | |
100 | +LIBOBJS+=translate-i386.o op-i386.o helper-i386.o | |
101 | +endif | |
102 | +ifeq ($(TARGET_ARCH), arm) | |
103 | +LIBOBJS+=translate-arm.o op-arm.o | |
104 | +endif | |
94 | 105 | |
95 | 106 | # NOTE: the disassembler code is only needed for debugging |
96 | -LIBOBJS+=disas.o i386-dis.o | |
97 | -ifeq ($(ARCH),alpha) | |
107 | +LIBOBJS+=disas.o | |
108 | +ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) | |
109 | +LIBOBJS+=i386-dis.o | |
110 | +endif | |
111 | +ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) | |
98 | 112 | LIBOBJS+=alpha-dis.o |
99 | 113 | endif |
100 | -ifeq ($(ARCH),ppc) | |
114 | +ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc) | |
101 | 115 | LIBOBJS+=ppc-dis.o |
102 | 116 | endif |
103 | -ifeq ($(ARCH),sparc) | |
117 | +ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc) | |
104 | 118 | LIBOBJS+=sparc-dis.o |
105 | 119 | endif |
106 | -ifeq ($(ARCH),arm) | |
120 | +ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) | |
107 | 121 | LIBOBJS+=arm-dis.o |
108 | 122 | endif |
109 | 123 | |
... | ... | @@ -133,20 +147,29 @@ libqemu.a: $(LIBOBJS) |
133 | 147 | dyngen: dyngen.c |
134 | 148 | $(HOST_CC) -O2 -Wall -g $< -o $@ |
135 | 149 | |
136 | -translate-i386.o: translate-i386.c op-i386.h opc-i386.h cpu-i386.h | |
150 | +translate-$(TARGET_ARCH).o: translate-$(TARGET_ARCH).c gen-op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h cpu-$(TARGET_ARCH).h | |
151 | + | |
152 | +translate.o: translate.c op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h cpu-$(TARGET_ARCH).h | |
137 | 153 | |
138 | -op-i386.h: op-i386.o dyngen | |
154 | +op-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o dyngen | |
139 | 155 | ./dyngen -o $@ $< |
140 | 156 | |
141 | -opc-i386.h: op-i386.o dyngen | |
157 | +opc-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o dyngen | |
142 | 158 | ./dyngen -c -o $@ $< |
143 | 159 | |
144 | -op-i386.o: op-i386.c opreg_template.h ops_template.h | |
160 | +gen-op-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o dyngen | |
161 | + ./dyngen -g -o $@ $< | |
162 | + | |
163 | +op-$(TARGET_ARCH).o: op-$(TARGET_ARCH).c | |
145 | 164 | $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< |
146 | 165 | |
147 | -helper-i386.o: helper-i386.c | |
166 | +helper-$(TARGET_ARCH).o: helper-$(TARGET_ARCH).c | |
148 | 167 | $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< |
149 | 168 | |
169 | +op-i386.o: op-i386.c opreg_template.h ops_template.h | |
170 | + | |
171 | +op-arm.o: op-arm.c op-arm-template.h | |
172 | + | |
150 | 173 | %.o: %.c |
151 | 174 | $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< |
152 | 175 | |
... | ... | @@ -173,17 +196,24 @@ qemu-doc.html: qemu-doc.texi |
173 | 196 | |
174 | 197 | FILES= \ |
175 | 198 | README README.distrib COPYING COPYING.LIB TODO Changelog VERSION \ |
176 | -dyngen.c dyngen.h ioctls.h ops_template.h op_string.h syscall_types.h\ | |
177 | -Makefile elf.h thunk.c\ | |
178 | -elfload.c main.c signal.c thunk.h exec.h\ | |
179 | -cpu-i386.h qemu.h op-i386.c helper-i386.c syscall-i386.h translate-i386.c\ | |
180 | -syscall.c opreg_template.h syscall_defs.h vm86.c\ | |
181 | -dis-asm.h disas.c disas.h alpha-dis.c ppc-dis.c i386-dis.c sparc-dis.c arm-dis.c\ | |
182 | -ppc.ld alpha.ld s390.ld sparc.ld arm.ld exec-i386.h exec-i386.c path.c exec.c mmap.c configure \ | |
183 | -tests/Makefile\ | |
184 | -tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\ | |
185 | -tests/test-i386-muldiv.h tests/test-i386-code16.S\ | |
186 | -tests/hello.c tests/hello tests/sha1.c \ | |
199 | +configure \ | |
200 | +dyngen.c dyngen.h dyngen-exec.h ioctls.h syscall_types.h \ | |
201 | +Makefile elf.h elfload.c main.c signal.c qemu.h \ | |
202 | +syscall.c syscall_defs.h vm86.c path.c mmap.c \ | |
203 | +ppc.ld alpha.ld s390.ld sparc.ld arm.ld\ | |
204 | +thunk.c cpu-exec.c translate.c cpu-all.h thunk.h exec.h\ | |
205 | +exec.c cpu-exec.c\ | |
206 | +cpu-i386.h op-i386.c helper-i386.c syscall-i386.h translate-i386.c \ | |
207 | +exec-i386.h ops_template.h op_string.h opreg_template.h \ | |
208 | +cpu-arm.h syscall-arm.h exec-arm.h op-arm.c translate-arm.c op-arm-template.h \ | |
209 | +dis-asm.h disas.c disas.h alpha-dis.c ppc-dis.c i386-dis.c sparc-dis.c \ | |
210 | +arm-dis.c \ | |
211 | +tests/Makefile \ | |
212 | +tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h \ | |
213 | +tests/test-i386-muldiv.h tests/test-i386-code16.S tests/test-i386-vm86.S \ | |
214 | +tests/hello.c tests/hello \ | |
215 | +tests/hello-arm.c tests/hello-arm \ | |
216 | +tests/sha1.c \ | |
187 | 217 | tests/testsig.c tests/testclone.c tests/testthread.c \ |
188 | 218 | tests/runcom.c tests/pi_10.com \ |
189 | 219 | tests/test_path.c \ | ... | ... |
VERSION
configure
... | ... | @@ -28,6 +28,7 @@ ar="ar" |
28 | 28 | make="make" |
29 | 29 | strip="strip" |
30 | 30 | target_cpu="x86" |
31 | +target_bigendian="default" | |
31 | 32 | cpu=`uname -m` |
32 | 33 | case "$cpu" in |
33 | 34 | i386|i486|i586|i686|i86pc|BePC) |
... | ... | @@ -103,6 +104,12 @@ for opt do |
103 | 104 | ;; |
104 | 105 | --cpu=*) cpu=`echo $opt | cut -d '=' -f 2` |
105 | 106 | ;; |
107 | + --target-cpu=*) target_cpu=`echo $opt | cut -d '=' -f 2` | |
108 | + ;; | |
109 | + --target-big-endian) target_bigendian="yes" | |
110 | + ;; | |
111 | + --target-little-endian) target_bigendian="no" | |
112 | + ;; | |
106 | 113 | --enable-gprof) gprof="yes" |
107 | 114 | ;; |
108 | 115 | --static) static="yes" |
... | ... | @@ -162,6 +169,16 @@ if $cc -o $TMPO $TMPC 2> /dev/null ; then |
162 | 169 | gcc_major="3" |
163 | 170 | fi |
164 | 171 | |
172 | +if test "$target_bigendian" = "default" ; then | |
173 | + if test "$target_cpu" = "x86" ; then | |
174 | + target_bigendian="no" | |
175 | + elif test "$target_cpu" = "arm" ; then | |
176 | + target_bigendian="no" | |
177 | + else | |
178 | + target_bigendian="no" | |
179 | + fi | |
180 | +fi | |
181 | + | |
165 | 182 | if test x"$1" = x"-h" -o x"$1" = x"--help" ; then |
166 | 183 | cat << EOF |
167 | 184 | |
... | ... | @@ -173,6 +190,7 @@ echo "Standard options:" |
173 | 190 | echo " --help print this message" |
174 | 191 | echo " --prefix=PREFIX install in PREFIX [$prefix]" |
175 | 192 | echo " --interp-prefix=PREFIX where to find shared libraries, etc. [$interp_prefix]" |
193 | +echo " --target_cpu=CPU set target cpu (x86 or arm) [$target_cpu]" | |
176 | 194 | echo "" |
177 | 195 | echo "Advanced options (experts only):" |
178 | 196 | echo " --source-path=PATH path of source code [$source_path]" |
... | ... | @@ -191,8 +209,9 @@ echo "ELF interp prefix $interp_prefix" |
191 | 209 | echo "C compiler $cc" |
192 | 210 | echo "make $make" |
193 | 211 | echo "host CPU $cpu" |
194 | -echo "Big Endian $bigendian" | |
212 | +echo "host big endian $bigendian" | |
195 | 213 | echo "target CPU $target_cpu" |
214 | +echo "target big endian $target_bigendian" | |
196 | 215 | echo "gprof enabled $gprof" |
197 | 216 | echo "static build $static" |
198 | 217 | |
... | ... | @@ -246,6 +265,24 @@ if test "$bigendian" = "yes" ; then |
246 | 265 | echo "WORDS_BIGENDIAN=yes" >> config.mak |
247 | 266 | echo "#define WORDS_BIGENDIAN 1" >> $TMPH |
248 | 267 | fi |
268 | + | |
269 | +if test "$target_cpu" = "x86" ; then | |
270 | + echo "TARGET_ARCH=i386" >> config.mak | |
271 | + echo "#define TARGET_ARCH \"i386\"" >> $TMPH | |
272 | + echo "#define TARGET_I386 1" >> $TMPH | |
273 | +elif test "$target_cpu" = "arm" ; then | |
274 | + echo "TARGET_ARCH=arm" >> config.mak | |
275 | + echo "#define TARGET_ARCH \"arm\"" >> $TMPH | |
276 | + echo "#define TARGET_ARM 1" >> $TMPH | |
277 | +else | |
278 | + echo "Unsupported target CPU" | |
279 | + exit 1 | |
280 | +fi | |
281 | +if test "$target_bigendian" = "yes" ; then | |
282 | + echo "TARGET_WORDS_BIGENDIAN=yes" >> config.mak | |
283 | + echo "#define TARGET_WORDS_BIGENDIAN 1" >> $TMPH | |
284 | +fi | |
285 | + | |
249 | 286 | if test "$gprof" = "yes" ; then |
250 | 287 | echo "TARGET_GPROF=yes" >> config.mak |
251 | 288 | echo "#define HAVE_GPROF 1" >> $TMPH | ... | ... |
translate.c