4680N/A * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * A utility method for asking the CPU about itself. 0N/A * There's a corresponding version of linux-i586 0N/A * because the compilers are different. 0N/A /* rbx is a callee-saved register */ 0N/A " movq %rbx, %r11 \n" 0N/A /* rdx and rcx are 3rd and 4th argument registers */ 0N/A " movq %rdx, %r10 \n" 0N/A " movq %rcx, %r9 \n" 0N/A " movl %edi, %eax \n" 0N/A " movl %eax, (%rsi)\n" 0N/A " movl %ebx, (%r10)\n" 0N/A " movl %ecx, (%r9) \n" 0N/A " movl %edx, (%r8) \n" 0N/A " movq %r11, %rbx");
0N/A /* EBX is a callee-saved register */ 0N/A /* Need ESI for storing through arguments */ 0N/A asm(
" movl 8(%ebp), %eax \n" 0N/A " movl 12(%ebp), %esi \n" 0N/A " movl %eax, (%esi) \n" 0N/A " movl 16(%ebp), %esi \n" 0N/A " movl %ebx, (%esi) \n" 0N/A " movl 20(%ebp), %esi \n" 0N/A " movl %ecx, (%esi) \n" 0N/A " movl 24(%ebp), %esi \n" 0N/A " movl %edx, (%esi) ");
0N/A /* Restore ESI and EBX */ 0N/A /* How big is a server class machine? */ 0N/A * We seem not to get our full complement of memory. 0N/A * We allow some part (1/8?) of the memory to be "missing", 0N/A * based on the sizes of DIMMs, and maybe graphics cards. 0N/A /* Is this a server class machine? */ 0N/A#
endif /* __solaris__ */ 0N/A * A utility method for asking the CPU about itself. 0N/A * There's a corresponding version of solaris-i586 0N/A * because the compilers are different. 0N/A " movl %4, %%eax \n" 0N/A " movl %%eax, (%0)\n" 0N/A " movl %%ebx, (%1)\n" 0N/A " movl %%ecx, (%2)\n" 0N/A " movl %%edx, (%3)\n" 0N/A "%rax",
"%rbx",
"%rcx",
"%rdx",
"memory" 0N/A /* ebx is callee-save, so push it */ 0N/A " movl %4, %%eax \n" 0N/A " movl %%eax, %0 \n" 0N/A " movl %%ebx, %1 \n" 0N/A " movl %%ecx, %2 \n" 0N/A " movl %%edx, %3 \n" 0N/A "%eax",
"%ecx",
"%edx" 0N/A/* The definition of a server-class machine for linux-i586 */ 0N/A /* How big is a server class machine? */ 0N/A * We seem not to get our full complement of memory. 0N/A * We allow some part (1/8?) of the memory to be "missing", 0N/A * based on the sizes of DIMMs, and maybe graphics cards. 0N/A /* Is this a server class machine? */ 0N/A#
endif /* __linux__ */ 0N/A * Routines shared by solaris-i586 and linux-i586. 0N/A/* Determine if hyperthreading is supported */ 0N/A /* Bits 11 through 8 is family processor id */ 0N/A /* Bits 23 through 20 is extended family processor id */ 0N/A /* Pentium 4 family processor id */ 0N/A /* Bit 28 indicates Hyper-Threading Technology support */ 0N/A /* Yes, this is supposed to be [0], [2], [1] */ 0N/A/* Determine how many logical processors there are per CPU */ 0N/A * After CPUID with EAX==1, register EBX bits 23 through 16 0N/A * indicate the number of logical processors per package 0N/A/* Compute the number of physical processors, not logical processors */