home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / bsd / 11922 < prev    next >
Encoding:
Text File  |  1993-01-28  |  3.0 KB  |  114 lines

  1. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!paladin.american.edu!howland.reston.ans.net!spool.mu.edu!yale.edu!yale!mintaka.lcs.mit.edu!ai-lab!hal.gnu.ai.mit.edu!mycroft
  2. From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum)
  3. Newsgroups: comp.unix.bsd
  4. Subject: [386BSD] Rebooting woes
  5. Date: 27 Jan 1993 11:25:44 GMT
  6. Organization: MIT Artificial Intelligence Lab
  7. Lines: 102
  8. Distribution: world
  9. Message-ID: <1k5rfoINNhpu@life.ai.mit.edu>
  10. NNTP-Posting-Host: hal.ai.mit.edu
  11.  
  12.  
  13. I have a HP Vectra 486.  None of the standard kluges will reboot it; they
  14. all just hang the machine.
  15.  
  16. I decided I wanted to do a portable reboot.  The only way I could think of
  17. involves switching back to real mode and using the BIOS.  This turns out
  18. to not be so easy.
  19.  
  20. This is the code I've come up with.  It warm boots one machine (presumably
  21. because of the magic sequence at `start:' which was executed already), but
  22. *cold boots* the Vectra.  un-#ifdefing the sequence which should tell it
  23. to warm boot just hangs the machine.  Even more confusing, modifying said
  24. sequence to write a `0' (which should force a cold boot) also causes the
  25. machine to hang.  As of right now, I haven't the foggiest notion why.
  26.  
  27. Anyway, it at least reboots the machine, so I thought I'd post it, since I
  28. suspect I'm not the only person with this problem.
  29.  
  30. The following code should go in /sys/i386/i386/locore.s, and the C version
  31. of cpu_reset() should be removed from /sys/i386/i386/vm_machdep.c.
  32.  
  33.  
  34. Anyone with insight into why it won't warm boot is more than welcome to
  35. send me mail about it.  I will be looking at it more myself, and will
  36. probably post another version of the code in a few days.
  37.  
  38.  
  39. -----8<-----snip-----8<-----snip-----8<-----snip-----8<-----snip-----8<-----
  40.     ALIGN32
  41. ENTRY(cpu_reset)
  42.     /* die */
  43.     cli
  44.  
  45.     /* use linear addressing */
  46.     /* (relies on GDT set up in bootstrap code) */
  47.     mov    $16,%eax
  48.     mov    %ax,%ds
  49.     mov    %ax,%es
  50.  
  51. #if 0
  52.     /* force warm boot */
  53.     movw    $1234,%ax
  54.     movw    %ax,0x472
  55. #endif
  56.  
  57.     /* copy frob & jump code */
  58.     mov    $_Reboot,%esi
  59.     mov    $0x0500,%edi
  60.     mov    $0x040,%ecx        /* 256 bytes */
  61.     cld
  62.     .byte    0xf3,0xa5        /* rep movsd */
  63.  
  64.     /* set up 16-bit descriptor tables */
  65.     lidt    _Reboot-_RebootIDT+0x500
  66.     lgdt    _Reboot-_RebootGDT+0x500
  67.  
  68.     /* smash data descriptors */
  69.     mov    $16,%eax
  70.     mov    %ax,%ds
  71.     mov    %ax,%es
  72.     mov    %ax,%fs
  73.     mov    %ax,%gs
  74.     mov    %ax,%ss
  75.  
  76.     /* jump to code copied from _Reboot */
  77.     ljmp    $8,$0x0500
  78.  
  79.     ALIGN32
  80. _Reboot:
  81.     smsw    %eax
  82.     andl    $0x7ffffff6,%eax
  83.     lmsw    %eax
  84.     xorl    %eax,%eax
  85.     mov    %eax,%cr3
  86.     /* jmp FFFF:0000 */
  87.     .byte    0xea
  88.     .long    0xffff0000
  89.  
  90.     ALIGN32
  91. _RebootIDT:
  92.     .word    0x3ff
  93.     .long    0
  94.  
  95.     ALIGN32
  96. _RebootGDT:
  97.     .word    0x17
  98.     .long    _RebootGDT-SYSTEM+6
  99. /* null descriptor */
  100.     .word 0,0
  101.     .byte 0,0,0,0
  102. /* code descriptor */
  103.     .word -1,0
  104.     .byte 0,0x9f,0,0
  105. /* data descriptor */
  106.     .word -1,0
  107.     .byte 0,0x93,0,0
  108. -----8<-----snip-----8<-----snip-----8<-----snip-----8<-----snip-----8<-----
  109.  
  110. -- 
  111.  \  /   Charles Hannum, mycroft@ai.mit.edu
  112.  /\ \   PGP public key available on request.  MIME, AMS, NextMail accepted.
  113. Scheme  White heterosexual atheist male (WHAM) pride!
  114.