linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: stian@nixia.no
To: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] [PATCH 1/3] um: extend _fpstate to _xstate
Date: Mon, 14 Mar 2016 08:58:45 +0100	[thread overview]
Message-ID: <da47737df6fd95a3c870b7d486ef34f7@nixia.no> (raw)
In-Reply-To: <56E3C055.1080301@gmx.com>


> /* test if signal handling preserves XMM registers */
> #include <stdio.h>
> #include <unistd.h>
> #include <signal.h>
>
> int count;
>
> void sighandler(int signum)
> {
>         count++;
>
>         /* alarm(1) without calling libc */
>         asm("mov $0x1,%rdi");
>         asm("mov $0x25,%rax");
>         asm("syscall");
>
>         asm("movq $0xdeadbeef,%r11");
>         /* the following two instructions
>          * modify xmm0 and xmm1 registers */
>         asm("vmovq %r11,%xmm0");
>         asm("vmovq %r11,%xmm1");
> }
>
> int main()
> {
>         struct sigaction act;
>         double a = 3.14159, b = 2.71828;
>
>         act.sa_handler = sighandler;
>         act.sa_flags = 0;
>         sigemptyset(&act.sa_mask);
>         sigaction(SIGALRM, &act, NULL);
>
>         alarm(1);
>
>         /* this loop should run indefinitely */
>         while (a + b == a + b) ;
>
>         printf("count = %d\n", count);

if you put a break here in gdb, and dump the FPU regs, what does it 
say?

Can be that either we a lacking or missplaced a fwait (to flush FPU)

>         return 1;
> }


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


  parent reply	other threads:[~2016-03-14  8:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-06 14:36 [uml-devel] [PATCH 0/3] um: Add support for extended processor state Eli Cooper
2016-03-06 14:36 ` [uml-devel] [PATCH 1/3] um: extend _fpstate to _xstate Eli Cooper
2016-03-09 20:44   ` Richard Weinberger
2016-03-12  7:08     ` Eli Cooper
2016-03-13  7:58       ` Richard Weinberger
2016-03-13 13:56         ` Eli Cooper
2016-03-14  7:58       ` stian [this message]
2016-03-06 14:36 ` [uml-devel] [PATCH 2/3] um: add extended processor state save/restore support Eli Cooper
2016-03-06 14:36 ` [uml-devel] [PATCH 3/3] um: fix ptrace PTRACE_GETFPREGS and PTRACE_SETFPREG support Eli Cooper

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=da47737df6fd95a3c870b7d486ef34f7@nixia.no \
    --to=stian@nixia.no \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).