From owner-freebsd-hackers Mon Jul 23 15: 4:17 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from hotmail.com (f94.pav2.hotmail.com [64.4.37.94]) by hub.freebsd.org (Postfix) with ESMTP id 5A05837B409; Mon, 23 Jul 2001 15:03:55 -0700 (PDT) (envelope-from weiguang_shi@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 23 Jul 2001 15:03:55 -0700 Received: from 129.128.29.128 by pv2fd.pav2.hotmail.msn.com with HTTP; Mon, 23 Jul 2001 22:03:55 GMT X-Originating-IP: [129.128.29.128] From: "Weiguang SHI" To: jhb@FreeBSD.org Cc: freebsd-hackers@FreeBSD.org Subject: RE: jmp after setting PE? Date: Mon, 23 Jul 2001 16:03:55 -0600 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 23 Jul 2001 22:03:55.0293 (UTC) FILETIME=[5D98CCD0:01C113C3] Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thanks. I think I've found it in btx.s: 213 mov %eax,%cr0 # 214 ljmp $SEL_SCODE,$init.8 # To 32-bit code 215 .code32 216 init.8: xorl %ecx,%ecx # Zero And there IS this "ljmp". Well, this BTX thing is amazing: all this effort, (btxld, run-time library crt0.o, loader, etc.) seems to just to provide a 32-bit protected and possibly paging-enabled environment to start the kernel/loader(and to confuse a new-comer like me.) What are the other gains? Where can I found more info about this BTX before going through the ultimate source code? (I've search the mailing-lists.) Thanks Weiguang >From: John Baldwin >To: Weiguang SHI >CC: freebsd-hackers@FreeBSD.org >Subject: RE: jmp after setting PE? >Date: Mon, 23 Jul 2001 12:07:44 -0700 (PDT) > > >On 21-Jul-01 Weiguang SHI wrote: > > Hi, > > > > Please forgive me if this seems too easy. > > > > "http://people.freebsd.org/~jhb/386htm/s10_03.htm" says: > > > > Immediately after setting the PE flag, the initialization code must > > flush the processor's instruction prefetch queue by > > executing a JMP instruction. The 80386 fetches and decodes > > instructions and addresses before they are used; however, > > after a change into protected mode, the prefetched instruction > > information (which pertains to real-address mode) is > > no longer valid. A JMP forces the processor to discard the invalid > > information. > > > > "/home/src/sys/i386/i386" says: > > > > 329 /* Now enable paging */ > > 330 movl R(_IdlePTD), %eax > > 331 movl %eax,%cr3 /* load ptd addr > > into mm > > 332 movl %cr0,%eax /* get control >word > > */ > > 333 orl $CR0_PE|CR0_PG,%eax /* enable paging >*/ > > 334 movl %eax,%cr0 /* and let's >page > > NOW! * > > 335 > > 336 #ifdef BDE_DEBUGGER > > 337 /* > > 338 * Complete the adjustments for paging so that we can keep >tracing > > throu > > 339 * initi386() after the low (physical) addresses for the gdt and >idt > > bec > > 340 * invalid. > > 341 */ > > 342 call bdb_commit_paging > > 343 #endif > > 344 > > 345 pushl $begin /* jump to high > > virtuali > > 346 ret > >We are already in protected mode when the kernel starts (the boot blocks >call >us from protected mode) so this isn't turning on the PE bit. Line 333 is >somewhat misleading (the comment is more accurate) and should probably >read: > > orl $CRO_PG,%eax > >If PE isn't on by the time we get here we would have blown up by now >anyways. > >-- > >John Baldwin -- http://www.FreeBSD.org/~jhb/ >PGP Key: http://www.baldwin.cx/~john/pgpkey.asc >"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message