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: arargh403NOSPAM_at_NOW.AT.arargh.com: "Re: Adding a public function to a DLL"
- Previous message: Bx.C: "disassembler prefix-byte check -- wanting comments good and bad"
- Next in thread: Tim Roberts: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Reply: Tim Roberts: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 26 Mar 2004 04:07:26 +0000 (UTC)
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: arargh403NOSPAM_at_NOW.AT.arargh.com: "Re: Adding a public function to a DLL"
- Previous message: Bx.C: "disassembler prefix-byte check -- wanting comments good and bad"
- Next in thread: Tim Roberts: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Reply: Tim Roberts: "Re: 16-bit vs. 32-bit code segment check -- wanting comments good and bad..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|