Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 09 Feb 2005 09:20:27 -0600
From:      Billy Newsom <smartweb@leadhill.net>
To:        freebsd-hackers@freebsd.org
Subject:   Cold Reboot (or cold restart) FreeBSD? locore.s hack attempt
Message-ID:  <420A2A3B.2060507@leadhill.net>

next in thread | raw e-mail | index | archive | help
I want to do a cold reboot of FreeBSD due to (what seens to be) a 
problem with the FreeBSD 5.3 system on my particular machine.  To make a 
long story short, I have determined that FreeBSD 5.3 sputters and coughs 
when it tries to reboot this system.  (The problem wasn't on 4.7, for 
example, and DOS can reboot the machine fine.)

I believe the solution (barring a change of the kernel I'm not sure how 
to do) is to merely rewrite the code which send the command to reboot 
the system.  I want to be able to do a shutdown -r now, or merely a 
"reboot" from single user mode, etc. and the system restart, do its full 
POST, count memory, and run properly.

So here's my unified diff, which did not seem to work:
-----------------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

Recompiling my kernel and using that diff did not work.  The system 
would still lock up and freeze when I attempted to do a shutdown -r now. 
  The 0x472h address is supposed to point to a region of memory that the 
BIOS looks at when deciding to do a cold or warm restart.  Perhaps doing 
this in locore.s is not working somehow, or that region of memory gets 
corrupted.

So to see the full discussion of my problem in detail, see the archives 
of the freebsd-questions list:
http://lists.freebsd.org/pipermail/freebsd-questions/2005-January/074567.html
(my original post)

Here's what I came up with:
http://lists.freebsd.org/pipermail/freebsd-questions/2005-February/074728.html

Well, so far I tried this hack:
http://lists.freebsd.org/pipermail/freebsd-questions/2005-February/074867.html

This problem is very weird, because only FreeBSD 5.3 seems to break the 
rebooting ability of this machine.  The underlying problem might have to 
do with some sort of aggressive use of the BIOS memroy region or some 
reserved memory which causes a warm (or perhaps even the cold) reboot to 
fail.  IF that's the case, is there a hack to reserve memory from 
FreeBSD's kernel so that these secret regions get left in tact?

Other than that, would someone like to see if my hack of locore.s Works 
For Them?  I'm curious to see if someone else's computer will perform 
the cold restart (count memory).  This code region is apparently about 
10 years old or more (pre-3.0.5), so it would be interesting to hack it 
now.  As a side note, I believe that linux and others allow you to 
decide on which reboot flavor you prefer.

Thanks,
Billy



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?420A2A3B.2060507>