Jamie Lokier wrote: > 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.
Good point. I included this in an initial suggestion of an extended register set, see [1]. Providing this information will likely remain VM-business, but that doesn't mean we shouldn't use it when available. Jan [1] http://sourceware.org/ml/gdb/2009-01/msg00008.html
signature.asc
Description: OpenPGP digital signature
