From owner-freebsd-amd64@FreeBSD.ORG Sun Jul 17 05:19:45 2005 Return-Path: X-Original-To: freebsd-amd64@FreeBSD.org Delivered-To: freebsd-amd64@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A360916A41C for ; Sun, 17 Jul 2005 05:19:45 +0000 (GMT) (envelope-from weijian0204@yahoo.com.cn) Received: from web15309.mail.cnb.yahoo.com (web15309.mail.cnb.yahoo.com [202.43.216.184]) by mx1.FreeBSD.org (Postfix) with SMTP id 0861743D45 for ; Sun, 17 Jul 2005 05:19:44 +0000 (GMT) (envelope-from weijian0204@yahoo.com.cn) Received: (qmail 23824 invoked by uid 60001); 17 Jul 2005 05:19:43 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.cn; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=boutWrGe9skM3dy/OoIOddOq70Q1eUc2y3Ay6ryAAAm47/8DELFCIs0Erfp+HzfQW1iOTaajGMwdVojKiGeKLiCXm9zOTT4k8XiFf3S21k0CQyQWFXRJXSbAVZjgvIw/rmrB366RO1pgXSITwZXdAVOxdRyipckxvEu2+7+4jLo= ; Message-ID: <20050717051943.23822.qmail@web15309.mail.cnb.yahoo.com> Received: from [221.7.131.221] by web15309.mail.cnb.yahoo.com via HTTP; Sun, 17 Jul 2005 13:19:43 CST Date: Sun, 17 Jul 2005 13:19:43 +0800 (CST) From: =?gb2312?q?Mr=20=BC=FC=20=CE=A4?= To: freebsd-amd64@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sun, 17 Jul 2005 11:33:12 +0000 Cc: Subject: Please help me about enter long mode! X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jul 2005 05:19:45 -0000 Hi: Please help me.I can't enter long mode.I'm no good ideas!If you could give me your assembly code about how to enter long mode correctly,I can give some monney.Thank you,very much. My assembly code: ;---------------------------------------------------------------------- ; Processor Initialization ;---------------------------------------------------------------------- bits 16 org 0x7c00 ;---------------------------------------------------------------------- GDT_CodeSegment_Selector equ 0x08 ;---------------------------------------------------------------------- jmp Initializate_Processor GDT_Tables: GDT_Null: Null_Discriptor1 dd 0x00 Null_Discriptor2 dd 0x00 GDT_CodeSegment_Address equ $-GDT_Tables GDT_CodeSegment: dw 0xffff dw 0x0000 db 0x00 db 10011010b db 11001111b db 0x00 GDT_DataSegment_Address equ $-GDT_Tables GDT_DataSegment: dw 0xffff dw 0x0000 db 0x00 db 10010010b db 11001111b db 0x00 GDT64_CodeSegment_Address equ $-GDT_Tables GDT64_CodeSegment: dd 0x0000 db 0x00 db 10011000b db 00000000b db 0x00 GDT_End: GDT_Address: dw GDT_End-GDT_Tables-1 dd GDT_Tables ;---------------------------------------------------------------------- IDT_Address: IDT_Address_Limit dw IDT_End-IDT_Tables-1 IDT_Address_Base dd IDT_Tables IDT_Tables: IDT_Discriptor_00: Target_Code_Segment_Offset1_00 dw 0x0000 ;Low bit Target_Code_Segment_Selector_00 dw GDT_CodeSegment_Selector Attribute_00 dw 0x8e00 Target_Code_Segment_Offset2_00 dw 0x0100 ;High bit IDT_End: ; -------------------------------------------------------------------------------------- Initializate_Processor: Mask_All_IRQ: mov al,255 out 0xa1,al out 0x21,al Enable_A20: Enable_A20_First: in al,0x64 test al,2 jnz Enable_A20_First mov al,0xd1 out 0x64,al Enable_A20_Second: in al,0x64 test al,2 jnz Enable_A20_Second mov al,0xdf out 0x60,al Disable_Interrupt: cli Load_GDT: lgdt [GDT_Address] lidt [IDT_Address] Enable_ProtectedMode: mov eax,0x11 mov cr0,eax jmp GDT_CodeSegment_Address:Code_32 Bits 32 Code_32: mov ax,GDT_DataSegment_Address mov ds,ax mov es,ax mov ss,ax mov fs,ax mov gs,ax mov esp,0xffff PAE: mov edi,0x100000 mov eax,0x110000 add eax,0x01 stosd mov edi,0x110000 mov eax,0x120000 add eax,0x01 stosd mov edi,0x120000 mov eax,0x130000 add eax,0x01 stosd mov edi,0x130000 mov eax,0x000001 mov ecx,0x200 STOSE_PTE: stosd add eax,0x1000 add edi,4 loop STOSE_PTE mov eax,cr4 bts eax,5 mov cr4,eax mov eax,0x100000 ; page directory location mov cr3,eax mov eax,cr0 mov ecx,0xc0000080 rdmsr bts eax,8 wrmsr mov eax,cr0 bts eax,31 mov cr0,eax db 0x66 db 0xea dd Start64 dw 0x18 bits 64 Start64: jmp $ Jian. 07/16/2005 ___________________________________________________________ 雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱 http://cn.mail.yahoo.com/?id=77071