Add an API for COMBOOT images, and add support for "COM32" -- 32-bit
[profile/ivi/syslinux.git] / cpuinit.inc
1 ;; $Id$
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 ;;   Bostom 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                 int 12h
31                 cmp ax,(real_mode_seg+0xa00) >> 6
32                 jae enough_ram
33                 mov si,err_noram
34                 call writestr
35                 jmp kaboom
36 enough_ram:
37 skip_checks:
38
39 ;
40 ; Check if we're 386 (as opposed to 486+); if so we need to blank out
41 ; the WBINVD instruction
42 ;
43 ; We check for 486 by setting EFLAGS.AC
44 ;
45 %if DO_WBINVD
46                 pushfd                          ; Save the good flags
47                 pushfd
48                 pop eax
49                 mov ebx,eax
50                 xor eax,(1 << 18)               ; AC bit
51                 push eax
52                 popfd
53                 pushfd
54                 pop eax
55                 popfd                           ; Restore the original flags
56                 xor eax,ebx
57                 jnz is_486
58 ;
59 ; 386 - Looks like we better blot out the WBINVD instruction
60 ;
61                 mov byte [try_wbinvd],0c3h              ; Near RET
62 is_486:
63 %endif  ; DO_WBINVD
64 ;
65 ; Mark A20 type as unknown.  This particular word needs to be in BSS,
66 ; so it needs to be initialized.
67 ;
68                 mov word [A20Type],0
69
70