qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] QEMU 0.2 is out
@ 2003-05-28  0:58 Fabrice Bellard
  2003-06-01 18:19 ` Falk Hueffner
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Bellard @ 2003-05-28  0:58 UTC (permalink / raw)
  To: qemu-devel


Most of the QEMU architecture is now finished. There are still 
complicated issues regarding thread locking. My main issue is that I 
would like to avoid locking the cpu emulator while doing 'tb_find()'.

DOSEMU is now working better (I was able to launch DOS Navigator and a 
small VGA demonstration). The speed seems reasonnable althought QEMU has 
to emulate both the DOS code _and_ the dosemu code itself !

About the Sparc code: is it possible to move the prolog and epilog 
generation from dyngen_code() to the cpu main loop ? It would ease a lot 
the precise exception handling and the direct block chaining.

For Alpha and Sparc, if someone has an account that I can use, I could 
make some debug to fix the last issues.

Fabrice.

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

* Re: [Qemu-devel] QEMU 0.2 is out
  2003-05-28  0:58 [Qemu-devel] QEMU 0.2 is out Fabrice Bellard
@ 2003-06-01 18:19 ` Falk Hueffner
  2003-06-02 22:52   ` Fabrice Bellard
  0 siblings, 1 reply; 8+ messages in thread
From: Falk Hueffner @ 2003-06-01 18:19 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 592 bytes --]


> For Alpha and Sparc, if someone has an account that I can use, I
> could make some debug to fix the last issues.

You can get an account on Alpha Linux from HP at
http://www.testdrive.compaq.com/, or I can give you one on my machine
if you send me a ssh key.

I've attached a patch with all my changes, it doesn't seem to work at
all though, I get sig11 on all tests. It used to work "mostly" about
two weeks ago. I don't have time right now to look into it...

I think the fault address reporting was only introduced in 2.4.20 on
Alpha, so it might not work on older kernels.

-- 
	Falk


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: qemu-alpha-2003.06.01.patch --]
[-- Type: text/x-patch, Size: 3781 bytes --]

Index: dyngen.c
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen.c,v
retrieving revision 1.16
diff -u -p -r1.16 dyngen.c
--- dyngen.c	29 May 2003 20:05:18 -0000	1.16
+++ dyngen.c	1 Jun 2003 18:15:02 -0000
@@ -691,7 +691,7 @@ void gen_code(const char *name, host_ulo
 			case R_ALPHA_BRSGP:
 			    /* PC-relative jump. Tweak offset to skip the two instructions that try to
 			       set up the gp from the pv.  */
-			    fprintf(outfile, "    fix_bsr(gen_code_ptr + %ld, (uint8_t *) &%s - (gen_code_ptr + %ld) + 4);\n",
+			    fprintf(outfile, "    fix_bsr(gen_code_ptr + %ld, (uint8_t *) &%s - (gen_code_ptr + %ld + 4) + 8);\n",
 				    rel->r_offset - start_offset, sym_name, rel->r_offset - start_offset);
 			    break;
 			default:
Index: exec-i386.c
===================================================================
RCS file: /cvsroot/qemu/qemu/exec-i386.c,v
retrieving revision 1.26
diff -u -p -r1.26 exec-i386.c
--- exec-i386.c	29 May 2003 20:04:28 -0000	1.26
+++ exec-i386.c	1 Jun 2003 18:15:03 -0000
@@ -447,6 +447,34 @@ int cpu_x86_signal_handler(int host_sign
                              is_write, &uc->uc_sigmask);
 }
 
+#elif defined(__alpha__)
+
+int cpu_x86_signal_handler(int host_signum, struct siginfo *info, 
+                           void *puc)
+{
+    struct ucontext *uc = puc;
+    uint32_t *pc = uc->uc_mcontext.sc_pc;
+    uint32_t insn = *pc;
+    int is_write = 0;
+
+    switch (insn >> 26) {
+    case 0x0d: // stw
+    case 0x0e: // stb
+    case 0x0f: // stq_u
+    case 0x24: // stf
+    case 0x25: // stg
+    case 0x26: // sts
+    case 0x27: // stt
+    case 0x2c: // stl
+    case 0x2d: // stq
+    case 0x2e: // stl_c
+    case 0x2f: // stq_c
+	is_write = 1;
+    }
+
+    return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
+                             is_write, &uc->uc_sigmask);
+}
 #else
 
 #error CPU specific signal handler needed
Index: exec-i386.h
===================================================================
RCS file: /cvsroot/qemu/qemu/exec-i386.h,v
retrieving revision 1.17
diff -u -p -r1.17 exec-i386.h
--- exec-i386.h	29 May 2003 20:04:28 -0000	1.17
+++ exec-i386.h	1 Jun 2003 18:15:03 -0000
@@ -124,6 +124,8 @@ register unsigned int A0 asm("$11");
 register unsigned int EAX asm("$12");
 register unsigned int ESP asm("$13");
 register unsigned int EBP asm("$14");
+/* Note $15 is the frame pointer, so anything in op-i386.c that would
+   require a frame pointer, like alloca, would probably loose.  */
 register struct CPUX86State *env asm("$15");
 #define reg_EAX
 #define reg_ESP
Index: exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/exec.h,v
retrieving revision 1.3
diff -u -p -r1.3 exec.h
--- exec.h	27 May 2003 23:29:24 -0000	1.3
+++ exec.h	1 Jun 2003 18:15:03 -0000
@@ -214,7 +214,7 @@ static inline int testandset (int *p)
 #endif
 
 #ifdef __alpha__
-int testandset (int *p)
+static inline int testandset (int *p)
 {
     int ret;
     unsigned long one;
Index: op-i386.c
===================================================================
RCS file: /cvsroot/qemu/qemu/op-i386.c,v
retrieving revision 1.31
diff -u -p -r1.31 op-i386.c
--- op-i386.c	29 May 2003 20:04:27 -0000	1.31
+++ op-i386.c	1 Jun 2003 18:15:05 -0000
@@ -1762,16 +1762,16 @@ typedef union {
     double d;
 #ifndef WORDS_BIGENDIAN
     struct {
-        unsigned long lower;
-        long upper;
+        uint32_t lower;
+        int32_t upper;
     } l;
 #else
     struct {
-        long upper;
-        unsigned long lower;
+        int32_t upper;
+        uint32_t lower;
     } l;
 #endif
-    long long ll;
+    int64_t ll;
 } CPU86_LDoubleU;
 
 /* the following deal with IEEE double-precision numbers */

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

* Re: [Qemu-devel] QEMU 0.2 is out
  2003-06-01 18:19 ` Falk Hueffner
