From: SourceForge.net <no...@so...> - 2004-08-04 16:32:45
|
Bugs item #1003390, was opened at 2004-08-04 16:32 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1003390&group_id=599 Category: msc51(8051) target Group: None Status: Open Resolution: None Priority: 5 Submitted By: Frieder Ferlemann (frief) Assigned to: Nobody/Anonymous (nobody) Summary: IRQ preamble might save wrong register bank Initial Comment: This problem only occurs if functions are declared with the "using" keyword. (SDCC 2.4.3 #785) Source and some generated assembly follows: #include <8052.h> volatile unsigned char ms; #pragma save #pragma nooverlay void some_function(void) reentrant { ms++; } #pragma restore // IRQ preamble eventually pushes wrong register bank here if interrupt // occurs while register bank0 is not selected void some_irq( void ) interrupt 1 { some_function(); } void not_bank0_function() using 3 { unsigned char i=ms; while(--i) // allocated to r2 in bank 3 (0x1a) ms--; } void main( void ) { while(1) not_bank0_function(); } #if 0 ;irq.c:16: void some_irq( void ) interrupt 1 ; ----------------------------------------- ; function some_irq ; ----------------------------------------- _some_irq: push acc push b push dpl push dph ; ;*** pushing/setting psw should be done here?! ; push (0+2) push (0+3) push (0+4) push (0+5) push (0+6) push (0+7) push (0+0) push (0+1) push psw mov psw,#0x00 ;irq.c:18: some_function(); ; genCall lcall _some_function 00101$: pop psw pop (0+1) pop (0+0) pop (0+7) pop (0+6) pop (0+5) pop (0+4) pop (0+3) pop (0+2) ; ;*** popping psw should be done here?! ; pop dph pop dpl pop b pop acc reti #endif ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1003390&group_id=599 |