From 033af4225d424fdd270701b559210528032d9e54 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 27 Nov 2023 16:21:39 +0000 Subject: [PATCH] [build] Include x86-specific code only for x86 builds Signed-off-by: Michael Brown --- src/callback.S | 5 +++++ src/int13.c | 4 ++++ src/paging.c | 4 ++++ src/prefix.S | 11 +++++++---- src/startup.S | 5 +++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/callback.S b/src/callback.S index ef0fe4f..c4cb798 100644 --- a/src/callback.S +++ b/src/callback.S @@ -48,6 +48,9 @@ #define CR0_PG 0x80000000 .section ".note.GNU-stack", "", @progbits + +#if defined(__i386__) || defined(__x86_64__) + .arch i386 .code32 @@ -226,3 +229,5 @@ _rmstack: .space 8192 .size _rmstack, . - _rmstack _ermstack: + +#endif /* defined(__i386__) || defined(__x86_64__) */ diff --git a/src/int13.c b/src/int13.c index 4538f9f..c204bc1 100644 --- a/src/int13.c +++ b/src/int13.c @@ -30,6 +30,8 @@ #include "int13.h" #include "vdisk.h" +#if defined(__i386__) || defined(__x86_64__) + /** Emulated drive number */ static int vdisk_drive; @@ -223,3 +225,5 @@ void emulate_int13 ( struct bootapp_callback_params *params ) { } } } + +#endif /* defined(__i386__) || defined(__x86_64__) */ diff --git a/src/paging.c b/src/paging.c index ba043af..2fa91c5 100644 --- a/src/paging.c +++ b/src/paging.c @@ -32,6 +32,8 @@ #include "memmap.h" #include "paging.h" +#if defined(__i386__) || defined(__x86_64__) + /** Virtual address used as a 2MB window during relocation */ #define COPY_WINDOW 0x200000 @@ -253,3 +255,5 @@ uint64_t relocate_memory_high ( void *data, size_t len ) { /* Leave at original location */ return ( ( intptr_t ) data ); } + +#endif /* defined(__i386__) || defined(__x86_64__) */ diff --git a/src/prefix.S b/src/prefix.S index 306109a..245bae8 100644 --- a/src/prefix.S +++ b/src/prefix.S @@ -62,14 +62,14 @@ .section ".note.GNU-stack", "", @progbits .text - .code16 - .arch i386 - .org 0 .section ".prefix", "ax", @progbits - .org 0 _prefix: +#if defined(__i386__) || defined(__x86_64__) + + .arch i386 + .org 0x1f1 setup_sects: .byte SETUP_SECTS @@ -119,6 +119,7 @@ version_string: .asciz VERSION /* Setup code */ + .code16 setup: /* Reset %cs so that labels work */ pushw %ds @@ -196,4 +197,6 @@ gdt: .size gdt, . - gdt .equ gdt_limit, . - gdt - 1 +#endif + .org SETUP_LEN diff --git a/src/startup.S b/src/startup.S index b73d2dc..d259232 100644 --- a/src/startup.S +++ b/src/startup.S @@ -32,6 +32,9 @@ #define KC_CMD_RESET 0xfe .section ".note.GNU-stack", "", @progbits + +#if defined(__i386__) || defined(__x86_64__) + .arch i386 .code32 @@ -127,3 +130,5 @@ _stack: .space ( 64 * 1024 ) .size _stack, . - _stack _estack: + +#endif /* defined(__i386__) || defined(__x86_64__) */