2009-10-09 Robert Millan <rmh.grub@aybabtu.com>
Fail gracefuly when attempting to load 64-bit kFreeBSD on IA32 CPU.
* include/grub/i386/cpuid.h: New file.
* commands/i386/cpuid.c: Include `<grub/i386/cpuid.h>'.
(has_longmode): Rename to ...
(grub_cpuid_has_longmode): ... this. Update all users. Remove
`static' attribute.
* loader/i386/bsd.c: Include `<grub/i386/cpuid.h>'.
(grub_bsd_load_elf): Fail if load of 64-bit kernel was requested
on a CPU that doesn't implement AMD64 instruction set.
This commit is contained in:
parent
186e7cf23b
commit
5c936493d3
4 changed files with 42 additions and 5 deletions
|
|
@ -19,6 +19,7 @@
|
|||
#include <grub/loader.h>
|
||||
#include <grub/cpu/loader.h>
|
||||
#include <grub/cpu/bsd.h>
|
||||
#include <grub/i386/cpuid.h>
|
||||
#include <grub/machine/init.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/memory.h>
|
||||
|
|
@ -871,6 +872,9 @@ grub_bsd_load_elf (grub_elf_t elf)
|
|||
{
|
||||
is_64bit = 1;
|
||||
|
||||
if (! grub_cpuid_has_longmode)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "Your CPU does not implement AMD64 architecture.");
|
||||
|
||||
/* FreeBSD has 64-bit entry point. */
|
||||
if (kernel_type == KERNEL_TYPE_FREEBSD)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue