From 7b9ea3efdec9f86a1042893e8107d0b23aad8727 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 25 Dec 2022 18:43:58 +0100 Subject: [PATCH] Kernel+Userland: Remove uses of the __i386__ compiler macro --- Kernel/Arch/mcontext.h | 2 +- Kernel/Arch/x86_64/mcontext.h | 13 ------------- Userland/Libraries/LibC/elf.h | 6 +----- Userland/Libraries/LibC/inttypes.h | 9 ++------- Userland/Libraries/LibC/setjmp.h | 13 ++----------- 5 files changed, 6 insertions(+), 37 deletions(-) diff --git a/Kernel/Arch/mcontext.h b/Kernel/Arch/mcontext.h index 1da7496634..034ebd93af 100644 --- a/Kernel/Arch/mcontext.h +++ b/Kernel/Arch/mcontext.h @@ -6,7 +6,7 @@ #pragma once -#if defined(__i386__) || defined(__x86_64__) +#if defined(__x86_64__) # include #elif defined(__aarch64__) # include diff --git a/Kernel/Arch/x86_64/mcontext.h b/Kernel/Arch/x86_64/mcontext.h index b2755dd431..798367593f 100644 --- a/Kernel/Arch/x86_64/mcontext.h +++ b/Kernel/Arch/x86_64/mcontext.h @@ -13,18 +13,6 @@ extern "C" { #endif struct __attribute__((packed)) __mcontext { -#ifdef __i386__ - uint32_t eax; - uint32_t ecx; - uint32_t edx; - uint32_t ebx; - uint32_t esp; - uint32_t ebp; - uint32_t esi; - uint32_t edi; - uint32_t eip; - uint32_t eflags; -#else uint64_t rax; uint64_t rcx; uint64_t rdx; @@ -43,7 +31,6 @@ struct __attribute__((packed)) __mcontext { uint64_t r14; uint64_t r15; uint64_t rflags; -#endif uint32_t cs; uint32_t ss; uint32_t ds; diff --git a/Userland/Libraries/LibC/elf.h b/Userland/Libraries/LibC/elf.h index 9d968e59bf..76baf1525e 100644 --- a/Userland/Libraries/LibC/elf.h +++ b/Userland/Libraries/LibC/elf.h @@ -39,11 +39,7 @@ # include #endif -#ifdef __i386__ -# define ElfW(type) Elf32_##type -#else -# define ElfW(type) Elf64_##type -#endif +#define ElfW(type) Elf64_##type typedef uint8_t Elf_Byte; diff --git a/Userland/Libraries/LibC/inttypes.h b/Userland/Libraries/LibC/inttypes.h index 21d114add9..aad48a1022 100644 --- a/Userland/Libraries/LibC/inttypes.h +++ b/Userland/Libraries/LibC/inttypes.h @@ -12,13 +12,8 @@ __BEGIN_DECLS -#ifdef __i386__ -# define __PRI64_PREFIX "ll" -# define __PRIPTR_PREFIX -#else -# define __PRI64_PREFIX "l" -# define __PRIPTR_PREFIX "l" -#endif +#define __PRI64_PREFIX "l" +#define __PRIPTR_PREFIX "l" #define PRId8 "d" #define PRId16 "d" diff --git a/Userland/Libraries/LibC/setjmp.h b/Userland/Libraries/LibC/setjmp.h index 3b4c7d9a75..d4b7c75db1 100644 --- a/Userland/Libraries/LibC/setjmp.h +++ b/Userland/Libraries/LibC/setjmp.h @@ -19,14 +19,7 @@ __BEGIN_DECLS // struct __jmp_buf { -#ifdef __i386__ - uint32_t ebx; - uint32_t esi; - uint32_t edi; - uint32_t ebp; - uint32_t esp; - uint32_t eip; -#elif defined(__x86_64__) +#if defined(__x86_64__) uint64_t rbx; uint64_t r12; uint64_t r13; @@ -52,9 +45,7 @@ typedef struct __jmp_buf sigjmp_buf[1]; * Since setjmp.h may be included by ports written in C, we need to guard this. */ #ifdef __cplusplus -# ifdef __i386__ -static_assert(sizeof(struct __jmp_buf) == 32, "struct __jmp_buf unsynchronized with i386/setjmp.S"); -# elif defined(__x86_64__) +# if defined(__x86_64__) static_assert(sizeof(struct __jmp_buf) == 72, "struct __jmp_buf unsynchronized with x86_64/setjmp.S"); # elif defined(__aarch64__) static_assert(sizeof(struct __jmp_buf) == 184, "struct __jmp_buf unsynchronized with aarch64/setjmp.S");