Exemple #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);
}
Exemple #2
0
int init_module(void)
{
	int i, ret;
//	unsigned long vaddr = 0x080484a8U;

	printk(KERN_INFO "In probe5ag init_module \n");
	if (u_dbfs_init("probe5ag")) {
		printk(KERN_INFO "In probe5ag u_dbfs_init failed\n");
		return -1;
	}
	test_printk("Registering %d uprobes on pid %d, vaddr %#lx\n",
		nprobes, pid, vaddr);
	probes = (struct uprobe*) kzalloc(nprobes*sizeof(struct uprobe),
		GFP_KERNEL);
	if (!probes) {
		printk(KERN_INFO "No memory for probe array.\n");
		u_dbfs_cleanup();
		return -1;
	}
	for (i = 0; i < nprobes; i++) {
		probes[i].vaddr = vaddr;
		probes[i].pid = pid;
		probes[i].handler = add_inst;
		ret = register_uprobe(&probes[i]);
		if (ret != 0) {
			printk(KERN_INFO
				"register_uprobe() #%d failed, returned %d\n",
				i, ret);
			shut_down();
			u_dbfs_cleanup();
			return ret;
		}
	}
	return 0;
}
Exemple #3
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();
    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 error\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);
}
Exemple #4
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);
}
Exemple #5
0
static void child_exit(void) 
{
	test_printk("nhits=%d\n", nhits);
}
Exemple #6
0
static void add_inst(struct uprobe *u, struct pt_regs *regs)
{
	if (verbose)
		test_printk("add() called\n");
	nhits++;
}