16-bit vs. 32-bit code segment check -- wanting comments good and bad...
From: Bx.C (invalid-email-address_at_invalid.shiragajin)
Date: 03/26/04
- Next message: Frank Kotler: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Previous message: Bx.C: "disassembler prefix-byte check -- wanting comments good and bad"
- Next in thread: Frank Kotler: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Reply: Frank Kotler: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Reply: Herbert Kleebauer: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Reply: wolfgang kern: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 25 Mar 2004 21:42:45 -0600
binary 16-bit 32-bit
--------------------------------
55 push bp push ebp
89 E5 mov bp,sp mov ebp,esp
55 push bp push ebp
29 E5 sub bp,sp sub ebp,esp
01 EC add sp,bp add esp,ebp
83 FD 04 cmp bp,+4 cmp ebp,+4
19 C0 sbb ax,ax sbb ax,ax
5D pop bp pop ebp
74 xx jz cs32b jz cs32b
as long as the jump is within short jump range, this code will work to
differentiate between whether or not the cpu is currently running the code
as 32-bit or 16-bit... not that this ever happens to anyone, though...
oh and the sbb ax,ax can be taken out if you don't want an error-code to
tell you which you're in...
i think people making debuggers to work in real-mode and protected-mode
might like this code snippet...
- Next message: Frank Kotler: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Previous message: Bx.C: "disassembler prefix-byte check -- wanting comments good and bad"
- Next in thread: Frank Kotler: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Reply: Frank Kotler: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Reply: Herbert Kleebauer: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Reply: wolfgang kern: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|