@ 2003-06-02 22:52   ` Fabrice Bellard
  2003-06-02 23:20     ` Falk Hueffner
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Bellard @ 2003-06-02 22:52 UTC (permalink / raw)
  To: qemu-devel

Falk Hueffner wrote:
>>For Alpha and Sparc, if someone has an account that I can use, I
>>could make some debug to fix the last issues.
> 
> 
> You can get an account on Alpha Linux from HP at
> http://www.testdrive.compaq.com/, or I can give you one on my machine
> if you send me a ssh key.
> 
> I've attached a patch with all my changes, it doesn't seem to work at
> all though, I get sig11 on all tests. It used to work "mostly" about
> two weeks ago. I don't have time right now to look into it...
> 
> I think the fault address reporting was only introduced in 2.4.20 on
> Alpha, so it might not work on older kernels.

I have now access to an Alpha and a Sparc computer.

For Alpha: I am using gcc 3.2.3 and '-msmall-text' is not supported. Is 
it really necessary ?

Fabrice.

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

* Re: [Qemu-devel] QEMU 0.2 is out
  2003-06-02 22:52   ` Fabrice Bellard
@ 2003-06-02 23:20     ` Falk Hueffner
  2003-06-03  0:49       ` Fabrice Bellard
  0 siblings, 1 reply; 8+ messages in thread
From: Falk Hueffner @ 2003-06-02 23:20 UTC (permalink / raw)
  To: qemu-devel

Fabrice Bellard <fabrice.bellard@free.fr> writes:

> For Alpha: I am using gcc 3.2.3 and '-msmall-text' is not
> supported. Is it really necessary ?

Not really, I was just hoping to avoid a few gp readjustments with it,
however it doesn't really seem to have that effect, since for
non-static functions, that cannot be done, and for static functions,
gcc already knows to avoid gp restoring.

-- 
	Falk

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

* Re: [Qemu-devel] QEMU 0.2 is out
  2003-06-02 23:20     ` Falk Hueffner
