public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] AArch64 ensure getcontext initializes pstate.
@ 2013-06-04  9:10 Marcus Shawcroft
  2013-06-04 12:43 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Marcus Shawcroft @ 2013-06-04  9:10 UTC (permalink / raw)
  To: libc-ports

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

This patch ensures that getcontext() initializes pstate to a sane value.

/Marcus

2013-06-04  Marcus Shawcroft  <marcus.shawcroft@linaro.org>

  * sysdeps/unix/sysv/linux/aarch64/getcontext.S (__getcontext):
  Initialize pstate.
* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (oPSTATE): Define.

[-- Attachment #2: glibc-getcontext-initialize-pstate.diff --]
[-- Type: application/octet-stream, Size: 1062 bytes --]

diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/getcontext.S b/ports/sysdeps/unix/sysv/linux/aarch64/getcontext.S
index eea6867..c370957 100644
--- a/ports/sysdeps/unix/sysv/linux/aarch64/getcontext.S
+++ b/ports/sysdeps/unix/sysv/linux/aarch64/getcontext.S
@@ -53,6 +53,10 @@ ENTRY(__getcontext)
 	mov	x2, sp
 	str     x2, [x0, oSP]
 
+	/* Initialize the pstate.  */
+	mov	x3, #0
+	str	x3, [x0, oPSTATE]
+
 	/* Figure out where to place the first context extension
 	   block.  */
 	add     x2, x0, #oEXTENSION
diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym b/ports/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym
index 1afff78..ab3930c 100644
--- a/ports/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym
+++ b/ports/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym
@@ -37,6 +37,7 @@ STACK_FLAGS			stack (ss_flags)
 oX0				mcontext (regs)
 oSP				mcontext (sp)
 oPC				mcontext (pc)
+oPSTATE				mcontext (pstate)
 oEXTENSION                      mcontext (__reserved)
 
 #define fpsimd_context(member)  offsetof (struct fpsimd_context, member)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [COMMITTED] AArch64 ensure getcontext initializes pstate.
  2013-06-04  9:10 [COMMITTED] AArch64 ensure getcontext initializes pstate Marcus Shawcroft
@ 2013-06-04 12:43 ` Richard Henderson
  2013-06-05 15:03   ` Marcus Shawcroft
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2013-06-04 12:43 UTC (permalink / raw)
  To: Marcus Shawcroft; +Cc: libc-ports

On 06/04/2013 02:10 AM, Marcus Shawcroft wrote:
>  	mov	x2, sp
>  	str     x2, [x0, oSP]
>  
> +	/* Initialize the pstate.  */
> +	mov	x3, #0
> +	str	x3, [x0, oPSTATE]

Surely you can store XZR directly?


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [COMMITTED] AArch64 ensure getcontext initializes pstate.
  2013-06-04 12:43 ` Richard Henderson
@ 2013-06-05 15:03   ` Marcus Shawcroft
  0 siblings, 0 replies; 3+ messages in thread
From: Marcus Shawcroft @ 2013-06-05 15:03 UTC (permalink / raw)
  To: Richard Henderson; +Cc: libc-ports

On 4 June 2013 13:43, Richard Henderson <rth@twiddle.net> wrote:
> On 06/04/2013 02:10 AM, Marcus Shawcroft wrote:
>>       mov     x2, sp
>>       str     x2, [x0, oSP]
>>
>> +     /* Initialize the pstate.  */
>> +     mov     x3, #0
>> +     str     x3, [x0, oPSTATE]
>
> Surely you can store XZR directly?

Yes... I'll push another patch shortly.
/Marcus

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-05 15:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-04  9:10 [COMMITTED] AArch64 ensure getcontext initializes pstate Marcus Shawcroft
2013-06-04 12:43 ` Richard Henderson
2013-06-05 15:03   ` Marcus Shawcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).