/* macho.c - load Mach-O files. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* This Mach-O loader is incomplete and can load only non-relocatable segments.
This is however enough to boot xnu (otool -l and Mach-O specs for more info).
*/
#include <grub/machoload.h>
{
if (file)
return grub_errno;
}
{
if (! macho)
return 0;
goto fail;
!= sizeof (filestart))
{
grub_error_push ();
goto fail;
}
/* Is it a fat file? */
{
int i, narchs;
/* Load architecture description. */
== (grub_off_t) -1)
goto fail;
if (!archs)
goto fail;
sizeof (struct grub_macho_fat_arch) * narchs)
{
grub_error_push ();
goto fail;
}
for (i = 0; i < narchs; i++)
{
{
}
{
}
}
}
/* Is it a thin 32-bit file? */
{
}
/* Is it a thin 64-bit file? */
{
}
return macho;
fail:
return 0;
}
{
if (! file)
return 0;
if (! macho)
return macho;
}