From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 29 19:33:05 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA7F716A4CE for ; Wed, 29 Sep 2004 19:33:05 +0000 (GMT) Received: from hotmail.com (bay13-f17.bay13.hotmail.com [64.4.31.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8DBAF43D2D for ; Wed, 29 Sep 2004 19:33:05 +0000 (GMT) (envelope-from vijju_s@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 29 Sep 2004 12:33:02 -0700 Received: from 206.132.194.2 by by13fd.bay13.hotmail.msn.com with HTTP; Wed, 29 Sep 2004 19:32:53 GMT X-Originating-IP: [206.132.194.2] X-Originating-Email: [vijju_s@hotmail.com] X-Sender: vijju_s@hotmail.com From: "vijay singh" To: freebsd-hackers@freebsd.org Date: Wed, 29 Sep 2004 12:32:53 -0700 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 29 Sep 2004 19:33:02.0595 (UTC) FILETIME=[2299B530:01C4A65B] X-Mailman-Approved-At: Thu, 30 Sep 2004 12:24:54 +0000 Subject: about freebsd boot1.S X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2004 19:33:05 -0000 hello all, i am trying to understand the freebsd boot code. i saw that the 1st stage boot loader relocates itself from 7c00 to 700. why is this done? if the run time kernel were to switch to real-mode and transfer control to this location (0700) would the 1st stage boot program run again? for the output below, i used the BIOS debugger and read the 1st sector into 7c00, and unassebled the text. 0000:00007C1D cld 0000:00007C1E xor cx, cx /* cx = 0 */ 0000:00007C20 mov es, cx /* es = 0 */ 0000:00007C22 mov ds, cx /* ds = 0 */ 0000:00007C24 mov ss, cx /* ss = 0 */ 0000:00007C26 mov sp, 7C00 /* set SP to current location */ 0000:00007C29 mov si, sp 0000:00007C2B mov di, 0700 /* DS:SI pair denotes the source string and ES:DI pair the destination string 0:7C00 -> 0:700 */ 0000:00007C2E inc ch /* ch = 1, cx = 100*/ 0000:00007C30 repe /* repeat the movsw instruction cx number of times */ 0000:00007C31 movsw /* moves 200h = 512 bytes from 7C00 to 700*/ please cc me in your reply. thanks vijay