diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-30 18:13:20 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-30 18:13:20 -0800 |
commit | 10ffe3dbf7f9c63d6fde3d1fe23b8fd2ae4d7bd1 (patch) | |
tree | 579d5f88d8cb9eea77925a516fdaede366f05d82 /arch/x86/boot/cpuflags.c | |
parent | f8a504c404c6c4abbed4ae34fe1027ba3c24d035 (diff) | |
parent | de3accdaec88851874c573031de007283e90b199 (diff) | |
download | lwn-10ffe3dbf7f9c63d6fde3d1fe23b8fd2ae4d7bd1.tar.gz lwn-10ffe3dbf7f9c63d6fde3d1fe23b8fd2ae4d7bd1.zip |
Merge branch 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 build bits from Peter Anvin:
"Various build-related minor bits.
Most of this is work by David Woodhouse to be able to compile the
early boot code with clang/llvm; we have also managed to push an
actual -m16 option into gcc 4.9 so this makes us use that option if
available instead of hacking it.
The balance is a patch from Michael Davidson to the relocs program to
help manual debugging.
None of these should change the actual compiled binary with currently
released compilers"
* 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86, build: Build 16-bit code with -m16 where possible
x86, boot: Fix word-size assumptions in has_eflag() inline asm
x86, boot: Use __attribute__((used)) to ensure videocard structs are emitted
x86: Remove duplication of 16-bit CFLAGS
x86, relocs: Add manual debug mode
Diffstat (limited to 'arch/x86/boot/cpuflags.c')
-rw-r--r-- | arch/x86/boot/cpuflags.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/arch/x86/boot/cpuflags.c b/arch/x86/boot/cpuflags.c index a9fcb7cfb241..431fa5f84537 100644 --- a/arch/x86/boot/cpuflags.c +++ b/arch/x86/boot/cpuflags.c @@ -28,20 +28,35 @@ static int has_fpu(void) return fsw == 0 && (fcw & 0x103f) == 0x003f; } +/* + * For building the 16-bit code we want to explicitly specify 32-bit + * push/pop operations, rather than just saying 'pushf' or 'popf' and + * letting the compiler choose. But this is also included from the + * compressed/ directory where it may be 64-bit code, and thus needs + * to be 'pushfq' or 'popfq' in that case. + */ +#ifdef __x86_64__ +#define PUSHF "pushfq" +#define POPF "popfq" +#else +#define PUSHF "pushfl" +#define POPF "popfl" +#endif + int has_eflag(unsigned long mask) { unsigned long f0, f1; - asm volatile("pushf \n\t" - "pushf \n\t" + asm volatile(PUSHF " \n\t" + PUSHF " \n\t" "pop %0 \n\t" "mov %0,%1 \n\t" "xor %2,%1 \n\t" "push %1 \n\t" - "popf \n\t" - "pushf \n\t" + POPF " \n\t" + PUSHF " \n\t" "pop %1 \n\t" - "popf" + POPF : "=&r" (f0), "=&r" (f1) : "ri" (mask)); |