diff options
Diffstat (limited to 'libphobos/libdruntime')
-rw-r--r-- | libphobos/libdruntime/MERGE | 2 | ||||
-rw-r--r-- | libphobos/libdruntime/config/x86/switchcontext.S | 8 | ||||
-rw-r--r-- | libphobos/libdruntime/core/cpuid.d | 18 | ||||
-rw-r--r-- | libphobos/libdruntime/rt/util/utf.d | 4 |
4 files changed, 27 insertions, 5 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE index c61ad7c..bcde105 100644 --- a/libphobos/libdruntime/MERGE +++ b/libphobos/libdruntime/MERGE @@ -1,4 +1,4 @@ -7bdd83d7b4bd9fd4cb9ffca0d50babc90b31bfd6 +d05ebaad15fbffce6d707c138c84d7b60fcf5ffd The first line of this file holds the git revision number of the last merge done from the dlang/druntime repository. diff --git a/libphobos/libdruntime/config/x86/switchcontext.S b/libphobos/libdruntime/config/x86/switchcontext.S index f5d1a87..35063af 100644 --- a/libphobos/libdruntime/config/x86/switchcontext.S +++ b/libphobos/libdruntime/config/x86/switchcontext.S @@ -24,6 +24,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "../common/threadasm.S" +#ifdef __CET__ +# include <cet.h> +#else +# define _CET_ENDBR +#endif + #if defined(__i386__) .text @@ -32,6 +38,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see .align 16 CSYM(fiber_switchContext): .cfi_startproc + _CET_ENDBR // save current stack state push %ebp mov %esp, %ebp @@ -66,6 +73,7 @@ CSYM(fiber_switchContext): .align 16 CSYM(fiber_switchContext): .cfi_startproc + _CET_ENDBR // Save current stack state.save current stack state push %rbp mov %rsp, %rbp diff --git a/libphobos/libdruntime/core/cpuid.d b/libphobos/libdruntime/core/cpuid.d index 839605a..2ba13b5 100644 --- a/libphobos/libdruntime/core/cpuid.d +++ b/libphobos/libdruntime/core/cpuid.d @@ -941,13 +941,27 @@ void cpuidX86() datacache[0].lineSize = 32; } } - if (max_cpuid >= 0x0B) { + if (cf.probablyIntel && max_cpuid >= 0x0B) { // For Intel i7 and later, use function 0x0B to determine // cores and hyperthreads. getCpuInfo0B(); } else { if (hyperThreadingBit) cf.maxThreads = (apic>>>16) & 0xFF; else cf.maxThreads = cf.maxCores; + + if (cf.probablyAMD && max_extended_cpuid >= 0x8000_001E) { + version (GNU) asm pure nothrow @nogc { + "cpuid" : "=a" (a), "=b" (b) : "a" (0x8000_001E) : "ecx", "edx"; + } else { + asm pure nothrow @nogc { + mov EAX, 0x8000_001e; + cpuid; + mov b, EBX; + } + } + ubyte coresPerComputeUnit = ((b >> 8) & 3) + 1; + cf.maxCores = cf.maxThreads / coresPerComputeUnit; + } } } @@ -975,7 +989,7 @@ bool hasCPUID() xor {(%%esp), %%eax|eax, [esp]} # eax = whichever bits were changed popf{l|d} # Restore original EFLAGS - " : "=a" flags; + " : "=a" (flags); } } else version (D_InlineAsm_X86) diff --git a/libphobos/libdruntime/rt/util/utf.d b/libphobos/libdruntime/rt/util/utf.d index 0775840..55869b3 100644 --- a/libphobos/libdruntime/rt/util/utf.d +++ b/libphobos/libdruntime/rt/util/utf.d @@ -651,9 +651,9 @@ string toUTF8(in wchar[] s) else { r.length = i; - foreach (dchar c; s[i .. slen]) + foreach (dchar ch; s[i .. slen]) { - encode(r, c); + encode(r, ch); } break; } |