Skip to content
Tcl Source Code History Of Ticket 3601804
Login

History Of Ticket 3601804

Artifacts Associated With Ticket 3601804

  1. Ticket change [ec47f02424] (rid 103685) by pooryorick on 2013-01-22 19:49:45:

    1. assignee initialized to: "dgp"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      platform-3.1 results in segmentation fault.  the CPUID instruction is documented to clobber eax, ebx, ecx, and edx.  The code clobbers edi, so chaning the list of clobbers in the assembly code in TclWinCPUID may be a good fix for the problem.  It cured the segmentation fault in my case:
      
      "edi","ebx","ecx","edx"
      
      "eax" does not need to be listed, since the code expects it to be clobbered.
      
    4. foundin initialized to: "current: 8.6.0"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "pooryorick"
    10. subsystem initialized to: "34. tcltest Package"
    11. title initialized to: "platformCPUID segmentation fault on Darwin"
    12. type initialized to: "Bug"
  2. Ticket change [8ddcd07a7a] (rid 128012) by dgp on 2013-01-23 02:54:24:

    1. assignee changed to: "kennykb"
    2. icomment:
      
      Passing to test originator.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. subsystem changed to: "38. Init - Library - Autoload"
    6. username: "dgp"
  3. Ticket change [ee944cc2f5] (rid 104100) by nijtmans on 2013-01-23 05:00:30:

    1. assignee changed to: "nijtmans"
    2. closedate changed to: "2013-01-22T22:00:30"
    3. closer changed to: "nijtmans"
    4. icomment:
      Good analysis, Thanks! However, ecx and edx are
      already output registers, so they cannot be mentioned
      twice. gcc will complain with "can’t find a register in class ‘DREG’ while reloading ‘asm’"
      
      However, "ebx" was indeed missing as clobber register.
      
      Fixed now in core-8-4-branch, core-8-5-branch and trunk.
      
      
    5. login: "nijtmans"
    6. mimetype: "text/plain"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
    9. username: "nijtmans"
  4. Ticket change [36b533e8dd] (rid 107155) by nijtmans on 2013-01-25 04:35:34:

    1. icomment:
      Had to revert the change on all branches: on i386,
      ebx is the PIC register, which cannot be used
      in assembler. The asm code already saves
      ebx before the cpuid, and restores it afterwards,
      so in reality ebx is not clobbered at all: The
      original code was correct......
      
      Poor, what platform are you using?
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. resolution changed to: "None"
    5. status changed to: "Open"
    6. username: "nijtmans"
  5. Ticket change [21013f837f] (rid 130505) by nijtmans on 2013-01-25 04:49:30:

    1. icomment:
      >Poor, what platform are you using?
      
      Just read from the title that it was Darwin..... What version?
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  6. Ticket change [2cfffad539] (rid 119009) by nijtmans on 2013-01-25 05:04:14:

    1. closedate changed to: "2013-01-24T22:04:14"
    2. closer changed to: "nijtmans"
    3. icomment:
      Found some other cpuid example code for Darwin. Committed a version now that doesn't use the edi register any more.
      
      Does that help?
      
      
    4. login: "nijtmans"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Pending"
    8. username: "nijtmans"
  7. Ticket change [52c9df3d35] (rid 126378) by pooryorick on 2013-01-26 02:39:14:

    1. icomment:
      This host is Mac OS X 10.6.8 (Darwin 10.8.0).  Still getting a segmentation fault with your latest changes.
      
      
    2. login: "pooryorick"
    3. mimetype: "text/plain"
    4. username: "pooryorick"
  8. Ticket change [b094044cbb] (rid 98004) by pooryorick on 2013-01-26 02:39:15:

    1. status changed to: "Open"
  9. Ticket change [ac83b0eb54] (rid 101309) by andreas_kupries on 2013-01-26 02:53:54:

    1. icomment:
      Where and why do we need this CPUID stuff in the Tcl core ?
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  10. Ticket change [5850f73c1a] (rid 117778) by pooryorick on 2013-01-26 20:36:05:

    1. resolution changed to: "None"
  11. Ticket change [2f84cfc317] (rid 93077) by nijtmans on 2013-01-26 22:08:45:

    1. icomment:
      The CPUID stuff came in the core for Cygwin, but
      actually it's processor-specific, not OS-specific. So it
      should simply work fine on any Intel or compatible
      processor, even on Darwin and Solaris.
      
      My big question is: Why is pooryorick the only
      one getting a segfault? This code is already in
      for more than half a year, and nobody else
      noticed a segmentation fault on Darwin
      in any of the past releases.
      
      This sounds to me like a "Works for Me", but
      I'm willing to give it some more time until
      someone comes up with a bright idea
      what's going on here. My best guess would
      be a buggy compiler.
      
      Regards,
             Jan Nijtmans
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  12. Ticket change [2a9a835981] (rid 118608) by pooryorick on 2013-01-26 23:14:15:

    1. icomment:
      I've found that using the 64-bit register names rbx and rsi with Jan's latest changes resolves  the segmentation fault problem.  I think the same would probably be true with the original code.
      
      
    2. login: "pooryorick"
    3. mimetype: "text/plain"
    4. username: "pooryorick"
  13. Ticket change [b01699beec] (rid 97923) by pooryorick on 2013-01-26 23:43:52:

    1. icomment:
      Here is an option that specifies fewer registers:
      
              __asm__ __volatile__(
                      "pushq %%rbx     \n\t" /* save %rbx */
                      "cpuid            \n\t"
                      "movl %%ebx ,%[rbx]  \n\t" /* write the result into output var */
                      "popq %%rbx \n\t"
                      : "=a"(regs[0]), [rbx] "=r"(regs[1]), "=c"(regs[2]), "=d"(regs[3])
                      : "a"(index));
      
      
      
    2. login: "pooryorick"
    3. mimetype: "text/plain"
    4. username: "pooryorick"
  14. Ticket change [7f0b3cc069] (rid 97507) by nijtmans on 2013-01-27 00:00:21:

    1. closedate changed to: "2013-01-26T17:00:21"
    2. closer changed to: "nijtmans"
    3. icomment:
      So, that's the point:  the problem only occurs on 64-bit Darwin. This
      means that we cannot have the same assembler-code in 32-bit
      and 64-bit machines.
      
      Should be fixed now on all branches.
      
      Thanks!
      
      
    4. login: "nijtmans"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Pending"
    8. username: "nijtmans"
  15. Ticket change [fd02cd5780] (rid 108336) by pooryorick on 2013-01-27 01:37:26:

    1. icomment:
      I think configure.in needs to be updated as well.
      
      
    2. login: "pooryorick"
    3. mimetype: "text/plain"
    4. status changed to: "Open"
    5. username: "pooryorick"
  16. Ticket change [03ae0f474b] (rid 119865) by msofer on 2013-01-27 01:41:03:

    1. icomment:
      Shouldn't this code be ifdef'ed out of the core for all non-cygwin builds? Why is it needed at all?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  17. Ticket change [cb95468c38] (rid 95543) by nijtmans on 2013-01-27 04:03:43:

    1. icomment:
      > Why is it needed at all?
      It could be needed by any code which wants to detect what
      kind of processor the system has. Currently, only "clock" is
      using it on Windows, but any platform could use it, provided
      the processor is Intel-compatible. See also TIP #377, which
      was rejected at that time, but it could easily be implemented
      for Intel based on cpuid.
      > I think configure.in needs to be updated as well.
      No, the problem here can only be detected at run-time,
      and "configure" doesn't run the code. So there is
      no way configure could detect this.
      >Shouldn't this code be ifdef'ed out ...
      Yes, it should be ifdefed out if the processor is not
      Intel, that's exactly what "configure" does.
      
      The problem that pouryorick found has no
      relation with cpuid, it's the code that gcc
      generates around it which is problematic.
      The compiler option -fPIC needs a special
      register, and when cpuid uses the same
      register, that's the problem that needs to
      be worked around. Without -fPIC it would
      work fine without any of those tricks.
      
      So, I' glad that this is fixed now. Case closed.
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  18. Ticket change [ff843f0779] (rid 108765) by nijtmans on 2013-04-15 17:07:16:

    1. closedate changed to: "2013-04-15T10:07:16"
    2. closer changed to: "nijtmans"
    3. icomment:
      
      
      allow_comments - 1
      
      
      
    4. login: "nijtmans"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "nijtmans"