diff src/core/ngx_cpuinfo.c @ 166:fef68f68bcfd NGINX_0_3_30

nginx 0.3.30 *) Change: the ECONNABORTED error log level was changed to "error" from "crit". *) Bugfix: the ngx_http_perl_module could not be build without the ngx_http_ssi_filter_module. *) Bugfix: nginx could not be built on i386 platform, if the PIC was used; bug appeared in 0.3.27.
author Igor Sysoev <http://sysoev.ru>
date Wed, 22 Feb 2006 00:00:00 +0300
parents 73e8476f9142
children d2ae1c9f1fd3
line wrap: on
line diff
--- a/src/core/ngx_cpuinfo.c
+++ b/src/core/ngx_cpuinfo.c
@@ -14,6 +14,39 @@
 static ngx_inline void ngx_cpuid(uint32_t i, uint32_t *buf);
 
 
+#if ( __i386__ )
+
+static ngx_inline void
+ngx_cpuid(uint32_t i, uint32_t *buf)
+{
+
+    /*
+     * we could not use %ebx as output parameter if gcc builds PIC,
+     * and we could not save %ebx on stack, because %esp is used,
+     * when the -fomit-frame-pointer optimization is specified.
+     */
+
+    __asm__ (
+
+    "    mov    %%ebx, %%esi;  "
+
+    "    cpuid;                "
+    "    mov    %%eax, %0;     "
+    "    mov    %%ebx, %1;     "
+    "    mov    %%edx, %2;     "
+    "    mov    %%ecx, %3;     "
+
+    "    mov    %%esi, %%ebx;  "
+
+    : "=m" (buf[0]), "=m" (buf[1]), "=m" (buf[2]), "=m" (buf[3])
+    : "a" (i)
+    : "ecx", "edx", "esi" );
+}
+
+
+#else /* __amd64__ */
+
+
 static ngx_inline void
 ngx_cpuid(uint32_t i, uint32_t *buf)
 {
@@ -32,6 +65,9 @@ ngx_cpuid(uint32_t i, uint32_t *buf)
 }
 
 
+#endif
+
+
 /* auto detect the L2 cache line size of modern and widespread CPUs */
 
 void