- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
i write a program under nios2 using assemble lanauge, following is the source code # include <linux/module.h># include <linux/kernel.h> void print(void) { printk("function print\n"); } typedef void(*pointer)(void); ulong code[3]; void jump(void) { __asm__("movia r12, print"); __asm__("jmp r12"); } int __init init_filter(void) { jump(); } void __exit exit_filter(void) { } module_init(init_filter); module_exit(exit_filter); this can work well, but if i change the function init_filter as bellow, the system will reboot, int __init init_filter(void) { pointer p; code[0]=0x03000034; code[1]=0x63000004; code[2]=0x6000683a; p = (pointer)code; p(); } code[0]~code[2] is the hex value that i get from nios2-elf-objdump according to two assemble sentences. how should i do? thanks a lotLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
see: http://forum.niosforum.com/forum/index.php...756&#entry19756 (http://forum.niosforum.com/forum/index.php?showtopic=5248&st=0&p=19756&#entry19756)

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page