Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[x86_64] Add support for compilation as an x86_64 binary
Currently the only supported platform for x86_64 is EFI. Building an EFI64 gPXE requires a version of gcc that supports __attribute__((ms_abi)). This currently means a development build of gcc; the feature should be present when gcc 4.4 is released. In the meantime; you can grab a suitable gcc tree from git://git.etherboot.org/scm/people/mcb30/gcc/.git
- Loading branch information
Michael Brown
committed
Dec 5, 2008
1 parent
b0d2c9a
commit ce0a0cc
Showing
34 changed files
with
997 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Include common x86 headers | ||
# | ||
CFLAGS += -Iarch/x86/include | ||
|
||
# x86-specific directories containing source files | ||
# | ||
SRCDIRS += arch/x86/core | ||
SRCDIRS += arch/x86/interface/efi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Code size reduction. | ||
# | ||
CFLAGS += -fstrength-reduce -fomit-frame-pointer | ||
|
||
# Code size reduction. gcc3 needs a different syntax to gcc2 if you | ||
# want to avoid spurious warnings. | ||
# | ||
CFLAGS += -falign-jumps=1 -falign-loops=1 -falign-functions=1 | ||
|
||
# Use %rip-relative addressing wherever possible. | ||
# | ||
CFLAGS += -fpie | ||
|
||
# Force 64-bit code | ||
# | ||
CFLAGS += -m64 | ||
ASFLAGS += --64 | ||
LDFLAGS += -m elf_x86_64 | ||
|
||
# EFI requires -fshort-wchar, and nothing else currently uses wchar_t | ||
# | ||
CFLAGS += -fshort-wchar | ||
|
||
# We need to undefine the default macro "i386" when compiling .S | ||
# files, otherwise ".arch i386" translates to ".arch 1"... | ||
# | ||
CFLAGS += -Ui386 | ||
|
||
# x86_64-specific directories containing source files | ||
# | ||
SRCDIRS += arch/x86_64/prefix | ||
|
||
# Include common x86 Makefile | ||
# | ||
MAKEDEPS += arch/x86/Makefile | ||
include arch/x86/Makefile | ||
|
||
# Include platform-specific Makefile | ||
# | ||
MAKEDEPS += arch/x86_64/Makefile.$(PLATFORM) | ||
include arch/x86_64/Makefile.$(PLATFORM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- makefile -*- : Force emacs to use Makefile mode | ||
|
||
# EFI probably doesn't guarantee us a red zone, so let's not rely on it. | ||
# | ||
CFLAGS += -mno-red-zone | ||
|
||
# The EFI linker script | ||
# | ||
LDSCRIPT = arch/x86_64/scripts/efi.lds | ||
|
||
# Use a relocatable link; we perform final relocations in the efilink utility. | ||
# | ||
LDFLAGS += -r -d -S | ||
|
||
# Media types. | ||
# | ||
NON_AUTO_MEDIA += efi | ||
|
||
# Rule for building EFI files | ||
# | ||
$(BIN)/%.efi.tmp-reloc : $(BIN)/%.efi.tmp $(EFILINK) | ||
$(QM)$(ECHO) " [EFILINK] $@" | ||
$(Q)$(LD) -e 0 -o /dev/null $< # Check for unresolved symbols | ||
$(Q)$(EFILINK) $< $@ | ||
|
||
$(BIN)/%.efi : $(BIN)/%.efi.tmp-reloc | ||
$(QM)$(ECHO) " [FINISH] $@" | ||
$(Q)$(OBJCOPY) -Obinary $< $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef _BITS_BYTESWAP_H | ||
#define _BITS_BYTESWAP_H | ||
|
||
static inline __attribute__ (( always_inline, const )) uint16_t | ||
__bswap_variable_16 ( uint16_t x ) { | ||
__asm__ ( "xchgb %b0,%h0" : "=Q" ( x ) : "0" ( x ) ); | ||
return x; | ||
} | ||
|
||
static inline __attribute__ (( always_inline, const )) uint32_t | ||
__bswap_variable_32 ( uint32_t x ) { | ||
__asm__ ( "bswapl %k0" : "=r" ( x ) : "0" ( x ) ); | ||
return x; | ||
} | ||
|
||
static inline __attribute__ (( always_inline, const )) uint64_t | ||
__bswap_variable_64 ( uint64_t x ) { | ||
__asm__ ( "bswapq %q0" : "=r" ( x ) : "0" ( x ) ); | ||
return x; | ||
} | ||
|
||
#endif /* _BITS_BYTESWAP_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef _BITS_COMPILER_H | ||
#define _BITS_COMPILER_H | ||
|
||
#ifndef ASSEMBLY | ||
|
||
/** Declare a function with standard calling conventions */ | ||
#define __asmcall __attribute__ (( regparm(0) )) | ||
|
||
/** Declare a function with libgcc implicit linkage */ | ||
#define __libgcc | ||
|
||
#endif /* ASSEMBLY */ | ||
|
||
#endif /* _BITS_COMPILER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef ETHERBOOT_BITS_ENDIAN_H | ||
#define ETHERBOOT_BITS_ENDIAN_H | ||
|
||
#define __BYTE_ORDER __LITTLE_ENDIAN | ||
|
||
#endif /* ETHERBOOT_BITS_ENDIAN_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef _BITS_ERRFILE_H | ||
#define _BITS_ERRFILE_H | ||
|
||
/** | ||
* @addtogroup errfile Error file identifiers | ||
* @{ | ||
*/ | ||
|
||
/** @} */ | ||
|
||
#endif /* _BITS_ERRFILE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef _BITS_IO_H | ||
#define _BITS_IO_H | ||
|
||
/** @file | ||
* | ||
* x86_64-specific I/O API implementations | ||
* | ||
*/ | ||
|
||
#endif /* _BITS_IO_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef _BITS_NAP_H | ||
#define _BITS_NAP_H | ||
|
||
/** @file | ||
* | ||
* x86_64-specific CPU sleeping API implementations | ||
* | ||
*/ | ||
|
||
#include <gpxe/efi/efix86_nap.h> | ||
|
||
#endif /* _BITS_MAP_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef _BITS_SMBIOS_H | ||
#define _BITS_SMBIOS_H | ||
|
||
/** @file | ||
* | ||
* i386-specific SMBIOS API implementations | ||
* | ||
*/ | ||
|
||
#endif /* _BITS_SMBIOS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef _BITS_STDINT_H | ||
#define _BITS_STDINT_H | ||
|
||
typedef unsigned long size_t; | ||
typedef signed long ssize_t; | ||
typedef signed long off_t; | ||
|
||
typedef unsigned char uint8_t; | ||
typedef unsigned short uint16_t; | ||
typedef unsigned int uint32_t; | ||
typedef unsigned long long uint64_t; | ||
|
||
typedef signed char int8_t; | ||
typedef signed short int16_t; | ||
typedef signed int int32_t; | ||
typedef signed long long int64_t; | ||
|
||
typedef unsigned long physaddr_t; | ||
typedef unsigned long intptr_t; | ||
|
||
#endif /* _BITS_STDINT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef _BITS_TIMER_H | ||
#define _BITS_TIMER_H | ||
|
||
/** @file | ||
* | ||
* x86_64-specific timer API implementations | ||
* | ||
*/ | ||
|
||
#endif /* _BITS_TIMER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef _BITS_UACCESS_H | ||
#define _BITS_UACCESS_H | ||
|
||
/** @file | ||
* | ||
* x86_64-specific user access API implementations | ||
* | ||
*/ | ||
|
||
#endif /* _BITS_UACCESS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef _BITS_UMALLOC_H | ||
#define _BITS_UMALLOC_H | ||
|
||
/** @file | ||
* | ||
* x86_64-specific user memory allocation API implementations | ||
* | ||
*/ | ||
|
||
#endif /* _BITS_UMALLOC_H */ |
Oops, something went wrong.