=== modified file 'ChangeLog' --- ChangeLog 2011-01-05 11:23:06 +0000 +++ ChangeLog 2011-01-06 01:29:08 +0000 @@ -1,3 +1,13 @@ +2011-01-05 Elliott Mitchell
+ + * include/grub/i386/tsc.h: Create shared macros for handling all the + tiny little blobs of assembly where we'd like to be able to clobber + %ebx. Replace the many uses of #ifdef(APPLE_CC)/#ifdef(__x64_64__) + with usage of these macros. Testing found %rbx *can* be clobbered in + amd64/64-bit mode. + * grub-core/loader/i386/xnu.c: Propogate usage of the macros created + above to this file. Removes sections of copy&paste code. + 2011-01-05 Vladimir Serbinenko Run terminfo_cls on initing terminfo output to clear the screen and === modified file 'grub-core/loader/i386/xnu.c' --- grub-core/loader/i386/xnu.c 2010-09-05 11:05:36 +0000 +++ grub-core/loader/i386/xnu.c 2011-01-06 01:22:33 +0000 @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2009 Free Software Foundation, Inc. + * Copyright (C) 2009,2011 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,62 +130,27 @@ if (! grub_cpu_is_cpuid_supported ()) return sane_value; -#ifdef APPLE_CC asm volatile ("movl $0, %%eax\n" -#ifdef __x86_64__ - "push %%rbx\n" -#else - "push %%ebx\n" -#endif + ASM_SAVE_REG_B "cpuid\n" -#ifdef __x86_64__ - "pop %%rbx\n" -#else - "pop %%ebx\n" -#endif - : "=a" (max_cpuid), - "=d" (manufacturer[1]), "=c" (manufacturer[2])); - - /* Only Intel for now is done. */ - if (grub_memcmp (manufacturer + 1, "ineIntel", 12) != 0) - return sane_value; - -#else - asm volatile ("movl $0, %%eax\n" - "cpuid" - : "=a" (max_cpuid), "=b" (manufacturer[0]), + ASM_REST_REG_B_XCHG + : "=a" (max_cpuid), ASM_REG_B_OUT (manufacturer[0]), "=d" (manufacturer[1]), "=c" (manufacturer[2])); /* Only Intel for now is done. */ if (grub_memcmp (manufacturer, "GenuineIntel", 12) != 0) return sane_value; -#endif /* Check Speedstep. */ if (max_cpuid < 1) return sane_value; -#ifdef APPLE_CC asm volatile ("movl $1, %%eax\n" -#ifdef __x86_64__ - "push %%rbx\n" -#else - "push %%ebx\n" -#endif + ASM_SAVE_REG_B "cpuid\n" -#ifdef __x86_64__ - "pop %%rbx\n" -#else - "pop %%ebx\n" -#endif - : "=c" (capabilities): - : "%rax", "%rdx"); -#else - asm volatile ("movl $1, %%eax\n" - "cpuid" - : "=c" (capabilities): - : "%rax", "%rbx", "%rdx"); -#endif + ASM_REST_REG_B + : "=c" (capabilities): + : "%rax", ASM_CLOB_REG_B, "%rdx"); if (! (capabilities & (1 << 7))) return sane_value; === modified file 'include/grub/i386/tsc.h' --- include/grub/i386/tsc.h 2010-01-03 22:05:07 +0000 +++ include/grub/i386/tsc.h 2011-01-06 01:27:48 +0000 @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2008,2009,2011 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,24 @@ #include