From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bxHF7-0004lQ-Bi for mharc-grub-devel@gnu.org; Thu, 20 Oct 2016 13:35:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxHF5-0004je-E5 for grub-devel@gnu.org; Thu, 20 Oct 2016 13:35:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxHF1-0005o6-A0 for grub-devel@gnu.org; Thu, 20 Oct 2016 13:34:59 -0400 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:36589) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bxHF1-0005n2-1g for grub-devel@gnu.org; Thu, 20 Oct 2016 13:34:55 -0400 Received: by mail-lf0-x233.google.com with SMTP id b75so92922086lfg.3 for ; Thu, 20 Oct 2016 10:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=Ik9xG8MF2P9AIY+3Imfw9qAjCPIDVHcw/C+USaiNOQM=; b=ukI0Mo4yoRCF8MSfrP22EmNENPydcKvwL0588oaHcVsLrQVQ/M5LIAtbWX/2q81zeu gAmwYNJ/gQkEBTMIydFT/hgP/LlGV9q+1bDGy2YXeYI5Yti8wB5cZVdzAxAq/1xSiflT 86gBta0QT78IAOBKVn5oSmkkzZ81qj0ZtgsEpcHGI4hE+YMOWnrSyfcGR/pOvACJRbJR vjusOvzgemxpv0O64eHu5B/trouRuJZnerSNJrcxXvzz5pJlNX3lHkrZeiPIhsh4jsuM /ILGDJ9XfrdQjjbHAvFhB8ERWpDs5KwDA2iAQUt+2yx7LAC6dbP5Jv7Jn9edsWZ7ugyq gR9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Ik9xG8MF2P9AIY+3Imfw9qAjCPIDVHcw/C+USaiNOQM=; b=bhfg/3aU8q3MtCKiDSRr39Hflr+lMcJ1Rv7TFUrJ081X7bChzLpitO+uAY+DhKaF/h UhPjfP8k7I5ohulKaKmK7saGcHS0NElDD3ymqihlZohAgfQhjC1Y+xdoLKi7Gao8kpwd 4iGPQ2M9EzHOpezriP4H0hPpEFOW6aq7V+iyloGT8yy/PIw5qHxsejuHB6iK8gqNSByG tm/kUbUauO8QUXT3+1a6pi7ejyfXf4y7GSWNevrmpq6Esc8nNy4nqcNRYYycbGkrd/Le DE7fkq4/I6fhFWOqrjhvOIuYWJGzMhlnSYYx4YXFONfIDug/XGf0Q6DdDBtr+60UwKAK O6Fg== X-Gm-Message-State: AA6/9RmxIOBOCiLpiaeG8J5tgvbhTlRYVhg3YO1GUWyYnGdeq5GRgbtcQjNFU3jZnmbxyg== X-Received: by 10.25.212.136 with SMTP id l130mr1133881lfg.73.1476984892970; Thu, 20 Oct 2016 10:34:52 -0700 (PDT) Received: from [192.168.1.44] (ppp109-252-90-102.pppoe.spdop.ru. [109.252.90.102]) by smtp.gmail.com with ESMTPSA id l65sm12639509lfl.30.2016.10.20.10.34.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Oct 2016 10:34:52 -0700 (PDT) Subject: Re: "Illegal Instruction" error in grub_script_comments To: The development of GNU GRUB , Lennart Sorensen References: <20161018191208.GF20428@csclub.uwaterloo.ca> <909472052.9545840.1476891128586.JavaMail.zimbra@redhat.com> From: Andrei Borzenkov Message-ID: Date: Thu, 20 Oct 2016 20:34:51 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <909472052.9545840.1476891128586.JavaMail.zimbra@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::233 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 17:35:00 -0000 19.10.2016 18:32, Matthew Whitehead пишет: > Lennart, > I think I found the problem. I don't know what kernel.img does, but I'm guessing it is an essential part of grub2, loading after the 1st and 2nd stage loaders? I disassembled the binary using 'objdump -D -b binary -m i386 kernel.img' and found several cases both of rdtsc and cpuid. Both of these instructions do not exist on first generation 80486 cpus. Here they are, and I've attached the full disassembly output. > > 53a0: 85 c0 test %eax,%eax > 53a2: 74 6f je 0x5413 > 53a4: b8 01 00 00 00 mov $0x1,%eax > 53a9: 0f a2 cpuid > 53ab: 80 e2 10 and $0x10,%dl > 53ae: 74 63 je 0x5413 > 53b0: 31 c0 xor %eax,%eax > 53b2: 0f a2 cpuid > 53b4: 0f 31 rdtsc > 53b6: a3 48 67 01 00 mov %eax,0x16748 > 53bb: 89 15 4c 67 01 00 mov %edx,0x1674c > 53c1: 31 c0 xor %eax,%eax > 53c3: 0f a2 cpuid > 53c5: 0f 31 rdtsc > 53c7: 89 c6 mov %eax,%esi > 53c9: b8 ff ff 00 00 mov $0xffff,%eax > 53ce: 89 d7 mov %edx,%edi > 53d0: e8 83 00 00 00 call 0x5458 > 53d5: 31 c0 xor %eax,%eax > 53d7: 0f a2 cpuid > 53d9: 0f 31 rdtsc > 53db: 89 45 e0 mov %eax,-0x20(%ebp) > 53de: 8b 4d e0 mov -0x20(%ebp),%ecx > ... > 5439: 31 c0 xor %eax,%eax > 543b: 0f a2 cpuid > 543d: 0f 31 rdtsc > 543f: 8b 0d 50 67 01 00 mov 0x16750,%ecx > 5445: 6a 00 push $0x0 > 5447: e8 8f dc ff ff call 0x30db > > How can we adjust the makefiles to include -march=i486 or something similar? > This code is likely grub_cpu_is_tsc_supported() (see include/grub/i386/tsc.h) which *is* protected by grub_cpu_is_cpuid_supported(). Can you test if this function yields wrong result in your case (just compile it separately)? > - Matthew > > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >