1 #!/bin/sh /usr/share/dpatch/dpatch-run
2 ## 02-64bit-autodetection.dpatch by Byron Stanoszek <gandalf@winds.org>
4 ## DP: Allows auto-detection of 64bit CPUs (Closes: #408138), see
5 ## DP: http://syslinux.zytor.com/archives/2007-January/007832.html
9 diff -Naur syslinux-3.36.orig
/cpuinit.inc syslinux-3.36
/cpuinit.inc
10 --- syslinux-3.36.orig
/cpuinit.inc
2007-02-10 20:47:08.000000000 +0000
11 +++ syslinux-3.36
/cpuinit.inc
2007-03-05 00:45:25.000000000 +0000
16 -; Check
if we
're 386 (as opposed to 486+); if so we need to blank out
17 -; the WBINVD instruction
18 +; Determine if we're running on a
64-bit CPU
20 -; We check
for 486 by setting EFLAGS.AC
21 +; First
, check
if we
're 386. If so, we need to blank out the WBINVD instruction
24 pushfd ; Save the good flags
29 ; 386 - Looks like we better blot out the WBINVD instruction
32 mov byte [try_wbinvd],0c3h ; Near RET
38 +; Check if this CPU supports the CPUID command
40 + pushfd ; Save the flags again
44 + xor eax,(1 << 21) ; CPUID bit
49 + popfd ; Restore the original flags
53 +; Now check for the 64-bit flag (bit 29) in the CPU extended features byte ($8000_0001, edx)
55 + mov eax, 80000000h ; Find last AMD cpuid #
59 + mov eax, 80000001h ; Read AMD CPU flags
61 + bt edx, 29 ; 64-bit if bit 29 is set
64 +is_64bit: mov byte [Is64Bit],1 ; Flag that we're
64-bit
66 diff -Naur syslinux-3.36.orig
/keywords syslinux-3.36
/keywords
67 --- syslinux-3.36.orig
/keywords
2007-02-10 20:47:08.000000000 +0000
68 +++ syslinux-3.36
/keywords
2007-03-05 00:45:38.000000000 +0000
77 diff -Naur syslinux-3.36.orig
/keywords.inc syslinux-3.36
/keywords.inc
78 --- syslinux-3.36.orig
/keywords.inc
2007-02-10 20:47:08.000000000 +0000
79 +++ syslinux-3.36
/keywords.inc
2007-03-05 00:46:05.000000000 +0000
82 keyword append
, pc_append
83 keyword default
, pc_default
84 + keyword default64
, pc_default64
85 keyword display
, pc_filecmd
, get_msg_file
86 keyword font
, pc_filecmd
, loadfont
87 keyword implicit
, pc_setint16
, AllowImplicit
88 diff -Naur syslinux-3.36.orig
/kwdhash.gen syslinux-3.36
/kwdhash.gen
89 --- syslinux-3.36.orig
/kwdhash.gen
2007-02-10 20:47:13.000000000 +0000
90 +++ syslinux-3.36
/kwdhash.gen
2007-03-05 00:46:23.000000000 +0000
92 hash_text equ
0x003b9b74
93 hash_append equ
0xc53999a4
94 hash_default equ
0xcc5159ed
95 +hash_default64 equ
0x4567b1c5
96 hash_display equ
0xd509bc40
97 hash_font equ
0x0032b1b4
98 hash_implicit equ
0xa6f50207
99 diff -Naur syslinux-3.36.orig
/parseconfig.inc syslinux-3.36
/parseconfig.inc
100 --- syslinux-3.36.orig
/parseconfig.inc
2007-02-10 20:47:08.000000000 +0000
101 +++ syslinux-3.36
/parseconfig.inc
2007-03-05 00:50:12.000000000 +0000
106 -pc_default: mov di
,default_cmd
107 +pc_default
: cmp byte
[HasDefault64
],0 ; Check
if we accepted
'default64'
108 + ja pc_getline
; If so
, do nothing
111 + mov byte
[di-1
],0 ; null-terminate
115 +; "default64" command
117 +pc_default64
: cmp byte
[Is64Bit
],0 ; Make sure cpu is
64-bit
119 + mov byte
[HasDefault64
],1 ; Note that we saw a default64
122 mov byte
[di-1
],0 ; null-terminate
125 SerialPort dw
0 ; Serial port base
(or
0 for no serial port
)
126 VKernelBytes dw
0 ; Number of bytes used by vkernels
127 VKernel db
0 ; Have we seen any
"label" statements?
128 +Is64Bit db
0 ; Is this CPU
64-bit?
129 +HasDefault64 db
0 ; We
've seen a 'default64
' statement
132 alignb 4 ; For the good of REP MOVSD