[2/2] GO S/390: Add kdsaQuery function

Message ID 20191014090900.7065-1-krebbel@linux.ibm.com
State New
Headers show
Series
  • libgo: Update to Go 1.13beta1 release
Related show

Commit Message

Andreas Krebbel Oct. 14, 2019, 9:09 a.m.
Since the update to Go 1.13beta1 the kdsaQuery function is expected to
be present. However, it is not with GCCGO since the assembler file
from GOLANG cannot be understood by gas.  This patch adds an inline
assembly implementation to cpu_gccgo.c.

2019-10-14  Andreas Krebbel  <krebbel@linux.ibm.com>

	* libgo/go/internal/cpu/cpu_gccgo.c:
---
 libgo/go/internal/cpu/cpu_gccgo.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

-- 
2.23.0

Comments

Ian Lance Taylor Oct. 14, 2019, 2:01 p.m. | #1
On Mon, Oct 14, 2019 at 2:09 AM Andreas Krebbel <krebbel@linux.ibm.com> wrote:
>

> Since the update to Go 1.13beta1 the kdsaQuery function is expected to

> be present. However, it is not with GCCGO since the assembler file

> from GOLANG cannot be understood by gas.  This patch adds an inline

> assembly implementation to cpu_gccgo.c.


Thanks.

Committed to trunk.

Ian



> 2019-10-14  Andreas Krebbel  <krebbel@linux.ibm.com>

>

>         * libgo/go/internal/cpu/cpu_gccgo.c:

> ---

>  libgo/go/internal/cpu/cpu_gccgo.c | 15 +++++++++++++++

>  1 file changed, 15 insertions(+)

>

> diff --git a/libgo/go/internal/cpu/cpu_gccgo.c b/libgo/go/internal/cpu/cpu_gccgo.c

> index ed0e7bff8cd..76b99cb00a0 100644

> --- a/libgo/go/internal/cpu/cpu_gccgo.c

> +++ b/libgo/go/internal/cpu/cpu_gccgo.c

> @@ -184,4 +184,19 @@ struct queryResult klmdQuery() {

>      return ret;

>  }

>

> +struct queryResult kdsaQuery(void)

> +  __asm__(GOSYM_PREFIX "internal..z2fcpu.kdsaQuery")

> +  __attribute__((no_split_stack));

> +

> +struct queryResult kdsaQuery() {

> +    struct queryResult ret;

> +

> +    __asm__ ("lghi   %%r0, 0\t\n"  // set function code to 0 (KDSA-Query)

> +            "la     %%r1, %[ret]\t\n"

> +            ".long  0xb93a0024\t\n"  // kdsa

> +            :[ret] "=QRST" (ret) : : "r0", "r1", "cc");

> +

> +    return ret;

> +}

> +

>  #endif /* defined(__s390x__)  */

> --

> 2.23.0

>

Patch

diff --git a/libgo/go/internal/cpu/cpu_gccgo.c b/libgo/go/internal/cpu/cpu_gccgo.c
index ed0e7bff8cd..76b99cb00a0 100644
--- a/libgo/go/internal/cpu/cpu_gccgo.c
+++ b/libgo/go/internal/cpu/cpu_gccgo.c
@@ -184,4 +184,19 @@  struct queryResult klmdQuery() {
     return ret;
 }
 
+struct queryResult kdsaQuery(void)
+  __asm__(GOSYM_PREFIX "internal..z2fcpu.kdsaQuery")
+  __attribute__((no_split_stack));
+
+struct queryResult kdsaQuery() {
+    struct queryResult ret;
+
+    __asm__ ("lghi   %%r0, 0\t\n"  // set function code to 0 (KDSA-Query)
+	     "la     %%r1, %[ret]\t\n"
+	     ".long  0xb93a0024\t\n"  // kdsa
+	     :[ret] "=QRST" (ret) : : "r0", "r1", "cc");
+
+    return ret;
+}
+
 #endif /* defined(__s390x__)  */