Home | History | Annotate | Download | only in X64
      1 /*++
      2 
      3 Copyright (c) 2005 - 2006, Intel Corporation. All rights reserved.<BR>
      4 This program and the accompanying materials
      5 are licensed and made available under the terms and conditions of the BSD License
      6 which accompanies this distribution.  The full text of the license may be found at
      7 http://opensource.org/licenses/bsd-license.php
      8 
      9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 
     12 
     13 Module Name:
     14 
     15   PeCoffLoaderEx.c
     16 
     17 Abstract:
     18 
     19   x64 Specific relocation fixups
     20 
     21 Revision History
     22 
     23 --*/
     24 
     25 #include "TianoCommon.h"
     26 #include "EfiImage.h"
     27 
     28 EFI_STATUS
     29 PeCoffLoaderRelocateImageEx (
     30   IN UINT16      *Reloc,
     31   IN OUT CHAR8   *Fixup,
     32   IN OUT CHAR8   **FixupData,
     33   IN UINT64      Adjust
     34   )
     35 /*++
     36 
     37 Routine Description:
     38   Performs an x64 specific relocation fixup
     39 
     40 Arguments:
     41   Reloc      - Pointer to the relocation record
     42   Fixup      - Pointer to the address to fix up
     43   FixupData  - Pointer to a buffer to log the fixups
     44   Adjust     - The offset to adjust the fixup
     45 
     46 Returns:
     47   EFI_UNSUPPORTED - relocate unsupported
     48 
     49 --*/
     50 {
     51   return EFI_UNSUPPORTED;
     52 }
     53 
     54 BOOLEAN
     55 PeCoffLoaderImageFormatSupported (
     56   IN  UINT16  Machine
     57   )
     58 /*++
     59 Routine Description:
     60 
     61   Returns TRUE if the machine type of PE/COFF image is supported. Supported
     62   does not mean the image can be executed it means the PE/COFF loader supports
     63   loading and relocating of the image type. It's up to the caller to support
     64   the entry point.
     65 
     66   This function implies the basic PE/COFF loader/relocator supports IA32, EBC,
     67   & X64 images. Calling the entry point in a correct mannor is up to the
     68   consumer of this library.
     69 
     70 Arguments:
     71 
     72   Machine   - Machine type from the PE Header.
     73 
     74 Returns:
     75 
     76   TRUE      - if this PE/COFF loader can load the image
     77   FALSE     - if this PE/COFF loader cannot load the image
     78 
     79 --*/
     80 {
     81   if ((Machine == EFI_IMAGE_MACHINE_IA32) || (Machine == EFI_IMAGE_MACHINE_X64) ||
     82       (Machine ==  EFI_IMAGE_MACHINE_EBC)) {
     83     return TRUE;
     84   }
     85 
     86   return FALSE;
     87 }
     88