Dear Ebiederman,
Thank you! I have add ".code16" at protected mode or real mode, then the
machine code is right: "e8 01 00". But CPU still fetch code incorrectly. I guess
my code don't back to real mode, it seem to still in protected mode.
I don't know what is wrong with my code. So strange???
Regards,
Collins
[EMAIL PROTECTED] (Eric W. Biederman) on 2002-02-28 01:18:48
To: Collins Chen/ALI_ZSZ/ACER@ACER
cc: Ronald G Minnich <[EMAIL PROTECTED]>, Jeffrey
W.C. Chen/ALI_TPE/ACER@ACER,
[EMAIL PROTECTED]
Subject Re: Why CPU don't execute 16-bit code
:
"Collins Chen" <"collins_chen"@ali.com.tw> writes:
> Hi Ron,
> In ipl.S the machine code "e8 01 00" (is a short call) can execute
because
> in real mode.
> In start32.inc the same machine code "e8 01 00" can't execute because in
> protected mode, I find in protected mode, CPU always fetch 4 bytes as offset
> after machine code "e8". So I must back to real mode before invoke vga bios,
but
>
> then CPU still fetch 4 bytes as offset like in protected mode. I think maybe
my
> code about back real mode is wrong. Can you give me some advice?
> BTW, if CPU can execute "e8 01 00" correctly in protected mode?
Your code goes to real mode but it doesn't switch to 16bit mode. I'm
not quite certain how such a contradiction can exist but it does.
Switch to a 16bit protected mode segment before switching to real mode
and it should work.
Eric
>
> Regards,
> Collins
>
> my code:
>
> movl %cr0, %eax /*exit protected mode*/
> andb $0xfe, %al
> movl %eax, %cr0
>
> ljmp $0x8000, $realcc
> /* jmp realccc */
> realcc: