diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2020-08-27 20:50:18 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-07-06 06:09:13 +0000 |
commit | adcf7827bd00757cd52e87693c8bbfbe08ed6b13 (patch) | |
tree | 30d823ebe33966e2367e3f4c7aab9a4dae05fffe /src/arch | |
parent | e85e7af6d02cb7d5acc51a10d0a1abbd7980ce12 (diff) |
arch/x86: Use ENV_X86_64 instead of _x86_64_
Tested on Intel Sandybridge x86_64 and x86_32.
Change-Id: I152483d24af0512c0ee4fbbe8931b7312e487ac6
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/44867
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/x86/assembly_entry.S | 4 | ||||
-rw-r--r-- | src/arch/x86/boot.c | 4 | ||||
-rw-r--r-- | src/arch/x86/c_exit.S | 2 | ||||
-rw-r--r-- | src/arch/x86/c_start.S | 18 | ||||
-rw-r--r-- | src/arch/x86/cpu.c | 4 | ||||
-rw-r--r-- | src/arch/x86/cpu_common.c | 2 | ||||
-rw-r--r-- | src/arch/x86/exception.c | 2 | ||||
-rw-r--r-- | src/arch/x86/exit_car.S | 12 | ||||
-rw-r--r-- | src/arch/x86/gdt_init.S | 2 | ||||
-rw-r--r-- | src/arch/x86/idt.S | 4 | ||||
-rw-r--r-- | src/arch/x86/include/arch/cpu.h | 2 | ||||
-rw-r--r-- | src/arch/x86/include/arch/registers.h | 2 | ||||
-rw-r--r-- | src/arch/x86/memcpy.c | 2 | ||||
-rw-r--r-- | src/arch/x86/wakeup.S | 4 |
14 files changed, 32 insertions, 32 deletions
diff --git a/src/arch/x86/assembly_entry.S b/src/arch/x86/assembly_entry.S index 31670c29b6..6e730273f8 100644 --- a/src/arch/x86/assembly_entry.S +++ b/src/arch/x86/assembly_entry.S @@ -15,7 +15,7 @@ #define _STACK_TOP _ecar_stack #endif -#ifdef __x86_64__ +#if ENV_X86_64 .code64 #else .code32 @@ -26,7 +26,7 @@ _start: /* Migrate GDT to this text segment */ -#ifdef __x86_64__ +#if ENV_X86_64 call gdt_init64 #else call gdt_init diff --git a/src/arch/x86/boot.c b/src/arch/x86/boot.c index 777a0b7d90..31e7cee4dc 100644 --- a/src/arch/x86/boot.c +++ b/src/arch/x86/boot.c @@ -21,14 +21,14 @@ int payload_arch_usable_ram_quirk(uint64_t start, uint64_t size) void arch_prog_run(struct prog *prog) { -#if ENV_RAMSTAGE && defined(__x86_64__) +#if ENV_RAMSTAGE && ENV_X86_64 const uint32_t arg = pointer_to_uint32_safe(prog_entry_arg(prog)); const uint32_t entry = pointer_to_uint32_safe(prog_entry(prog)); /* On x86 coreboot payloads expect to be called in protected mode */ protected_mode_jump(entry, arg); #else -#ifdef __x86_64__ +#if ENV_X86_64 void (*doit)(void *arg); #else /* Ensure the argument is pushed on the stack. */ diff --git a/src/arch/x86/c_exit.S b/src/arch/x86/c_exit.S index e5b9bf8d74..bb1df28adf 100644 --- a/src/arch/x86/c_exit.S +++ b/src/arch/x86/c_exit.S @@ -5,7 +5,7 @@ #include <cpu/x86/cr.h> -#ifdef __x86_64__ +#if ENV_X86_64 /* * Functions to handle mode switches from long mode to protected diff --git a/src/arch/x86/c_start.S b/src/arch/x86/c_start.S index b7ffddc385..3ef03b3346 100644 --- a/src/arch/x86/c_start.S +++ b/src/arch/x86/c_start.S @@ -24,7 +24,7 @@ thread_stacks: #endif .section ".text._start", "ax", @progbits -#ifdef __x86_64__ +#if ENV_X86_64 .code64 #else .code32 @@ -32,7 +32,7 @@ thread_stacks: .globl _start _start: cli -#ifdef __x86_64__ +#if ENV_X86_64 movabs $gdtaddr, %rax lgdt (%rax) #else @@ -45,7 +45,7 @@ _start: movl %eax, %ss movl %eax, %fs movl %eax, %gs -#ifdef __x86_64__ +#if ENV_X86_64 mov $RAM_CODE_SEG64, %ecx call SetCodeSelector #endif @@ -54,7 +54,7 @@ _start: cld -#ifdef __x86_64__ +#if ENV_X86_64 mov %rdi, %rax movabs %rax, _cbmem_top_ptr movabs $_stack, %rdi @@ -117,7 +117,7 @@ _start: .globl gdb_stub_breakpoint gdb_stub_breakpoint: -#ifdef __x86_64__ +#if ENV_X86_64 pop %rax /* Return address */ pushfl push %cs @@ -139,7 +139,7 @@ gdb_stub_breakpoint: gdtaddr: .word gdt_end - gdt - 1 -#ifdef __x86_64__ +#if ENV_X86_64 .quad gdt #else .long gdt /* we know the offset */ @@ -176,7 +176,7 @@ gdt: /* selgdt 0x18, flat data segment */ .word 0xffff, 0x0000 -#ifdef __x86_64__ +#if ENV_X86_64 .byte 0x00, 0x92, 0xcf, 0x00 #else .byte 0x00, 0x93, 0xcf, 0x00 @@ -210,7 +210,7 @@ gdt: * limit */ -#ifdef __x86_64__ +#if ENV_X86_64 /* selgdt 0x48, flat x64 code segment */ .word 0xffff, 0x0000 .byte 0x00, 0x9b, 0xaf, 0x00 @@ -218,7 +218,7 @@ gdt: gdt_end: .section ".text._start", "ax", @progbits -#ifdef __x86_64__ +#if ENV_X86_64 SetCodeSelector: # save rsp because iret will align it to a 16 byte boundary mov %rsp, %rdx diff --git a/src/arch/x86/cpu.c b/src/arch/x86/cpu.c index c929e5ea69..f4cb83a4dd 100644 --- a/src/arch/x86/cpu.c +++ b/src/arch/x86/cpu.c @@ -13,7 +13,7 @@ #include <device/device.h> #include <smp/spinlock.h> -#ifndef __x86_64__ +#if ENV_X86_32 /* Standard macro to see if a specific flag is changeable */ static inline int flag_is_changeable_p(uint32_t flag) { @@ -136,7 +136,7 @@ static void identify_cpu(struct device *cpu) vendor_name[0] = '\0'; /* Unset */ -#ifndef __x86_64__ +#if ENV_X86_32 /* Find the id and vendor_name */ if (!cpu_have_cpuid()) { /* Its a 486 if we can modify the AC flag */ diff --git a/src/arch/x86/cpu_common.c b/src/arch/x86/cpu_common.c index 07de1553b8..77d08c4196 100644 --- a/src/arch/x86/cpu_common.c +++ b/src/arch/x86/cpu_common.c @@ -2,7 +2,7 @@ #include <cpu/cpu.h> -#ifndef __x86_64__ +#if ENV_X86_32 /* Standard macro to see if a specific flag is changeable */ static inline int flag_is_changeable_p(uint32_t flag) { diff --git a/src/arch/x86/exception.c b/src/arch/x86/exception.c index aa94d3fe73..624226e36e 100644 --- a/src/arch/x86/exception.c +++ b/src/arch/x86/exception.c @@ -492,7 +492,7 @@ void x86_exception(struct eregs *info) logical_processor = cpu_index(); #endif u8 *code; -#ifdef __x86_64__ +#if ENV_X86_64 #define MDUMP_SIZE 0x100 printk(BIOS_EMERG, "CPU Index %d - APIC %d Unexpected Exception:\n" diff --git a/src/arch/x86/exit_car.S b/src/arch/x86/exit_car.S index d1b1a537fe..527a3cb13a 100644 --- a/src/arch/x86/exit_car.S +++ b/src/arch/x86/exit_car.S @@ -11,7 +11,7 @@ post_car_stack_top: .long 0 .long 0 -#if defined(__x86_64__) +#if ENV_X86_64 .code64 .macro pop_eax_edx pop %rax @@ -42,13 +42,13 @@ _start: is expected to be implemented in assembly. */ /* Migrate GDT to this text segment */ -#if defined(__x86_64__) +#if ENV_X86_64 call gdt_init64 #else call gdt_init #endif -#ifdef __x86_64__ +#if ENV_X86_64 mov %rdi, %rax movabs %rax, _cbmem_top_ptr #else @@ -61,7 +61,7 @@ _start: cpuid btl $CPUID_FEATURE_CLFLUSH_BIT, %edx jnc skip_clflush -#ifdef __x86_64__ +#if ENV_X86_64 movabs _cbmem_top_ptr, %rax clflush (%rax) #else @@ -73,7 +73,7 @@ skip_clflush: call chipset_teardown_car /* Enable caching if not already enabled. */ -#ifdef __x86_64__ +#if ENV_X86_64 mov %cr0, %rax and $(~(CR0_CD | CR0_NW)), %eax mov %rax, %cr0 @@ -115,7 +115,7 @@ skip_clflush: /* Need to align stack to 16 bytes at the call instruction. Therefore account for the 1 push. */ andl $0xfffffff0, %esp -#if defined(__x86_64__) +#if ENV_X86_64 mov %rbp, %rdi #else sub $12, %esp diff --git a/src/arch/x86/gdt_init.S b/src/arch/x86/gdt_init.S index 30b39653c9..825c23ccbd 100644 --- a/src/arch/x86/gdt_init.S +++ b/src/arch/x86/gdt_init.S @@ -18,7 +18,7 @@ gdtptr: .word gdt_end - gdt -1 /* compute the table limit */ .long gdt /* we know the offset */ -#ifdef __x86_64__ +#if ENV_X86_64 .code64 .section .init._gdt64_, "ax", @progbits .globl gdt_init64 diff --git a/src/arch/x86/idt.S b/src/arch/x86/idt.S index 6807056fe3..d763b9e3fe 100644 --- a/src/arch/x86/idt.S +++ b/src/arch/x86/idt.S @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ .section ".text._idt", "ax", @progbits -#ifdef __x86_64__ +#if ENV_X86_64 .code64 #else .code32 @@ -109,7 +109,7 @@ vec19: .global int_hand int_hand: -#ifdef __x86_64__ +#if ENV_X86_64 /* At this point, on x86-64, on the stack there is: * 0(%rsp) vector * 8(%rsp) error code diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index 889628da27..3fd4c1b2ea 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -235,7 +235,7 @@ static inline struct cpu_info *cpu_info(void) { struct cpu_info *ci; __asm__( -#ifdef __x86_64__ +#if ENV_X86_64 "and %%rsp,%0; " "or %2, %0 " #else diff --git a/src/arch/x86/include/arch/registers.h b/src/arch/x86/include/arch/registers.h index 5f8f9becd3..7043cd1941 100644 --- a/src/arch/x86/include/arch/registers.h +++ b/src/arch/x86/include/arch/registers.h @@ -42,7 +42,7 @@ uint64_t r##A; \ } __packed -#ifdef __ARCH_x86_64__ +#if ENV_X86_64 struct eregs { QUAD_DOWNTO8(a); QUAD_DOWNTO8(c); diff --git a/src/arch/x86/memcpy.c b/src/arch/x86/memcpy.c index 1cfdf89175..93002cdd27 100644 --- a/src/arch/x86/memcpy.c +++ b/src/arch/x86/memcpy.c @@ -15,7 +15,7 @@ void *memcpy(void *dest, const void *src, size_t n) #endif asm volatile( -#ifdef __x86_64__ +#if ENV_X86_64 "rep ; movsd\n\t" "mov %4,%%rcx\n\t" #else diff --git a/src/arch/x86/wakeup.S b/src/arch/x86/wakeup.S index ae2efe00ed..dc9510bb90 100644 --- a/src/arch/x86/wakeup.S +++ b/src/arch/x86/wakeup.S @@ -6,7 +6,7 @@ /* CR0 bits */ #define PE (1 << 0) -#ifdef __x86_64__ +#if ENV_X86_64 .code64 #else .code32 @@ -14,7 +14,7 @@ .globl __wakeup __wakeup: -#ifdef __x86_64__ +#if ENV_X86_64 xor %rax,%rax mov %ss, %ax push %rax |