home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 August (Alt) / CHIP 2005-08.1.iso / program / guvenlik / syslinux-3.07.exe / cpuinit.inc < prev    next >
Encoding:
Text File  |  2004-12-27  |  1.8 KB  |  77 lines

  1. ;; $Id: cpuinit.inc,v 1.5 2004/12/27 07:04:08 hpa Exp $
  2. ;; -----------------------------------------------------------------------
  3. ;;   
  4. ;;   Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
  5. ;;
  6. ;;   This program is free software; you can redistribute it and/or modify
  7. ;;   it under the terms of the GNU General Public License as published by
  8. ;;   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
  9. ;;   Boston MA 02111-1307, USA; either version 2 of the License, or
  10. ;;   (at your option) any later version; incorporated herein by reference.
  11. ;;
  12. ;; -----------------------------------------------------------------------
  13.  
  14. ;;
  15. ;; cpuinit.inc
  16. ;; 
  17. ;; CPU-dependent initialization and related checks.
  18. ;;
  19.  
  20. check_escapes:
  21.         mov ah,02h            ; Check keyboard flags
  22.         int 16h
  23.         mov [KbdFlags],al        ; Save for boot prompt check
  24.         test al,04h            ; Ctrl->skip 386 check
  25.         jnz skip_checks
  26.  
  27. ;
  28. ; Now check that there is sufficient low (DOS) memory
  29. ;
  30. ; NOTE: Linux doesn't use all of real_mode_seg, but we use the same
  31. ; segment for COMBOOT images, which can use all 64K
  32. ;
  33. dosram_k    equ (real_mode_seg+0x1000) >> 6    ; Minimum DOS memory (K)
  34.         int 12h
  35.         cmp ax,dosram_k
  36.         jae enough_ram
  37.         mov si,err_noram
  38.         call writestr
  39.         jmp kaboom
  40. enough_ram:
  41. skip_checks:
  42.  
  43. ;
  44. ; Initialize the bcopy32 code in low memory
  45. ;
  46.         mov si,section..bcopy32.start
  47.         mov di,__bcopy_start
  48.         mov cx,__bcopy_size >> 2
  49.         rep movsd
  50.  
  51. ;
  52. ; Check if we're 386 (as opposed to 486+); if so we need to blank out
  53. ; the WBINVD instruction
  54. ;
  55. ; We check for 486 by setting EFLAGS.AC
  56. ;
  57. %if DO_WBINVD
  58.         pushfd                ; Save the good flags
  59.         pushfd
  60.         pop eax
  61.         mov ebx,eax
  62.         xor eax,(1 << 18)        ; AC bit
  63.         push eax
  64.         popfd
  65.         pushfd
  66.         pop eax
  67.         popfd                ; Restore the original flags
  68.         xor eax,ebx
  69.         jnz is_486
  70. ;
  71. ; 386 - Looks like we better blot out the WBINVD instruction
  72. ;
  73.         mov byte [try_wbinvd],0c3h        ; Near RET
  74. is_486:
  75. %endif    ; DO_WBINVD
  76.  
  77.