[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[microblaze-uclinux] [patch] r17 must be saved



Hi John and all,

One of my colleagues pin this bug down. Currently r17 is not saved in
irq.

here is the senario:

- Process A call one of syscalls, which save returning point to r17

- a timer interrupt occur, save most of registers except r17

- at the end of interrupt, need_resched is checked.  we switch from
process A to Process B

- Process B call one of syscalls, over writing Process A's returning
point in r17

the following patch fixes this bug, but not sure how John want to fix
it.

best,
--
             yashi


Index: entry.S
===================================================================
RCS file: /var/cvs/uClinux-2.4.x/arch/microblaze/kernel/entry.S,v
retrieving revision 1.8
diff -u -r1.8 entry.S
--- entry.S	18 May 2004 12:36:43 -0000	1.8
+++ entry.S	21 Aug 2004 15:13:31 -0000
@@ -167,6 +167,7 @@
 /* Save system registers to the struct pt_regs pointed to by REG.  
    r11 is clobbered.  */
 #define SAVE_SYS_REGS_FOR_IRQ						      \
+	SAVE_REG(17); \
 	swi	r14, r1, PTO+PT_PC;	/* user's PC, before interrupt */     \
 	mfs	r11, rmsr;	/* & PSW (XXX save this?) */		      \
 	swi	r11, r1, PTO+PT_PSW;	
@@ -174,6 +175,7 @@
 /* Restore system registers from the struct pt_regs pointed to by EP.         
    clobber r14 to restore status register, it gets fixed immediately */    
 #define RESTORE_SYS_REGS_FOR_IRQ					      \
+	RESTORE_REG(17); \
 	lwi	r11, r1, PTO+PT_PSW;	/* Processor status word */	      \
 	mts	rmsr, r11;						      \
 	lwi	r14, r1, PTO+PT_PC;	/* User's PC before interrupt */      
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/