segment.c revision a734c64bff58bda2fa48c2795453e092167b0ff7
/*
* Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
*
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* @file
*
* Executable image segments
*
*/
#include <errno.h>
#include <ipxe/errortab.h>
/**
* Segment-specific error messages
*
* This error happens sufficiently often to merit a user-friendly
* description.
*/
#define EINFO_ERANGE_SEGMENT \
};
/**
* Prepare segment for loading
*
* @v segment Segment start
* @v filesz Size of the "allocated bytes" portion of the segment
* @v memsz Size of the segment
* @ret rc Return status code
*/
struct memory_map memmap;
unsigned int i;
/* Sanity check */
return -EINVAL;
}
/* Get a fresh memory map. This allows us to automatically
* avoid treading on any regions that Etherboot is currently
* editing out of the memory map.
*/
get_memmap ( &memmap );
/* Look for a suitable memory region */
/* Found valid region: zero bss and return */
return 0;
}
}
/* No suitable memory region found */
DBG ( "Segment [%lx,%lx,%lx) does not fit into available memory\n",
return -ERANGE_SEGMENT;
}