From owner-freebsd-questions@FreeBSD.ORG Wed Feb 2 08:47:17 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E66C016A4CE for ; Wed, 2 Feb 2005 08:47:16 +0000 (GMT) Received: from natco8.natcotech.com (natco8.natcotech.com [205.167.142.108]) by mx1.FreeBSD.org (Postfix) with ESMTP id 396B943D53 for ; Wed, 2 Feb 2005 08:47:16 +0000 (GMT) (envelope-from smartweb@leadhill.net) Received: from localhost (int9.natcotech.com [192.168.1.9]) by natco8.natcotech.com (Postfix) with ESMTP id 7F74F298376; Wed, 2 Feb 2005 02:47:15 -0600 (CST) Received: from natco8.natcotech.com ([192.168.1.8]) by localhost (natco9 [192.168.1.9]) (amavisd-new, port 10024) with LMTP id 18742-01-18; Wed, 2 Feb 2005 02:47:15 -0600 (CST) Received: from [192.168.0.4] (lhr4-dial-12-28-49-64.natcotech.com [12.28.49.64]) by natco8.natcotech.com (Postfix) with ESMTP id C944A2982F6; Wed, 2 Feb 2005 02:47:14 -0600 (CST) Message-ID: <42009392.2030703@leadhill.net> Date: Wed, 02 Feb 2005 02:47:14 -0600 From: Billy Newsom User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <200501311550.j0VFot428451@clunix.cl.msu.edu> <200501311905.00949.ian@codepad.net> <41FE85EB.3090200@nlcc.us> <200502011257.55611.ian@codepad.net> <41FF8ED9.1080004@leadhill.net> <41FF96A1.1070406@leadhill.net> <20050201153233.GA33167@kongemord.krig.net> In-Reply-To: <20050201153233.GA33167@kongemord.krig.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at natco9.natcotech.com Subject: Re: How do I do a COLD Reboot on FreeBSD? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Feb 2005 08:47:17 -0000 Bob Hall wrote: > This may help. > > http://www.faqs.org/faqs/assembly-language/x86/general/part3/section-5.html > > Bob Hall Hmmm. Good link. Here's a better one that I just discovered reading about this stuff: http://unix.derkeiler.com/Mailing-Lists/FreeBSD/hackers/2003-11/0205.html I began to notice that the 0x472 code is rampant in these reboot assembler code examples. Then I found out that FreeBSD has its own asembly language found in the boot loaders, etc. OpenBSD and others like Linux use this stuff similarly. Linux seems to give you the option in a config file!! to cold reboot. So this led me to: /usr/src/sys/i386/i386/locore.s Which looks to me the place where a warm boot is guaranteed. By the way, the guy above (Adrian Steinmann) might have cleaned up the code for the btx (usr/src/sys/boot/i386/btx/btx/btx.S) in 2003. But his code cleanup never stayed in /usr/src/sys/boot/i386/boot2/boot1.S. Example from FreeBSD-5-stable: /usr/src/sys/boot/i386/btx/btx/btx.S has this: movw $0x1234, BDA_BOOT # Do a warm boot ljmp $0xffff,$0x0 # reboot the machine /usr/src/sys/boot/i386/boot2/boot1.S has the *better* version: movw $0x1234, BDA_BOOT # Do a warm boot ljmp $0xf000,$0xfff0 # reboot the machine Anyway, Adrian Steinmann tried to patch the reboot code in btx.s to do some sort of bugfix and troubleshooting on his particular machine. There may have been a regresion here since he tried that, but I don't care much about the BTX or the boot1 code. My issue is for now with the reboot done during a normal full kernel running. That is when SMP code is active and the memory is being actively used. I believe the locore.s file is where I need to look, because it moves this 0x1234 data into the BDA_BOOT location, which is 0x427 in memory. Therefore, I will try to hack the locore.s file and use a zero instead of 0x1234 to move into memory at the BDA_BOOT location. here's my unified diff: -----------------Code --- locore.s Thu Jul 8 17:35:34 2004 +++ /usr/src/sys/i386/i386/locore.s Wed Feb 2 01:50:36 2005 @@ -214,7 +214,8 @@ movsb #else /* IBM-PC */ /* Tell the bios to warmboot next time */ - movw $0x1234,0x472 +/* movw $0x1234,0x472 */ + movw $0x0000,0x472 /* Billy: Perform Cold Reboot! */ #endif /* PC98 */ /* Set up a real frame in case the double return in newboot is executed. */ -----------------Code The only substantial change is that I hope this make my machine do a cold reboot. Billy