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 -Naurp syslinux-3.51.orig
/cpuinit.inc syslinux-3.51
/cpuinit.inc
10 --- syslinux-3.51.orig
/cpuinit.inc
2007-06-10 22:51:39.000000000 +0000
11 +++ syslinux-3.51
/cpuinit.inc
2007-06-18 17:03:58.000000000 +0000
12 @@
-48,12 +48,10 @@ skip_checks
:
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
27 @@ -69,6 +67,37 @@ skip_checks:
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 in bit 29 of the Extended CPU features byte,
56 + mov eax, 80000000h ; Find last extended CPUID #
60 + mov eax, 80000001h ; Read Extended CPU flags
62 + bt edx, 29 ; 64-bit if bit 29 is set
64 + mov byte [Is64Bit],1 ; Flag that we're
64-bit
66 diff -Naurp syslinux-3.51.orig
/keywords syslinux-3.51
/keywords
67 --- syslinux-3.51.orig
/keywords
2007-06-10 22:51:39.000000000 +0000
68 +++ syslinux-3.51
/keywords
2007-06-18 17:03:58.000000000 +0000
69 @@
-4,6 +4,7 @@ include
77 diff -Naurp syslinux-3.51.orig
/keywords.inc syslinux-3.51
/keywords.inc
78 --- syslinux-3.51.orig
/keywords.inc
2007-06-10 22:51:39.000000000 +0000
79 +++ syslinux-3.51
/keywords.inc
2007-06-18 17:03:58.000000000 +0000
80 @@
-50,6 +50,7 @@ keywd_table
:
81 keyword include
, pc_filecmd
, pc_include
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 -Naurp syslinux-3.51.orig
/kwdhash.gen syslinux-3.51
/kwdhash.gen
89 --- syslinux-3.51.orig
/kwdhash.gen
2007-06-10 22:51:45.000000000 +0000
90 +++ syslinux-3.51
/kwdhash.gen
2007-06-18 17:03:58.000000000 +0000
91 @@
-4,6 +4,7 @@ hash_include equ
0x9a07d8ff
92 hash_append equ
0xc53999a4
93 hash_config equ
0xc0c69547
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 -Naurp syslinux-3.51.orig
/layout.inc syslinux-3.51
/layout.inc
100 --- syslinux-3.51.orig
/layout.inc
2007-06-10 22:51:39.000000000 +0000
101 +++ syslinux-3.51
/layout.inc
2007-06-18 17:03:58.000000000 +0000
102 @@
-26,7 +26,7 @@ TEXT_START equ
7C00h
103 ; The secondary BSS section
, above the text
; we really wish we could
104 ; just
make it follow .bcopy32 or hang off the end
,
105 ; but it doesn
't seem to work that way.
106 -LATEBSS_START equ 0B300h
107 +LATEBSS_START equ 0B310h
109 ; Reserve memory for the stack. This causes checkov to abort the
110 ; compile if we violate this space.
111 diff -Naurp syslinux-3.51.orig/parseconfig.inc syslinux-3.51/parseconfig.inc
112 --- syslinux-3.51.orig/parseconfig.inc 2007-06-10 22:51:39.000000000 +0000
113 +++ syslinux-3.51/parseconfig.inc 2007-06-18 17:03:58.000000000 +0000
118 -pc_default: mov di,default_cmd
119 +pc_default: cmp byte [HasDefault64],0 ; Check if we accepted 'default64
'
120 + ja pc_getline ; If so, do nothing
123 + mov byte [di-1],0 ; null-terminate
127 +; "default64" command
129 +pc_default64: cmp byte [Is64Bit],0 ; Make sure cpu is 64-bit
131 + mov byte [HasDefault64],1 ; Note that we saw a default64
134 mov byte [di-1],0 ; null-terminate
136 @@ -431,6 +444,8 @@ IncludeLevel dw 1 ; Nesting level
137 SerialPort dw 0 ; Serial port base (or 0 for no serial port)
138 VKernelBytes dw 0 ; Number of bytes used by vkernels
139 VKernel db 0 ; Have we seen any "label" statements?
140 +Is64Bit db 0 ; Is this CPU 64-bit?
141 +HasDefault64 db 0 ; We've seen a
'default64' statement
144 IPAppend db
0 ; Default IPAPPEND option