NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: port-sh3/49597: swapcontext(3) stack pointer problem on NetBSD/sh3
The following reply was made to PR port-sh3/49597; it has been noted by GNATS.
From: Yasushi Oshima <oshima-ya%yagoto-urayama.jp@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: port-sh3/49597: swapcontext(3) stack pointer problem on
NetBSD/sh3
Date: Fri, 23 Jan 2015 01:42:39 +0900 (JST)
Thu, 22 Jan 2015 14:55:00 +0000 (UTC)
Valery Ushakov <uwe%stderr.spb.ru@localhost> wrote'
> Have you tested this?
Yes, but __PIC__ case only.
The atf-tests in lib/libc/sys/t_swapcontext and fs/psshfs became
to success by this patch in my environment.
> From a quick look, getcontext() captures the state that has not two,
> but three registers in the stack - including mov.l r4, @-sp in the
> delay slot of the CALL, doesn't it?
Yes include in the delay slot, and include in PIC_PROLOGUE() macro.
Stacking register is:
1) PIC_PROLOGUE(.L_got) ; r12 when __PIC__ only in sh3/asm.h
2) mov.l r5, @-sp
3) sts.l pr, @-sp
4) mov.l r4, @-sp ; in delay slot (CALL is bsrf or bsr)
and get from stack after getcontext()
5) mov.l @sp+ r1
SP saved in a ucontext stored by getcontext() shows 4 regs(__PIC__)
or 3 regs (NOT __PIC__) away from swapcontext() caller.
After getcontext() and pop stack by 5), current SP is 3 (or 2) regs away.
And I've checked this difference of SP is 12 bytes (=3 regs) by gdb
libc/sys/t_swapcontext test program (in __PIC__ case).
Thanks.
Home |
Main Index |
Thread Index |
Old Index