Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: require enc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 13 of 18 Topic 4631 of 4729
Post > Topic >>

Re: require encoding

by "Alexei A. Frounze" <spamtrap@[EMAIL PROTECTED] > Apr 27, 2008 at 04:03 AM

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.

Actually, I take my words back. You can force TASM (and probably MASM
as well) to generate this kind of far instruction without using DB
0EAH,... But you need to jump through the hoops.

Here's an example:
CODE SEGMENT PARA PUBLIC "CODE" USE16
ASSUME CS:CODE
FXN PROC NEAR
        NOP
        JMP FAR PTR LOAD_CS_8
FXN_NEXT = $ - FXN
        RET
FXN ENDP
CODE ENDS

CODE8 SEGMENT BYTE PUBLIC "CODE" USE16 AT 8
ASSUME CS:CODE8
ORG FXN_NEXT
LOAD_CS_8 PROC FAR
LOAD_CS_8 ENDP
CODE8 ENDS

END FXN
The disassembly:
C:\>debug FARJ.EXE
-u
15C5:0000 90            NOP
15C5:0001 EA06000800    JMP     0008:0006
15C5:0006 C3            RET

Alex
 




 18 Posts in Topic:
require encoding
"Helge Kruse"   2008-04-26 16:25:42 
Re: require encoding
"Alexei A. Frounze&q  2008-04-26 13:01:43 
Re: require encoding
"Helge Kruse"   2008-04-27 08:53:22 
Re: require encoding
Mike Gonta <spamtrap@  2008-04-26 15:57:45 
Re: require encoding
Frank Kotler <spamtra  2008-04-27 07:12:10 
Re: require encoding
ArarghMail804NOSPAM <s  2008-04-27 04:16:02 
Re: require encoding
"Helge Kruse"   2008-04-27 08:51:27 
Re: require encoding
"Wolfgang Kern"  2008-04-27 11:21:40 
Re: require encoding
"H. Peter Anvin"  2008-05-13 09:10:22 
Re: require encoding
ArarghMail804NOSPAM <s  2008-04-27 04:15:01 
Re: require encoding
"Alexei A. Frounze&q  2008-04-27 02:58:54 
Re: require encoding
Mike Gonta <spamtrap@  2008-04-27 04:26:48 
Re: require encoding
"Alexei A. Frounze&q  2008-04-27 04:03:20 
Re: require encoding
ArarghMail804NOSPAM <s  2008-04-28 00:49:27 
Re: require encoding
Mike Gonta <spamtrap@  2008-04-27 10:36:53 
Re: require encoding
Mike Gonta <spamtrap@  2008-04-27 10:46:45 
Re: require encoding
Brendan <spamtrap@[EM  2008-04-27 20:11:40 
Re: require encoding
"Alexei A. Frounze&q  2008-04-28 01:52:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:03:56 CDT 2008.