User:Combuster/notepad: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
No edit summary |
more bochs stuff, changed popf in popfd |
||
Line 5: | Line 5: | ||
:actually, i got the same result on a real 686, but not on AMDs... seems this test only works properly on 486s or before. |
:actually, i got the same result on a real 686, but not on AMDs... seems this test only works properly on 486s or before. |
||
PUSHFD |
|||
PUSHF |
|||
POP EAX |
POP EAX |
||
; either clear flags for first test, or set flags for second test. pick one: |
; either clear flags for first test, or set flags for second test. pick one: |
||
Line 13: | Line 13: | ||
MOV AX, 5 |
MOV AX, 5 |
||
MOV CL, 2 |
MOV CL, 2 |
||
POPFD |
|||
POPF |
|||
DIV CL |
DIV CL |
||
PUSHFD |
|||
PUSHF |
|||
POP EAX |
POP EAX |
||
AND EAX, 0x8D5 |
AND EAX, 0x8D5 |
||
;AX contains signature |
;AX contains signature |
||
in 16-bit mode, use ax instead of eax |
in 16-bit mode, use popf and ax instead of popfd and eax |
||
== Bochs messages == |
|||
A list of messages and likely causes: |
|||
interrupt(): gate descriptor is not valid sys seg |
|||
You have not loaded an IDT, or the IDT is corrupt |
|||
interrupt(): SS selector null |
|||
* You have no TSS |
|||
* You haven't set SS0 / ESP0 in the TSS |
Revision as of 12:01, 13 March 2007
These are my notes from experience. PD code, No warranty etc (i mess up things more than once).
Detecting Emulator
perform DIV test: all common flags are maintained. (0000 08D5)
- actually, i got the same result on a real 686, but not on AMDs... seems this test only works properly on 486s or before.
PUSHFD POP EAX ; either clear flags for first test, or set flags for second test. pick one: ; AND AX, (0xffff - 0x8D5) ; OR AX, 0x8D5 PUSH EAX MOV AX, 5 MOV CL, 2 POPFD DIV CL PUSHFD POP EAX AND EAX, 0x8D5 ;AX contains signature
in 16-bit mode, use popf and ax instead of popfd and eax
Bochs messages
A list of messages and likely causes:
interrupt(): gate descriptor is not valid sys seg
You have not loaded an IDT, or the IDT is corrupt
interrupt(): SS selector null
- You have no TSS
- You haven't set SS0 / ESP0 in the TSS