> /* 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

Reply via email to