[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "Illegal Instruction" error in grub_script_comments
From: |
Matthew Whitehead |
Subject: |
Re: "Illegal Instruction" error in grub_script_comments |
Date: |
Wed, 19 Oct 2016 11:32:08 -0400 (EDT) |
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?
- Matthew
kernel.dis
Description: application/vnd.mobius.dis