Files
codezero/conts/posix/mm0/mm/bootdesc.c
Bahadir Balban 6b5d4b26c2 Changes to mm0 initialization. mm0 building.
Changed mm0 initialization.
Removed all cruft about boot-specific task setup and initialization,
mm0 now builds with new changes.
2009-10-05 16:40:51 +03:00

48 lines
1.0 KiB
C

/*
* Reading of bootdesc forged at build time.
*
* Copyright (C) 2007 - 2009 Bahadir Balban
*/
#include <bootdesc.h>
#include <bootm.h>
#include <init.h>
#include <linker.h>
#include <l4lib/arch/syslib.h>
extern unsigned long pager_offset;
struct svc_image *bootdesc_get_image_byname(char *name)
{
for (int i = 0; i < initdata.bootdesc->total_images; i++)
if (!strncmp(initdata.bootdesc->images[i].name, name, strlen(name)))
return &initdata.bootdesc->images[i];
return 0;
}
void read_boot_params()
{
int npages;
struct bootdesc *bootdesc;
/*
* End of the executable image is where bootdesc resides
*/
bootdesc = (struct bootdesc *)__end;
/* Check if bootdesc is on an unmapped page */
if (is_page_aligned(bootdesc))
l4_map_helper(bootdesc - pager_offset, 1);
/* Allocate bootdesc sized structure */
initdata.bootdesc = alloc_bootmem(bootdesc->desc_size, 0);
/* Copy bootdesc to initdata */
memcpy(initdata.bootdesc, bootdesc,
bootdesc->desc_size);
if (npages > 0)
l4_unmap_helper((void *)page_align_up(__end), npages);
}