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

Re: [microblaze-uclinux] Patch for stability under heavy IRQ load



Hi Alejandro,

Alejandro Lucero wrote:

> I'm going to apply the patch since I have this problem, but I don't understand 
> why you say r12 was not restored. I'm working with an older version of 
> entry.S but I was sure this was done, so I have download the last entry.S and 
> you restore r12 as I though,
>  
> TRAP_STATE_RESTORER->RESTORE_CALL_CLOBBERED_REGS_NO_RVAL->RESTORE_CALL_CLOBBERED_REGS_AFTER_RVAL

That is actually conditional on TRAPS_PRESERVE_CALL_CLOBBERED_REGS being true,
which by default it is not (see include/asm-microblaze/entry.h).

#if TRAPS_PRESERVE_CALL_CLOBBERED_REGS

/* Traps save/restore all call-clobbered registers (except for rval regs).  */
#define TRAP_STATE_SAVER                                                      \
     SAVE_CALL_CLOBBERED_REGS_NO_RVAL;                                        \
     SAVE_SYS_REGS_FOR_TRAP

#define TRAP_STATE_RESTORER                                                   \
     RESTORE_CALL_CLOBBERED_REGS_NO_RVAL;                                     \
     RESTORE_SYS_REGS_FOR_TRAP

#else /* !TRAPS_PRESERVE_CALL_CLOBBERED_REGS */

/* Traps don't save call-clobbered registers (but do still save arg regs).  */
#define TRAP_STATE_SAVER                                                      \
     SAVE_ARG_REGS;                                                           \
     SAVE_SYS_REGS_FOR_TRAP

...

/* When traps return, they just leave call-clobbered registers (except for arg
   regs) with whatever value they have from the kernel.  */
#define TRAP_STATE_RESTORER                                                   \
     RESTORE_ARG_REGS;                                                        \
     RESTORE_SYS_REGS_FOR_TRAP

Since, in the context of a system call, r12 is a "system register" (holding the
syscall number), adding it to "RESTORE_SYS_REGS_FOR_TRAP" makes sure that either
way, the syscall number is restored.

Cheers,

John

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/