[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MirageOS-devel] Crash on x86 with doubles



I've got printing of floating point values working now on ARM, but
while testing I discovered it crashes on x86.

This turned out to be unrelated to OCaml or Mirage. It seems that
passing a double argument to any varargs function causes a crash on
x86_64 if done from a Mini-OS thread. Can any x86 gurus here shed some
light on what might cause that? x86 is a mystery to me.

My test case is:

static void foo(char *fmt, ...) { }

static void float_tester(void *p)
{
    printk("Running tests...\n");
    foo("%d", 3);
    printk("Pass int.\n");
    foo("%f", 3.1);
    printk("Pass float.\n");
}

I run it twice, once in the main thread and once in a Mini-OS thread:

    printk("Test main: start_info=%p\n", si);
    float_tester(NULL);
    printk("Starting float_thread...\n");
    create_thread("float", float_tester, NULL);

The output is:

(d114) Test main: start_info=00000000000416c0
(d114) Running tests...
(d114) Pass int.
(d114) Pass float.
(d114) Starting float_thread...
(d114) Thread "float": pointer: 0x1ef190, stack: 0x230000
(d114) Running tests...
(d114) Pass int.
(d114) GPF rip: 0000000000006b0c, error_code=0
(d114) Thread: float
(d114) RIP: e030:[<0000000000006b0c>]
(d114) RSP: e02b:000000000023ff08  EFLAGS: 00010202
(d114) RAX: 0000000000000001 RBX: 0000000000006b35 RCX: 00000000deadbeef
(d114) RDX: 00000000deadbeef RSI: 00000000deadbeef RDI: 0000000000011d59
(d114) RBP: 000000000023ffc8 R08: 000000000000000b R09: 0000000000000000
(d114) R10: 000000000000000b R11: 0000000000000000 R12: 0000000000000000
(d114) R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
(d114) base is 0x23ffc8 caller is 0x6b95
(d114) base is 0x23ffe8 caller is 0x343b
(d114)
(d114) 23fef0: 08 ff 23 00 00 00 00 00 2b e0 00 00 00 00 00 00
(d114) 23ff00: 08 00 00 00 30 00 00 00 d8 ff 23 00 00 00 00 00
(d114) 23ff10: 18 ff 23 00 00 00 00 00 c2 c2 c2 c2 c2 c2 c2 c2
(d114) 23ff20: ef be ad de 00 00 00 00 ef be ad de 00 00 00 00
(d114)
(d114) 23ffb0: c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2
(d114) 23ffc0: c2 c2 c2 c2 c2 c2 c2 c2 e8 ff 23 00 00 00 00 00
(d114) 23ffd0: 95 6b 00 00 00 00 00 00 cd cc cc cc cc cc 08 40
(d114) 23ffe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(d114)
(d114) 6af0: ff ff ff 48 89 8d 68 ff ff ff 4c 89 85 70 ff ff
(d114) 6b00: ff 4c 89 8d 78 ff ff ff 84 c0 74 20 0f 29 45 80
(d114) 6b10: 0f 29 4d 90 0f 29 55 a0 0f 29 5d b0 0f 29 65 c0
(d114) 6b20: 0f 29 6d d0 0f 29 75 e0 0f 29 7d f0 48 89 bd 48

Any ideas?

The test case is on the "crash" branch here if you want to try it:

  https://github.com/talex5/xen/commits/crash


-- 
Dr Thomas Leonard        http://0install.net/
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.