Jan Kiszka wrote:
> You need CR0.PE to detect if you are in real or protected mode. And then
> you need GDTR/LDTR to find the descriptor CS is pointing at, parsing it
> to detect if you are running 16, 32 or 64 bit code (by default). Those
> extensions would also be useful in order to decode memory addresses in
> case descriptor.base != 0 (or if it's CS >> 4, ie. you are in real
> mode).

If you're going to decode segment descriptors (great idea, btw, and
helpful for threaded code), it might be better to supply the CPU's
internal segment state, if that's possible, instead of looking at the
LDT/GDT in memory, since the CPU's state can differ from the memory
version when the latter is written to.

-- Jamie
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to