Ejemplo n.º 1
0
void __attribute__ ((weak)) _premain()  
{
	int t;
	size_t size;
	size_t low;
	low=(size_t)&_romend;
	low+=15;
	low&=0xfffffff0; // Align to SDRAM burst boundary

	_initIO();
	printf("Initialising files\n");
	for(t=0;t<MAX_FILES;++t)
		Files[t]=0;

	size=1L<<HW_BOARD(REG_CAP_RAMSIZE);
	size-=low;
	size-=0x1000; // Leave room for the stack
	printf("Heap_low: %lx, heap_size: %lx\n",low,size);
	malloc_add((void*)low,size);

//	_init();
	t=main(1, args);
	exit(t);
	for (;;);
}
Ejemplo n.º 2
0
void AddMemory()
{
	size_t low;
	size_t size;
	low=(size_t)&heap_low;
	low+=7;
	low&=0xfffffff8; // Align to SDRAM burst boundary
	size=((char*)&heap_top)-low;
	printf("Heap_low: %lx, heap_size: %lx\n",low,size);
	malloc_add((void*)low,size);
}
Ejemplo n.º 3
0
void __attribute__ ((weak)) _premain()  
{
	int t;
	int *ctors;
	char *ramtop;
// Clear BSS data
	int *bss=&__bss_start__;
	while(bss<&__bss_end__)
		*bss++=0;

	_initIO();
	printf("Initialising files\n");
	for(t=0;t<MAX_FILES;++t)
		Files[t]=0;
//	printf("_end is %d, RAMTOP is %d\n",&_end,RAMTOP);
//	malloc_add(&_end,(char *)RAMTOP-&_end);	// Add the entire RAM to the free memory pool
	ramtop=(char *)addresscheck((volatile int *)&_end,0);
	malloc_add(&_end,ramtop-&_end);	// Add the entire RAM to the free memory pool
//	_init();

//  Run global constructors...
	ctors=&__ctors_start__;
	printf("Running global constructors");
	while(ctors<&__ctors_end__)
	{
		printf(".");
		void (*fp)();
		fp=(void (*)())(*ctors);
		fp();
		++ctors;
	}
	printf("\n");
	t=main(1, args);
//  Run global destructors...
	ctors=&__dtors_start__;
	while(ctors<&__dtors_end__)
	{
		void (*fp)();
		fp=(void (*)())(*ctors);
		fp();
		++ctors;
	}
	_exit(t);
}