Skip to contentSkip to conversation

Problem with non 4gb CS and TSS

Qemu-devel Sylvain Dupont 1 participant 1 message May 22, 2006

lore
Share & tools
lore
#0 lore raw

Hello, I hope it's the good place to post this.

We've been developping a small OS for a school assignment.

There seems to be a problem if you switch tss on a non 4GB segment. It gives a General protection fault exception (0D) I traced the exception in GDB and it appears to be raised here in switch_tss (helper.c) :

  /* check that EIP is in the CS segment limits */
   if (new_eip > env->segs[R_CS].limit) {
       /* XXX: different exception if CALL ? */
       raise_exception_err(EXCP0D_GPF, 0);
   }

Shouldnt that be something like :

if (new_eip < env->segs[R_CS].base || new_eip > env->segs[R_CS].base +
env->segs[R_CS].limit)

?

When limit is 4gb and base is 0, no problem (usually the case). But as soon as you use a EIP that is greater than the limit, the problem appears.

Is it normal or a bug ?

Thanks

Regards
Sylvain Dupont