Skip to content

Commit

Permalink
[build] Include x86-specific code only for x86 builds
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <[email protected]>
  • Loading branch information
mcb30 committed Nov 27, 2023
1 parent e200314 commit 033af42
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/callback.S
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
#define CR0_PG 0x80000000

.section ".note.GNU-stack", "", @progbits

#if defined(__i386__) || defined(__x86_64__)

.arch i386
.code32

Expand Down Expand Up @@ -226,3 +229,5 @@ _rmstack:
.space 8192
.size _rmstack, . - _rmstack
_ermstack:

#endif /* defined(__i386__) || defined(__x86_64__) */
4 changes: 4 additions & 0 deletions src/int13.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "int13.h"
#include "vdisk.h"

#if defined(__i386__) || defined(__x86_64__)

/** Emulated drive number */
static int vdisk_drive;

Expand Down Expand Up @@ -223,3 +225,5 @@ void emulate_int13 ( struct bootapp_callback_params *params ) {
}
}
}

#endif /* defined(__i386__) || defined(__x86_64__) */
4 changes: 4 additions & 0 deletions src/paging.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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__) */
11 changes: 7 additions & 4 deletions src/prefix.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -119,6 +119,7 @@ version_string:
.asciz VERSION

/* Setup code */
.code16
setup:
/* Reset %cs so that labels work */
pushw %ds
Expand Down Expand Up @@ -196,4 +197,6 @@ gdt:
.size gdt, . - gdt
.equ gdt_limit, . - gdt - 1

#endif

.org SETUP_LEN
5 changes: 5 additions & 0 deletions src/startup.S
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#define KC_CMD_RESET 0xfe

.section ".note.GNU-stack", "", @progbits

#if defined(__i386__) || defined(__x86_64__)

.arch i386
.code32

Expand Down Expand Up @@ -127,3 +130,5 @@ _stack:
.space ( 64 * 1024 )
.size _stack, . - _stack
_estack:

#endif /* defined(__i386__) || defined(__x86_64__) */

0 comments on commit 033af42

Please sign in to comment.