- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody,
maby someone of you has an explenation for this behavior? I am calling a c function from assembler code, handing over two arguments in registers r4 and r5. So far so good. The c function assigns these argumetns to two variables and calls another c function: void my_exception_handler(ulong addr, ulong type) { ExceptionAddr = addr; ExceptionType = type; restart(); } restart sends ExceptionAddr and ExceptionType to the console and restarts the system. The assignment is not working unless I do something in advance. Like: void my_exception_handler(ulong addr, ulong type) { int etemp; etemp = 1; ExceptionAddr = addr; ExceptionType = type; restart(); } http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/blink.gif Any ideas? --wolfLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
declaring ExceptionAddr and ExceptionType as volatile did't work either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please post the disassembly version of the function?
Paolo- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Both versions seem to be ok for me. What do you think?
0104e248 g O .bss 00000004 ExceptionAddr 0104e24c g O .bss 00000004 ExceptionType void my_exception_handler(ulong addr, ulong type) { 102a824: defffb04 addi sp,sp,-20 102a828: dfc00415 stw ra,16(sp) 102a82c: df000315 stw fp,12(sp) 102a830: d839883a mov fp,sp 102a834: e1000015 stw r4,0(fp) 102a838: e1400115 stw r5,4(fp) int etemp; etemp = 1; 102a83c: 00800044 movi r2,1 102a840: e0800215 stw r2,8(fp) ExceptionAddr = addr; 102a844: 00c04174 movhi r3,261 102a848: 18f89204 addi r3,r3,-7608 102a84c: e0800017 ldw r2,0(fp) 102a850: 18800015 stw r2,0(r3) ExceptionType = type; 102a854: 00c04174 movhi r3,261 102a858: 18f89304 addi r3,r3,-7604 102a85c: e0800117 ldw r2,4(fp) 102a860: 18800015 stw r2,0(r3) restart(); 102a864: 01000404 movi r4,16 102a868: 10142d00 call 10142d0 <restart> } --- 0104e240 g O .bss 00000004 ExceptionAddr 0104e244 g O .bss 00000004 ExceptionType void my_exception_handler(ulong addr, ulong type) { 102a824: defffc04 addi sp,sp,-16 102a828: dfc00315 stw ra,12(sp) 102a82c: df000215 stw fp,8(sp) 102a830: d839883a mov fp,sp 102a834: e1000015 stw r4,0(fp) 102a838: e1400115 stw r5,4(fp) // int etemp; // etemp = 1; ExceptionAddr = addr; 102a83c: 00c04174 movhi r3,261 102a840: 18f89004 addi r3,r3,-7616 102a844: e0800017 ldw r2,0(fp) 102a848: 18800015 stw r2,0(r3) ExceptionType = type; 102a84c: 00c04174 movhi r3,261 102a850: 18f89104 addi r3,r3,-7612 102a854: e0800117 ldw r2,4(fp) 102a858: 18800015 stw r2,0(r3) restart(); 102a85c: 01000404 movi r4,16 102a860: 10142d00 call 10142d0 <restart> }- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, at a first look they seem ok...
Paolo
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