Changeset View
Changeset View
Standalone View
Standalone View
head/sys/riscv/riscv/unwind.c
Show All 29 Lines | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/proc.h> | |||||
#include <machine/stack.h> | #include <machine/stack.h> | ||||
#include <machine/vmparam.h> | #include <machine/vmparam.h> | ||||
int | bool | ||||
unwind_frame(struct unwind_state *frame) | unwind_frame(struct thread *td, struct unwind_state *frame) | ||||
{ | { | ||||
uintptr_t fp; | uintptr_t fp; | ||||
fp = frame->fp; | fp = frame->fp; | ||||
if (!INKERNEL(fp)) | if (!kstack_contains(td, fp - sizeof(fp) * 2, sizeof(fp) * 2)) | ||||
return (-1); | return (false); | ||||
frame->sp = fp; | frame->sp = fp; | ||||
frame->fp = ((uintptr_t *)fp)[-2]; | frame->fp = ((uintptr_t *)fp)[-2]; | ||||
frame->pc = ((uintptr_t *)fp)[-1] - 4; | frame->pc = ((uintptr_t *)fp)[-1] - 4; | ||||
return (0); | return (true); | ||||
} | } |