qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Help getting an qemu-alpha environment to work
@ 2010-04-24 15:51 qemu
  2010-04-25  1:07 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: qemu @ 2010-04-24 15:51 UTC (permalink / raw)
  To: qemu-devel

Hi There

I am new to qemu development but wanted to give a hand with the alpha
port. Unfortinuatly it is not that easy to get the initial development
environment up and running. So I ask you for help

I downloaded qemu 0.12.50 using git. That compiled cleanly on ubuntu
9.10, including qemu-alpha

After that i turned to crosstool-ng-1.6.2 to get a cross compiler
environment. I compiled the alphaev56-unknown-linux-gnu environment
without a hickup.

Lastly I went to qemu/tests/alpha and ran make:

$ make
alphaev56-unknown-linux-gnu-gcc -O   -c -o hello-alpha.o hello-alpha.c
alphaev56-unknown-linux-gnu-as   -o crt.o crt.s
alphaev56-unknown-linux-gnu-gcc -o hello-alpha crt.o hello-alpha.o -nostdlib
alphaev56-unknown-linux-gnu-gcc -O   -c -o test-cond.o test-cond.c
alphaev56-unknown-linux-gnu-gcc -o test-cond crt.o test-cond.o -nostdlib
alphaev56-unknown-linux-gnu-gcc -c -O -DTEST_CMOV -o test-cmov.o test-cond.c
alphaev56-unknown-linux-gnu-gcc -o test-cmov crt.o test-cmov.o -nostdlib

$ make check
for f in test-cond test-cmov; do ../../alpha-linux-user/qemu-alpha $f
|| exit 1; done
$ echo $?
0

Being convinced I had reached the goal I ran:

$ ../../alpha-linux-user/qemu-alpha hello-alpha
$ echo $?
0

I was a bit surprised not being greeted with "hello world", so I ran:

$ ../../alpha-linux-user/qemu-alpha -strace  hello-alpha
17682 write(1,0,536871368) = -1 errno=14 (Bad address)
17682 exit(0)

Obviously something was wrong, so I ran

$ ../../alpha-linux-user/qemu-alpha  -d in_asm,exec hello-alpha
$ cat /tmp/qemu.log
host mmap_min_addr=0x10000
guest_base  0x0
start    end      size     prot
0000000000110000-0000000000256000 0000000000146000 ---
0000000000508000-0000000000522000 000000000001a000 ---
00000000006de000-00000000006e0000 0000000000002000 ---
00000000008a4000-00000000008ae000 000000000000a000 ---
0000000000b2a000-0000000000b52000 0000000000028000 ---
0000000000c00000-0000000000c1e000 000000000001e000 ---
0000000020000000-0000000020002000 0000000000002000 r-x
0000000020012000-0000000020014000 0000000000002000 rw-
0000000040000000-0000000040800000 0000000000800000 rw-
0000000040800000-0000000040802000 0000000000002000 ---
0000000060000000-000000006008c000 000000000008c000 ---
000000006018a000-00000000621c4000 000000000203a000 ---
0000000063108000-000000006312a000 0000000000022000 ---
00000000b4cb8000-00000000b7710000 0000000002a58000 ---
00000000bfc10000-00000000bfc36000 0000000000026000 ---
start_brk   0x0000000120012010
end_code    0x0000000120000250
start_code  0x0000000120000000
start_data  0x0000000120012000
end_data    0x0000000120012010
start_stack 0x00000000407ffbe0
brk         0x0000000120012010
entry       0x0000000120000158

IN: _start
0x0000000120000158:  .long 0x63108418

IN: _start
0x000000012000015c:  .long 0x63108418
0x0000000120000160:  .long 0x63108418
0x0000000120000164:  .long 0x63108418
0x0000000120000168:  .long 0x63108418

