| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * arch/arm/kernel/unwind.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2008 ARM Limited |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 8 | | - * published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License |
|---|
| 16 | | - * along with this program; if not, write to the Free Software |
|---|
| 17 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | | - * |
|---|
| 19 | 6 | * |
|---|
| 20 | 7 | * Stack unwinding support for ARM |
|---|
| 21 | 8 | * |
|---|
| .. | .. |
|---|
| 457 | 444 | ctrl.vrs[PC] = ctrl.vrs[LR]; |
|---|
| 458 | 445 | |
|---|
| 459 | 446 | /* check for infinite loop */ |
|---|
| 460 | | - if (frame->pc == ctrl.vrs[PC]) |
|---|
| 447 | + if (frame->pc == ctrl.vrs[PC] && frame->sp == ctrl.vrs[SP]) |
|---|
| 461 | 448 | return -URC_FAILURE; |
|---|
| 462 | 449 | |
|---|
| 463 | 450 | frame->fp = ctrl.vrs[FP]; |
|---|
| .. | .. |
|---|
| 468 | 455 | return URC_OK; |
|---|
| 469 | 456 | } |
|---|
| 470 | 457 | |
|---|
| 471 | | -void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk) |
|---|
| 458 | +void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk, |
|---|
| 459 | + const char *loglvl) |
|---|
| 472 | 460 | { |
|---|
| 473 | 461 | struct stackframe frame; |
|---|
| 474 | 462 | |
|---|
| .. | .. |
|---|
| 506 | 494 | urc = unwind_frame(&frame); |
|---|
| 507 | 495 | if (urc < 0) |
|---|
| 508 | 496 | break; |
|---|
| 509 | | - dump_backtrace_entry(where, frame.pc, frame.sp - 4); |
|---|
| 497 | + dump_backtrace_entry(where, frame.pc, frame.sp - 4, loglvl); |
|---|
| 510 | 498 | } |
|---|
| 511 | 499 | } |
|---|
| 512 | 500 | |
|---|