@ 2003-06-03  0:49       ` Fabrice Bellard
  2003-06-03 13:18         ` Falk Hueffner
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Bellard @ 2003-06-03  0:49 UTC (permalink / raw)
  To: qemu-devel

Falk Hueffner wrote:
> Fabrice Bellard <fabrice.bellard@free.fr> writes:
> 
> 
>>For Alpha: I am using gcc 3.2.3 and '-msmall-text' is not
>>supported. Is it really necessary ?
> 
> 
> Not really, I was just hoping to avoid a few gp readjustments with it,
> however it doesn't really seem to have that effect, since for
> non-static functions, that cannot be done, and for static functions,
> gcc already knows to avoid gp restoring.

Which version of gcc are you using ? Do you use a patched gcc ? Can you 
give me your spec file and the gcc -v log when you compile op-i386.c ?

I am totally unable to get correct code. In particular, I cannot make 
gcc 3.2.3 generate R_ALPHA_BRADDR relocations. Currently, to get correct 
code, I must do the following:
--
int __op_param1;
#define PARAM1 ({ int _r; asm("ldah %0,__op_param1($29) !gprelhigh\n" \
                               "lda %0,__op_param1(%0)   !gprellow" : 
"=r"(_r) ); _r; })

#define CALL(x) asm volatile ("bsr $26, %0" : : "i" (x))
--
and use the macro CALL to call a function!

Fabrice.

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

* Re: [Qemu-devel] QEMU 0.2 is out
  2003-06-03  0:49       ` Fabrice Bellard
@ 2003-06-03 13:18         ` Falk Hueffner
  2003-06-04 22:43           ` Fabrice Bellard
  2003-06-05  1:12           ` [Qemu-devel] QEMU on Alpha Fabrice Bellard
  0 siblings, 2 replies; 8+ messages in thread
From: Falk Hueffner @ 2003-06-03 13:18 UTC (permalink / raw)
  To: qemu-devel

Fabrice Bellard <fabrice.bellard@free.fr> writes:

> Which version of gcc are you using ? Do you use a patched gcc ? Can
> you give me your spec file and the gcc -v log when you compile
> op-i386.c ?

I use gcc 3.3 or 3.4 snapshots usually.

> I am totally unable to get correct code. In particular, I cannot make
> gcc 3.2.3 generate R_ALPHA_BRADDR relocations. Currently, to get
> correct code, I must do the following:
> 
> --
> int __op_param1;
> #define PARAM1 ({ int _r; asm("ldah %0,__op_param1($29) !gprelhigh\n" \
>                                "lda %0,__op_param1(%0) !gprellow" :
>                                "=r"(_r) ); _r; })

Ah yes, this is because gcc 3.2.3 doesn't support visibility("hidden")
yet. If a symbol has global visibility, gcc cannot know it is accessed
with the same gp, since it might be provided by libc for example. I
don't think there's any better way do this with 3.2.3.

> #define CALL(x) asm volatile ("bsr $26, %0" : : "i" (x))
> --
> and use the macro CALL to call a function!

This seems to works for me even with 3.2.3. What happens if you don't
use the macro? Maybe your binutils is too old? I have 2.14.90.0.4-0.1.

