qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] set correct CS seg limit and flags on sipi
@ 2009-09-13  8:19 Gleb Natapov
  2009-09-13 11:34 ` [Qemu-devel] " Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Gleb Natapov @ 2009-09-13  8:19 UTC (permalink / raw)
  To: qemu-devel

TCG works with incorrect values somehow.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/hw/apic.c b/hw/apic.c
index 2c414c1..c89008e 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -516,7 +516,7 @@ void apic_sipi(CPUState *env)
 
     env->eip = 0;
     cpu_x86_load_seg_cache(env, R_CS, s->sipi_vector << 8, s->sipi_vector << 12,
-                           0xffff, 0);
+                           env->segs[R_CS].limit, env->segs[R_CS].flags);
     env->halted = 0;
     s->wait_for_sipi = 0;
 }
--
			Gleb.

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

* [Qemu-devel] Re: [PATCH] set correct CS seg limit and flags on sipi
  2009-09-13  8:19 [Qemu-devel] [PATCH] set correct CS seg limit and flags on sipi Gleb Natapov
@ 2009-09-13 11:34 ` Jan Kiszka
  2009-09-13 11:50   ` Gleb Natapov
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2009-09-13 11:34 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

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

Gleb Natapov wrote:
> TCG works with incorrect values somehow.

TCG doesn't care about limits and has only few segment type checks.

Some link to the corresponding spec section would be nice-to-have in
this commit message. I was looking for a reference what registers SIPIs
actually modify and how, but there seems to be none, at least in the
System Programming Guide.

> 
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/hw/apic.c b/hw/apic.c
> index 2c414c1..c89008e 100644
> --- a/hw/apic.c
> +++ b/hw/apic.c
> @@ -516,7 +516,7 @@ void apic_sipi(CPUState *env)
>  
>      env->eip = 0;
>      cpu_x86_load_seg_cache(env, R_CS, s->sipi_vector << 8, s->sipi_vector << 12,
> -                           0xffff, 0);
> +                           env->segs[R_CS].limit, env->segs[R_CS].flags);
>      env->halted = 0;
>      s->wait_for_sipi = 0;
>  }
> --
> 			Gleb.

Jan



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

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

* [Qemu-devel] Re: [PATCH] set correct CS seg limit and flags on sipi
  2009-09-13 11:34 ` [Qemu-devel] " Jan Kiszka
@ 2009-09-13 11:50   ` Gleb Natapov
  2009-09-13 12:02     ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Gleb Natapov @ 2009-09-13 11:50 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-devel

On Sun, Sep 13, 2009 at 01:34:01PM +0200, Jan Kiszka wrote:
> Gleb Natapov wrote:
> > TCG works with incorrect values somehow.
> 
> TCG doesn't care about limits and has only few segment type checks.
I already noticed that TCG implement some non existent CPU somewhat
similar to x86.

> 
> Some link to the corresponding spec section would be nice-to-have in
> this commit message. I was looking for a reference what registers SIPIs
> actually modify and how, but there seems to be none, at least in the
> System Programming Guide.
> 
This commit just fix obvious bug that caused SIPI to put garbage into
segment's flags. I don't have link to spec only common sense.

> > 
> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > diff --git a/hw/apic.c b/hw/apic.c
> > index 2c414c1..c89008e 100644
> > --- a/hw/apic.c
> > +++ b/hw/apic.c
> > @@ -516,7 +516,7 @@ void apic_sipi(CPUState *env)
> >  
> >      env->eip = 0;
> >      cpu_x86_load_seg_cache(env, R_CS, s->sipi_vector << 8, s->sipi_vector << 12,
> > -                           0xffff, 0);
> > +                           env->segs[R_CS].limit, env->segs[R_CS].flags);
> >      env->halted = 0;
> >      s->wait_for_sipi = 0;
> >  }
> > --
> > 			Gleb.
> 
> Jan
> 
> 



--
			Gleb.

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

* [Qemu-devel] Re: [PATCH] set correct CS seg limit and flags on sipi
  2009-09-13 11:50   ` Gleb Natapov
@ 2009-09-13 12:02     ` Jan Kiszka
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2009-09-13 12:02 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: qemu-devel

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

Gleb Natapov wrote:
> On Sun, Sep 13, 2009 at 01:34:01PM +0200, Jan Kiszka wrote:
>> Gleb Natapov wrote:
>>> TCG works with incorrect values somehow.
>> TCG doesn't care about limits and has only few segment type checks.
> I already noticed that TCG implement some non existent CPU somewhat
> similar to x86.

I once posted a patch that added full limit/flags check on memory
access. But it required more work and slowed down TCG quite noticeably.
Meanwhile we are only using KVM and don't require this precision
anymore, so this effort stalled.

> 
>> Some link to the corresponding spec section would be nice-to-have in
>> this commit message. I was looking for a reference what registers SIPIs
>> actually modify and how, but there seems to be none, at least in the
>> System Programming Guide.
>>
> This commit just fix obvious bug that caused SIPI to put garbage into
> segment's flags. I don't have link to spec only common sense.

I don't disagree. I was just wondering if it loads the specified reset
values into the flags or just keeps them untouched. BTW, looks like
BOCHS takes your path too (ie. don't touch them).

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

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

end of thread, other threads:[~2009-09-13 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-13  8:19 [Qemu-devel] [PATCH] set correct CS seg limit and flags on sipi Gleb Natapov
2009-09-13 11:34 ` [Qemu-devel] " Jan Kiszka
2009-09-13 11:50   ` Gleb Natapov
2009-09-13 12:02     ` Jan Kiszka

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