diff mbox series

[kvm-unit-tests,8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts

Message ID 20230116175757.71059-9-mhartmay@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series Some cleanup patches | expand

Commit Message

Marc Hartmayer Jan. 16, 2023, 5:57 p.m. UTC
Use the `STACK_FRAME_SIZE` macro instead of a hard-coded value of 160.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 s390x/flat.lds.S            | 4 +++-
 s390x/snippets/c/flat.lds.S | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

Comments

Claudio Imbrenda Jan. 16, 2023, 6:23 p.m. UTC | #1
On Mon, 16 Jan 2023 18:57:56 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> Use the `STACK_FRAME_SIZE` macro instead of a hard-coded value of 160.
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>

merge patch 6 into this one

> ---
>  s390x/flat.lds.S            | 4 +++-
>  s390x/snippets/c/flat.lds.S | 6 ++++--
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/s390x/flat.lds.S b/s390x/flat.lds.S
> index 952f6cd457ed..0cb7e383cc76 100644
> --- a/s390x/flat.lds.S
> +++ b/s390x/flat.lds.S
> @@ -1,3 +1,5 @@
> +#include <asm/asm-offsets.h>
> +
>  SECTIONS
>  {
>  	.lowcore : {
> @@ -44,6 +46,6 @@ SECTIONS
>  	/*
>  	 * stackptr set with initial stack frame preallocated
>  	 */
> -	stackptr = . - 160;
> +	stackptr = . - STACK_FRAME_SIZE;
>  	stacktop = .;
>  }
> diff --git a/s390x/snippets/c/flat.lds.S b/s390x/snippets/c/flat.lds.S
> index 9e5eb66bec23..468b5f1eebe8 100644
> --- a/s390x/snippets/c/flat.lds.S
> +++ b/s390x/snippets/c/flat.lds.S
> @@ -1,3 +1,5 @@
> +#include <asm/asm-offsets.h>
> +
>  SECTIONS
>  {
>  	.lowcore : {
> @@ -18,9 +20,9 @@ SECTIONS
>  	. = 0x4000;
>  	/*
>  	 * The stack grows down from 0x4000 to 0x2000, we pre-allocoate
> -	 * a frame via the -160.
> +	 * a frame via the -STACK_FRAME_SIZE.
>  	 */
> -	stackptr = . - 160;
> +	stackptr = . - STACK_FRAME_SIZE;
>  	stacktop = .;
>  	/* Start text 0x4000 */
>  	.text : {
Marc Hartmayer Jan. 18, 2023, 9:10 a.m. UTC | #2
Marc Hartmayer <mhartmay@linux.ibm.com> writes:

> Use the `STACK_FRAME_SIZE` macro instead of a hard-coded value of 160.
>
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>  s390x/flat.lds.S            | 4 +++-
>  s390x/snippets/c/flat.lds.S | 6 ++++--
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/s390x/flat.lds.S b/s390x/flat.lds.S
> index 952f6cd457ed..0cb7e383cc76 100644
> --- a/s390x/flat.lds.S
> +++ b/s390x/flat.lds.S
> @@ -1,3 +1,5 @@
> +#include <asm/asm-offsets.h>
> +
>  SECTIONS
>  {
>  	.lowcore : {
> @@ -44,6 +46,6 @@ SECTIONS
>  	/*
>  	 * stackptr set with initial stack frame preallocated
>  	 */
> -	stackptr = . - 160;
> +	stackptr = . - STACK_FRAME_SIZE;

One small fix: After this change the ‘$(asm-offsets)‘ dependency has to
be added to to %.lds target rule in the Makefile.

[…snip]
diff mbox series

Patch

diff --git a/s390x/flat.lds.S b/s390x/flat.lds.S
index 952f6cd457ed..0cb7e383cc76 100644
--- a/s390x/flat.lds.S
+++ b/s390x/flat.lds.S
@@ -1,3 +1,5 @@ 
+#include <asm/asm-offsets.h>
+
 SECTIONS
 {
 	.lowcore : {
@@ -44,6 +46,6 @@  SECTIONS
 	/*
 	 * stackptr set with initial stack frame preallocated
 	 */
-	stackptr = . - 160;
+	stackptr = . - STACK_FRAME_SIZE;
 	stacktop = .;
 }
diff --git a/s390x/snippets/c/flat.lds.S b/s390x/snippets/c/flat.lds.S
index 9e5eb66bec23..468b5f1eebe8 100644
--- a/s390x/snippets/c/flat.lds.S
+++ b/s390x/snippets/c/flat.lds.S
@@ -1,3 +1,5 @@ 
+#include <asm/asm-offsets.h>
+
 SECTIONS
 {
 	.lowcore : {
@@ -18,9 +20,9 @@  SECTIONS
 	. = 0x4000;
 	/*
 	 * The stack grows down from 0x4000 to 0x2000, we pre-allocoate
-	 * a frame via the -160.
+	 * a frame via the -STACK_FRAME_SIZE.
 	 */
-	stackptr = . - 160;
+	stackptr = . - STACK_FRAME_SIZE;
 	stacktop = .;
 	/* Start text 0x4000 */
 	.text : {