Also, concerning the signal handler, siginfo is only filled in with
2.4.20 and newer kernels...

-- 
	Falk

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

* Re: [Qemu-devel] QEMU 0.2 is out
  2003-06-03 13:18         ` Falk Hueffner
@ 2003-06-04 22:43           ` Fabrice Bellard
  2003-06-05  1:12           ` [Qemu-devel] QEMU on Alpha Fabrice Bellard
  1 sibling, 0 replies; 8+ messages in thread
From: Fabrice Bellard @ 2003-06-04 22:43 UTC (permalink / raw)
  To: qemu-devel

With gcc 3.3 and binutils 2.14.90.0.4 it is better. I fixed some bugs 
related to the new jump optimisation I introduced. But there is a big 
problem: no relocations are generated for calls to global functions if 
they are in the same file as the function call. I am trying various 
patches for this.

Fabrice.


Falk Hueffner wrote:
> Fabrice Bellard <fabrice.bellard@free.fr> writes:
> 
> 
>>Which version of gcc are you using ? Do you use a patched gcc ? Can
>>you give me your spec file and the gcc -v log when you compile
>>op-i386.c ?
> 
> 
> I use gcc 3.3 or 3.4 snapshots usually.
> 
> 
>>I am totally unable to get correct code. In particular, I cannot make
>>gcc 3.2.3 generate R_ALPHA_BRADDR relocations. Currently, to get
>>correct code, I must do the following:
>>
>>--
>>int __op_param1;
>>#define PARAM1 ({ int _r; asm("ldah %0,__op_param1($29) !gprelhigh\n" \
>>                               "lda %0,__op_param1(%0) !gprellow" :
>>                               "=r"(_r) ); _r; })
> 
> 
> Ah yes, this is because gcc 3.2.3 doesn't support visibility("hidden")
> yet. If a symbol has global visibility, gcc cannot know it is accessed
> with the same gp, since it might be provided by libc for example. I
> don't think there's any better way do this with 3.2.3.
> 
> 
>>#define CALL(x) asm volatile ("bsr $26, %0" : : "i" (x))
>>--
>>and use the macro CALL to call a function!
> 
> 
> This seems to works for me even with 3.2.3. What happens if you don't
> use the macro? Maybe your binutils is too old? I have 2.14.90.0.4-0.1.
> 
> Also, concerning the signal handler, siginfo is only filled in with
> 2.4.20 and newer kernels...
> 


-- 
Fabrice.

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

* [Qemu-devel] QEMU on Alpha
  2003-06-03 13:18         ` Falk Hueffner
  2003-06-04 22:43           ` Fabrice Bellard
@ 2003-06-05  1:12           ` Fabrice Bellard
  1 sibling, 0 replies; 8+ messages in thread
From: Fabrice Bellard @ 2003-06-05  1:12 UTC (permalink / raw)
  To: qemu-devel

Hi,

The CVS version of QEMU should now launch test-i386 successfully on 
Alpha. If you want to try it, read the README file to know what are the 
tested tools (gcc 3.3 is _required_). I tested it only with a 2.2 Linux 
kernel, so I was not able to test the precise exception support which 
requires a 2.4.20 kernel.

The remaining issues (in particular with ls) should only be related to 
bad syscall emulation, which is easier to fix.

Fabrice.

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

end of thread, other threads:[~2003-06-05  1:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-28  0:58 [Qemu-devel] QEMU 0.2 is out Fabrice Bellard
2003-06-01 18:19 ` Falk Hueffner
2003-06-02 22:52   ` Fabrice Bellard
2003-06-02 23:20     ` Falk Hueffner
2003-06-03  0:49       ` Fabrice Bellard
2003-06-03 13:18         ` Falk Hueffner
2003-06-04 22:43           ` Fabrice Bellard
2003-06-05  1:12           ` [Qemu-devel] QEMU on Alpha Fabrice Bellard

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).