1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
--- src/core/ngx_cpuinfo.c Wed Feb 8 14:39:29 2006
+++ src/core/ngx_cpuinfo.c Wed Feb 22 12:59:56 2006
@@ -14,6 +14,38 @@
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 parameter if gcc building with -fPIC
+ * and we could not push %ebx on stack
+ */
+
+ __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 +64,8 @@
}
+#endif
+
/* auto detect the L2 cache line size of modern and widespread CPUs */
void
@@ -53,6 +87,8 @@
if (vbuf[0] == 0) {
return;
}
+
+ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0, "CPU: \"%s\"", vendor);
ngx_cpuid(1, cpu);
|