Re: 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: Bx.C: "Re: disassembler prefix-byte check -- wanting comments good and bad"
- Previous message: wolfgang kern: "Re: newbie about winAPI"
- In reply to: 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 13:19:28 +0000 (UTC)
"Tim Roberts" <timr@probo.com> wrote in message
news:4pl760hne3gqmk975a51vmlllnchdpng6h@4ax.com...
> "Bx.C" <invalid-email-address@invalid.shiragajin> wrote:
> >
> >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
>
> Here's a shorter one:
>
> b8 00 00 fe c0 mov ax,0 mov eax,0c0fe0000h
> inc al
> 84 c0 test al,al test al,al
> 74 xx jz cs16b jz cs16b
>
> >i think people making debuggers to work in real-mode and protected-mode
> >might like this code snippet...
>
> We used to use something like this in the Cinepak codec in Windows 3.1.
> Windows 3.1 had the ability to load 32-bit code segments from a
> protect-mode EXE, but it would load them as 16-bit segments. We'd use
that
> kind of code to decide whether we needed to alter the segment descriptor.
> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
>
>
hehe... i KNEW it was useful for something...
how about this even shorter version that Herbert Kleebauer came up w/ in
alt.lang.asm last night... this solution looks much better...
(good thing he supplied his binary, i still can't make heads or tails of the
mnemonics he uses)
------------------------------------
b1 01 mov al,001h mov al,001h
c1 e0 10 shl ax,010h shl eax,010h
74 xx jz cs16b jz cs16b
------------------------------------
jumps if in 16-bit... doesn't if in 32-bit...
- Next message: Bx.C: "Re: disassembler prefix-byte check -- wanting comments good and bad"
- Previous message: wolfgang kern: "Re: newbie about winAPI"
- In reply to: 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
|