nds32 ptrace register overflow
building for adp-ag101p showed this warning:
interrupts.c: In function 'show_regs':
interrupts.c:93: warning: array subscript is above array bounds interrupts.c:93: warning: array subscript is above array bounds
and indeed, i see:arch/nds32/lib/interrupts.c:
void show_regs(struct pt_regs *regs)
{
...
printf("r27: %08lx r26: %08lx r25: %08lx r24: %08lx\n",
regs->r[27], regs->r[26], regs->r[25], regs->r[24]);but regs->r only has 26 members ...arch/nds32/include/asm/ptrace.h:
struct pt_regs {
...
NDS32_REG r[26]; /* r0 - r25 */
NDS32_REG fp; /* r28 */
NDS32_REG gp; /* r29 */maybe that should be r[28] in your asm/ptrace.h ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120305/1fb62fa7/attachment.pgp>
Hi Mike,
2012/3/6 Mike Frysinger <[email protected]>:
Quoted 4 lines
building for adp-ag101p showed this warning:
? ? ? ?interrupts.c: In function 'show_regs':
? ? ? ?interrupts.c:93: warning: array subscript is above array bounds ? ? ? ?interrupts.c:93: warning: array subscript is above array bounds
Thanks for reporting this.
Quoted 3 lines
but
regs->ronly has 26 members ...arch/nds32/include/asm/ptrace.h:
? ? ? ?structpt_regs{
It looks like r26 and r27 are missing here.
Registers r26 and r27 are named P0 and P1.
They are used for OS specifically.
But since all registers are general purposed and the usage between will affected by toolchain.
Maybe that's why there is no problem when used wrong registers.
Quoted 3 lines
? ? ? ? ? ? ? ?NDS32_REG r[26]; ? ?/* r0 - r25 */
? ? ? ? ? ? ? ?NDS32_REG fp; ? ? ? /* r28 */
? ? ? ? ? ? ? ?NDS32_REG gp; ? ? ? /* r29 */
I'll fix this later.
Thanks!
Signature · 2 lines
Best regards, Macpaul Lin