Sync BaseTool trunk (version r2649) into EDKII BaseTools.
Signed-off-by: Gao, Liming <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15188 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,87 +1,87 @@
|
||||
## @file
|
||||
# GNU/Linux makefile for C tools build.
|
||||
#
|
||||
# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
|
||||
ifndef ARCH
|
||||
#
|
||||
# If ARCH is not defined, then we use 'uname -m' to attempt
|
||||
# try to figure out the appropriate ARCH.
|
||||
#
|
||||
uname_m = $(shell uname -m)
|
||||
$(info Attempting to detect ARCH from 'uname -m': $(uname_m))
|
||||
ifeq ($(uname_m),x86_64)
|
||||
ARCH=X64
|
||||
endif
|
||||
ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
|
||||
ARCH=IA32
|
||||
endif
|
||||
ifndef ARCH
|
||||
$(info Could not detected ARCH from uname results)
|
||||
$(error ARCH is not defined!)
|
||||
endif
|
||||
$(info Detected ARCH of $(ARCH) using uname.)
|
||||
endif
|
||||
|
||||
export ARCH
|
||||
|
||||
MAKEROOT = .
|
||||
|
||||
include Makefiles/header.makefile
|
||||
|
||||
all: makerootdir subdirs $(MAKEROOT)/libs
|
||||
@echo Finished building BaseTools C Tools with ARCH=$(ARCH)
|
||||
|
||||
LIBRARIES = Common
|
||||
# NON_BUILDABLE_APPLICATIONS = GenBootSector BootSectImage
|
||||
APPLICATIONS = \
|
||||
GnuGenBootSector \
|
||||
BootSectImage \
|
||||
EfiLdrImage \
|
||||
EfiRom \
|
||||
GenFfs \
|
||||
GenFv \
|
||||
GenFw \
|
||||
GenPage \
|
||||
GenSec \
|
||||
GenCrc32 \
|
||||
GenVtf \
|
||||
LzmaCompress \
|
||||
Split \
|
||||
TianoCompress \
|
||||
VolInfo \
|
||||
VfrCompile
|
||||
|
||||
SUBDIRS := $(LIBRARIES) $(APPLICATIONS)
|
||||
|
||||
.PHONY: outputdirs
|
||||
makerootdir:
|
||||
-mkdir -p $(MAKEROOT)
|
||||
|
||||
.PHONY: subdirs $(SUBDIRS)
|
||||
subdirs: $(SUBDIRS)
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
.PHONY: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
|
||||
$(patsubst %,%-clean,$(sort $(SUBDIRS))):
|
||||
-$(MAKE) -C $(@:-clean=) clean
|
||||
|
||||
clean: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
|
||||
|
||||
clean: localClean
|
||||
|
||||
localClean:
|
||||
rm -f $(MAKEROOT)/bin/*
|
||||
-rmdir $(MAKEROOT)/libs $(MAKEROOT)/bin
|
||||
|
||||
include Makefiles/footer.makefile
|
||||
## @file
|
||||
# GNU/Linux makefile for C tools build.
|
||||
#
|
||||
# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
|
||||
ifndef ARCH
|
||||
#
|
||||
# If ARCH is not defined, then we use 'uname -m' to attempt
|
||||
# try to figure out the appropriate ARCH.
|
||||
#
|
||||
uname_m = $(shell uname -m)
|
||||
$(info Attempting to detect ARCH from 'uname -m': $(uname_m))
|
||||
ifeq ($(uname_m),x86_64)
|
||||
ARCH=X64
|
||||
endif
|
||||
ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
|
||||
ARCH=IA32
|
||||
endif
|
||||
ifndef ARCH
|
||||
$(info Could not detected ARCH from uname results)
|
||||
$(error ARCH is not defined!)
|
||||
endif
|
||||
$(info Detected ARCH of $(ARCH) using uname.)
|
||||
endif
|
||||
|
||||
export ARCH
|
||||
|
||||
MAKEROOT = .
|
||||
|
||||
include Makefiles/header.makefile
|
||||
|
||||
all: makerootdir subdirs $(MAKEROOT)/libs
|
||||
@echo Finished building BaseTools C Tools with ARCH=$(ARCH)
|
||||
|
||||
LIBRARIES = Common
|
||||
# NON_BUILDABLE_APPLICATIONS = GenBootSector BootSectImage
|
||||
APPLICATIONS = \
|
||||
GnuGenBootSector \
|
||||
BootSectImage \
|
||||
EfiLdrImage \
|
||||
EfiRom \
|
||||
GenFfs \
|
||||
GenFv \
|
||||
GenFw \
|
||||
GenPage \
|
||||
GenSec \
|
||||
GenCrc32 \
|
||||
GenVtf \
|
||||
LzmaCompress \
|
||||
Split \
|
||||
TianoCompress \
|
||||
VolInfo \
|
||||
VfrCompile
|
||||
|
||||
SUBDIRS := $(LIBRARIES) $(APPLICATIONS)
|
||||
|
||||
.PHONY: outputdirs
|
||||
makerootdir:
|
||||
-mkdir -p $(MAKEROOT)
|
||||
|
||||
.PHONY: subdirs $(SUBDIRS)
|
||||
subdirs: $(SUBDIRS)
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
.PHONY: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
|
||||
$(patsubst %,%-clean,$(sort $(SUBDIRS))):
|
||||
-$(MAKE) -C $(@:-clean=) clean
|
||||
|
||||
clean: $(patsubst %,%-clean,$(sort $(SUBDIRS)))
|
||||
|
||||
clean: localClean
|
||||
|
||||
localClean:
|
||||
rm -f $(MAKEROOT)/bin/*
|
||||
-rmdir $(MAKEROOT)/libs $(MAKEROOT)/bin
|
||||
|
||||
include Makefiles/footer.makefile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,24 +1,24 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _ELF_32_CONVERT_
|
||||
#define _ELF_32_CONVERT_
|
||||
|
||||
BOOLEAN
|
||||
InitializeElf32 (
|
||||
UINT8 *FileBuffer,
|
||||
ELF_FUNCTION_TABLE *ElfFunctions
|
||||
);
|
||||
|
||||
#endif
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _ELF_32_CONVERT_
|
||||
#define _ELF_32_CONVERT_
|
||||
|
||||
BOOLEAN
|
||||
InitializeElf32 (
|
||||
UINT8 *FileBuffer,
|
||||
ELF_FUNCTION_TABLE *ElfFunctions
|
||||
);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,24 +1,24 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _ELF_64_CONVERT_
|
||||
#define _ELF_64_CONVERT_
|
||||
|
||||
BOOLEAN
|
||||
InitializeElf64 (
|
||||
UINT8 *FileBuffer,
|
||||
ELF_FUNCTION_TABLE *ElfFunctions
|
||||
);
|
||||
|
||||
#endif
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _ELF_64_CONVERT_
|
||||
#define _ELF_64_CONVERT_
|
||||
|
||||
BOOLEAN
|
||||
InitializeElf64 (
|
||||
UINT8 *FileBuffer,
|
||||
ELF_FUNCTION_TABLE *ElfFunctions
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -1,233 +1,233 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "WinNtInclude.h"
|
||||
|
||||
#ifndef __GNUC__
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <Common/UefiBaseTypes.h>
|
||||
#include <IndustryStandard/PeImage.h>
|
||||
|
||||
#include "EfiUtilityMsgs.h"
|
||||
|
||||
#include "GenFw.h"
|
||||
#include "ElfConvert.h"
|
||||
#include "Elf32Convert.h"
|
||||
#include "Elf64Convert.h"
|
||||
|
||||
//
|
||||
// Result Coff file in memory.
|
||||
//
|
||||
UINT8 *mCoffFile = NULL;
|
||||
|
||||
//
|
||||
// COFF relocation data
|
||||
//
|
||||
EFI_IMAGE_BASE_RELOCATION *mCoffBaseRel;
|
||||
UINT16 *mCoffEntryRel;
|
||||
|
||||
//
|
||||
// Current offset in coff file.
|
||||
//
|
||||
UINT32 mCoffOffset;
|
||||
|
||||
//
|
||||
// Offset in Coff file of headers and sections.
|
||||
//
|
||||
UINT32 mTableOffset;
|
||||
|
||||
//
|
||||
//*****************************************************************************
|
||||
// Common ELF Functions
|
||||
//*****************************************************************************
|
||||
//
|
||||
|
||||
VOID
|
||||
CoffAddFixupEntry(
|
||||
UINT16 Val
|
||||
)
|
||||
{
|
||||
*mCoffEntryRel = Val;
|
||||
mCoffEntryRel++;
|
||||
mCoffBaseRel->SizeOfBlock += 2;
|
||||
mCoffOffset += 2;
|
||||
}
|
||||
|
||||
VOID
|
||||
CoffAddFixup(
|
||||
UINT32 Offset,
|
||||
UINT8 Type
|
||||
)
|
||||
{
|
||||
if (mCoffBaseRel == NULL
|
||||
|| mCoffBaseRel->VirtualAddress != (Offset & ~0xfff)) {
|
||||
if (mCoffBaseRel != NULL) {
|
||||
//
|
||||
// Add a null entry (is it required ?)
|
||||
//
|
||||
CoffAddFixupEntry (0);
|
||||
|
||||
//
|
||||
// Pad for alignment.
|
||||
//
|
||||
if (mCoffOffset % 4 != 0)
|
||||
CoffAddFixupEntry (0);
|
||||
}
|
||||
|
||||
mCoffFile = realloc (
|
||||
mCoffFile,
|
||||
mCoffOffset + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000
|
||||
);
|
||||
memset (
|
||||
mCoffFile + mCoffOffset, 0,
|
||||
sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000
|
||||
);
|
||||
|
||||
mCoffBaseRel = (EFI_IMAGE_BASE_RELOCATION*)(mCoffFile + mCoffOffset);
|
||||
mCoffBaseRel->VirtualAddress = Offset & ~0xfff;
|
||||
mCoffBaseRel->SizeOfBlock = sizeof(EFI_IMAGE_BASE_RELOCATION);
|
||||
|
||||
mCoffEntryRel = (UINT16 *)(mCoffBaseRel + 1);
|
||||
mCoffOffset += sizeof(EFI_IMAGE_BASE_RELOCATION);
|
||||
}
|
||||
|
||||
//
|
||||
// Fill the entry.
|
||||
//
|
||||
CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff)));
|
||||
}
|
||||
|
||||
VOID
|
||||
CreateSectionHeader (
|
||||
const CHAR8 *Name,
|
||||
UINT32 Offset,
|
||||
UINT32 Size,
|
||||
UINT32 Flags
|
||||
)
|
||||
{
|
||||
EFI_IMAGE_SECTION_HEADER *Hdr;
|
||||
Hdr = (EFI_IMAGE_SECTION_HEADER*)(mCoffFile + mTableOffset);
|
||||
|
||||
strcpy((char *)Hdr->Name, Name);
|
||||
Hdr->Misc.VirtualSize = Size;
|
||||
Hdr->VirtualAddress = Offset;
|
||||
Hdr->SizeOfRawData = Size;
|
||||
Hdr->PointerToRawData = Offset;
|
||||
Hdr->PointerToRelocations = 0;
|
||||
Hdr->PointerToLinenumbers = 0;
|
||||
Hdr->NumberOfRelocations = 0;
|
||||
Hdr->NumberOfLinenumbers = 0;
|
||||
Hdr->Characteristics = Flags;
|
||||
|
||||
mTableOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
|
||||
}
|
||||
|
||||
//
|
||||
//*****************************************************************************
|
||||
// Functions called from GenFw main code.
|
||||
//*****************************************************************************
|
||||
//
|
||||
|
||||
INTN
|
||||
IsElfHeader (
|
||||
UINT8 *FileBuffer
|
||||
)
|
||||
{
|
||||
return (FileBuffer[EI_MAG0] == ELFMAG0 &&
|
||||
FileBuffer[EI_MAG1] == ELFMAG1 &&
|
||||
FileBuffer[EI_MAG2] == ELFMAG2 &&
|
||||
FileBuffer[EI_MAG3] == ELFMAG3);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
ConvertElf (
|
||||
UINT8 **FileBuffer,
|
||||
UINT32 *FileLength
|
||||
)
|
||||
{
|
||||
ELF_FUNCTION_TABLE ElfFunctions;
|
||||
UINT8 EiClass;
|
||||
|
||||
//
|
||||
// Determine ELF type and set function table pointer correctly.
|
||||
//
|
||||
VerboseMsg ("Check Elf Image Header");
|
||||
EiClass = (*FileBuffer)[EI_CLASS];
|
||||
if (EiClass == ELFCLASS32) {
|
||||
if (!InitializeElf32 (*FileBuffer, &ElfFunctions)) {
|
||||
return FALSE;
|
||||
}
|
||||
} else if (EiClass == ELFCLASS64) {
|
||||
if (!InitializeElf64 (*FileBuffer, &ElfFunctions)) {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
Error (NULL, 0, 3000, "Unsupported", "ELF EI_CLASS not supported.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// Compute sections new address.
|
||||
//
|
||||
VerboseMsg ("Compute sections new address.");
|
||||
ElfFunctions.ScanSections ();
|
||||
|
||||
//
|
||||
// Write and relocate sections.
|
||||
//
|
||||
VerboseMsg ("Write and relocate sections.");
|
||||
ElfFunctions.WriteSections (SECTION_TEXT);
|
||||
ElfFunctions.WriteSections (SECTION_DATA);
|
||||
ElfFunctions.WriteSections (SECTION_HII);
|
||||
|
||||
//
|
||||
// Translate and write relocations.
|
||||
//
|
||||
VerboseMsg ("Translate and write relocations.");
|
||||
ElfFunctions.WriteRelocations ();
|
||||
|
||||
//
|
||||
// Write debug info.
|
||||
//
|
||||
VerboseMsg ("Write debug info.");
|
||||
ElfFunctions.WriteDebug ();
|
||||
|
||||
//
|
||||
// Make sure image size is correct before returning the new image.
|
||||
//
|
||||
VerboseMsg ("Set image size.");
|
||||
ElfFunctions.SetImageSize ();
|
||||
|
||||
//
|
||||
// Replace.
|
||||
//
|
||||
free (*FileBuffer);
|
||||
*FileBuffer = mCoffFile;
|
||||
*FileLength = mCoffOffset;
|
||||
|
||||
//
|
||||
// Free resources used by ELF functions.
|
||||
//
|
||||
ElfFunctions.CleanUp ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "WinNtInclude.h"
|
||||
|
||||
#ifndef __GNUC__
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <Common/UefiBaseTypes.h>
|
||||
#include <IndustryStandard/PeImage.h>
|
||||
|
||||
#include "EfiUtilityMsgs.h"
|
||||
|
||||
#include "GenFw.h"
|
||||
#include "ElfConvert.h"
|
||||
#include "Elf32Convert.h"
|
||||
#include "Elf64Convert.h"
|
||||
|
||||
//
|
||||
// Result Coff file in memory.
|
||||
//
|
||||
UINT8 *mCoffFile = NULL;
|
||||
|
||||
//
|
||||
// COFF relocation data
|
||||
//
|
||||
EFI_IMAGE_BASE_RELOCATION *mCoffBaseRel;
|
||||
UINT16 *mCoffEntryRel;
|
||||
|
||||
//
|
||||
// Current offset in coff file.
|
||||
//
|
||||
UINT32 mCoffOffset;
|
||||
|
||||
//
|
||||
// Offset in Coff file of headers and sections.
|
||||
//
|
||||
UINT32 mTableOffset;
|
||||
|
||||
//
|
||||
//*****************************************************************************
|
||||
// Common ELF Functions
|
||||
//*****************************************************************************
|
||||
//
|
||||
|
||||
VOID
|
||||
CoffAddFixupEntry(
|
||||
UINT16 Val
|
||||
)
|
||||
{
|
||||
*mCoffEntryRel = Val;
|
||||
mCoffEntryRel++;
|
||||
mCoffBaseRel->SizeOfBlock += 2;
|
||||
mCoffOffset += 2;
|
||||
}
|
||||
|
||||
VOID
|
||||
CoffAddFixup(
|
||||
UINT32 Offset,
|
||||
UINT8 Type
|
||||
)
|
||||
{
|
||||
if (mCoffBaseRel == NULL
|
||||
|| mCoffBaseRel->VirtualAddress != (Offset & ~0xfff)) {
|
||||
if (mCoffBaseRel != NULL) {
|
||||
//
|
||||
// Add a null entry (is it required ?)
|
||||
//
|
||||
CoffAddFixupEntry (0);
|
||||
|
||||
//
|
||||
// Pad for alignment.
|
||||
//
|
||||
if (mCoffOffset % 4 != 0)
|
||||
CoffAddFixupEntry (0);
|
||||
}
|
||||
|
||||
mCoffFile = realloc (
|
||||
mCoffFile,
|
||||
mCoffOffset + sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000
|
||||
);
|
||||
memset (
|
||||
mCoffFile + mCoffOffset, 0,
|
||||
sizeof(EFI_IMAGE_BASE_RELOCATION) + 2*0x1000
|
||||
);
|
||||
|
||||
mCoffBaseRel = (EFI_IMAGE_BASE_RELOCATION*)(mCoffFile + mCoffOffset);
|
||||
mCoffBaseRel->VirtualAddress = Offset & ~0xfff;
|
||||
mCoffBaseRel->SizeOfBlock = sizeof(EFI_IMAGE_BASE_RELOCATION);
|
||||
|
||||
mCoffEntryRel = (UINT16 *)(mCoffBaseRel + 1);
|
||||
mCoffOffset += sizeof(EFI_IMAGE_BASE_RELOCATION);
|
||||
}
|
||||
|
||||
//
|
||||
// Fill the entry.
|
||||
//
|
||||
CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff)));
|
||||
}
|
||||
|
||||
VOID
|
||||
CreateSectionHeader (
|
||||
const CHAR8 *Name,
|
||||
UINT32 Offset,
|
||||
UINT32 Size,
|
||||
UINT32 Flags
|
||||
)
|
||||
{
|
||||
EFI_IMAGE_SECTION_HEADER *Hdr;
|
||||
Hdr = (EFI_IMAGE_SECTION_HEADER*)(mCoffFile + mTableOffset);
|
||||
|
||||
strcpy((char *)Hdr->Name, Name);
|
||||
Hdr->Misc.VirtualSize = Size;
|
||||
Hdr->VirtualAddress = Offset;
|
||||
Hdr->SizeOfRawData = Size;
|
||||
Hdr->PointerToRawData = Offset;
|
||||
Hdr->PointerToRelocations = 0;
|
||||
Hdr->PointerToLinenumbers = 0;
|
||||
Hdr->NumberOfRelocations = 0;
|
||||
Hdr->NumberOfLinenumbers = 0;
|
||||
Hdr->Characteristics = Flags;
|
||||
|
||||
mTableOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
|
||||
}
|
||||
|
||||
//
|
||||
//*****************************************************************************
|
||||
// Functions called from GenFw main code.
|
||||
//*****************************************************************************
|
||||
//
|
||||
|
||||
INTN
|
||||
IsElfHeader (
|
||||
UINT8 *FileBuffer
|
||||
)
|
||||
{
|
||||
return (FileBuffer[EI_MAG0] == ELFMAG0 &&
|
||||
FileBuffer[EI_MAG1] == ELFMAG1 &&
|
||||
FileBuffer[EI_MAG2] == ELFMAG2 &&
|
||||
FileBuffer[EI_MAG3] == ELFMAG3);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
ConvertElf (
|
||||
UINT8 **FileBuffer,
|
||||
UINT32 *FileLength
|
||||
)
|
||||
{
|
||||
ELF_FUNCTION_TABLE ElfFunctions;
|
||||
UINT8 EiClass;
|
||||
|
||||
//
|
||||
// Determine ELF type and set function table pointer correctly.
|
||||
//
|
||||
VerboseMsg ("Check Elf Image Header");
|
||||
EiClass = (*FileBuffer)[EI_CLASS];
|
||||
if (EiClass == ELFCLASS32) {
|
||||
if (!InitializeElf32 (*FileBuffer, &ElfFunctions)) {
|
||||
return FALSE;
|
||||
}
|
||||
} else if (EiClass == ELFCLASS64) {
|
||||
if (!InitializeElf64 (*FileBuffer, &ElfFunctions)) {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
Error (NULL, 0, 3000, "Unsupported", "ELF EI_CLASS not supported.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// Compute sections new address.
|
||||
//
|
||||
VerboseMsg ("Compute sections new address.");
|
||||
ElfFunctions.ScanSections ();
|
||||
|
||||
//
|
||||
// Write and relocate sections.
|
||||
//
|
||||
VerboseMsg ("Write and relocate sections.");
|
||||
ElfFunctions.WriteSections (SECTION_TEXT);
|
||||
ElfFunctions.WriteSections (SECTION_DATA);
|
||||
ElfFunctions.WriteSections (SECTION_HII);
|
||||
|
||||
//
|
||||
// Translate and write relocations.
|
||||
//
|
||||
VerboseMsg ("Translate and write relocations.");
|
||||
ElfFunctions.WriteRelocations ();
|
||||
|
||||
//
|
||||
// Write debug info.
|
||||
//
|
||||
VerboseMsg ("Write debug info.");
|
||||
ElfFunctions.WriteDebug ();
|
||||
|
||||
//
|
||||
// Make sure image size is correct before returning the new image.
|
||||
//
|
||||
VerboseMsg ("Set image size.");
|
||||
ElfFunctions.SetImageSize ();
|
||||
|
||||
//
|
||||
// Replace.
|
||||
//
|
||||
free (*FileBuffer);
|
||||
*FileBuffer = mCoffFile;
|
||||
*FileLength = mCoffOffset;
|
||||
|
||||
//
|
||||
// Free resources used by ELF functions.
|
||||
//
|
||||
ElfFunctions.CleanUp ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -1,83 +1,83 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _ELF_CONVERT_H_
|
||||
#define _ELF_CONVERT_H_
|
||||
|
||||
#include "elf_common.h"
|
||||
#include "elf32.h"
|
||||
#include "elf64.h"
|
||||
|
||||
//
|
||||
// Externally defined variables
|
||||
//
|
||||
extern UINT32 mCoffOffset;
|
||||
extern CHAR8 *mInImageName;
|
||||
extern UINT32 mImageTimeStamp;
|
||||
extern UINT8 *mCoffFile;
|
||||
extern UINT32 mTableOffset;
|
||||
extern UINT32 mOutImageType;
|
||||
|
||||
//
|
||||
// Common EFI specific data.
|
||||
//
|
||||
#define ELF_HII_SECTION_NAME ".hii"
|
||||
|
||||
//
|
||||
// Filter Types
|
||||
//
|
||||
typedef enum {
|
||||
SECTION_TEXT,
|
||||
SECTION_HII,
|
||||
SECTION_DATA
|
||||
|
||||
} SECTION_FILTER_TYPES;
|
||||
|
||||
//
|
||||
// FunctionTalbe
|
||||
//
|
||||
typedef struct {
|
||||
VOID (*ScanSections) ();
|
||||
BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType);
|
||||
VOID (*WriteRelocations) ();
|
||||
VOID (*WriteDebug) ();
|
||||
VOID (*SetImageSize) ();
|
||||
VOID (*CleanUp) ();
|
||||
|
||||
} ELF_FUNCTION_TABLE;
|
||||
|
||||
//
|
||||
// Common functions
|
||||
//
|
||||
VOID
|
||||
CoffAddFixup (
|
||||
UINT32 Offset,
|
||||
UINT8 Type
|
||||
);
|
||||
|
||||
VOID
|
||||
CoffAddFixupEntry (
|
||||
UINT16 Val
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
CreateSectionHeader (
|
||||
const CHAR8 *Name,
|
||||
UINT32 Offset,
|
||||
UINT32 Size,
|
||||
UINT32 Flags
|
||||
);
|
||||
|
||||
#endif
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _ELF_CONVERT_H_
|
||||
#define _ELF_CONVERT_H_
|
||||
|
||||
#include "elf_common.h"
|
||||
#include "elf32.h"
|
||||
#include "elf64.h"
|
||||
|
||||
//
|
||||
// Externally defined variables
|
||||
//
|
||||
extern UINT32 mCoffOffset;
|
||||
extern CHAR8 *mInImageName;
|
||||
extern UINT32 mImageTimeStamp;
|
||||
extern UINT8 *mCoffFile;
|
||||
extern UINT32 mTableOffset;
|
||||
extern UINT32 mOutImageType;
|
||||
|
||||
//
|
||||
// Common EFI specific data.
|
||||
//
|
||||
#define ELF_HII_SECTION_NAME ".hii"
|
||||
|
||||
//
|
||||
// Filter Types
|
||||
//
|
||||
typedef enum {
|
||||
SECTION_TEXT,
|
||||
SECTION_HII,
|
||||
SECTION_DATA
|
||||
|
||||
} SECTION_FILTER_TYPES;
|
||||
|
||||
//
|
||||
// FunctionTalbe
|
||||
//
|
||||
typedef struct {
|
||||
VOID (*ScanSections) ();
|
||||
BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType);
|
||||
VOID (*WriteRelocations) ();
|
||||
VOID (*WriteDebug) ();
|
||||
VOID (*SetImageSize) ();
|
||||
VOID (*CleanUp) ();
|
||||
|
||||
} ELF_FUNCTION_TABLE;
|
||||
|
||||
//
|
||||
// Common functions
|
||||
//
|
||||
VOID
|
||||
CoffAddFixup (
|
||||
UINT32 Offset,
|
||||
UINT8 Type
|
||||
);
|
||||
|
||||
VOID
|
||||
CoffAddFixupEntry (
|
||||
UINT16 Val
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
CreateSectionHeader (
|
||||
const CHAR8 *Name,
|
||||
UINT32 Offset,
|
||||
UINT32 Size,
|
||||
UINT32 Flags
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -1,55 +1,55 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _GEN_FW_H_
|
||||
#define _GEN_FW_H_
|
||||
|
||||
//
|
||||
// Action for this tool.
|
||||
//
|
||||
#define FW_DUMMY_IMAGE 0
|
||||
#define FW_EFI_IMAGE 1
|
||||
#define FW_TE_IMAGE 2
|
||||
#define FW_ACPI_IMAGE 3
|
||||
#define FW_BIN_IMAGE 4
|
||||
#define FW_ZERO_DEBUG_IMAGE 5
|
||||
#define FW_SET_STAMP_IMAGE 6
|
||||
#define FW_MCI_IMAGE 7
|
||||
#define FW_MERGE_IMAGE 8
|
||||
#define FW_RELOC_STRIPEED_IMAGE 9
|
||||
#define FW_HII_PACKAGE_LIST_RCIMAGE 10
|
||||
#define FW_HII_PACKAGE_LIST_BINIMAGE 11
|
||||
#define FW_REBASE_IMAGE 12
|
||||
#define FW_SET_ADDRESS_IMAGE 13
|
||||
|
||||
#define DUMP_TE_HEADER 0x11
|
||||
|
||||
VOID
|
||||
SetHiiResourceHeader (
|
||||
UINT8 *HiiBinData,
|
||||
UINT32 OffsetToFile
|
||||
);
|
||||
|
||||
INTN
|
||||
IsElfHeader (
|
||||
UINT8 *FileBuffer
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
ConvertElf (
|
||||
UINT8 **FileBuffer,
|
||||
UINT32 *FileLength
|
||||
);
|
||||
|
||||
#endif
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _GEN_FW_H_
|
||||
#define _GEN_FW_H_
|
||||
|
||||
//
|
||||
// Action for this tool.
|
||||
//
|
||||
#define FW_DUMMY_IMAGE 0
|
||||
#define FW_EFI_IMAGE 1
|
||||
#define FW_TE_IMAGE 2
|
||||
#define FW_ACPI_IMAGE 3
|
||||
#define FW_BIN_IMAGE 4
|
||||
#define FW_ZERO_DEBUG_IMAGE 5
|
||||
#define FW_SET_STAMP_IMAGE 6
|
||||
#define FW_MCI_IMAGE 7
|
||||
#define FW_MERGE_IMAGE 8
|
||||
#define FW_RELOC_STRIPEED_IMAGE 9
|
||||
#define FW_HII_PACKAGE_LIST_RCIMAGE 10
|
||||
#define FW_HII_PACKAGE_LIST_BINIMAGE 11
|
||||
#define FW_REBASE_IMAGE 12
|
||||
#define FW_SET_ADDRESS_IMAGE 13
|
||||
|
||||
#define DUMP_TE_HEADER 0x11
|
||||
|
||||
VOID
|
||||
SetHiiResourceHeader (
|
||||
UINT8 *HiiBinData,
|
||||
UINT32 OffsetToFile
|
||||
);
|
||||
|
||||
INTN
|
||||
IsElfHeader (
|
||||
UINT8 *FileBuffer
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
ConvertElf (
|
||||
UINT8 **FileBuffer,
|
||||
UINT32 *FileLength
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -1,258 +1,258 @@
|
||||
/** @file
|
||||
Ported ELF include files from FreeBSD
|
||||
|
||||
Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
/*-
|
||||
* Copyright (c) 1996-1998 John D. Polstra.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.2 2007/12/03 21:30:36 marius Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ELF32_H_
|
||||
#define _SYS_ELF32_H_ 1
|
||||
|
||||
|
||||
/*
|
||||
* ELF definitions common to all 32-bit architectures.
|
||||
*/
|
||||
|
||||
typedef UINT32 Elf32_Addr;
|
||||
typedef UINT16 Elf32_Half;
|
||||
typedef UINT32 Elf32_Off;
|
||||
typedef INT32 Elf32_Sword;
|
||||
typedef UINT32 Elf32_Word;
|
||||
typedef UINT64 Elf32_Lword;
|
||||
|
||||
typedef Elf32_Word Elf32_Hashelt;
|
||||
|
||||
/* Non-standard class-dependent datatype used for abstraction. */
|
||||
typedef Elf32_Word Elf32_Size;
|
||||
typedef Elf32_Sword Elf32_Ssize;
|
||||
|
||||
/*
|
||||
* ELF header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||
Elf32_Half e_type; /* File type. */
|
||||
Elf32_Half e_machine; /* Machine architecture. */
|
||||
Elf32_Word e_version; /* ELF format version. */
|
||||
Elf32_Addr e_entry; /* Entry point. */
|
||||
Elf32_Off e_phoff; /* Program header file offset. */
|
||||
Elf32_Off e_shoff; /* Section header file offset. */
|
||||
Elf32_Word e_flags; /* Architecture-specific flags. */
|
||||
Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||
Elf32_Half e_phentsize; /* Size of program header entry. */
|
||||
Elf32_Half e_phnum; /* Number of program header entries. */
|
||||
Elf32_Half e_shentsize; /* Size of section header entry. */
|
||||
Elf32_Half e_shnum; /* Number of section header entries. */
|
||||
Elf32_Half e_shstrndx; /* Section name strings section. */
|
||||
} Elf32_Ehdr;
|
||||
|
||||
/*
|
||||
* Section header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word sh_name; /* Section name (index into the
|
||||
section header string table). */
|
||||
Elf32_Word sh_type; /* Section type. */
|
||||
Elf32_Word sh_flags; /* Section flags. */
|
||||
Elf32_Addr sh_addr; /* Address in memory image. */
|
||||
Elf32_Off sh_offset; /* Offset in file. */
|
||||
Elf32_Word sh_size; /* Size in bytes. */
|
||||
Elf32_Word sh_link; /* Index of a related section. */
|
||||
Elf32_Word sh_info; /* Depends on section type. */
|
||||
Elf32_Word sh_addralign; /* Alignment in bytes. */
|
||||
Elf32_Word sh_entsize; /* Size of each entry in section. */
|
||||
} Elf32_Shdr;
|
||||
|
||||
/*
|
||||
* Program header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word p_type; /* Entry type. */
|
||||
Elf32_Off p_offset; /* File offset of contents. */
|
||||
Elf32_Addr p_vaddr; /* Virtual address in memory image. */
|
||||
Elf32_Addr p_paddr; /* Physical address (not used). */
|
||||
Elf32_Word p_filesz; /* Size of contents in file. */
|
||||
Elf32_Word p_memsz; /* Size of contents in memory. */
|
||||
Elf32_Word p_flags; /* Access permission flags. */
|
||||
Elf32_Word p_align; /* Alignment in memory and file. */
|
||||
} Elf32_Phdr;
|
||||
|
||||
/*
|
||||
* Dynamic structure. The ".dynamic" section contains an array of them.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Sword d_tag; /* Entry type. */
|
||||
union {
|
||||
Elf32_Word d_val; /* Integer value. */
|
||||
Elf32_Addr d_ptr; /* Address value. */
|
||||
} d_un;
|
||||
} Elf32_Dyn;
|
||||
|
||||
/*
|
||||
* Relocation entries.
|
||||
*/
|
||||
|
||||
/* Relocations that don't need an addend field. */
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||
} Elf32_Rel;
|
||||
|
||||
/* Relocations that need an addend field. */
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||
Elf32_Sword r_addend; /* Addend. */
|
||||
} Elf32_Rela;
|
||||
|
||||
/* Macros for accessing the fields of r_info. */
|
||||
#define ELF32_R_SYM(info) ((info) >> 8)
|
||||
#define ELF32_R_TYPE(info) ((unsigned char)(info))
|
||||
|
||||
/* Macro for constructing r_info from field values. */
|
||||
#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
|
||||
|
||||
/*
|
||||
* Note entry header
|
||||
*/
|
||||
typedef Elf_Note Elf32_Nhdr;
|
||||
|
||||
/*
|
||||
* Move entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf32_Lword m_value; /* symbol value */
|
||||
Elf32_Word m_info; /* size + index */
|
||||
Elf32_Word m_poffset; /* symbol offset */
|
||||
Elf32_Half m_repeat; /* repeat count */
|
||||
Elf32_Half m_stride; /* stride info */
|
||||
} Elf32_Move;
|
||||
|
||||
/*
|
||||
* The macros compose and decompose values for Move.r_info
|
||||
*
|
||||
* sym = ELF32_M_SYM(M.m_info)
|
||||
* size = ELF32_M_SIZE(M.m_info)
|
||||
* M.m_info = ELF32_M_INFO(sym, size)
|
||||
*/
|
||||
#define ELF32_M_SYM(info) ((info)>>8)
|
||||
#define ELF32_M_SIZE(info) ((unsigned char)(info))
|
||||
#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||
|
||||
/*
|
||||
* Hardware/Software capabilities entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf32_Word c_tag; /* how to interpret value */
|
||||
union {
|
||||
Elf32_Word c_val;
|
||||
Elf32_Addr c_ptr;
|
||||
} c_un;
|
||||
} Elf32_Cap;
|
||||
|
||||
/*
|
||||
* Symbol table entries.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word st_name; /* String table index of name. */
|
||||
Elf32_Addr st_value; /* Symbol value. */
|
||||
Elf32_Word st_size; /* Size of associated object. */
|
||||
unsigned char st_info; /* Type and binding information. */
|
||||
unsigned char st_other; /* Reserved (not used). */
|
||||
Elf32_Half st_shndx; /* Section index of symbol. */
|
||||
} Elf32_Sym;
|
||||
|
||||
/* Macros for accessing the fields of st_info. */
|
||||
#define ELF32_ST_BIND(info) ((info) >> 4)
|
||||
#define ELF32_ST_TYPE(info) ((info) & 0xf)
|
||||
|
||||
/* Macro for constructing st_info from field values. */
|
||||
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
|
||||
/* Macro for accessing the fields of st_other. */
|
||||
#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||
|
||||
/* Structures used by Sun & GNU symbol versioning. */
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Half vd_version;
|
||||
Elf32_Half vd_flags;
|
||||
Elf32_Half vd_ndx;
|
||||
Elf32_Half vd_cnt;
|
||||
Elf32_Word vd_hash;
|
||||
Elf32_Word vd_aux;
|
||||
Elf32_Word vd_next;
|
||||
} Elf32_Verdef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word vda_name;
|
||||
Elf32_Word vda_next;
|
||||
} Elf32_Verdaux;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Half vn_version;
|
||||
Elf32_Half vn_cnt;
|
||||
Elf32_Word vn_file;
|
||||
Elf32_Word vn_aux;
|
||||
Elf32_Word vn_next;
|
||||
} Elf32_Verneed;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word vna_hash;
|
||||
Elf32_Half vna_flags;
|
||||
Elf32_Half vna_other;
|
||||
Elf32_Word vna_name;
|
||||
Elf32_Word vna_next;
|
||||
} Elf32_Vernaux;
|
||||
|
||||
typedef Elf32_Half Elf32_Versym;
|
||||
|
||||
typedef struct {
|
||||
Elf32_Half si_boundto; /* direct bindings - symbol bound to */
|
||||
Elf32_Half si_flags; /* per symbol flags */
|
||||
} Elf32_Syminfo;
|
||||
|
||||
#endif /* !_SYS_ELF32_H_ */
|
||||
/** @file
|
||||
Ported ELF include files from FreeBSD
|
||||
|
||||
Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
**/
|
||||
/*-
|
||||
* Copyright (c) 1996-1998 John D. Polstra.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.2 2007/12/03 21:30:36 marius Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ELF32_H_
|
||||
#define _SYS_ELF32_H_ 1
|
||||
|
||||
|
||||
/*
|
||||
* ELF definitions common to all 32-bit architectures.
|
||||
*/
|
||||
|
||||
typedef UINT32 Elf32_Addr;
|
||||
typedef UINT16 Elf32_Half;
|
||||
typedef UINT32 Elf32_Off;
|
||||
typedef INT32 Elf32_Sword;
|
||||
typedef UINT32 Elf32_Word;
|
||||
typedef UINT64 Elf32_Lword;
|
||||
|
||||
typedef Elf32_Word Elf32_Hashelt;
|
||||
|
||||
/* Non-standard class-dependent datatype used for abstraction. */
|
||||
typedef Elf32_Word Elf32_Size;
|
||||
typedef Elf32_Sword Elf32_Ssize;
|
||||
|
||||
/*
|
||||
* ELF header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||
Elf32_Half e_type; /* File type. */
|
||||
Elf32_Half e_machine; /* Machine architecture. */
|
||||
Elf32_Word e_version; /* ELF format version. */
|
||||
Elf32_Addr e_entry; /* Entry point. */
|
||||
Elf32_Off e_phoff; /* Program header file offset. */
|
||||
Elf32_Off e_shoff; /* Section header file offset. */
|
||||
Elf32_Word e_flags; /* Architecture-specific flags. */
|
||||
Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||
Elf32_Half e_phentsize; /* Size of program header entry. */
|
||||
Elf32_Half e_phnum; /* Number of program header entries. */
|
||||
Elf32_Half e_shentsize; /* Size of section header entry. */
|
||||
Elf32_Half e_shnum; /* Number of section header entries. */
|
||||
Elf32_Half e_shstrndx; /* Section name strings section. */
|
||||
} Elf32_Ehdr;
|
||||
|
||||
/*
|
||||
* Section header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word sh_name; /* Section name (index into the
|
||||
section header string table). */
|
||||
Elf32_Word sh_type; /* Section type. */
|
||||
Elf32_Word sh_flags; /* Section flags. */
|
||||
Elf32_Addr sh_addr; /* Address in memory image. */
|
||||
Elf32_Off sh_offset; /* Offset in file. */
|
||||
Elf32_Word sh_size; /* Size in bytes. */
|
||||
Elf32_Word sh_link; /* Index of a related section. */
|
||||
Elf32_Word sh_info; /* Depends on section type. */
|
||||
Elf32_Word sh_addralign; /* Alignment in bytes. */
|
||||
Elf32_Word sh_entsize; /* Size of each entry in section. */
|
||||
} Elf32_Shdr;
|
||||
|
||||
/*
|
||||
* Program header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word p_type; /* Entry type. */
|
||||
Elf32_Off p_offset; /* File offset of contents. */
|
||||
Elf32_Addr p_vaddr; /* Virtual address in memory image. */
|
||||
Elf32_Addr p_paddr; /* Physical address (not used). */
|
||||
Elf32_Word p_filesz; /* Size of contents in file. */
|
||||
Elf32_Word p_memsz; /* Size of contents in memory. */
|
||||
Elf32_Word p_flags; /* Access permission flags. */
|
||||
Elf32_Word p_align; /* Alignment in memory and file. */
|
||||
} Elf32_Phdr;
|
||||
|
||||
/*
|
||||
* Dynamic structure. The ".dynamic" section contains an array of them.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Sword d_tag; /* Entry type. */
|
||||
union {
|
||||
Elf32_Word d_val; /* Integer value. */
|
||||
Elf32_Addr d_ptr; /* Address value. */
|
||||
} d_un;
|
||||
} Elf32_Dyn;
|
||||
|
||||
/*
|
||||
* Relocation entries.
|
||||
*/
|
||||
|
||||
/* Relocations that don't need an addend field. */
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||
} Elf32_Rel;
|
||||
|
||||
/* Relocations that need an addend field. */
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||
Elf32_Sword r_addend; /* Addend. */
|
||||
} Elf32_Rela;
|
||||
|
||||
/* Macros for accessing the fields of r_info. */
|
||||
#define ELF32_R_SYM(info) ((info) >> 8)
|
||||
#define ELF32_R_TYPE(info) ((unsigned char)(info))
|
||||
|
||||
/* Macro for constructing r_info from field values. */
|
||||
#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
|
||||
|
||||
/*
|
||||
* Note entry header
|
||||
*/
|
||||
typedef Elf_Note Elf32_Nhdr;
|
||||
|
||||
/*
|
||||
* Move entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf32_Lword m_value; /* symbol value */
|
||||
Elf32_Word m_info; /* size + index */
|
||||
Elf32_Word m_poffset; /* symbol offset */
|
||||
Elf32_Half m_repeat; /* repeat count */
|
||||
Elf32_Half m_stride; /* stride info */
|
||||
} Elf32_Move;
|
||||
|
||||
/*
|
||||
* The macros compose and decompose values for Move.r_info
|
||||
*
|
||||
* sym = ELF32_M_SYM(M.m_info)
|
||||
* size = ELF32_M_SIZE(M.m_info)
|
||||
* M.m_info = ELF32_M_INFO(sym, size)
|
||||
*/
|
||||
#define ELF32_M_SYM(info) ((info)>>8)
|
||||
#define ELF32_M_SIZE(info) ((unsigned char)(info))
|
||||
#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||
|
||||
/*
|
||||
* Hardware/Software capabilities entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf32_Word c_tag; /* how to interpret value */
|
||||
union {
|
||||
Elf32_Word c_val;
|
||||
Elf32_Addr c_ptr;
|
||||
} c_un;
|
||||
} Elf32_Cap;
|
||||
|
||||
/*
|
||||
* Symbol table entries.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word st_name; /* String table index of name. */
|
||||
Elf32_Addr st_value; /* Symbol value. */
|
||||
Elf32_Word st_size; /* Size of associated object. */
|
||||
unsigned char st_info; /* Type and binding information. */
|
||||
unsigned char st_other; /* Reserved (not used). */
|
||||
Elf32_Half st_shndx; /* Section index of symbol. */
|
||||
} Elf32_Sym;
|
||||
|
||||
/* Macros for accessing the fields of st_info. */
|
||||
#define ELF32_ST_BIND(info) ((info) >> 4)
|
||||
#define ELF32_ST_TYPE(info) ((info) & 0xf)
|
||||
|
||||
/* Macro for constructing st_info from field values. */
|
||||
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
|
||||
/* Macro for accessing the fields of st_other. */
|
||||
#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||
|
||||
/* Structures used by Sun & GNU symbol versioning. */
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Half vd_version;
|
||||
Elf32_Half vd_flags;
|
||||
Elf32_Half vd_ndx;
|
||||
Elf32_Half vd_cnt;
|
||||
Elf32_Word vd_hash;
|
||||
Elf32_Word vd_aux;
|
||||
Elf32_Word vd_next;
|
||||
} Elf32_Verdef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word vda_name;
|
||||
Elf32_Word vda_next;
|
||||
} Elf32_Verdaux;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Half vn_version;
|
||||
Elf32_Half vn_cnt;
|
||||
Elf32_Word vn_file;
|
||||
Elf32_Word vn_aux;
|
||||
Elf32_Word vn_next;
|
||||
} Elf32_Verneed;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word vna_hash;
|
||||
Elf32_Half vna_flags;
|
||||
Elf32_Half vna_other;
|
||||
Elf32_Word vna_name;
|
||||
Elf32_Word vna_next;
|
||||
} Elf32_Vernaux;
|
||||
|
||||
typedef Elf32_Half Elf32_Versym;
|
||||
|
||||
typedef struct {
|
||||
Elf32_Half si_boundto; /* direct bindings - symbol bound to */
|
||||
Elf32_Half si_flags; /* per symbol flags */
|
||||
} Elf32_Syminfo;
|
||||
|
||||
#endif /* !_SYS_ELF32_H_ */
|
||||
|
@@ -1,260 +1,260 @@
|
||||
/** @file
|
||||
Ported ELF include files from FreeBSD
|
||||
|
||||
Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
/*-
|
||||
* Copyright (c) 1996-1998 John D. Polstra.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.2 2007/12/03 21:30:36 marius Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ELF64_H_
|
||||
#define _SYS_ELF64_H_ 1
|
||||
|
||||
|
||||
/*
|
||||
* ELF definitions common to all 64-bit architectures.
|
||||
*/
|
||||
|
||||
typedef UINT64 Elf64_Addr;
|
||||
typedef UINT16 Elf64_Half;
|
||||
typedef UINT64 Elf64_Off;
|
||||
typedef INT32 Elf64_Sword;
|
||||
typedef INT64 Elf64_Sxword;
|
||||
typedef UINT32 Elf64_Word;
|
||||
typedef UINT64 Elf64_Lword;
|
||||
typedef UINT64 Elf64_Xword;
|
||||
|
||||
/*
|
||||
* Types of dynamic symbol hash table bucket and chain elements.
|
||||
*
|
||||
* This is inconsistent among 64 bit architectures, so a machine dependent
|
||||
* typedef is required.
|
||||
*/
|
||||
|
||||
typedef Elf64_Word Elf64_Hashelt;
|
||||
|
||||
/* Non-standard class-dependent datatype used for abstraction. */
|
||||
typedef Elf64_Xword Elf64_Size;
|
||||
typedef Elf64_Sxword Elf64_Ssize;
|
||||
|
||||
/*
|
||||
* ELF header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||
Elf64_Half e_type; /* File type. */
|
||||
Elf64_Half e_machine; /* Machine architecture. */
|
||||
Elf64_Word e_version; /* ELF format version. */
|
||||
Elf64_Addr e_entry; /* Entry point. */
|
||||
Elf64_Off e_phoff; /* Program header file offset. */
|
||||
Elf64_Off e_shoff; /* Section header file offset. */
|
||||
Elf64_Word e_flags; /* Architecture-specific flags. */
|
||||
Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||
Elf64_Half e_phentsize; /* Size of program header entry. */
|
||||
Elf64_Half e_phnum; /* Number of program header entries. */
|
||||
Elf64_Half e_shentsize; /* Size of section header entry. */
|
||||
Elf64_Half e_shnum; /* Number of section header entries. */
|
||||
Elf64_Half e_shstrndx; /* Section name strings section. */
|
||||
} Elf64_Ehdr;
|
||||
|
||||
/*
|
||||
* Section header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word sh_name; /* Section name (index into the
|
||||
section header string table). */
|
||||
Elf64_Word sh_type; /* Section type. */
|
||||
Elf64_Xword sh_flags; /* Section flags. */
|
||||
Elf64_Addr sh_addr; /* Address in memory image. */
|
||||
Elf64_Off sh_offset; /* Offset in file. */
|
||||
Elf64_Xword sh_size; /* Size in bytes. */
|
||||
Elf64_Word sh_link; /* Index of a related section. */
|
||||
Elf64_Word sh_info; /* Depends on section type. */
|
||||
Elf64_Xword sh_addralign; /* Alignment in bytes. */
|
||||
Elf64_Xword sh_entsize; /* Size of each entry in section. */
|
||||
} Elf64_Shdr;
|
||||
|
||||
/*
|
||||
* Program header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word p_type; /* Entry type. */
|
||||
Elf64_Word p_flags; /* Access permission flags. */
|
||||
Elf64_Off p_offset; /* File offset of contents. */
|
||||
Elf64_Addr p_vaddr; /* Virtual address in memory image. */
|
||||
Elf64_Addr p_paddr; /* Physical address (not used). */
|
||||
Elf64_Xword p_filesz; /* Size of contents in file. */
|
||||
Elf64_Xword p_memsz; /* Size of contents in memory. */
|
||||
Elf64_Xword p_align; /* Alignment in memory and file. */
|
||||
} Elf64_Phdr;
|
||||
|
||||
/*
|
||||
* Dynamic structure. The ".dynamic" section contains an array of them.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Sxword d_tag; /* Entry type. */
|
||||
union {
|
||||
Elf64_Xword d_val; /* Integer value. */
|
||||
Elf64_Addr d_ptr; /* Address value. */
|
||||
} d_un;
|
||||
} Elf64_Dyn;
|
||||
|
||||
/*
|
||||
* Relocation entries.
|
||||
*/
|
||||
|
||||
/* Relocations that don't need an addend field. */
|
||||
typedef struct {
|
||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||
} Elf64_Rel;
|
||||
|
||||
/* Relocations that need an addend field. */
|
||||
typedef struct {
|
||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||
Elf64_Sxword r_addend; /* Addend. */
|
||||
} Elf64_Rela;
|
||||
|
||||
/* Macros for accessing the fields of r_info. */
|
||||
#define ELF64_R_SYM(info) ((info) >> 32)
|
||||
#define ELF64_R_TYPE(info) ((info) & 0xffffffffL)
|
||||
|
||||
/* Macro for constructing r_info from field values. */
|
||||
#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL))
|
||||
|
||||
#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40)
|
||||
#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56)
|
||||
#define ELF64_R_TYPE_INFO(data, type) \
|
||||
(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
|
||||
|
||||
/*
|
||||
* Note entry header
|
||||
*/
|
||||
typedef Elf_Note Elf64_Nhdr;
|
||||
|
||||
/*
|
||||
* Move entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf64_Lword m_value; /* symbol value */
|
||||
Elf64_Xword m_info; /* size + index */
|
||||
Elf64_Xword m_poffset; /* symbol offset */
|
||||
Elf64_Half m_repeat; /* repeat count */
|
||||
Elf64_Half m_stride; /* stride info */
|
||||
} Elf64_Move;
|
||||
|
||||
#define ELF64_M_SYM(info) ((info)>>8)
|
||||
#define ELF64_M_SIZE(info) ((unsigned char)(info))
|
||||
#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||
|
||||
/*
|
||||
* Hardware/Software capabilities entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf64_Xword c_tag; /* how to interpret value */
|
||||
union {
|
||||
Elf64_Xword c_val;
|
||||
Elf64_Addr c_ptr;
|
||||
} c_un;
|
||||
} Elf64_Cap;
|
||||
|
||||
/*
|
||||
* Symbol table entries.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word st_name; /* String table index of name. */
|
||||
unsigned char st_info; /* Type and binding information. */
|
||||
unsigned char st_other; /* Reserved (not used). */
|
||||
Elf64_Half st_shndx; /* Section index of symbol. */
|
||||
Elf64_Addr st_value; /* Symbol value. */
|
||||
Elf64_Xword st_size; /* Size of associated object. */
|
||||
} Elf64_Sym;
|
||||
|
||||
/* Macros for accessing the fields of st_info. */
|
||||
#define ELF64_ST_BIND(info) ((info) >> 4)
|
||||
#define ELF64_ST_TYPE(info) ((info) & 0xf)
|
||||
|
||||
/* Macro for constructing st_info from field values. */
|
||||
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
|
||||
/* Macro for accessing the fields of st_other. */
|
||||
#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||
|
||||
/* Structures used by Sun & GNU-style symbol versioning. */
|
||||
typedef struct {
|
||||
Elf64_Half vd_version;
|
||||
Elf64_Half vd_flags;
|
||||
Elf64_Half vd_ndx;
|
||||
Elf64_Half vd_cnt;
|
||||
Elf64_Word vd_hash;
|
||||
Elf64_Word vd_aux;
|
||||
Elf64_Word vd_next;
|
||||
} Elf64_Verdef;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word vda_name;
|
||||
Elf64_Word vda_next;
|
||||
} Elf64_Verdaux;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Half vn_version;
|
||||
Elf64_Half vn_cnt;
|
||||
Elf64_Word vn_file;
|
||||
Elf64_Word vn_aux;
|
||||
Elf64_Word vn_next;
|
||||
} Elf64_Verneed;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word vna_hash;
|
||||
Elf64_Half vna_flags;
|
||||
Elf64_Half vna_other;
|
||||
Elf64_Word vna_name;
|
||||
Elf64_Word vna_next;
|
||||
} Elf64_Vernaux;
|
||||
|
||||
typedef Elf64_Half Elf64_Versym;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Half si_boundto; /* direct bindings - symbol bound to */
|
||||
Elf64_Half si_flags; /* per symbol flags */
|
||||
} Elf64_Syminfo;
|
||||
|
||||
#endif /* !_SYS_ELF64_H_ */
|
||||
/** @file
|
||||
Ported ELF include files from FreeBSD
|
||||
|
||||
Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
/*-
|
||||
* Copyright (c) 1996-1998 John D. Polstra.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.2 2007/12/03 21:30:36 marius Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ELF64_H_
|
||||
#define _SYS_ELF64_H_ 1
|
||||
|
||||
|
||||
/*
|
||||
* ELF definitions common to all 64-bit architectures.
|
||||
*/
|
||||
|
||||
typedef UINT64 Elf64_Addr;
|
||||
typedef UINT16 Elf64_Half;
|
||||
typedef UINT64 Elf64_Off;
|
||||
typedef INT32 Elf64_Sword;
|
||||
typedef INT64 Elf64_Sxword;
|
||||
typedef UINT32 Elf64_Word;
|
||||
typedef UINT64 Elf64_Lword;
|
||||
typedef UINT64 Elf64_Xword;
|
||||
|
||||
/*
|
||||
* Types of dynamic symbol hash table bucket and chain elements.
|
||||
*
|
||||
* This is inconsistent among 64 bit architectures, so a machine dependent
|
||||
* typedef is required.
|
||||
*/
|
||||
|
||||
typedef Elf64_Word Elf64_Hashelt;
|
||||
|
||||
/* Non-standard class-dependent datatype used for abstraction. */
|
||||
typedef Elf64_Xword Elf64_Size;
|
||||
typedef Elf64_Sxword Elf64_Ssize;
|
||||
|
||||
/*
|
||||
* ELF header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||
Elf64_Half e_type; /* File type. */
|
||||
Elf64_Half e_machine; /* Machine architecture. */
|
||||
Elf64_Word e_version; /* ELF format version. */
|
||||
Elf64_Addr e_entry; /* Entry point. */
|
||||
Elf64_Off e_phoff; /* Program header file offset. */
|
||||
Elf64_Off e_shoff; /* Section header file offset. */
|
||||
Elf64_Word e_flags; /* Architecture-specific flags. */
|
||||
Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||
Elf64_Half e_phentsize; /* Size of program header entry. */
|
||||
Elf64_Half e_phnum; /* Number of program header entries. */
|
||||
Elf64_Half e_shentsize; /* Size of section header entry. */
|
||||
Elf64_Half e_shnum; /* Number of section header entries. */
|
||||
Elf64_Half e_shstrndx; /* Section name strings section. */
|
||||
} Elf64_Ehdr;
|
||||
|
||||
/*
|
||||
* Section header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word sh_name; /* Section name (index into the
|
||||
section header string table). */
|
||||
Elf64_Word sh_type; /* Section type. */
|
||||
Elf64_Xword sh_flags; /* Section flags. */
|
||||
Elf64_Addr sh_addr; /* Address in memory image. */
|
||||
Elf64_Off sh_offset; /* Offset in file. */
|
||||
Elf64_Xword sh_size; /* Size in bytes. */
|
||||
Elf64_Word sh_link; /* Index of a related section. */
|
||||
Elf64_Word sh_info; /* Depends on section type. */
|
||||
Elf64_Xword sh_addralign; /* Alignment in bytes. */
|
||||
Elf64_Xword sh_entsize; /* Size of each entry in section. */
|
||||
} Elf64_Shdr;
|
||||
|
||||
/*
|
||||
* Program header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word p_type; /* Entry type. */
|
||||
Elf64_Word p_flags; /* Access permission flags. */
|
||||
Elf64_Off p_offset; /* File offset of contents. */
|
||||
Elf64_Addr p_vaddr; /* Virtual address in memory image. */
|
||||
Elf64_Addr p_paddr; /* Physical address (not used). */
|
||||
Elf64_Xword p_filesz; /* Size of contents in file. */
|
||||
Elf64_Xword p_memsz; /* Size of contents in memory. */
|
||||
Elf64_Xword p_align; /* Alignment in memory and file. */
|
||||
} Elf64_Phdr;
|
||||
|
||||
/*
|
||||
* Dynamic structure. The ".dynamic" section contains an array of them.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Sxword d_tag; /* Entry type. */
|
||||
union {
|
||||
Elf64_Xword d_val; /* Integer value. */
|
||||
Elf64_Addr d_ptr; /* Address value. */
|
||||
} d_un;
|
||||
} Elf64_Dyn;
|
||||
|
||||
/*
|
||||
* Relocation entries.
|
||||
*/
|
||||
|
||||
/* Relocations that don't need an addend field. */
|
||||
typedef struct {
|
||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||
} Elf64_Rel;
|
||||
|
||||
/* Relocations that need an addend field. */
|
||||
typedef struct {
|
||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||
Elf64_Sxword r_addend; /* Addend. */
|
||||
} Elf64_Rela;
|
||||
|
||||
/* Macros for accessing the fields of r_info. */
|
||||
#define ELF64_R_SYM(info) ((info) >> 32)
|
||||
#define ELF64_R_TYPE(info) ((info) & 0xffffffffL)
|
||||
|
||||
/* Macro for constructing r_info from field values. */
|
||||
#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL))
|
||||
|
||||
#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40)
|
||||
#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56)
|
||||
#define ELF64_R_TYPE_INFO(data, type) \
|
||||
(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
|
||||
|
||||
/*
|
||||
* Note entry header
|
||||
*/
|
||||
typedef Elf_Note Elf64_Nhdr;
|
||||
|
||||
/*
|
||||
* Move entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf64_Lword m_value; /* symbol value */
|
||||
Elf64_Xword m_info; /* size + index */
|
||||
Elf64_Xword m_poffset; /* symbol offset */
|
||||
Elf64_Half m_repeat; /* repeat count */
|
||||
Elf64_Half m_stride; /* stride info */
|
||||
} Elf64_Move;
|
||||
|
||||
#define ELF64_M_SYM(info) ((info)>>8)
|
||||
#define ELF64_M_SIZE(info) ((unsigned char)(info))
|
||||
#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||
|
||||
/*
|
||||
* Hardware/Software capabilities entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf64_Xword c_tag; /* how to interpret value */
|
||||
union {
|
||||
Elf64_Xword c_val;
|
||||
Elf64_Addr c_ptr;
|
||||
} c_un;
|
||||
} Elf64_Cap;
|
||||
|
||||
/*
|
||||
* Symbol table entries.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word st_name; /* String table index of name. */
|
||||
unsigned char st_info; /* Type and binding information. */
|
||||
unsigned char st_other; /* Reserved (not used). */
|
||||
Elf64_Half st_shndx; /* Section index of symbol. */
|
||||
Elf64_Addr st_value; /* Symbol value. */
|
||||
Elf64_Xword st_size; /* Size of associated object. */
|
||||
} Elf64_Sym;
|
||||
|
||||
/* Macros for accessing the fields of st_info. */
|
||||
#define ELF64_ST_BIND(info) ((info) >> 4)
|
||||
#define ELF64_ST_TYPE(info) ((info) & 0xf)
|
||||
|
||||
/* Macro for constructing st_info from field values. */
|
||||
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
|
||||
/* Macro for accessing the fields of st_other. */
|
||||
#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||
|
||||
/* Structures used by Sun & GNU-style symbol versioning. */
|
||||
typedef struct {
|
||||
Elf64_Half vd_version;
|
||||
Elf64_Half vd_flags;
|
||||
Elf64_Half vd_ndx;
|
||||
Elf64_Half vd_cnt;
|
||||
Elf64_Word vd_hash;
|
||||
Elf64_Word vd_aux;
|
||||
Elf64_Word vd_next;
|
||||
} Elf64_Verdef;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word vda_name;
|
||||
Elf64_Word vda_next;
|
||||
} Elf64_Verdaux;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Half vn_version;
|
||||
Elf64_Half vn_cnt;
|
||||
Elf64_Word vn_file;
|
||||
Elf64_Word vn_aux;
|
||||
Elf64_Word vn_next;
|
||||
} Elf64_Verneed;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word vna_hash;
|
||||
Elf64_Half vna_flags;
|
||||
Elf64_Half vna_other;
|
||||
Elf64_Word vna_name;
|
||||
Elf64_Word vna_next;
|
||||
} Elf64_Vernaux;
|
||||
|
||||
typedef Elf64_Half Elf64_Versym;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Half si_boundto; /* direct bindings - symbol bound to */
|
||||
Elf64_Half si_flags; /* per symbol flags */
|
||||
} Elf64_Syminfo;
|
||||
|
||||
#endif /* !_SYS_ELF64_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,158 +1,158 @@
|
||||
/** @file
|
||||
Processor or Compiler specific defines and types for ARM.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PROCESSOR_BIND_H__
|
||||
#define __PROCESSOR_BIND_H__
|
||||
|
||||
///
|
||||
/// Define the processor type so other code can make processor based choices
|
||||
///
|
||||
#define MDE_CPU_ARM
|
||||
|
||||
//
|
||||
// Make sure we are using the correct packing rules per EFI specification
|
||||
//
|
||||
#ifndef __GNUC__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#if _MSC_EXTENSIONS
|
||||
//
|
||||
// use Microsoft* C complier dependent integer width types
|
||||
//
|
||||
typedef unsigned __int64 UINT64;
|
||||
typedef __int64 INT64;
|
||||
typedef unsigned __int32 UINT32;
|
||||
typedef __int32 INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
#else
|
||||
//
|
||||
// Assume standard ARM alignment.
|
||||
//
|
||||
typedef unsigned long long UINT64;
|
||||
typedef long long INT64;
|
||||
typedef unsigned int UINT32;
|
||||
typedef int INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
|
||||
#define UINT8_MAX 0xff
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||
/// 8 bytes on supported 64-bit processor instructions)
|
||||
///
|
||||
typedef UINT32 UINTN;
|
||||
|
||||
///
|
||||
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||
/// 8 bytes on supported 64-bit processor instructions)
|
||||
///
|
||||
typedef INT32 INTN;
|
||||
|
||||
//
|
||||
// Processor specific defines
|
||||
//
|
||||
|
||||
///
|
||||
/// A value of native width with the highest bit set.
|
||||
///
|
||||
#define MAX_BIT 0x80000000
|
||||
|
||||
///
|
||||
/// A value of native width with the two highest bits set.
|
||||
///
|
||||
#define MAX_2_BITS 0xC0000000
|
||||
|
||||
///
|
||||
/// Maximum legal ARM address
|
||||
///
|
||||
#define MAX_ADDRESS 0xFFFFFFFF
|
||||
|
||||
///
|
||||
/// The stack alignment required for ARM
|
||||
///
|
||||
#define CPU_STACK_ALIGNMENT sizeof(UINT64)
|
||||
|
||||
//
|
||||
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
||||
// use the correct C calling convention. All protocol member functions and
|
||||
// EFI intrinsics are required to modify their member functions with EFIAPI.
|
||||
//
|
||||
#define EFIAPI
|
||||
|
||||
#if defined(__GNUC__)
|
||||
///
|
||||
/// For GNU assembly code, .global or .globl can declare global symbols.
|
||||
/// Define this macro to unify the usage.
|
||||
///
|
||||
#define ASM_GLOBAL .globl
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
///
|
||||
/// ARM EABI defines that the linker should not manipulate call relocations
|
||||
/// (do bl/blx conversion) unless the target symbol has function type.
|
||||
/// CodeSourcery 2010.09 started requiring the .type to function properly
|
||||
///
|
||||
#define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
|
||||
|
||||
#define GCC_ASM_EXPORT(func__) \
|
||||
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
|
||||
.type ASM_PFX(func__), %function
|
||||
|
||||
#define GCC_ASM_IMPORT(func__) \
|
||||
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
|
||||
|
||||
#else
|
||||
//
|
||||
// .type not supported by Apple Xcode tools
|
||||
//
|
||||
#define INTERWORK_FUNC(func__)
|
||||
|
||||
#define GCC_ASM_EXPORT(func__) \
|
||||
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
|
||||
|
||||
#define GCC_ASM_IMPORT(name)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
Return the pointer to the first instruction of a function given a function pointer.
|
||||
On ARM CPU architectures, these two pointer values are the same,
|
||||
so the implementation of this macro is very simple.
|
||||
|
||||
@param FunctionPointer A pointer to a function.
|
||||
|
||||
@return The pointer to the first instruction of a function given a function pointer.
|
||||
|
||||
**/
|
||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/** @file
|
||||
Processor or Compiler specific defines and types for ARM.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PROCESSOR_BIND_H__
|
||||
#define __PROCESSOR_BIND_H__
|
||||
|
||||
///
|
||||
/// Define the processor type so other code can make processor based choices
|
||||
///
|
||||
#define MDE_CPU_ARM
|
||||
|
||||
//
|
||||
// Make sure we are using the correct packing rules per EFI specification
|
||||
//
|
||||
#ifndef __GNUC__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#if _MSC_EXTENSIONS
|
||||
//
|
||||
// use Microsoft* C complier dependent integer width types
|
||||
//
|
||||
typedef unsigned __int64 UINT64;
|
||||
typedef __int64 INT64;
|
||||
typedef unsigned __int32 UINT32;
|
||||
typedef __int32 INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
#else
|
||||
//
|
||||
// Assume standard ARM alignment.
|
||||
//
|
||||
typedef unsigned long long UINT64;
|
||||
typedef long long INT64;
|
||||
typedef unsigned int UINT32;
|
||||
typedef int INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
|
||||
#define UINT8_MAX 0xff
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||
/// 8 bytes on supported 64-bit processor instructions)
|
||||
///
|
||||
typedef UINT32 UINTN;
|
||||
|
||||
///
|
||||
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||
/// 8 bytes on supported 64-bit processor instructions)
|
||||
///
|
||||
typedef INT32 INTN;
|
||||
|
||||
//
|
||||
// Processor specific defines
|
||||
//
|
||||
|
||||
///
|
||||
/// A value of native width with the highest bit set.
|
||||
///
|
||||
#define MAX_BIT 0x80000000
|
||||
|
||||
///
|
||||
/// A value of native width with the two highest bits set.
|
||||
///
|
||||
#define MAX_2_BITS 0xC0000000
|
||||
|
||||
///
|
||||
/// Maximum legal ARM address
|
||||
///
|
||||
#define MAX_ADDRESS 0xFFFFFFFF
|
||||
|
||||
///
|
||||
/// The stack alignment required for ARM
|
||||
///
|
||||
#define CPU_STACK_ALIGNMENT sizeof(UINT64)
|
||||
|
||||
//
|
||||
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
||||
// use the correct C calling convention. All protocol member functions and
|
||||
// EFI intrinsics are required to modify their member functions with EFIAPI.
|
||||
//
|
||||
#define EFIAPI
|
||||
|
||||
#if defined(__GNUC__)
|
||||
///
|
||||
/// For GNU assembly code, .global or .globl can declare global symbols.
|
||||
/// Define this macro to unify the usage.
|
||||
///
|
||||
#define ASM_GLOBAL .globl
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
///
|
||||
/// ARM EABI defines that the linker should not manipulate call relocations
|
||||
/// (do bl/blx conversion) unless the target symbol has function type.
|
||||
/// CodeSourcery 2010.09 started requiring the .type to function properly
|
||||
///
|
||||
#define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
|
||||
|
||||
#define GCC_ASM_EXPORT(func__) \
|
||||
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
|
||||
.type ASM_PFX(func__), %function
|
||||
|
||||
#define GCC_ASM_IMPORT(func__) \
|
||||
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
|
||||
|
||||
#else
|
||||
//
|
||||
// .type not supported by Apple Xcode tools
|
||||
//
|
||||
#define INTERWORK_FUNC(func__)
|
||||
|
||||
#define GCC_ASM_EXPORT(func__) \
|
||||
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
|
||||
|
||||
#define GCC_ASM_IMPORT(name)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
Return the pointer to the first instruction of a function given a function pointer.
|
||||
On ARM CPU architectures, these two pointer values are the same,
|
||||
so the implementation of this macro is very simple.
|
||||
|
||||
@param FunctionPointer A pointer to a function.
|
||||
|
||||
@return The pointer to the first instruction of a function given a function pointer.
|
||||
|
||||
**/
|
||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -14,4 +14,4 @@
|
||||
|
||||
**/
|
||||
|
||||
#define __BUILD_VERSION "Build 2640"
|
||||
#define __BUILD_VERSION "Build 2649"
|
||||
|
@@ -7,7 +7,7 @@
|
||||
@REM # http://opensource.org/licenses/bsd-license.php
|
||||
@REM #
|
||||
@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
|
||||
@echo off
|
||||
|
@@ -1,27 +1,27 @@
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
|
||||
MAKEROOT ?= ../..
|
||||
|
||||
include $(MAKEROOT)/Makefiles/header.makefile
|
||||
|
||||
APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
|
||||
|
||||
.PHONY:all
|
||||
all: $(MAKEROOT)/bin $(APPLICATION)
|
||||
|
||||
$(APPLICATION): $(OBJECTS)
|
||||
$(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
|
||||
|
||||
$(OBJECTS): ../Include/Common/BuildVersion.h
|
||||
|
||||
include $(MAKEROOT)/Makefiles/footer.makefile
|
||||
## @file
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
|
||||
MAKEROOT ?= ../..
|
||||
|
||||
include $(MAKEROOT)/Makefiles/header.makefile
|
||||
|
||||
APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
|
||||
|
||||
.PHONY:all
|
||||
all: $(MAKEROOT)/bin $(APPLICATION)
|
||||
|
||||
$(APPLICATION): $(OBJECTS)
|
||||
$(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs $(LIBS)
|
||||
|
||||
$(OBJECTS): ../Include/Common/BuildVersion.h
|
||||
|
||||
include $(MAKEROOT)/Makefiles/footer.makefile
|
||||
|
@@ -7,28 +7,28 @@
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
DEPFILES = $(OBJECTS:%.o=%.d)
|
||||
|
||||
$(MAKEROOT)/libs-$(ARCH):
|
||||
mkdir -p $(MAKEROOT)/libs-$(ARCH)
|
||||
|
||||
.PHONY: install
|
||||
install: $(MAKEROOT)/libs-$(ARCH) $(LIBRARY)
|
||||
cp $(LIBRARY) $(MAKEROOT)/libs-$(ARCH)
|
||||
|
||||
$(LIBRARY): $(OBJECTS)
|
||||
$(AR) crs $@ $^
|
||||
|
||||
%.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
%.o : %.S
|
||||
$(AS) -c $(ASFLAGS) $< -o $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@rm -f $(OBJECTS) $(LIBRARY) $(DEPFILES)
|
||||
|
||||
-include $(DEPFILES)
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
DEPFILES = $(OBJECTS:%.o=%.d)
|
||||
|
||||
$(MAKEROOT)/libs-$(ARCH):
|
||||
mkdir -p $(MAKEROOT)/libs-$(ARCH)
|
||||
|
||||
.PHONY: install
|
||||
install: $(MAKEROOT)/libs-$(ARCH) $(LIBRARY)
|
||||
cp $(LIBRARY) $(MAKEROOT)/libs-$(ARCH)
|
||||
|
||||
$(LIBRARY): $(OBJECTS)
|
||||
$(AR) crs $@ $^
|
||||
|
||||
%.o : %.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
%.o : %.S
|
||||
$(AS) -c $(ASFLAGS) $< -o $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@rm -f $(OBJECTS) $(LIBRARY) $(DEPFILES)
|
||||
|
||||
-include $(DEPFILES)
|
||||
|
@@ -7,28 +7,28 @@
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
APPLICATION = $(BIN_PATH)\$(APPNAME).exe
|
||||
|
||||
all: $(APPLICATION)
|
||||
|
||||
$(APPLICATION) : $(OBJECTS)
|
||||
-@if not exist $(BIN_PATH) mkdir $(BIN_PATH)
|
||||
$(LD) /nologo /debug /incremental:no /nodefaultlib:libc.lib /out:$@ $(LIBS) $**
|
||||
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
APPLICATION = $(BIN_PATH)\$(APPNAME).exe
|
||||
|
||||
all: $(APPLICATION)
|
||||
|
||||
$(APPLICATION) : $(OBJECTS)
|
||||
-@if not exist $(BIN_PATH) mkdir $(BIN_PATH)
|
||||
$(LD) /nologo /debug /incremental:no /nodefaultlib:libc.lib /out:$@ $(LIBS) $**
|
||||
|
||||
$(OBJECTS) : ..\Include\Common\BuildVersion.h
|
||||
|
||||
.PHONY:clean
|
||||
.PHONY:cleanall
|
||||
|
||||
clean:
|
||||
del /f /q $(OBJECTS) *.pdb > nul
|
||||
|
||||
cleanall:
|
||||
del /f /q $(OBJECTS) $(APPLICATION) *.pdb $(BIN_PATH)\*.pdb > nul
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.rule
|
||||
|
||||
.PHONY:clean
|
||||
.PHONY:cleanall
|
||||
|
||||
clean:
|
||||
del /f /q $(OBJECTS) *.pdb > nul
|
||||
|
||||
cleanall:
|
||||
del /f /q $(OBJECTS) $(APPLICATION) *.pdb $(BIN_PATH)\*.pdb > nul
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.rule
|
||||
|
||||
|
@@ -7,54 +7,54 @@
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!IFNDEF EDK_TOOLS_PATH
|
||||
!ERROR "Please set your EDK_TOOLS_PATH!"
|
||||
!ENDIF
|
||||
|
||||
!IFNDEF BASE_TOOLS_PATH
|
||||
!ERROR "BASE_TOOLS_PATH is not set! Please run build_tools.bat at first!"
|
||||
!ENDIF
|
||||
|
||||
!IFNDEF ARCH
|
||||
ARCH = IA32
|
||||
!ENDIF
|
||||
|
||||
MAKE = nmake -nologo
|
||||
|
||||
SOURCE_PATH = $(BASE_TOOLS_PATH)\Source\C
|
||||
BIN_PATH = $(BASE_TOOLS_PATH)\Bin
|
||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib
|
||||
|
||||
SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin
|
||||
SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib
|
||||
|
||||
!IF "$(ARCH)"=="IA32"
|
||||
ARCH_INCLUDE = $(SOURCE_PATH)\Include\Ia32
|
||||
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32
|
||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
|
||||
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
|
||||
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
|
||||
!ENDIF
|
||||
|
||||
!IF "$(ARCH)"=="X64"
|
||||
ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64
|
||||
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
|
||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
|
||||
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
|
||||
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
|
||||
!ENDIF
|
||||
|
||||
CC = cl.exe
|
||||
CXX = cl.exe
|
||||
AS = ml.exe
|
||||
AR = lib.exe
|
||||
LD = link.exe
|
||||
LINKER = $(LD)
|
||||
|
||||
INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
|
||||
|
||||
CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
||||
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
||||
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!IFNDEF EDK_TOOLS_PATH
|
||||
!ERROR "Please set your EDK_TOOLS_PATH!"
|
||||
!ENDIF
|
||||
|
||||
!IFNDEF BASE_TOOLS_PATH
|
||||
!ERROR "BASE_TOOLS_PATH is not set! Please run build_tools.bat at first!"
|
||||
!ENDIF
|
||||
|
||||
!IFNDEF ARCH
|
||||
ARCH = IA32
|
||||
!ENDIF
|
||||
|
||||
MAKE = nmake -nologo
|
||||
|
||||
SOURCE_PATH = $(BASE_TOOLS_PATH)\Source\C
|
||||
BIN_PATH = $(BASE_TOOLS_PATH)\Bin
|
||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib
|
||||
|
||||
SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin
|
||||
SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib
|
||||
|
||||
!IF "$(ARCH)"=="IA32"
|
||||
ARCH_INCLUDE = $(SOURCE_PATH)\Include\Ia32
|
||||
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32
|
||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
|
||||
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
|
||||
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
|
||||
!ENDIF
|
||||
|
||||
!IF "$(ARCH)"=="X64"
|
||||
ARCH_INCLUDE = $(SOURCE_PATH)\Include\X64
|
||||
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
|
||||
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
|
||||
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
|
||||
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
|
||||
!ENDIF
|
||||
|
||||
CC = cl.exe
|
||||
CXX = cl.exe
|
||||
AS = ml.exe
|
||||
AR = lib.exe
|
||||
LD = link.exe
|
||||
LINKER = $(LD)
|
||||
|
||||
INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
|
||||
|
||||
CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
||||
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
|
||||
|
||||
|
@@ -7,25 +7,25 @@
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
LIBRARY = $(LIB_PATH)\$(LIBNAME).lib
|
||||
|
||||
all: $(LIBRARY)
|
||||
|
||||
$(LIBRARY) : $(OBJECTS)
|
||||
-@if not exist $(LIB_PATH) mkdir $(LIB_PATH)
|
||||
$(AR) /nologo /out:$@ $**
|
||||
|
||||
.PHONY:clean
|
||||
clean:
|
||||
del /f /q $(OBJECTS) *.pdb > nul
|
||||
|
||||
.PHONY:cleanall
|
||||
cleanall:
|
||||
del /f /q $(OBJECTS) $(LIBRARY) *.pdb > nul
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.rule
|
||||
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
LIBRARY = $(LIB_PATH)\$(LIBNAME).lib
|
||||
|
||||
all: $(LIBRARY)
|
||||
|
||||
$(LIBRARY) : $(OBJECTS)
|
||||
-@if not exist $(LIB_PATH) mkdir $(LIB_PATH)
|
||||
$(AR) /nologo /out:$@ $**
|
||||
|
||||
.PHONY:clean
|
||||
clean:
|
||||
del /f /q $(OBJECTS) *.pdb > nul
|
||||
|
||||
.PHONY:cleanall
|
||||
cleanall:
|
||||
del /f /q $(OBJECTS) $(LIBRARY) *.pdb > nul
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.rule
|
||||
|
||||
|
@@ -7,18 +7,18 @@
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
#DEPFILES = $(OBJECTS:%.o=%.d)
|
||||
|
||||
.c.obj :
|
||||
$(CC) -c $(CFLAGS) $(INC) $< -Fo$@
|
||||
|
||||
.S.obj :
|
||||
$(AS) -c $(ASFLAGS) $< -Fo$@
|
||||
|
||||
.cpp.obj :
|
||||
$(CXX) -c $(CPPFLAGS) $(INC) $< -Fo$@
|
||||
|
||||
#-include $(DEPFILES)
|
||||
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
#DEPFILES = $(OBJECTS:%.o=%.d)
|
||||
|
||||
.c.obj :
|
||||
$(CC) -c $(CFLAGS) $(INC) $< -Fo$@
|
||||
|
||||
.S.obj :
|
||||
$(AS) -c $(ASFLAGS) $< -Fo$@
|
||||
|
||||
.cpp.obj :
|
||||
$(CXX) -c $(CPPFLAGS) $(INC) $< -Fo$@
|
||||
|
||||
#-include $(DEPFILES)
|
||||
|
||||
|
@@ -7,17 +7,17 @@
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
APPNAME = GenSec
|
||||
|
||||
LIBS = $(LIB_PATH)\Common.lib
|
||||
|
||||
OBJECTS = GenSec.obj
|
||||
|
||||
#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.app
|
||||
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
APPNAME = GenSec
|
||||
|
||||
LIBS = $(LIB_PATH)\Common.lib
|
||||
|
||||
OBJECTS = GenSec.obj
|
||||
|
||||
#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.app
|
||||
|
||||
|
@@ -7,17 +7,17 @@
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
#
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
APPNAME = GenSec
|
||||
|
||||
LIBS = $(LIB_PATH)\Common.lib
|
||||
|
||||
OBJECTS = PyUtility.obj
|
||||
|
||||
#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.app
|
||||
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.common
|
||||
|
||||
APPNAME = GenSec
|
||||
|
||||
LIBS = $(LIB_PATH)\Common.lib
|
||||
|
||||
OBJECTS = PyUtility.obj
|
||||
|
||||
#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
|
||||
|
||||
!INCLUDE ..\Makefiles\ms.app
|
||||
|
||||
|
@@ -82,7 +82,7 @@ SPendingAssign::AssignValue (
|
||||
IN UINT32 Len
|
||||
)
|
||||
{
|
||||
memcpy (mAddr, Addr, (mLen < Len ? mLen : Len));
|
||||
memmove (mAddr, Addr, (mLen < Len ? mLen : Len));
|
||||
mFlag = ASSIGNED;
|
||||
}
|
||||
|
||||
@@ -685,7 +685,7 @@ CFormPkg::AdjustDynamicInsertOpcode (
|
||||
//
|
||||
// Override the restore buffer data.
|
||||
//
|
||||
memcpy (LastFormEndAddr, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
|
||||
memmove (LastFormEndAddr, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
|
||||
InsertOpcodeNode->mBufferFree -= NeedRestoreCodeLen;
|
||||
memset (InsertOpcodeNode->mBufferFree, 0, NeedRestoreCodeLen);
|
||||
} else {
|
||||
@@ -733,7 +733,7 @@ CFormPkg::AdjustDynamicInsertOpcode (
|
||||
//
|
||||
// Override the restore buffer data.
|
||||
//
|
||||
memcpy (InsertOpcodeNode->mBufferStart, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
|
||||
memmove (InsertOpcodeNode->mBufferStart, InsertOpcodeAddr, InsertOpcodeNode->mBufferFree - InsertOpcodeAddr);
|
||||
InsertOpcodeNode->mBufferFree -= InsertOpcodeAddr - InsertOpcodeNode->mBufferStart;
|
||||
|
||||
//
|
||||
@@ -1542,7 +1542,7 @@ CIfrObj::_EMIT_PENDING_OBJ (
|
||||
//
|
||||
ObjBinBuf = gCFormPkg.IfrBinBufferGet (mObjBinLen);
|
||||
if (ObjBinBuf != NULL) {
|
||||
memcpy (ObjBinBuf, mObjBinBuf, mObjBinLen);
|
||||
memmove (ObjBinBuf, mObjBinBuf, mObjBinLen);
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -368,7 +368,7 @@ public:
|
||||
VOID VARSTORE_INFO (OUT EFI_VARSTORE_INFO *Info) {
|
||||
if (Info != NULL) {
|
||||
Info->mVarStoreId = mHeader->VarStoreId;
|
||||
memcpy (&Info->mVarStoreId, &mHeader->VarStoreInfo, sizeof (Info->mVarStoreId));
|
||||
memmove (&Info->mVarStoreId, &mHeader->VarStoreInfo, sizeof (Info->mVarStoreId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ public:
|
||||
}
|
||||
|
||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||
memcpy (&mFormSet->Guid, Guid, sizeof (EFI_GUID));
|
||||
memmove (&mFormSet->Guid, Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
VOID SetFormSetTitle (IN EFI_STRING_ID FormSetTitle) {
|
||||
@@ -627,7 +627,7 @@ public:
|
||||
}
|
||||
|
||||
VOID SetClassGuid (IN EFI_GUID *Guid) {
|
||||
memcpy (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID));
|
||||
memmove (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
UINT8 GetFlags() {
|
||||
@@ -749,7 +749,7 @@ public:
|
||||
IncLength (sizeof (EFI_IFR_FORM_MAP_METHOD));
|
||||
|
||||
mMethodMap->MethodTitle = MethodTitle;
|
||||
memcpy (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID));
|
||||
memmove (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID));
|
||||
mMethodMap ++;
|
||||
}
|
||||
}
|
||||
@@ -769,7 +769,7 @@ public:
|
||||
}
|
||||
|
||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||
memcpy (&mVarStore->Guid, Guid, sizeof (EFI_GUID));
|
||||
memmove (&mVarStore->Guid, Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
VOID SetVarStoreId (IN EFI_VARSTORE_ID VarStoreId) {
|
||||
@@ -809,7 +809,7 @@ public:
|
||||
}
|
||||
|
||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||
memcpy (&mVarStoreEfi->Guid, Guid, sizeof (EFI_GUID));
|
||||
memmove (&mVarStoreEfi->Guid, Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
VOID SetVarStoreId (IN UINT16 VarStoreId) {
|
||||
@@ -863,7 +863,7 @@ public:
|
||||
}
|
||||
|
||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||
memcpy (&mVarStoreNameValue->Guid, Guid, sizeof (EFI_GUID));
|
||||
memmove (&mVarStoreNameValue->Guid, Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
VOID SetVarStoreId (IN UINT16 VarStoreId) {
|
||||
@@ -938,7 +938,7 @@ public:
|
||||
CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header, Size) {
|
||||
mDefault->Type = Type;
|
||||
mDefault->DefaultId = DefaultId;
|
||||
memcpy (&(mDefault->Value), &Value, Size - OFFSET_OF (EFI_IFR_DEFAULT, Value));
|
||||
memmove (&(mDefault->Value), &Value, Size - OFFSET_OF (EFI_IFR_DEFAULT, Value));
|
||||
}
|
||||
|
||||
VOID SetDefaultId (IN UINT16 DefaultId) {
|
||||
@@ -950,7 +950,7 @@ public:
|
||||
}
|
||||
|
||||
VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
|
||||
memcpy (&mDefault->Value, &Value, mDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value));
|
||||
memmove (&mDefault->Value, &Value, mDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1673,7 +1673,7 @@ public:
|
||||
}
|
||||
|
||||
VOID SetRefreshEventGroutId (IN EFI_GUID *RefreshEventGroupId) {
|
||||
memcpy (&mRefreshId->RefreshEventGroupId, RefreshEventGroupId, sizeof (EFI_GUID));
|
||||
memmove (&mRefreshId->RefreshEventGroupId, RefreshEventGroupId, sizeof (EFI_GUID));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1755,7 +1755,7 @@ public:
|
||||
}
|
||||
|
||||
VOID SetValue (IN EFI_IFR_TYPE_VALUE Value) {
|
||||
memcpy (&mOneOfOption->Value, &Value, mOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
|
||||
memmove (&mOneOfOption->Value, &Value, mOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));
|
||||
}
|
||||
|
||||
UINT8 GetFlags (VOID) {
|
||||
@@ -1904,11 +1904,11 @@ public:
|
||||
}
|
||||
|
||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||
memcpy (&mGuid->Guid, Guid, sizeof (EFI_GUID));
|
||||
memmove (&mGuid->Guid, Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
VOID SetData (IN UINT8* DataBuff, IN UINT8 Size) {
|
||||
memcpy ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size);
|
||||
memmove ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2214,7 +2214,7 @@ public:
|
||||
}
|
||||
|
||||
VOID SetPermissions (IN EFI_GUID *Permissions) {
|
||||
memcpy (&mSecurity->Permissions, Permissions, sizeof (EFI_GUID));
|
||||
memmove (&mSecurity->Permissions, Permissions, sizeof (EFI_GUID));
|
||||
}
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,41 +1,41 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
VolInfo.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Local Definitions for the VolInfo utility
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _VOLINFO_H_
|
||||
#define _VOLINFO_H_ 1
|
||||
|
||||
#define PI_SPECIFICATION_VERSION 0x00010000
|
||||
|
||||
#define EFI_DEP_BEFORE 0x00
|
||||
#define EFI_DEP_AFTER 0x01
|
||||
#define EFI_DEP_PUSH 0x02
|
||||
#define EFI_DEP_AND 0x03
|
||||
#define EFI_DEP_OR 0x04
|
||||
#define EFI_DEP_NOT 0x05
|
||||
#define EFI_DEP_TRUE 0x06
|
||||
#define EFI_DEP_FALSE 0x07
|
||||
#define EFI_DEP_END 0x08
|
||||
#define EFI_DEP_SOR 0x09
|
||||
|
||||
#define EFI_SECTION_LAST_LEAF_SECTION_TYPE 0x1B
|
||||
#define EFI_SECTION_LAST_SECTION_TYPE 0x1B
|
||||
|
||||
#endif
|
||||
/** @file
|
||||
|
||||
Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
VolInfo.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Local Definitions for the VolInfo utility
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _VOLINFO_H_
|
||||
#define _VOLINFO_H_ 1
|
||||
|
||||
#define PI_SPECIFICATION_VERSION 0x00010000
|
||||
|
||||
#define EFI_DEP_BEFORE 0x00
|
||||
#define EFI_DEP_AFTER 0x01
|
||||
#define EFI_DEP_PUSH 0x02
|
||||
#define EFI_DEP_AND 0x03
|
||||
#define EFI_DEP_OR 0x04
|
||||
#define EFI_DEP_NOT 0x05
|
||||
#define EFI_DEP_TRUE 0x06
|
||||
#define EFI_DEP_FALSE 0x07
|
||||
#define EFI_DEP_END 0x08
|
||||
#define EFI_DEP_SOR 0x09
|
||||
|
||||
#define EFI_SECTION_LAST_LEAF_SECTION_TYPE 0x1B
|
||||
#define EFI_SECTION_LAST_SECTION_TYPE 0x1B
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user