X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=util%2Fmsrtool%2Fsys.c;h=f6aded52bc4a4f66b830a9b17df34bdacf3d6d06;hb=2d7ab4c559ae1da8ebf1107b179e3a136b869beb;hp=cc2cc4e7c034ecf66e1699687f044176419f7a6b;hpb=0924dee124acfd1f8ae96685720c7a4af068e843;p=coreboot.git diff --git a/util/msrtool/sys.c b/util/msrtool/sys.c index cc2cc4e7c..f6aded52b 100644 --- a/util/msrtool/sys.c +++ b/util/msrtool/sys.c @@ -2,6 +2,7 @@ * This file is part of msrtool. * * Copyright (c) 2008 Peter Stuge + * Copyright (c) 2009 coresystems GmbH * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -25,7 +26,18 @@ static struct cpuid_t id; struct cpuid_t *cpuid(void) { uint32_t outeax; + +#if defined(__DARWIN__) && !defined(__LP64__) + asm volatile ( + "pushl %%ebx \n" + "cpuid \n" + "popl %%ebx \n" + : "=a" (outeax) : "a" (1) : "%ecx", "%edx" + ); +#else asm ("cpuid" : "=a" (outeax) : "a" (1) : "%ebx", "%ecx", "%edx"); +#endif + id.stepping = outeax & 0xf; outeax >>= 4; id.model = outeax & 0xf; @@ -40,6 +52,9 @@ struct cpuid_t *cpuid(void) { id.model |= (id.ext_model << 4); id.family += id.ext_family; } + printf_verbose("CPU: family %x, model %x, stepping %x\n", + id.family, id.model, id.stepping); + return &id; }