Skip to content

Instantly share code, notes, and snippets.

@doug65536
Last active May 30, 2019 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doug65536/67c0d76228cdfb869906d019470a91c8 to your computer and use it in GitHub Desktop.
Save doug65536/67c0d76228cdfb869906d019470a91c8 to your computer and use it in GitHub Desktop.
(qemu) info idt
IDTR.base=0xffffffff804deae0 IDTR.limit=0xfff
offset base limit/cs DPL flg typ
0x0000 0xffffffff8004e000 cs=0x0060 0 0x0 0xF (trap gate)
0x0010 0xffffffff8004e010 cs=0x0060 0 0x0 0xF (trap gate)
0x0020 0xffffffff8004e020 cs=0x0060 0 0x0 0xE (int gate)
0x0030 0xffffffff8004e030 cs=0x0060 0 0x0 0xF (trap gate)
0x0040 0xffffffff8004e040 cs=0x0060 0 0x0 0xF (trap gate)
0x0050 0xffffffff8004e050 cs=0x0060 0 0x0 0xF (trap gate)
0x0060 0xffffffff8004e060 cs=0x0060 0 0x0 0xF (trap gate)
0x0070 0xffffffff8004e070 cs=0x0060 0 0x0 0xF (trap gate)
0x0080 0xffffffff8004e080 cs=0x0060 0 0x0 0xE (int gate)
0x0090 0xffffffff8004e090 cs=0x0060 0 0x0 0xF (trap gate)
0x00a0 0xffffffff8004e0a0 cs=0x0060 0 0x0 0xF (trap gate)
0x00b0 0xffffffff8004e0b0 cs=0x0060 0 0x0 0xF (trap gate)
0x00c0 0xffffffff8004e0c0 cs=0x0060 0 0x0 0xF (trap gate)
0x00d0 0xffffffff8004e0d0 cs=0x0060 0 0x0 0xF (trap gate)
0x00e0 0xffffffff8004e0e0 cs=0x0060 0 0x0 0xF (trap gate)
0x00f0 0xffffffff8004e0f0 cs=0x0060 0 0x0 0xE (int gate)
0x0100 0xffffffff8004e100 cs=0x0060 0 0x0 0xF (trap gate)
0x0110 0xffffffff8004e110 cs=0x0060 0 0x0 0xF (trap gate)
0x0120 0xffffffff8004e120 cs=0x0060 0 0x0 0xE (int gate)
0x0130 0xffffffff8004e130 cs=0x0060 0 0x0 0xF (trap gate)
0x0140 0xffffffff8004e140 cs=0x0060 0 0x0 0xE (int gate)
0x0150 0xffffffff8004e150 cs=0x0060 0 0x0 0xE (int gate)
0x0160 0xffffffff8004e160 cs=0x0060 0 0x0 0xE (int gate)
0x0170 0xffffffff8004e170 cs=0x0060 0 0x0 0xE (int gate)
0x0180 0xffffffff8004e180 cs=0x0060 0 0x0 0xE (int gate)
0x0190 0xffffffff8004e190 cs=0x0060 0 0x0 0xE (int gate)
0x01a0 0xffffffff8004e1a0 cs=0x0060 0 0x0 0xE (int gate)
0x01b0 0xffffffff8004e1b0 cs=0x0060 0 0x0 0xE (int gate)
0x01c0 0xffffffff8004e1c0 cs=0x0060 0 0x0 0xE (int gate)
0x01d0 0xffffffff8004e1d0 cs=0x0060 0 0x0 0xE (int gate)
0x01e0 0xffffffff8004e1e0 cs=0x0060 0 0x0 0xE (int gate)
0x01f0 0xffffffff8004e1f0 cs=0x0060 0 0x0 0xE (int gate)
0x0200 0xffffffff8004e200 cs=0x0060 0 0x0 0xE (int gate)
0x0210 0xffffffff8004e210 cs=0x0060 0 0x0 0xE (int gate)
0x0220 0xffffffff8004e220 cs=0x0060 0 0x0 0xE (int gate)
0x0230 0xffffffff8004e230 cs=0x0060 0 0x0 0xE (int gate)
0x0240 0xffffffff8004e240 cs=0x0060 0 0x0 0xE (int gate)
0x0250 0xffffffff8004e250 cs=0x0060 0 0x0 0xE (int gate)
0x0260 0xffffffff8004e260 cs=0x0060 0 0x0 0xE (int gate)
0x0270 0xffffffff8004e270 cs=0x0060 0 0x0 0xE (int gate)
0x0280 0xffffffff8004e280 cs=0x0060 0 0x0 0xE (int gate)
0x0290 0xffffffff8004e290 cs=0x0060 0 0x0 0xE (int gate)
0x02a0 0xffffffff8004e2a0 cs=0x0060 0 0x0 0xF (trap gate)
0x02b0 0xffffffff8004e2b0 cs=0x0060 0 0x0 0xE (int gate)
0x02c0 0xffffffff8004e2c0 cs=0x0060 0 0x0 0xE (int gate)
0x02d0 0xffffffff8004e2d0 cs=0x0060 0 0x0 0xE (int gate)
0x02e0 0xffffffff8004e2e0 cs=0x0060 0 0x0 0xE (int gate)
0x02f0 0xffffffff8004e2f0 cs=0x0060 0 0x0 0xE (int gate)
0x0300 0xffffffff8004e300 cs=0x0060 0 0x0 0xE (int gate)
0x0310 0xffffffff8004e310 cs=0x0060 0 0x0 0xE (int gate)
0x0320 0xffffffff8004e320 cs=0x0060 0 0x0 0xE (int gate)
0x0330 0xffffffff8004e330 cs=0x0060 0 0x0 0xE (int gate)
0x0340 0xffffffff8004e340 cs=0x0060 0 0x0 0xE (int gate)
0x0350 0xffffffff8004e350 cs=0x0060 0 0x0 0xE (int gate)
0x0360 0xffffffff8004e360 cs=0x0060 0 0x0 0xE (int gate)
0x0370 0xffffffff8004e370 cs=0x0060 0 0x0 0xE (int gate)
0x0380 0xffffffff8004e380 cs=0x0060 0 0x0 0xE (int gate)
0x0390 0xffffffff8004e390 cs=0x0060 0 0x0 0xE (int gate)
0x03a0 0xffffffff8004e3a0 cs=0x0060 0 0x0 0xE (int gate)
0x03b0 0xffffffff8004e3b0 cs=0x0060 0 0x0 0xE (int gate)
0x03c0 0xffffffff8004e3c0 cs=0x0060 0 0x0 0xE (int gate)
0x03d0 0xffffffff8004e3d0 cs=0x0060 0 0x0 0xE (int gate)
0x03e0 0xffffffff8004e3e0 cs=0x0060 0 0x0 0xE (int gate)
0x03f0 0xffffffff8004e3f0 cs=0x0060 0 0x0 0xE (int gate)
0x0400 0xffffffff8004e400 cs=0x0060 0 0x0 0xE (int gate)
0x0410 0xffffffff8004e410 cs=0x0060 0 0x0 0xE (int gate)
0x0420 0xffffffff8004e420 cs=0x0060 0 0x0 0xE (int gate)
0x0430 0xffffffff8004e430 cs=0x0060 0 0x0 0xE (int gate)
0x0440 0xffffffff8004e440 cs=0x0060 0 0x0 0xE (int gate)
0x0450 0xffffffff8004e450 cs=0x0060 0 0x0 0xE (int gate)
0x0460 0xffffffff8004e460 cs=0x0060 0 0x0 0xE (int gate)
0x0470 0xffffffff8004e470 cs=0x0060 0 0x0 0xE (int gate)
0x0480 0xffffffff8004e480 cs=0x0060 0 0x0 0xE (int gate)
0x0490 0xffffffff8004e490 cs=0x0060 0 0x0 0xE (int gate)
0x04a0 0xffffffff8004e4a0 cs=0x0060 0 0x0 0xE (int gate)
0x04b0 0xffffffff8004e4b0 cs=0x0060 0 0x0 0xE (int gate)
0x04c0 0xffffffff8004e4c0 cs=0x0060 0 0x0 0xE (int gate)
0x04d0 0xffffffff8004e4d0 cs=0x0060 0 0x0 0xE (int gate)
0x04e0 0xffffffff8004e4e0 cs=0x0060 0 0x0 0xE (int gate)
0x04f0 0xffffffff8004e4f0 cs=0x0060 0 0x0 0xE (int gate)
0x0500 0xffffffff8004e500 cs=0x0060 0 0x0 0xE (int gate)
0x0510 0xffffffff8004e510 cs=0x0060 0 0x0 0xE (int gate)
0x0520 0xffffffff8004e520 cs=0x0060 0 0x0 0xE (int gate)
0x0530 0xffffffff8004e530 cs=0x0060 0 0x0 0xE (int gate)
0x0540 0xffffffff8004e540 cs=0x0060 0 0x0 0xE (int gate)
0x0550 0xffffffff8004e550 cs=0x0060 0 0x0 0xE (int gate)
0x0560 0xffffffff8004e560 cs=0x0060 0 0x0 0xE (int gate)
0x0570 0xffffffff8004e570 cs=0x0060 0 0x0 0xE (int gate)
0x0580 0xffffffff8004e580 cs=0x0060 0 0x0 0xE (int gate)
0x0590 0xffffffff8004e590 cs=0x0060 0 0x0 0xE (int gate)
0x05a0 0xffffffff8004e5a0 cs=0x0060 0 0x0 0xE (int gate)
0x05b0 0xffffffff8004e5b0 cs=0x0060 0 0x0 0xE (int gate)
0x05c0 0xffffffff8004e5c0 cs=0x0060 0 0x0 0xE (int gate)
0x05d0 0xffffffff8004e5d0 cs=0x0060 0 0x0 0xE (int gate)
0x05e0 0xffffffff8004e5e0 cs=0x0060 0 0x0 0xE (int gate)
0x05f0 0xffffffff8004e5f0 cs=0x0060 0 0x0 0xE (int gate)
0x0600 0xffffffff8004e600 cs=0x0060 0 0x0 0xE (int gate)
0x0610 0xffffffff8004e610 cs=0x0060 0 0x0 0xE (int gate)
0x0620 0xffffffff8004e620 cs=0x0060 0 0x0 0xE (int gate)
0x0630 0xffffffff8004e630 cs=0x0060 0 0x0 0xE (int gate)
0x0640 0xffffffff8004e640 cs=0x0060 0 0x0 0xE (int gate)
0x0650 0xffffffff8004e650 cs=0x0060 0 0x0 0xE (int gate)
0x0660 0xffffffff8004e660 cs=0x0060 0 0x0 0xE (int gate)
0x0670 0xffffffff8004e670 cs=0x0060 0 0x0 0xE (int gate)
0x0680 0xffffffff8004e680 cs=0x0060 0 0x0 0xE (int gate)
0x0690 0xffffffff8004e690 cs=0x0060 0 0x0 0xE (int gate)
0x06a0 0xffffffff8004e6a0 cs=0x0060 0 0x0 0xE (int gate)
0x06b0 0xffffffff8004e6b0 cs=0x0060 0 0x0 0xE (int gate)
0x06c0 0xffffffff8004e6c0 cs=0x0060 0 0x0 0xE (int gate)
0x06d0 0xffffffff8004e6d0 cs=0x0060 0 0x0 0xE (int gate)
0x06e0 0xffffffff8004e6e0 cs=0x0060 0 0x0 0xE (int gate)
0x06f0 0xffffffff8004e6f0 cs=0x0060 0 0x0 0xE (int gate)
0x0700 0xffffffff8004e700 cs=0x0060 0 0x0 0xE (int gate)
0x0710 0xffffffff8004e710 cs=0x0060 0 0x0 0xE (int gate)
0x0720 0xffffffff8004e720 cs=0x0060 0 0x0 0xE (int gate)
0x0730 0xffffffff8004e730 cs=0x0060 0 0x0 0xE (int gate)
0x0740 0xffffffff8004e740 cs=0x0060 0 0x0 0xE (int gate)
0x0750 0xffffffff8004e750 cs=0x0060 0 0x0 0xE (int gate)
0x0760 0xffffffff8004e760 cs=0x0060 0 0x0 0xE (int gate)
0x0770 0xffffffff8004e770 cs=0x0060 0 0x0 0xE (int gate)
0x0780 0xffffffff8004e780 cs=0x0060 0 0x0 0xE (int gate)
0x0790 0xffffffff8004e790 cs=0x0060 0 0x0 0xE (int gate)
0x07a0 0xffffffff8004e7a0 cs=0x0060 0 0x0 0xE (int gate)
0x07b0 0xffffffff8004e7b0 cs=0x0060 0 0x0 0xE (int gate)
0x07c0 0xffffffff8004e7c0 cs=0x0060 0 0x0 0xE (int gate)
0x07d0 0xffffffff8004e7d0 cs=0x0060 0 0x0 0xE (int gate)
0x07e0 0xffffffff8004e7e0 cs=0x0060 0 0x0 0xE (int gate)
0x07f0 0xffffffff8004e7f0 cs=0x0060 0 0x0 0xE (int gate)
0x0800 0xffffffff8004e800 cs=0x0060 0 0x0 0xE (int gate)
0x0810 0xffffffff8004e810 cs=0x0060 0 0x0 0xE (int gate)
0x0820 0xffffffff8004e820 cs=0x0060 0 0x0 0xE (int gate)
0x0830 0xffffffff8004e830 cs=0x0060 0 0x0 0xE (int gate)
0x0840 0xffffffff8004e840 cs=0x0060 0 0x0 0xE (int gate)
0x0850 0xffffffff8004e850 cs=0x0060 0 0x0 0xE (int gate)
0x0860 0xffffffff8004e860 cs=0x0060 0 0x0 0xE (int gate)
0x0870 0xffffffff8004e870 cs=0x0060 0 0x0 0xE (int gate)
0x0880 0xffffffff8004e880 cs=0x0060 0 0x0 0xE (int gate)
0x0890 0xffffffff8004e890 cs=0x0060 0 0x0 0xE (int gate)
0x08a0 0xffffffff8004e8a0 cs=0x0060 0 0x0 0xE (int gate)
0x08b0 0xffffffff8004e8b0 cs=0x0060 0 0x0 0xE (int gate)
0x08c0 0xffffffff8004e8c0 cs=0x0060 0 0x0 0xE (int gate)
0x08d0 0xffffffff8004e8d0 cs=0x0060 0 0x0 0xE (int gate)
0x08e0 0xffffffff8004e8e0 cs=0x0060 0 0x0 0xE (int gate)
0x08f0 0xffffffff8004e8f0 cs=0x0060 0 0x0 0xE (int gate)
0x0900 0xffffffff8004e900 cs=0x0060 0 0x0 0xE (int gate)
0x0910 0xffffffff8004e910 cs=0x0060 0 0x0 0xE (int gate)
0x0920 0xffffffff8004e920 cs=0x0060 0 0x0 0xE (int gate)
0x0930 0xffffffff8004e930 cs=0x0060 0 0x0 0xE (int gate)
0x0940 0xffffffff8004e940 cs=0x0060 0 0x0 0xE (int gate)
0x0950 0xffffffff8004e950 cs=0x0060 0 0x0 0xE (int gate)
0x0960 0xffffffff8004e960 cs=0x0060 0 0x0 0xE (int gate)
0x0970 0xffffffff8004e970 cs=0x0060 0 0x0 0xE (int gate)
0x0980 0xffffffff8004e980 cs=0x0060 0 0x0 0xE (int gate)
0x0990 0xffffffff8004e990 cs=0x0060 0 0x0 0xE (int gate)
0x09a0 0xffffffff8004e9a0 cs=0x0060 0 0x0 0xE (int gate)
0x09b0 0xffffffff8004e9b0 cs=0x0060 0 0x0 0xE (int gate)
0x09c0 0xffffffff8004e9c0 cs=0x0060 0 0x0 0xE (int gate)
0x09d0 0xffffffff8004e9d0 cs=0x0060 0 0x0 0xE (int gate)
0x09e0 0xffffffff8004e9e0 cs=0x0060 0 0x0 0xE (int gate)
0x09f0 0xffffffff8004e9f0 cs=0x0060 0 0x0 0xE (int gate)
0x0a00 0xffffffff8004ea00 cs=0x0060 0 0x0 0xE (int gate)
0x0a10 0xffffffff8004ea10 cs=0x0060 0 0x0 0xE (int gate)
0x0a20 0xffffffff8004ea20 cs=0x0060 0 0x0 0xE (int gate)
0x0a30 0xffffffff8004ea30 cs=0x0060 0 0x0 0xE (int gate)
0x0a40 0xffffffff8004ea40 cs=0x0060 0 0x0 0xE (int gate)
0x0a50 0xffffffff8004ea50 cs=0x0060 0 0x0 0xE (int gate)
0x0a60 0xffffffff8004ea60 cs=0x0060 0 0x0 0xE (int gate)
0x0a70 0xffffffff8004ea70 cs=0x0060 0 0x0 0xE (int gate)
0x0a80 0xffffffff8004ea80 cs=0x0060 0 0x0 0xE (int gate)
0x0a90 0xffffffff8004ea90 cs=0x0060 0 0x0 0xE (int gate)
0x0aa0 0xffffffff8004eaa0 cs=0x0060 0 0x0 0xE (int gate)
0x0ab0 0xffffffff8004eab0 cs=0x0060 0 0x0 0xE (int gate)
0x0ac0 0xffffffff8004eac0 cs=0x0060 0 0x0 0xE (int gate)
0x0ad0 0xffffffff8004ead0 cs=0x0060 0 0x0 0xE (int gate)
0x0ae0 0xffffffff8004eae0 cs=0x0060 0 0x0 0xE (int gate)
0x0af0 0xffffffff8004eaf0 cs=0x0060 0 0x0 0xE (int gate)
0x0b00 0xffffffff8004eb00 cs=0x0060 0 0x0 0xE (int gate)
0x0b10 0xffffffff8004eb10 cs=0x0060 0 0x0 0xE (int gate)
0x0b20 0xffffffff8004eb20 cs=0x0060 0 0x0 0xE (int gate)
0x0b30 0xffffffff8004eb30 cs=0x0060 0 0x0 0xE (int gate)
0x0b40 0xffffffff8004eb40 cs=0x0060 0 0x0 0xE (int gate)
0x0b50 0xffffffff8004eb50 cs=0x0060 0 0x0 0xE (int gate)
0x0b60 0xffffffff8004eb60 cs=0x0060 0 0x0 0xE (int gate)
0x0b70 0xffffffff8004eb70 cs=0x0060 0 0x0 0xE (int gate)
0x0b80 0xffffffff8004eb80 cs=0x0060 0 0x0 0xE (int gate)
0x0b90 0xffffffff8004eb90 cs=0x0060 0 0x0 0xE (int gate)
0x0ba0 0xffffffff8004eba0 cs=0x0060 0 0x0 0xE (int gate)
0x0bb0 0xffffffff8004ebb0 cs=0x0060 0 0x0 0xE (int gate)
0x0bc0 0xffffffff8004ebc0 cs=0x0060 0 0x0 0xE (int gate)
0x0bd0 0xffffffff8004ebd0 cs=0x0060 0 0x0 0xE (int gate)
0x0be0 0xffffffff8004ebe0 cs=0x0060 0 0x0 0xE (int gate)
0x0bf0 0xffffffff8004ebf0 cs=0x0060 0 0x0 0xE (int gate)
0x0c00 0xffffffff8004ec00 cs=0x0060 0 0x0 0xE (int gate)
0x0c10 0xffffffff8004ec10 cs=0x0060 0 0x0 0xE (int gate)
0x0c20 0xffffffff8004ec20 cs=0x0060 0 0x0 0xE (int gate)
0x0c30 0xffffffff8004ec30 cs=0x0060 0 0x0 0xE (int gate)
0x0c40 0xffffffff8004ec40 cs=0x0060 0 0x0 0xE (int gate)
0x0c50 0xffffffff8004ec50 cs=0x0060 0 0x0 0xE (int gate)
0x0c60 0xffffffff8004ec60 cs=0x0060 0 0x0 0xE (int gate)
0x0c70 0xffffffff8004ec70 cs=0x0060 0 0x0 0xE (int gate)
0x0c80 0xffffffff8004ec80 cs=0x0060 0 0x0 0xE (int gate)
0x0c90 0xffffffff8004ec90 cs=0x0060 0 0x0 0xE (int gate)
0x0ca0 0xffffffff8004eca0 cs=0x0060 0 0x0 0xE (int gate)
0x0cb0 0xffffffff8004ecb0 cs=0x0060 0 0x0 0xE (int gate)
0x0cc0 0xffffffff8004ecc0 cs=0x0060 0 0x0 0xE (int gate)
0x0cd0 0xffffffff8004ecd0 cs=0x0060 0 0x0 0xE (int gate)
0x0ce0 0xffffffff8004ece0 cs=0x0060 0 0x0 0xE (int gate)
0x0cf0 0xffffffff8004ecf0 cs=0x0060 0 0x0 0xE (int gate)
0x0d00 0xffffffff8004ed00 cs=0x0060 0 0x0 0xE (int gate)
0x0d10 0xffffffff8004ed10 cs=0x0060 0 0x0 0xE (int gate)
0x0d20 0xffffffff8004ed20 cs=0x0060 0 0x0 0xE (int gate)
0x0d30 0xffffffff8004ed30 cs=0x0060 0 0x0 0xE (int gate)
0x0d40 0xffffffff8004ed40 cs=0x0060 0 0x0 0xE (int gate)
0x0d50 0xffffffff8004ed50 cs=0x0060 0 0x0 0xE (int gate)
0x0d60 0xffffffff8004ed60 cs=0x0060 0 0x0 0xE (int gate)
0x0d70 0xffffffff8004ed70 cs=0x0060 0 0x0 0xE (int gate)
0x0d80 0xffffffff8004ed80 cs=0x0060 0 0x0 0xE (int gate)
0x0d90 0xffffffff8004ed90 cs=0x0060 0 0x0 0xE (int gate)
0x0da0 0xffffffff8004eda0 cs=0x0060 0 0x0 0xE (int gate)
0x0db0 0xffffffff8004edb0 cs=0x0060 0 0x0 0xE (int gate)
0x0dc0 0xffffffff8004edc0 cs=0x0060 0 0x0 0xE (int gate)
0x0dd0 0xffffffff8004edd0 cs=0x0060 0 0x0 0xE (int gate)
0x0de0 0xffffffff8004ede0 cs=0x0060 0 0x0 0xE (int gate)
0x0df0 0xffffffff8004edf0 cs=0x0060 0 0x0 0xE (int gate)
0x0e00 0xffffffff8004ee00 cs=0x0060 0 0x0 0xE (int gate)
0x0e10 0xffffffff8004ee10 cs=0x0060 0 0x0 0xE (int gate)
0x0e20 0xffffffff8004ee20 cs=0x0060 0 0x0 0xE (int gate)
0x0e30 0xffffffff8004ee30 cs=0x0060 0 0x0 0xE (int gate)
0x0e40 0xffffffff8004ee40 cs=0x0060 0 0x0 0xE (int gate)
0x0e50 0xffffffff8004ee50 cs=0x0060 0 0x0 0xE (int gate)
0x0e60 0xffffffff8004ee60 cs=0x0060 0 0x0 0xE (int gate)
0x0e70 0xffffffff8004ee70 cs=0x0060 0 0x0 0xE (int gate)
0x0e80 0xffffffff8004ee80 cs=0x0060 0 0x0 0xE (int gate)
0x0e90 0xffffffff8004ee90 cs=0x0060 0 0x0 0xE (int gate)
0x0ea0 0xffffffff8004eea0 cs=0x0060 0 0x0 0xE (int gate)
0x0eb0 0xffffffff8004eeb0 cs=0x0060 0 0x0 0xE (int gate)
0x0ec0 0xffffffff8004eec0 cs=0x0060 0 0x0 0xE (int gate)
0x0ed0 0xffffffff8004eed0 cs=0x0060 0 0x0 0xE (int gate)
0x0ee0 0xffffffff8004eee0 cs=0x0060 0 0x0 0xE (int gate)
0x0ef0 0xffffffff8004eef0 cs=0x0060 0 0x0 0xE (int gate)
0x0f00 0xffffffff8004ef00 cs=0x0060 0 0x0 0xE (int gate)
0x0f10 0xffffffff8004ef10 cs=0x0060 0 0x0 0xE (int gate)
0x0f20 0xffffffff8004ef20 cs=0x0060 0 0x0 0xE (int gate)
0x0f30 0xffffffff8004ef30 cs=0x0060 0 0x0 0xE (int gate)
0x0f40 0xffffffff8004ef40 cs=0x0060 0 0x0 0xE (int gate)
0x0f50 0xffffffff8004ef50 cs=0x0060 0 0x0 0xE (int gate)
0x0f60 0xffffffff8004ef60 cs=0x0060 0 0x0 0xE (int gate)
0x0f70 0xffffffff8004ef70 cs=0x0060 0 0x0 0xE (int gate)
0x0f80 0xffffffff8004ef80 cs=0x0060 0 0x0 0xE (int gate)
0x0f90 0xffffffff8004ef90 cs=0x0060 0 0x0 0xE (int gate)
0x0fa0 0xffffffff8004efa0 cs=0x0060 0 0x0 0xE (int gate)
0x0fb0 0xffffffff8004efb0 cs=0x0060 0 0x0 0xE (int gate)
0x0fc0 0xffffffff8004efc0 cs=0x0060 0 0x0 0xE (int gate)
0x0fd0 0xffffffff8004efd0 cs=0x0060 0 0x0 0xE (int gate)
0x0fe0 0xffffffff8004efe0 cs=0x0060 0 0x0 0xE (int gate)
0x0ff0 0xffffffff8004eff0 cs=0x0060 0 0x0 0xE (int gate)
(qemu) info gdt
GDTR.base=0xffffffff800cf280 GDTR.limit=0xbf
offset base limit/cs DPL flg typ
0x0000 ------------------ ---------- - --- 0x0
0x0008 0x0000000000000000 0x0000ffff 0 0x0 0xB (code execute/read, accessed) 16-bit
0x0010 0x0000000000000000 0x0000ffff 0 0x0 0x3 (data r/w, accessed) 16-bit
0x0018 0x0000000000000000 0xffffffff 0 0xC 0xB (code execute/read, accessed) 32-bit
0x0020 0x0000000000000000 0xffffffff 0 0xC 0x3 (data r/w, accessed) big
0x0028 ------------------ ---------- - --- 0x0
0x0030 ------------------ ---------- - --- 0x0
0x0038 ------------------ ---------- - --- 0x0
0x0040 0x0000000000000000 0xffffffff 3 0xC 0xB (code execute/read, accessed) 32-bit
0x0048 0x0000000000000000 0xffffffff 3 0xC 0x3 (data r/w, accessed) big
0x0050 0x0000000000000000 0xffffffff 3 0xA 0xB (code execute/read, accessed) 64-bit
0x0058 ------------------ ---------- - --- 0x0
0x0060 0x0000000000000000 0xffffffff 0 0xA 0xB (code execute/read, accessed) 64-bit
0x0068 0x0000000000000000 0xffffffff 0 0xC 0x3 (data r/w, accessed) big
0x0070 ------------------ ---------- - --- 0x0
0x0078 ------------------ ---------- - --- 0x0
0x0080 0xffffffff804db1c4 0x000000ff 0 0x0 0x9 (tss)
0x0090 ------------------ ---------- - --- 0x0
0x0098 ------------------ ---------- - --- 0x0
0x00a0 ------------------ ---------- - --- 0x0
0x00a8 ------------------ ---------- - --- 0x0
0x00b0 ------------------ ---------- - --- 0x0
0x00b8 ------------------ ---------- - --- 0x0
(qemu) info idt 4
IDTR.base=0xffffffff804deae0 IDTR.limit=0xfff
offset base limit/cs DPL flg typ
0x0020 0xffffffff8004e020 cs=0x0060 0 0x0 0xE (int gate)
(qemu) info gdt 4
GDTR.base=0xffffffff800cf280 GDTR.limit=0xbf
offset base limit/cs DPL flg typ
0x0020 0x0000000000000000 0xffffffff 0 0xC 0x3 (data r/w, accessed) big
(qemu) help info idt
info idt [index] -- show current interrupt descriptor table or specific entry
(qemu) help info gdt
info gdt [index] -- show current global descriptor table or specific entry
(qemu)
From 7f76ff34210d87fe5a9d5e024434c48c6c84b93a Mon Sep 17 00:00:00 2001
From: Doug Gale <doug16k@gmail.com>
Date: Thu, 30 May 2019 15:00:46 -0230
Subject: [PATCH] i386/monitor: add "info gdt [index]" and "info idt [index]"
commands
Signed-off-by: Doug Gale <doug16k@gmail.com>
---
hmp-commands-info.hx | 28 +++
include/monitor/hmp-target.h | 2 +
target/i386/monitor.c | 450 +++++++++++++++++++++++++++++++++++
3 files changed, 480 insertions(+)
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index c59444c461..b4967c4d57 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -202,6 +202,34 @@ STEXI
@item info pic
@findex info pic
Show PIC state.
+ETEXI
+
+ {
+ .name = "gdt",
+ .args_type = "index:i?",
+ .params = "[index]",
+ .help = "show current global descriptor table or specific entry",
+ .cmd = hmp_info_gdt,
+ },
+
+STEXI
+@item info gdt
+@findex info gdt
+Show GDT.
+ETEXI
+
+ {
+ .name = "idt",
+ .args_type = "index:i?",
+ .params = "[index]",
+ .help = "show current interrupt descriptor table or specific entry",
+ .cmd = hmp_info_idt,
+ },
+
+STEXI
+@item info idt
+@findex info idt
+Show IDT.
ETEXI
{
diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
index 454e8ed155..4435352919 100644
--- a/include/monitor/hmp-target.h
+++ b/include/monitor/hmp-target.h
@@ -46,5 +46,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict);
void hmp_mce(Monitor *mon, const QDict *qdict);
void hmp_info_local_apic(Monitor *mon, const QDict *qdict);
void hmp_info_io_apic(Monitor *mon, const QDict *qdict);
+void hmp_info_gdt(Monitor *mon, const QDict *qdict);
+void hmp_info_idt(Monitor *mon, const QDict *qdict);
#endif /* MONITOR_HMP_TARGET_H */
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 56e2dbece7..3ea03d6255 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -736,3 +736,453 @@ SevCapability *qmp_query_sev_capabilities(Error **errp)
return data;
}
+
+typedef struct {
+ uint16_t limit_15_0;
+ uint16_t base_15_0;
+ uint8_t base_23_16;
+ uint8_t type_pl;
+ uint8_t limit_19_16_flags;
+ uint8_t base_31_24;
+} QEMU_PACKED gdt_entry_t;
+
+typedef struct {
+ uint16_t base_15_0;
+ uint16_t seg;
+ uint8_t zero;
+ uint8_t type_pl;
+ uint16_t base_31_16;
+} QEMU_PACKED gate_entry_t;
+
+/* 1=code or data segment, 0=system segment */
+#define GDT_ENT_PL_CODESEG_BIT 4
+/* DPL, 2 bits */
+#define GDT_ENT_PL_DPL_MASK 0x3
+#define GDT_ENT_PL_DPL_BIT 5
+/* Present */
+#define GDT_ENT_PL_P_BIT 7
+
+/*
+ * Granularity, when 1 limit field value
+ * is shifted left 12 bits, shifting in ones
+ */
+#define GDT_ENT_FLAGS_G_BIT 7
+/* Big big, 1=32 bit operation default */
+#define GDT_ENT_FLAGS_B_BIT 6
+/* Long, 1=long mode when other conditions permit */
+#define GDT_ENT_FLAGS_L_BIT 5
+/* Available */
+#define GDT_ENT_FLAGS_V_BIT 4
+
+#define GDT_TYPE_NULL 0x0
+#define GDT_TYPE_SYS_TSS16 0x1
+#define GDT_TYPE_SYS_LDT 0x2
+#define GDT_TYPE_SYS_TSS16BUSY 0x3
+#define GDT_TYPE_SYS_CALLGATE16 0x4
+#define GDT_TYPE_SYS_TASKGATE 0x5
+#define GDT_TYPE_SYS_INTGATE16 0x6
+#define GDT_TYPE_SYS_TRAPGATE16 0x7
+#define GDT_TYPE_SYS_TSS 0x9
+#define GDT_TYPE_SYS_TSSBUSY 0xB
+#define GDT_TYPE_SYS_CALLGATE 0xC
+#define GDT_TYPE_SYS_INTGATE 0xE
+#define GDT_TYPE_SYS_TRAPGATE 0xF
+
+static uint32_t gdt_entry_base(const gdt_entry_t *ent)
+{
+ return (ent->base_31_24 << 24) |
+ (ent->base_23_16 << 16) |
+ (ent->base_15_0);
+}
+
+static uint32_t gate_entry_base(const gate_entry_t *ent)
+{
+ return (ent->base_31_16 << 16) |
+ (ent->base_15_0);
+}
+
+static uint32_t gdt_entry_limit(const gdt_entry_t *ent)
+{
+ uint32_t limit = ((ent->limit_19_16_flags & 0x0F) << 16) |
+ (ent->limit_15_0);
+
+ if (ent->limit_19_16_flags & GDT_ENT_FLAGS_G_BIT) {
+ limit <<= 12;
+ limit |= 0xFFF;
+ }
+ return limit;
+}
+
+static uint8_t gdt_entry_type(const gdt_entry_t *ent)
+{
+ return ent->type_pl & 0xF;
+}
+
+static uint8_t gdt_entry_dpl(const gdt_entry_t *ent)
+{
+ return (ent->type_pl >> GDT_ENT_PL_DPL_BIT) & GDT_ENT_PL_DPL_MASK;
+}
+
+static int gdt_entry_is_sys(const gdt_entry_t *ent)
+{
+ return (ent->type_pl & (1 << GDT_ENT_PL_CODESEG_BIT)) == 0;
+}
+
+static uint8_t gdt_entry_flags(const gdt_entry_t *ent)
+{
+ return (ent->limit_19_16_flags >> 4) & 0xF;
+}
+
+static int gdt_entry_is_big(const gdt_entry_t *ent)
+{
+ return (ent->limit_19_16_flags & (1 << GDT_ENT_FLAGS_B_BIT)) != 0;
+}
+
+#ifdef TARGET_X86_64
+static int gdt_entry_is_doublesize(const gdt_entry_t *ent)
+{
+ /* Code and data segments are regular sized */
+ if (!gdt_entry_is_sys(ent)) {
+ return 0;
+ }
+
+ /* Special system segments are double sized */
+ switch (gdt_entry_type(ent)) {
+ case GDT_TYPE_SYS_LDT:
+ case GDT_TYPE_SYS_TSS:
+ case GDT_TYPE_SYS_TSSBUSY:
+ case GDT_TYPE_SYS_CALLGATE:
+ case GDT_TYPE_SYS_INTGATE:
+ case GDT_TYPE_SYS_TRAPGATE:
+ return 1;
+ }
+
+ /* Everything else is regular sized */
+ return 0;
+}
+
+static int gdt_entry_is_64(const gdt_entry_t *ent)
+{
+ return (ent->limit_19_16_flags & (1 << GDT_ENT_FLAGS_L_BIT)) != 0;
+}
+#endif
+
+static int gdt_entry_type_is_gate(int type)
+{
+ switch (type) {
+ case GDT_TYPE_SYS_CALLGATE16:
+ case GDT_TYPE_SYS_INTGATE16:
+ case GDT_TYPE_SYS_TRAPGATE16:
+ case GDT_TYPE_SYS_TASKGATE:
+ case GDT_TYPE_SYS_CALLGATE:
+ case GDT_TYPE_SYS_INTGATE:
+ case GDT_TYPE_SYS_TRAPGATE:
+ return 1;
+ }
+
+ return 0;
+}
+
+static int gdt_entry_is_code(const gdt_entry_t *ent)
+{
+ return !gdt_entry_is_sys(ent) && gdt_entry_type(ent) >= 8;
+}
+
+static const char *gdt_entry_sys_type_text(uint8_t type)
+{
+ /*
+ *-----+------------------------+-------------------------*
+ * type| 32-bit meaning | 64-bit meaning *
+ *-----+------------------------+-------------------------*
+ * 0x0 | Reserved | Reserved *
+ * 0x1 | 16-bit TSS (Available) | Reserved *
+ * 0x2 | LDT | LDT *
+ * 0x3 | 16-bit TSS (Busy) | Reserved *
+ * 0x4 | 16-bit Call Gate | Reserved *
+ * 0x5 | Task Gate | Reserved *
+ * 0x6 | 16-bit Interrupt Gate | Reserved *
+ * 0x7 | 16-bit Trap Gate | Reserved *
+ * 0x8 | Reserved | Reserved *
+ * 0x9 | 32-bit TSS (Available) | 64-bit TSS (Available) *
+ * 0xA | Reserved | Reserved *
+ * 0xB | 32-bit TSS (Busy) | 64-bit TSS (Busy) *
+ * 0xC | 32-bit Call Gate | 64-bit Call Gate *
+ * 0xD | Reserved | Reserved *
+ * 0xE | 32-bit Interrupt Gate | 64-bit Interrupt Gate *
+ * 0xF | 32-bit Trap Gate | 64-bit Trap Gate *
+ *-----+------------------------+-------------------------*
+ * Intel SDM, volume 3, 3.4.5 Segment Descriptors *
+ *-----+------------------------+-------------------------*
+ */
+
+ switch (type) {
+ case GDT_TYPE_NULL:
+ return "";
+ case GDT_TYPE_SYS_TSS16:
+ return "16-bit tss";
+ case GDT_TYPE_SYS_LDT:
+ return "ldt";
+ case GDT_TYPE_SYS_TSS16BUSY:
+ return "16-bit busy tss";
+ case GDT_TYPE_SYS_CALLGATE16:
+ return "16-bit call gate";
+ case GDT_TYPE_SYS_TASKGATE:
+ return "task gate";
+ case GDT_TYPE_SYS_INTGATE16:
+ return "16-bit int gate";
+ case GDT_TYPE_SYS_TRAPGATE16:
+ return "16-bit trap gate";
+ case GDT_TYPE_SYS_TSS:
+ return "tss";
+ case GDT_TYPE_SYS_TSSBUSY:
+ return "busy tss";
+ case GDT_TYPE_SYS_CALLGATE:
+ return "call gate";
+ case GDT_TYPE_SYS_INTGATE:
+ return "int gate";
+ case GDT_TYPE_SYS_TRAPGATE:
+ return "trap gate";
+ }
+
+ return "reserved";
+}
+
+static const char *gdt_entry_cd_type_text(uint8_t type)
+{
+ /*
+ *----+-------+-------------------------------------------*
+ * |X E W A| *
+ * 0x0|0 0 0 0|Data R/O *
+ * 0x1|0 0 0 1|Data R/O, accessed *
+ * 0x2|0 0 1 0|Data R/W *
+ * 0x3|0 0 1 1|Data R/W, accessed *
+ * 0x4|0 1 0 0|Data R/O, expand-down *
+ * 0x5|0 1 0 1|Data R/O, expand-down, accessed *
+ * 0x6|0 1 1 0|Data R/W, expand-down *
+ * 0x7|0 1 1 1|Data R/W, expand-down, accessed *
+ * | | *
+ * | C R A| *
+ * 0x8|1 0 0 0|Code Execute only *
+ * 0x9|1 0 0 1|Code Execute only, accessed *
+ * 0xA|1 0 1 0|Code Execute/read *
+ * 0xB|1 0 1 1|Code Execute/read, accessed *
+ * 0xC|1 1 0 0|Code Execute only, conforming *
+ * 0xD|1 1 0 1|Code Execute only, conforming, accessed *
+ * 0xE|1 1 1 0|Code Execute/read, conforming *
+ * 0xF|1 1 1 1|Code Execute/read, conforming, accessed *
+ *----+-------+-------------------------------------------*
+ */
+
+ switch (type) {
+ case 0x0: return "data r/o";
+ case 0x1: return "data r/o, accessed";
+ case 0x2: return "data r/w";
+ case 0x3: return "data r/w, accessed";
+ case 0x4: return "data r/o, expand-down";
+ case 0x5: return "data r/o, expand-down, accessed";
+ case 0x6: return "data r/w, expand-down";
+ case 0x7: return "data r/w, expand-down, accessed";
+ case 0x8: return "code execute only";
+ case 0x9: return "code execute only, accessed";
+ case 0xA: return "code execute/read";
+ case 0xB: return "code execute/read, accessed";
+ case 0xC: return "code execute only, conforming";
+ case 0xD: return "code execute only, conforming, accessed";
+ case 0xE: return "code execute/read, conforming";
+ case 0xF: return "code execute/read, conforming, accessed";
+ }
+
+ return "??";
+}
+
+static void hmp_info_descriptor_table(Monitor *mon, const QDict *qdict,
+ CPUState *cs, const char *name,
+ uint64_t base, uint16_t limit)
+{
+ int specific_entry = qdict_get_try_int(qdict, "index", -1);
+
+ monitor_printf(mon, "%sR.base=%#" PRIx64 " %sR.limit=%#" PRIx32 "\n",
+ name, (uint64_t)base, name, limit);
+
+ monitor_printf(mon,
+ "offset"
+ " base "
+ " limit/cs "
+ " DPL"
+ " flg"
+ " typ"
+ "\n");
+
+ size_t nr_entries = (limit + 1) >> 3;
+
+ size_t st = 0;
+ size_t en = nr_entries;
+
+ if (specific_entry >= 0) {
+ st = specific_entry;
+ en = specific_entry + 1;
+ }
+
+ for (size_t i = st; i < nr_entries && i < en; ++i) {
+ gdt_entry_t gdt_ent;
+ memset(&gdt_ent, 0, sizeof(gdt_ent));
+
+ size_t ofs = i << 3;
+
+ size_t skip_ahead = 0;
+
+ target_ulong addr = base + (i << 3);
+ if (cpu_memory_rw_debug(cs, addr, (uint8_t *)&gdt_ent,
+ sizeof(gdt_ent), false) == 0) {
+ target_ulong base = gdt_entry_base(&gdt_ent);
+ uint32_t limit = gdt_entry_limit(&gdt_ent);
+
+
+#ifdef TARGET_X86_64
+ uint32_t upper_half[2] = { 0, 0 };
+
+ if (gdt_entry_is_doublesize(&gdt_ent)) {
+ skip_ahead = 1;
+
+ if (cpu_memory_rw_debug(cs, addr + 8, (uint8_t *)upper_half,
+ sizeof(gdt_ent), false) >= 0) {
+ base |= (target_ulong)upper_half[0] << 32;
+
+ /*
+ * Only bits 12:8 of the upper half
+ * upper 32-bit word are reserved
+ * AMD vol 2 - system - 4.8.3 System descriptors
+ */
+ if ((upper_half[1] & 0x1F00) != 0) {
+ monitor_printf(mon,
+ "0x%.4zx"
+ " ***Error, reserved bits set"
+ " in upper half of double-sized"
+ " GDT entry: 0x%x!\n",
+ ofs, upper_half[1]);
+ }
+ } else {
+ monitor_printf(mon, "0x%.4zx"
+ " ***Error, unable to access"
+ " memory when fetching the"
+ " second half of double-sized GDT"
+ " entry!\n", ofs);
+ }
+ }
+#endif
+
+ uint8_t dpl = gdt_entry_dpl(&gdt_ent);
+ uint8_t type = gdt_entry_type(&gdt_ent);
+ const char *type_text = NULL;
+ const char *size_text = "";
+
+ if (gdt_entry_is_sys(&gdt_ent)) {
+ type_text = gdt_entry_sys_type_text(type);
+ } else {
+ type_text = gdt_entry_cd_type_text(type);
+
+ /*
+ * AMD volume 2 - system - 4.8.1 Code-Segment Descriptors
+ * If the processor is running in 64-bit mode (L=1), the
+ * only valid setting of the D bit is 0. This setting produces
+ * a default operand size of 32 bits and a default address
+ * size of 64 bits. The combination L=1 and D=1 is
+ * reserved for future use.
+ *
+ * X L B
+ * 0 0 0 16-bit data
+ * 0 0 1 big data (32-bit or 64 bit)
+ * 0 1 0 undefined (64 bit data is nonsense)
+ * 0 1 1 reserved - do not use
+ * 1 0 0 16-bit code
+ * 1 0 1 32-bit code
+ * 1 1 0 64-bit
+ * 1 1 1 reserved - do not use
+ */
+
+#ifdef TARGET_X86_64
+ if (gdt_entry_is_64(&gdt_ent)) {
+ if (gdt_entry_is_big((&gdt_ent))) {
+ monitor_printf(mon, "0x%.4zx"
+ " ***Error, segment cannot be"
+ " both long (L=1) and big (B=1),"
+ " reserved combination!\n", ofs);
+ }
+
+ if (gdt_entry_is_code(&gdt_ent)) {
+ size_text = "64-bit";
+ }
+ } else
+#endif
+ {
+ if (gdt_entry_is_big(&gdt_ent)) {
+ if (!gdt_entry_is_code(&gdt_ent)) {
+ /*
+ * "big" because the L bit is ignored and a there
+ * is no such thing as a 64 bit data segment,
+ * avoid implying that such a thing exists
+ */
+ size_text = "big";
+ } else {
+ size_text = "32-bit";
+ }
+ } else {
+ size_text = "16-bit";
+ }
+ }
+ }
+
+ uint8_t flags = gdt_entry_flags(&gdt_ent);
+
+ if (type || base || limit || flags || dpl) {
+ gate_entry_t gate;
+ if (!gdt_entry_type_is_gate(type)) {
+ monitor_printf(mon, "0x%.4zx 0x%.*" PRIx64
+ " 0x%.8x %u 0x%X 0x%X (%s) %s\n",
+ ofs, (int)sizeof(target_ulong) * 2,
+ (uint64_t)base, limit, dpl, flags,
+ type, type_text, size_text);
+ } else {
+ memcpy(&gate, &gdt_ent, sizeof(gate));
+ base = gate_entry_base(&gate);
+
+#ifdef TARGET_X86_64
+ base |= (uint64_t)upper_half[0] << 32;
+#endif
+
+ monitor_printf(mon, "0x%.4zx 0x%.*" PRIx64
+ " cs=0x%.4x %u 0x%X 0x%X (%s) %s\n",
+ ofs, (int)sizeof(target_ulong) * 2,
+ (uint64_t)base, gate.seg, dpl, flags,
+ type, type_text, size_text);
+ }
+ } else {
+ monitor_printf(mon, "0x%.4zx ------------------"
+ " ---------- - "
+ " --- 0x%X\n",
+ ofs, type);
+ }
+ } else {
+ monitor_printf(mon, "%4zx: unable to access memory at 0x"
+ TARGET_FMT_lx, ofs, addr);
+ }
+
+ i += skip_ahead;
+ }
+}
+
+void hmp_info_gdt(Monitor *mon, const QDict *qdict)
+{
+ CPUState *cs = mon_get_cpu();
+ CPUX86State *x86 = mon_get_cpu_env();
+ hmp_info_descriptor_table(mon, qdict, cs,
+ "GDT", x86->gdt.base, x86->gdt.limit);
+}
+
+void hmp_info_idt(Monitor *mon, const QDict *qdict)
+{
+ CPUState *cs = mon_get_cpu();
+ CPUX86State *x86 = mon_get_cpu_env();
+ hmp_info_descriptor_table(mon, qdict, cs,
+ "IDT", x86->idt.base, x86->idt.limit);
+}
--
2.17.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment