/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <strings.h>
#include <stdio.h>
#include <sys/inttypes.h>
#include <sys/elf_notes.h>
#include "sys/multiboot.h"
static char *pname;
static char *fname;
/*
* patch the load address / entry address
* Find the physical load address of the 1st PT_LOAD segment.
* Find the amount that e_entry exceeds that amount.
* Now go back and subtract the excess from the p_paddr of the LOAD segment.
*/
static int
{
/*
* Verify some ELF basics - this must be an executable with program
* headers.
*/
return (1);
}
fname);
return (1);
}
/*
* Get the program headers.
*/
return (1);
}
/*
* Look for multiboot header. It must be 32-bit aligned and
* completely contained in the 1st 8K of the file.
*/
break;
}
return (1);
}
/*
* Find the 1:1 mapped PT_LOAD section
*/
/*LINTED [ELF program header alignment]*/
/*
* Find the low memory 1:1 PT_LOAD section!
*/
continue;
continue;
continue;
/*
* Make sure the multiboot header is part of the first PT_LOAD
* segment, and that the executables entry point starts at the
* same segment.
*/
return (1);
}
return (1);
}
/*
* Patch the multiboot header fields to get entire file loaded.
* Grub uses the MB header for 64 bit loading.
*/
#ifdef VERBOSE
#endif
return (0);
}
return (1);
}
int
{
int fd;
uchar_t *ident;
/*
* we expect one argument -- the elf file
*/
if (argc != 2) {
return (1);
}
else
++pname;
return (1);
}
/*
* mmap just the 1st 8K -- since that's where the GRUB
* multiboot header must be located.
*/
if (image == MAP_FAILED) {
return (1);
}
ident = ELFSEEK(0);
fname);
return (1);
}
if (ident[EI_CLASS] == ELFCLASS64) {
}
if (ident[EI_CLASS] != ELFCLASS32) {
ident[EI_CLASS]);
return (1);
}
return (0);
}