From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1WbsSg-0001s4-Ib for mharc-grub-devel@gnu.org; Sun, 20 Apr 2014 10:11:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbsSa-0001rC-Cr for grub-devel@gnu.org; Sun, 20 Apr 2014 10:11:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WbsSW-0006Xy-7r for grub-devel@gnu.org; Sun, 20 Apr 2014 10:11:08 -0400 Received: from mail-ee0-x230.google.com ([2a00:1450:4013:c00::230]:57032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbsSV-0006Xu-Sj for grub-devel@gnu.org; Sun, 20 Apr 2014 10:11:04 -0400 Received: by mail-ee0-f48.google.com with SMTP id b57so2982679eek.21 for ; Sun, 20 Apr 2014 07:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=sZix5okmUP7J2/GzoJXrUJ4hyaal+5T5gtHpuFHfRe4=; b=078gBfU1OU/9Zn5roHGsFq1d2Otkf4Tclf3/ieO8fQaWH4KxAeNCqQQ6sbfJxbZnSd IRhYusxknjLugmYs5RXlCr6IE+zk5tX3AVc2lm8l7PyzFdKRd728ZghKDbcdfLrbj67+ kI56GZISGBH0SK8pR6OM+71PCqiTvId9JP5lq0dvG5jMEthtFQ+f0lghapdKmRL0UtJe J7bqTxSxLxBiDkflf8b/tjFnulOsat4c8aIe9wA/SgG/CS/kMFHWnkt0JBxtSgUfDigQ FkqIXDKXSHF2gDJwVavJ5++Hb1rTpNIi/PsM+C5O7C5/hBrSwR7G66OCdwjDPWrKm6BX B5Wg== X-Received: by 10.14.7.65 with SMTP id 41mr67103eeo.100.1398003062999; Sun, 20 Apr 2014 07:11:02 -0700 (PDT) Received: from [192.168.42.163] (1-228.197-178.cust.bluewin.ch. [178.197.228.1]) by mx.google.com with ESMTPSA id p8sm94921314eef.26.2014.04.20.07.11.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 20 Apr 2014 07:11:01 -0700 (PDT) Message-ID: <5353D572.7020309@gmail.com> Date: Sun, 20 Apr 2014 16:10:58 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: Patch to compile grub2 with Apple compiler References: <6B5724B7-1255-40AA-8CA7-FF60CA96AB57@zetam.org> <534301C7.9060306@gmail.com> <8A285E3D-F116-4C77-8075-AC00FBC6C338@zetam.org> <53470B1D.5090908@gmail.com> <4B88F6F1-7508-493F-AEFF-38E80FE8100D@zetam.org> <20140412210620.6cf2563c@opensuse.site> <76E9DB82-FC79-440E-B506-2484773D99C0@zetam.org> In-Reply-To: <76E9DB82-FC79-440E-B506-2484773D99C0@zetam.org> X-Enigmail-Version: 1.6 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="A2bNdKasXlGm1owOgVULowVnnxJLHKoCa" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::230 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Apr 2014 14:11:12 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --A2bNdKasXlGm1owOgVULowVnnxJLHKoCa Content-Type: multipart/mixed; boundary="------------040802000607000701070409" This is a multi-part message in MIME format. --------------040802000607000701070409 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12.04.2014 19:54, Yves Blusseau wrote: >=20 > Le 12 avr. 2014 =C3=A0 19:06, Andrey Borzenkov a = =C3=A9crit : >=20 >> =D0=92 Sat, 12 Apr 2014 13:27:57 +0200 >> Yves Blusseau =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> >>> The "i386-pc" version built from OSX doesn't work. >>> It will only display Grub Loading=E2=80=A6 >>> Not surprising. Apple misassembler generates correct 16-bit code only when stars are right. Every version of Apple misassembler has bugs, every version they are different. You'd need to disassemble the resulting code and compare it with original file to know which instructions are wrong. Just a hunch: it may be ADDR32/DATA32. Attached is my experimental patch for removal of ADDR32/DATA32 >> >> On which platform?=20 > i386-pc >=20 >=20 >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >=20 --------------040802000607000701070409 Content-Type: text/x-diff; name="data32.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="data32.diff" diff --git a/acinclude.m4 b/acinclude.m4 index 32d5477..89b1710 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -210,80 +210,6 @@ fi ]) =20 =20 -dnl Mass confusion! -dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit -dnl instructions, but implicitly insert addr32 and data32 bytes so -dnl that the code works in real mode''. -dnl -dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit -dnl instructions,'' which seems right. This requires the programmer -dnl to explicitly insert addr32 and data32 instructions when they want -dnl them. -dnl -dnl We only support the newer versions, because the old versions cause -dnl major pain, by requiring manual assembly to get 16-bit instructions = into -dnl asm files. -AC_DEFUN([grub_I386_ASM_ADDR32], -[AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT]) -AC_MSG_CHECKING([for .code16 addr32 assembler support]) -AC_CACHE_VAL(grub_cv_i386_asm_addr32, -[cat > conftest.s.in <<\EOF - .code16 -l1: @ADDR32@ movb %al, l1 -EOF - -if test "x$grub_cv_i386_asm_prefix_requirement" =3D xyes; then - sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s -else - sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s -fi - -if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]= ) && test -s conftest.o; then - grub_cv_i386_asm_addr32=3Dyes -else - grub_cv_i386_asm_addr32=3Dno -fi - -rm -f conftest*]) - -AC_MSG_RESULT([$grub_cv_i386_asm_addr32])]) - -dnl Later versions of GAS requires that addr32 and data32 prefixes -dnl appear in the same lines as the instructions they modify, while -dnl earlier versions requires that they appear in separate lines. -AC_DEFUN([grub_I386_ASM_PREFIX_REQUIREMENT], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(dnl -[whether addr32 must be in the same line as the instruction]) -AC_CACHE_VAL(grub_cv_i386_asm_prefix_requirement, -[cat > conftest.s <<\EOF - .code16 -l1: addr32 movb %al, l1 -EOF - -if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]= ) && test -s conftest.o; then - grub_cv_i386_asm_prefix_requirement=3Dyes -else - grub_cv_i386_asm_prefix_requirement=3Dno -fi - -rm -f conftest*]) - -if test "x$grub_cv_i386_asm_prefix_requirement" =3D xyes; then - grub_tmp_addr32=3D"addr32" - grub_tmp_data32=3D"data32" -else - grub_tmp_addr32=3D"addr32;" - grub_tmp_data32=3D"data32;" -fi - -ADDR32=3D$grub_tmp_addr32 -DATA32=3D$grub_tmp_data32 - -AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])]) - - dnl Check what symbol is defined as a bss start symbol. dnl Written by Michael Hohmoth and Yoshinori K. Okuji. AC_DEFUN([grub_CHECK_BSS_START_SYMBOL], diff --git a/config.h.in b/config.h.in index 4b63014..d93b687 100644 --- a/config.h.in +++ b/config.h.in @@ -31,10 +31,6 @@ #define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@ /* Define if C symbols get an underscore after compilation. */ #define HAVE_ASM_USCORE @HAVE_ASM_USCORE@ -/* Define it to \"addr32\" or \"addr32;\" to make GAS happy. */ -#define ADDR32 @ADDR32@ -/* Define it to \"data32\" or \"data32;\" to make GAS happy. */ -#define DATA32 @DATA32@ /* Define it to one of __bss_start, edata and _edata. */ #define BSS_START_SYMBOL @BSS_START_SYMBOL@ /* Define it to either end or _end. */ diff --git a/configure.ac b/configure.ac index 77c942a..b25304f 100644 --- a/configure.ac +++ b/configure.ac @@ -1046,8 +1046,6 @@ if test "x$target_cpu" =3D xi386; then grub_CHECK_END_SYMBOL fi CFLAGS=3D"$TARGET_CFLAGS" - grub_I386_ASM_PREFIX_REQUIREMENT - grub_I386_ASM_ADDR32 fi =20 grub_PROG_NM_WORKS @@ -1568,8 +1566,6 @@ AS_IF([test x$target_cpu =3D xi386 -a x$platform =3D= xqemu], [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)]) =20 AC_SUBST(HAVE_ASM_USCORE) -AC_SUBST(ADDR32) -AC_SUBST(DATA32) AC_SUBST(BSS_START_SYMBOL) AC_SUBST(END_SYMBOL) AC_SUBST(PACKAGE) diff --git a/grub-core/boot/i386/pc/startup_raw.S b/grub-core/boot/i386/p= c/startup_raw.S index 2796740..7b1c502 100644 --- a/grub-core/boot/i386/pc/startup_raw.S +++ b/grub-core/boot/i386/pc/startup_raw.S @@ -89,13 +89,13 @@ LOCAL (codestart): sti /* we're safe again */ =20 /* save the boot drive */ - ADDR32 movb %dl, LOCAL(boot_drive) + movb %dl, LOCAL(boot_drive) =20 /* reset disk system (%ah =3D 0) */ int $0x13 =20 /* transition to protected mode */ - DATA32 call real_to_prot + calll real_to_prot =20 /* The ".code32" directive takes GAS out of 16-bit mode. */ .code32 @@ -149,7 +149,7 @@ gate_a20_try_bios: movw $0x2401, %ax int $0x15 =20 - DATA32 call real_to_prot + calll real_to_prot .code32 =20 popl %ebp diff --git a/grub-core/boot/i386/qemu/boot.S b/grub-core/boot/i386/qemu/b= oot.S index bdd68c7..8d97fc1 100644 --- a/grub-core/boot/i386/qemu/boot.S +++ b/grub-core/boot/i386/qemu/boot.S @@ -48,7 +48,7 @@ VARIABLE(grub_core_entry_addr) /* Transition to protected mode. We use pushl to force generation of a flat return address. */ pushl $1f - DATA32 jmp real_to_prot + jmpl real_to_prot .code32 /* Ensure A20 is enabled. We're in qemu, so control port A works and there is no need to wait since there is no real logic, it's diff --git a/grub-core/kern/i386/pc/startup.S b/grub-core/kern/i386/pc/st= artup.S index 6bb36c6..b8a9b33 100644 --- a/grub-core/kern/i386/pc/startup.S +++ b/grub-core/kern/i386/pc/startup.S @@ -135,7 +135,7 @@ LOCAL(prot_to_real_addr): =20 .macro REAL_TO_PROT movl LOCAL(real_to_prot_addr), %eax - DATA32 call *%ax + calll *%eax .endm =20 /* diff --git a/grub-core/kern/i386/realmode.S b/grub-core/kern/i386/realmod= e.S index 541cedc..1384d52 100644 --- a/grub-core/kern/i386/realmode.S +++ b/grub-core/kern/i386/realmode.S @@ -54,7 +54,7 @@ protstack: .endm =20 .macro REAL_TO_PROT - DATA32 call real_to_prot + calll real_to_prot .endm =20 /* @@ -137,7 +137,7 @@ real_to_prot: /* load the GDT register */ xorw %ax, %ax movw %ax, %ds - DATA32 ADDR32 lgdt gdtdesc + lgdtl gdtdesc =20 /* turn on protected mode */ movl %cr0, %eax @@ -145,7 +145,7 @@ real_to_prot: movl %eax, %cr0 =20 /* jump to relocation, flush prefetch queue, and reload %cs */ - DATA32 ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg + ljmpl $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg =20 .code32 protcseg: @@ -237,7 +237,7 @@ tmpcseg: movl %eax, %cr0 =20 /* flush prefetch queue, reload %cs */ - DATA32 ljmp $0, $realcseg + ljmpl $0, $realcseg =20 realcseg: /* we are in real mode now @@ -258,6 +258,6 @@ realcseg: #endif =20 /* return on new stack! */ - DATA32 ret + retl =20 .code32 diff --git a/grub-core/modinfo.sh.in b/grub-core/modinfo.sh.in index d46b56c..ebe93bb 100644 --- a/grub-core/modinfo.sh.in +++ b/grub-core/modinfo.sh.in @@ -9,8 +9,6 @@ grub_have_font_source=3D@HAVE_FONT_SOURCE@ =20 # Autodetected config grub_have_asm_uscore=3D@HAVE_ASM_USCORE@ -grub_i8086_addr32=3D"@ADDR32@" -grub_i8086_data32=3D"@DATA32@" grub_bss_start_symbol=3D"@BSS_START_SYMBOL@" grub_end_symbol=3D"@END_SYMBOL@" =20 --------------040802000607000701070409-- --A2bNdKasXlGm1owOgVULowVnnxJLHKoCa Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iF4EAREKAAYFAlNT1XIACgkQmBXlbbo5nOv57AEApomvYbo7uibNmpxY7VhpuoQO GGi/8t1/5puFBXYb+2cBAIU9XsWk81rXG4qHA0yMi1m31LUO+G7vPoMGv2TAhRBM =cVBj -----END PGP SIGNATURE----- --A2bNdKasXlGm1owOgVULowVnnxJLHKoCa--