Add the 64-bit and 32-bit CC flag

Added a new CC flag into build32 and build64 Makefiles to distinguish
whether compiling to 32-bit or 64-bit code.

[Lionel Debroux: rebased on the memrw functions refactor.]

Signed-off-by: Chao Li <lichao@loongson.cn>
This commit is contained in:
Chao Li
2024-07-22 22:50:15 +02:00
committed by Lionel Debroux
parent 8d966d98f4
commit e99ce97648
12 changed files with 22 additions and 21 deletions
+2 -2
View File
@@ -13,7 +13,7 @@
#include <stdint.h>
#ifdef __x86_64__
#if (ARCH_BITS == 64)
#define NATIVE_MSB UINT64_C(0x8000000000000000)
#else
#define NATIVE_MSB 0x80000000
@@ -71,7 +71,7 @@
#define efiapi __attribute__((ms_abi))
#ifdef __x86_64__
#if (ARCH_BITS == 64)
typedef uint64_t uintn_t;
#else
typedef uint32_t uintn_t;
+5 -5
View File
@@ -146,7 +146,7 @@ static void test_frame_buffer(screen_info_t *si)
pixel_value.word = (r_value << si->red_pos) | (g_value << si->green_pos) | (b_value << si->blue_pos);
uintptr_t lfb_base = si->lfb_base;
#ifdef __x86_64__
#if (ARCH_BITS == 64)
if (LFB_CAPABILITY_64BIT_BASE & si->capabilities) {
lfb_base |= (uintptr_t)si->ext_lfb_base << 32;
}
@@ -489,7 +489,7 @@ static efi_status_t set_screen_info_from_gop(screen_info_t *si, efi_handle_t *ha
si->lfb_width = best_info.h_resolution;
si->lfb_height = best_info.v_resolution;
si->lfb_base = lfb_base;
#ifdef __x86_64__
#if (ARCH_BITS == 64)
if (lfb_base >> 32) {
si->capabilities |= LFB_CAPABILITY_64BIT_BASE;
si->ext_lfb_base = lfb_base >> 32;
@@ -669,7 +669,7 @@ static efi_status_t set_efi_info_and_exit_boot_services(efi_handle_t handle, boo
goto fail;
}
#ifdef __x86_64
#if (ARCH_BITS == 64)
boot_params->efi_info.loader_signature = EFI64_LOADER_SIGNATURE;
#else
boot_params->efi_info.loader_signature = EFI32_LOADER_SIGNATURE;
@@ -679,7 +679,7 @@ static efi_status_t set_efi_info_and_exit_boot_services(efi_handle_t handle, boo
boot_params->efi_info.mem_desc_version = mem_desc_version;
boot_params->efi_info.mem_map = (uintptr_t)mem_map;
boot_params->efi_info.mem_map_size = mem_map_size;
#ifdef __x86_64__
#if (ARCH_BITS == 64)
boot_params->efi_info.sys_tab_hi = (uintptr_t)sys_table >> 32;
boot_params->efi_info.mem_map_hi = (uintptr_t)mem_map >> 32;
#endif
@@ -691,7 +691,7 @@ fail:
static void set_e820_map(boot_params_t *params)
{
uintptr_t mem_map_addr = params->efi_info.mem_map;
#ifdef __x86_64__
#if (ARCH_BITS == 64)
mem_map_addr |= (uintptr_t)params->efi_info.mem_map_hi << 32;
#endif
size_t mem_map_size = params->efi_info.mem_map_size;