On Apr 26, 11:51 pm, "Helge Kruse" <spamt...@[EMAIL PROTECTED]
> wrote:
> Reply inline.
>
> "Mike Gonta" <spamt...@[EMAIL PROTECTED]
> wrote in
messagenews:770a0df6-a9d3-46c6-b5d2-76ea248fc4fc@[EMAIL PROTECTED]
> > On Apr 26, 10:25 am, "Helge Kruse" wrote:
>
> >> I wrote a x86 boot loader a long time ago. One step is to jump form
16 bit to 32 bit segment before entering protected mode.
> >> Is there any way to write a clean jump to 32 bit segment?
>
> > ;assemble with FASM
> > use16
> > 66 31 C0 xor eax, eax
> > 8E D8 mov ds, ax
> > 0F 01 16 18 00 lgdt [gdt]
> > 0F 20 C0 mov eax, cr0
> > 24 EF and al, 0EFh
> > 0F 22 C0 mov cr0, eax
> > EA 30 00 08 00 jmp 8:protected_mode
>
> I dont know the syntax 8:Label. Is 8 the selector offset?
> In that case I would expect a far jump. This would need 16 bit selector
offset and 32 bit offset, wouldn't it? But I think EA is the
> opcode for a near jump.
Please reread my previous reply and the CPU do***entation with
attention. The 0xEA opcode is for a far jump. Ap in the mnemonic "JMP
Ap" is do***ented as:
- A Far pointer is encoded in the instruction
- p A 32-bit or 48-bit far pointer, depending on the effective operand
size
EA 30 00 08 00 jmp 8:protected_mode
is exactly this thing. TASM and MASM sup****t far jumps/calls (with
this encoding) but in a restricted manner -- protected_mode must be a
far proc in a different segment. And to achieve precisely this
instruction in this situation with TASM/MASM you probably have no
other way than just doing DB 0EAH, etc.
Alex


|