]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2010-01-25 Robert Millan <rmh.grub@aybabtu.com>
authorRobert Millan <rmh@aybabtu.com>
Mon, 25 Jan 2010 19:13:33 +0000 (19:13 +0000)
committerRobert Millan <rmh@aybabtu.com>
Mon, 25 Jan 2010 19:13:33 +0000 (19:13 +0000)
* stage2/imgact_aout.h: Rewrite using aout.h from GRUB 1.97.2 as
a base.
* stage2/boot.c (load_image): Remove a.out handler for *BSD kernels.

ChangeLog
stage2/boot.c
stage2/imgact_aout.h

index e860e083a234a2943fe78fa8a058e0e22faa1fb9..565a4325b3c8306258a715a7e74ce8b97b48ef0f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-25  Robert Millan  <rmh.grub@aybabtu.com>
+
+       * stage2/imgact_aout.h: Rewrite using aout.h from GRUB 1.97.2 as
+       a base.
+       * stage2/boot.c (load_image): Remove a.out handler for *BSD kernels.
+
 2010-01-21  Robert Millan  <rmh.grub@aybabtu.com>
 
        * configure.ac: Remove `--enable-example-kernel' option.
index 04c77358d8f0990d0eb5603fb01a385f7d22fd88..4881985cccfd2d7de106cb7955f20ef18eb389c3 100644 (file)
@@ -169,53 +169,6 @@ load_image (char *kernel, char *arg, kernel_t suggested_type,
       exec_type = 2;
       str = "kludge";
     }
-  else if (len > sizeof (struct exec) && !N_BADMAG ((*(pu.aout))))
-    {
-      entry_addr = (entry_func) pu.aout->a_entry;
-
-      if (type == KERNEL_TYPE_NONE)
-       {
-         /*
-          *  If it doesn't have a Multiboot header, then presume
-          *  it is either a FreeBSD or NetBSD executable.  If so,
-          *  then use a magic number of normal ordering, ZMAGIC to
-          *  determine if it is FreeBSD.
-          *
-          *  This is all because freebsd and netbsd seem to require
-          *  masking out some address bits...  differently for each
-          *  one...  plus of course we need to know which booting
-          *  method to use.
-          */
-         entry_addr = (entry_func) ((int) entry_addr & 0xFFFFFF);
-         
-         if (buffer[0] == 0xb && buffer[1] == 1)
-           {
-             type = KERNEL_TYPE_FREEBSD;
-             cur_addr = (int) entry_addr;
-             str2 = "FreeBSD";
-           }
-         else
-           {
-             type = KERNEL_TYPE_NETBSD;
-             cur_addr = (int) entry_addr & 0xF00000;
-             if (N_GETMAGIC ((*(pu.aout))) != NMAGIC)
-               align_4k = 0;
-             str2 = "NetBSD";
-           }
-       }
-
-      /* first offset into file */
-      grub_seek (N_TXTOFF (*(pu.aout)));
-      text_len = pu.aout->a_text;
-      data_len = pu.aout->a_data;
-      bss_len = pu.aout->a_bss;
-
-      if (cur_addr < 0x100000)
-       errnum = ERR_BELOW_1MB;
-
-      exec_type = 1;
-      str = "a.out";
-    }
   else if (lh->boot_flag == BOOTSEC_SIGNATURE
           && lh->setup_sects <= LINUX_MAX_SETUP_SECTS)
     {
index eb83b7ddb68a21d409e8c0656e20a0fcccda52b9..9ee9f22d71c91ee1eb0e46e6318c08abe3b9bdcd 100644 (file)
@@ -1,7 +1,6 @@
-
 /*-
  * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
+ *      The Regents of the University of California.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     from: @(#)exec.h        8.1 (Berkeley) 6/11/93
- *     $Id$
- */
-/*
- *  11/23/95 - Kludge to get "ntohl" null macro added.  -- ESB
- *           - and for __LDPGSZ
+ *      from: @(#)exec.h        8.1 (Berkeley) 6/11/93
+ * $FreeBSD$
  */
 
-#ifndef        _IMGACT_AOUT_H_
-#define        _IMGACT_AOUT_H_
-
-/* XXX ESB */
-#define ntohl(x) ((x << 24) | ((x & 0xFF00) << 8) \
-                 | ((x >> 8) & 0xFF00) | (x >> 24))
-#define htonl(x) ntohl(x)
-#define __LDPGSZ 0x1000
-
-#define N_GETMAGIC(ex) \
-       ( (ex).a_midmag & 0xffff )
-#define N_GETMID(ex) \
-       ( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETMID_NET(ex) : \
-       ((ex).a_midmag >> 16) & 0x03ff )
-#define N_GETFLAG(ex) \
-       ( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETFLAG_NET(ex) : \
-       ((ex).a_midmag >> 26) & 0x3f )
-#define N_SETMAGIC(ex,mag,mid,flag) \
-       ( (ex).a_midmag = (((flag) & 0x3f) <<26) | (((mid) & 0x03ff) << 16) | \
-       ((mag) & 0xffff) )
-
-#define N_GETMAGIC_NET(ex) \
-       (ntohl((ex).a_midmag) & 0xffff)
-#define N_GETMID_NET(ex) \
-       ((ntohl((ex).a_midmag) >> 16) & 0x03ff)
-#define N_GETFLAG_NET(ex) \
-       ((ntohl((ex).a_midmag) >> 26) & 0x3f)
-#define N_SETMAGIC_NET(ex,mag,mid,flag) \
-       ( (ex).a_midmag = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \
-       (((mag)&0xffff)) ) )
-
-#define N_ALIGN(ex,x) \
-       (N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC || \
-        N_GETMAGIC_NET(ex) == ZMAGIC || N_GETMAGIC_NET(ex) == QMAGIC ? \
-        ((x) + __LDPGSZ - 1) & ~(unsigned long)(__LDPGSZ - 1) : (x))
-
-/* Valid magic number check. */
-#define        N_BADMAG(ex) \
-       (N_GETMAGIC(ex) != OMAGIC && N_GETMAGIC(ex) != NMAGIC && \
-        N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC && \
-        N_GETMAGIC_NET(ex) != OMAGIC && N_GETMAGIC_NET(ex) != NMAGIC && \
-        N_GETMAGIC_NET(ex) != ZMAGIC && N_GETMAGIC_NET(ex) != QMAGIC)
-
-
-/* Address of the bottom of the text segment. */
-#define N_TXTADDR(ex) \
-       ((N_GETMAGIC(ex) == OMAGIC || N_GETMAGIC(ex) == NMAGIC || \
-       N_GETMAGIC(ex) == ZMAGIC) ? 0 : __LDPGSZ)
-
-/* Address of the bottom of the data segment. */
-#define N_DATADDR(ex) \
-       N_ALIGN(ex, N_TXTADDR(ex) + (ex).a_text)
-
-/* Text segment offset. */
-#define        N_TXTOFF(ex) \
-       (N_GETMAGIC(ex) == ZMAGIC ? __LDPGSZ : (N_GETMAGIC(ex) == QMAGIC || \
-       N_GETMAGIC_NET(ex) == ZMAGIC) ? 0 : sizeof(struct exec))
-
-/* Data segment offset. */
-#define        N_DATOFF(ex) \
-       N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text)
-
-/* Relocation table offset. */
-#define N_RELOFF(ex) \
-       N_ALIGN(ex, N_DATOFF(ex) + (ex).a_data)
-
-/* Symbol table offset. */
-#define N_SYMOFF(ex) \
-       (N_RELOFF(ex) + (ex).a_trsize + (ex).a_drsize)
-
-/* String table offset. */
-#define        N_STROFF(ex)    (N_SYMOFF(ex) + (ex).a_syms)
-
-/*
- * Header prepended to each a.out file.
- * only manipulate the a_midmag field via the
- * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros in a.out.h
- */
+#ifndef GRUB_AOUT_HEADER
+#define GRUB_AOUT_HEADER 1
 
 struct exec
-  {
-    unsigned long a_midmag;    /* htonl(flags<<26 | mid<<16 | magic) */
-    unsigned long a_text;      /* text segment size */
-    unsigned long a_data;      /* initialized data size */
-    unsigned long a_bss;       /* uninitialized data size */
-    unsigned long a_syms;      /* symbol table size */
-    unsigned long a_entry;     /* entry point */
-    unsigned long a_trsize;    /* text relocation size */
-    unsigned long a_drsize;    /* data relocation size */
-  };
-#define a_magic a_midmag       /* XXX Hack to work with current kern_execve.c */
-
-/* a_magic */
-#define        OMAGIC          0x107   /* 0407 old impure format */
-#define        NMAGIC          0x108   /* 0410 read-only text */
-#define        ZMAGIC          0x10b   /* 0413 demand load format */
-#define QMAGIC          0xcc   /* 0314 "compact" demand load format */
-
-/* a_mid */
-#define        MID_ZERO        0       /* unknown - implementation dependent */
-#define        MID_SUN010      1       /* sun 68010/68020 binary */
-#define        MID_SUN020      2       /* sun 68020-only binary */
-#define MID_I386       134     /* i386 BSD binary */
-#define MID_SPARC      138     /* sparc */
-#define        MID_HP200       200     /* hp200 (68010) BSD binary */
-#define        MID_HP300       300     /* hp300 (68020+68881) BSD binary */
-#define        MID_HPUX        0x20C   /* hp200/300 HP-UX binary */
-#define        MID_HPUX800     0x20B   /* hp800 HP-UX binary */
-
-/*
- * a_flags
- */
-#define EX_PIC         0x10    /* contains position independant code */
-#define EX_DYNAMIC     0x20    /* contains run-time link-edit info */
-#define EX_DPMASK      0x30    /* mask for the above */
-
-#endif /* !_IMGACT_AOUT_H_ */
+{
+  unsigned int a_midmag;       /* htonl(flags<<26 | mid<<16 | magic) */
+  unsigned int a_text;         /* text segment size */
+  unsigned int a_data;         /* initialized data size */
+  unsigned int a_bss;          /* uninitialized data size */
+  unsigned int a_syms;         /* symbol table size */
+  unsigned int a_entry;                /* entry point */
+  unsigned int a_trsize;       /* text relocation size */
+  unsigned int a_drsize;       /* data relocation size */
+};
+
+#endif /* ! GRUB_AOUT_HEADER */