IN: main
0x0000000120000188:  .long 0x63108418
0x000000012000018c:  .long 0x63108418
0x0000000120000190:  .long 0x63108418
0x0000000120000194:  .long 0x63108418
0x0000000120000198:  .long 0x63108418
0x000000012000019c:  .long 0x63108418
0x00000001200001a0:  .long 0x63108418
0x00000001200001a4:  .long 0x63108418
0x00000001200001a8:  .long 0x63108418
0x00000001200001ac:  .long 0x63108418

IN:
0x000000012000017c:  .long 0x63108418
0x0000000120000180:  .long 0x63108418

IN:
0x0000000120000184:  .long 0x63108418

IN: main
0x00000001200001b0:  .long 0x63108418
0x00000001200001b4:  .long 0x63108418
0x00000001200001b8:  .long 0x63108418
0x00000001200001bc:  .long 0x63108418
0x00000001200001c0:  .long 0x63108418
0x00000001200001c4:  .long 0x63108418

IN: _start
0x000000012000016c:  .long 0x63108418
0x0000000120000170:  .long 0x63108418
0x0000000120000174:  .long 0x63108418

I would appriciate if one of you qemu wizards could help me get a
develop env setup.

Br. Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Help getting an qemu-alpha environment to work
  2010-04-24 15:51 [Qemu-devel] Help getting an qemu-alpha environment to work qemu
@ 2010-04-25  1:07 ` Richard Henderson
  2010-04-27  6:00   ` qemu
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2010-04-25  1:07 UTC (permalink / raw)
  To: qemu; +Cc: qemu-devel

On 04/24/2010 08:51 AM, qemu@zensonic.dk wrote:
> I was a bit surprised not being greeted with "hello world", so I ran:
> 
> $ ../../alpha-linux-user/qemu-alpha -strace  hello-alpha
> 17682 write(1,0,536871368) = -1 errno=14 (Bad address)
> 17682 exit(0)

There's a problem with the current implementation of mmap
in linux-user such that it can return addresses that are
outside the "valid" address space of the guest.

I have a patch sequence that fixes this, but it's not
terribly clean and has bad worst-case performance so I
havn't bothered submitting it.


r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Help getting an qemu-alpha environment to work
  2010-04-25  1:07 ` Richard Henderson
@ 2010-04-27  6:00   ` qemu
  2010-04-27 18:13     ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: qemu @ 2010-04-27  6:00 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel

> There's a problem with the current implementation of mmap
> in linux-user such that it can return addresses that are
> outside the "valid" address space of the guest.

How do I, either

1. avoid the problem? (Give the guest a larger valid address space)
2. Fix the problem ? (Could you give 4 lines describing the problem
and give hints to files to look at and/or send me your patch. I do not
mind any performance penalty/"ugliness" of code)

Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Help getting an qemu-alpha environment to work
  2010-04-27  6:00   ` qemu
@ 2010-04-27 18:13     ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2010-04-27 18:13 UTC (permalink / raw)
  To: qemu; +Cc: qemu-devel

On 04/26/2010 11:00 PM, qemu@zensonic.dk wrote:
> 1. avoid the problem? (Give the guest a larger valid address space)

Assuming that you don't have a guest program that (ab)uses the 
"known unused" high bits of the address for type tagging pointers
(common in some lisp and virtual machine interpreters, including
emacs), then you can simply change target-alpha/cpu.h:

-#define TARGET_VIRT_ADDR_SPACE_BITS     (30 + TARGET_PAGE_BITS)
+#define TARGET_VIRT_ADDR_SPACE_BITS     63

I know for a fact that glibc *does* use the msb for some pointer
tagging, so you can't use 64 here.  I don't think that's actually
a problem for any current Linux host.  If you only care about amd64
as the host, you can reduce this number to 47 and save 2 levels 
of lookup in the address space tables.



r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-27 18:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-24 15:51 [Qemu-devel] Help getting an qemu-alpha environment to work qemu
2010-04-25  1:07 ` Richard Henderson
2010-04-27  6:00   ` qemu
2010-04-27 18:13     ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).