aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_cpuinfo.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-02-22 19:41:39 +0000
committerIgor Sysoev <igor@sysoev.ru>2006-02-22 19:41:39 +0000
commitcce886c71df5b1de9d9bf57fc26f9d830cb517eb (patch)
treed25f11e23de1ec0fb0ab74dbf2dc08b29da8c110 /src/core/ngx_cpuinfo.c
parent2a74c506c726b1ba06a329f6293540e9ea213326 (diff)
downloadnginx-release-0.3.30.tar.gz
nginx-release-0.3.30.zip
nginx-0.3.30-RELEASE importrelease-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; the bug had appeared in 0.3.27.
Diffstat (limited to 'src/core/ngx_cpuinfo.c')
-rw-r--r--src/core/ngx_cpuinfo.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/core/ngx_cpuinfo.c b/src/core/ngx_cpuinfo.c
index a939635f8..f905cbc13 100644
--- 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