Beispiel #1
0
void plat_boot(void){
	int i;
	for(i=0;init[i];i++){
		init[i]();
	}
	init_sys_mmu();
	start_mmu();
	test_mmu();
	test_printk();
//	timer_init();
	init_page_map();
	kmalloc_init();
	char *p1,*p2,*p3,*p4;
	p1=kmalloc(127);
	printk("the first alloced address is %x\n",p1);
	p2=kmalloc(124);
	printk("the second alloced address is %x\n",p2);
	kfree(p1);
	kfree(p2);
	p3=kmalloc(119);
	printk("the third alloced address is %x\n",p3);
	p4=kmalloc(512);
	printk("the forth alloced address is %x\n",p4);
	while(1);
}
Beispiel #2
0
void plat_boot(void) {
    int i;
    for(i=0; init[i]; i++) {
        init[i]();
    }
    init_sys_mmu();
    start_mmu();
//	timer_init();

    init_page_map();
    kmalloc_init();

    ramdisk_driver_init();
    romfs_init();

    struct inode *node;
    char buf[128];

    node=fs_type[ROMFS]->namei(fs_type[ROMFS],"number.txt");

    fs_type[ROMFS]->device->dout(fs_type[ROMFS]->device,buf,fs_type[ROMFS]->get_daddr(node),node->dsize);

    for(i=0; i<sizeof(buf); i++) {
        printk("%c ",buf[i]);
    }

    while(1);
}
Beispiel #3
0
void plat_boot(void){
	int i;
	for(i=0;init[i];i++){
		init[i]();
	}
	init_sys_mmu();
	start_mmu();
//	timer_init();

	init_page_map();
	kmalloc_init();

	ramdisk_driver_init();
	romfs_init();

	struct inode *node;

	char *buf=(char *)0x30100000;

	if((node=fs_type[ROMFS]->namei(fs_type[ROMFS],"main.bin"))==(void *)0){
		printk("inode read eror\n");
		goto HALT;
	}
	

	if(fs_type[ROMFS]->device->dout(fs_type[ROMFS]->device,buf,fs_type[ROMFS]->get_daddr(node),node->dsize)){
		printk("dout error\n");
		goto HALT;
	}

	exec(buf);
	
HALT:
	while(1);
}
Beispiel #4
0
void plat_boot(void) {
    int i;
    for (i=0; init[i]; i++) {
        init[i]();
    }
    init_sys_mmu();
    start_mmu();
//    timer_init();

    init_page_map();
    kmalloc_init();
    ramdisk_driver_init();
    romfs_init();

    struct inode *node;
    struct elf32_phdr *phdr;
    struct elf32_ehdr *ehdr;
    int phnum, pos, dpos;
    char *buf;

    if ((buf = (char *)kmalloc(1024)) == (void *)0) {
        printk("get free pages error\n");
        goto HALT;
    }

    if ((node = fs_type[ROMFS]->namei(fs_type[ROMFS], "main")) == (void *)0) {
        printk("inode read error\n");
        goto HALT;
    }

    if (fs_type[ROMFS]->device->dout(fs_type[ROMFS]->device, buf, \
                fs_type[ROMFS]->get_daddr(node), node->dsize)) {
        printk("dount error\n");
        goto HALT;
    }

    ehdr = (struct elf32_ehdr *)buf;
    phdr = (struct elf32_phdr *)((char *)buf+ehdr->e_phoff);
    
    for (i = 0; i< ehdr->e_phnum; i++) {
        if (CHECK_PT_TYPE_LOAD(phdr)) {
            if (fs_type[ROMFS]->device->dout(fs_type[ROMFS]->device,\
                        (char *)phdr->p_vaddr, \
                        fs_type[ROMFS]->get_daddr(node) + \
                        phdr->p_offset, phdr->p_filesz) < 0) {
                printk("dout error\n");
                goto HALT;
            }
        }
        phdr++;
    }

    exec(ehdr->e_entry);

HALT:
    while (1);
}
Beispiel #5
0
void plat_boot(void) {
    int i;
    for (i=0; init[i]; i++) {
        init[i]();
    }
    init_sys_mmu();
    start_mmu();
    task_init();
    timer_init();

    init_page_map();
    kmalloc_init();
    ramdisk_driver_init();
    romfs_init();
    
    i = do_fork(test_process, (void *)0x1);
    i = do_fork(test_process, (void *)0x2);

    while (1) {
        delay ();
        printk("this is the original process\n");
    }

}
Beispiel #6
0
void plat_boot(void){
	int i;
	for(i=0;init[i];i++){
		init[i]();
	}
	init_sys_mmu();
	start_mmu();
	test_mmu();
	test_printk();
//	timer_init();
	init_page_map();
	char *p1,*p2,*p3,*p4;
	p1=(char *)get_free_pages(0,6);
	printk("the return address of get_free_pages %x\n",p1);
	p2=(char *)get_free_pages(0,6);
	printk("the return address of get_free_pages %x\n",p2);
	put_free_pages(p2,6);
	put_free_pages(p1,6);
	p3=(char *)get_free_pages(0,7);
	printk("the return address of get_free_pages %x\n",p3);
	p4=(char *)get_free_pages(0,7);
	printk("the return address of get_free_pages %x\n",p4);
	while(1);
}