public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
	david@redhat.com, thuth@redhat.com, seiden@linux.ibm.com,
	nrb@linux.ibm.com
Subject: [kvm-unit-tests PATCH 4/5] s390x: Clear first stack frame and end backtrace early
Date: Wed, 23 Nov 2022 08:46:55 +0000	[thread overview]
Message-ID: <20221123084656.19864-5-frankja@linux.ibm.com> (raw)
In-Reply-To: <20221123084656.19864-1-frankja@linux.ibm.com>

When setting the first stack frame to 0, we can check for a 0
backchain pointer when doing backtraces to know when to stop.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 lib/s390x/stack.c | 2 ++
 s390x/cstart64.S  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/lib/s390x/stack.c b/lib/s390x/stack.c
index e714e07c..9f234a12 100644
--- a/lib/s390x/stack.c
+++ b/lib/s390x/stack.c
@@ -22,6 +22,8 @@ int backtrace_frame(const void *frame, const void **return_addrs, int max_depth)
 	for (depth = 0; stack && depth < max_depth; depth++) {
 		return_addrs[depth] = (void *)stack->grs[8];
 		stack = stack->back_chain;
+		if (!stack)
+			break;
 	}
 
 	return depth;
diff --git a/s390x/cstart64.S b/s390x/cstart64.S
index 666a9567..6f83da2a 100644
--- a/s390x/cstart64.S
+++ b/s390x/cstart64.S
@@ -37,6 +37,8 @@ start:
 	sam64				# Set addressing mode to 64 bit
 	/* setup stack */
 	larl	%r15, stackptr
+	/* Clear first stack frame */
+	xc      0(160,%r15), 0(%r15)
 	/* setup initial PSW mask + control registers*/
 	larl	%r1, initial_psw
 	lpswe	0(%r1)
-- 
2.34.1


  parent reply	other threads:[~2022-11-23  8:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  8:46 [kvm-unit-tests PATCH 0/5] s390x: Snippet fixes Janosch Frank
2022-11-23  8:46 ` [kvm-unit-tests PATCH 1/5] s390x: Add a linker script to assembly snippets Janosch Frank
2022-11-23 12:45   ` Claudio Imbrenda
2022-11-24 14:28     ` Janosch Frank
2022-11-24 20:42   ` Janis Schoetterl-Glausch
2022-11-25 10:07     ` Janosch Frank
2022-11-23  8:46 ` [kvm-unit-tests PATCH 2/5] s390x: snippets: Fix SET_PSW_NEW_ADDR macro Janosch Frank
2022-11-23 10:58   ` Nico Boehr
2022-11-23 13:05   ` Claudio Imbrenda
2022-11-23  8:46 ` [kvm-unit-tests PATCH 3/5] lib: s390x: sie: Set guest memory pointer Janosch Frank
2022-11-23 11:01   ` Nico Boehr
2022-11-23 12:46   ` Claudio Imbrenda
2022-11-23  8:46 ` Janosch Frank [this message]
2022-11-23 11:05   ` [kvm-unit-tests PATCH 4/5] s390x: Clear first stack frame and end backtrace early Nico Boehr
2022-11-23 12:47   ` Claudio Imbrenda
2022-11-23  8:46 ` [kvm-unit-tests PATCH 5/5] lib: s390x: Handle debug prints for SIE exceptions correctly Janosch Frank
2022-11-23 13:01   ` Claudio Imbrenda
2022-11-30 14:38     ` Janosch Frank
2022-11-30 14:46       ` Claudio Imbrenda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221123084656.19864-5-frankja@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=seiden@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox