Magellan Linux

Contents of /trunk/mkinitrd-magellan/isolinux/cpuinit.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1133 - (show annotations) (download)
Thu Aug 19 09:50:43 2010 UTC (13 years, 8 months ago) by niro
File size: 2426 byte(s)
-updated to isolinux-3.86
1 ;; -----------------------------------------------------------------------
2 ;;
3 ;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
4 ;; Copyright 2010 Intel Corporation; author: H. Peter Anvin
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_early
39 jmp kaboom
40 enough_ram:
41 skip_checks:
42
43 ;
44 ; Detect old versions Xen HVM and disable halt
45 ; Xen HVM older than version 3.3 might be using vmxassist, which breaks
46 ; if HLT is executed in real mode.
47 ;
48 ; Note: in Syslinux 4, we should probably just execute the HLT in
49 ; protected mode instead.
50 ;
51 check_xen:
52 pushfd
53 pushfd
54 pop eax
55 mov edx,eax
56 xor eax,(1 << 21) ; ID flag
57 push eax
58 popfd
59 pushfd
60 pop eax
61 popfd
62 xor eax,edx
63 and eax,(1 << 21)
64 jz .not_xen ; No CPUID
65
66 xor ebx,ebx
67 xor ecx,ecx
68 xor edx,edx
69 mov eax,0x40000000
70 cpuid
71 cmp ebx,"XenV"
72 jne .not_xen
73 cmp ecx,"MMXe"
74 jne .not_xen
75 cmp edx,"nVMM"
76 jne .not_xen
77
78 ; We're on Xen...
79 mov eax,0x40000001
80 cpuid
81 cmp eax,0x00030003
82 jae .not_xen ; Xen >= 3.3, not affected
83
84 ; We may be using vmxassist, so disable HLT
85 mov byte [ForceNoHalt],1
86
87 .not_xen:
88
89 section .data
90 err_noram db 'It appears your computer has less than '
91 asciidec dosram_k
92 db 'K of low ("DOS")'
93 db CR, LF
94 db 'RAM. Linux needs at least this amount to boot. If you get'
95 db CR, LF
96 db 'this message in error, hold down the Ctrl key while'
97 db CR, LF
98 db 'booting, and I will take your word for it.', CR, LF, 0
99 section .text