OpenCore  1.0.4
OpenCore Bootloader
1.0.4
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MachoFat.c File Reference
#include <Uefi.h>
#include <IndustryStandard/AppleMachoImage.h>
#include <IndustryStandard/AppleFatBinaryImage.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/DebugLib.h>
#include <Library/OcMachoLib.h>
#include "OcMachoLibInternal.h"

Go to the source code of this file.

Functions

EFI_STATUS FatGetArchitectureOffset (IN CONST UINT8 *Buffer, IN UINT32 BufferSize, IN UINT32 FullSize, IN MACH_CPU_TYPE CpuType, OUT UINT32 *FatOffset, OUT UINT32 *FatSize)
 
EFI_STATUS FatFilterArchitectureByType (IN OUT UINT8 **FileData, IN OUT UINT32 *FileSize, IN MACH_CPU_TYPE CpuType)
 
EFI_STATUS FatFilterArchitecture32 (IN OUT UINT8 **FileData, IN OUT UINT32 *FileSize)
 
EFI_STATUS FatFilterArchitecture64 (IN OUT UINT8 **FileData, IN OUT UINT32 *FileSize)
 

Detailed Description

Copyright (C) 2020, Goldfish64. All rights reserved.

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.

Definition in file MachoFat.c.

Function Documentation

◆ FatFilterArchitecture32()

EFI_STATUS FatFilterArchitecture32 ( IN OUT UINT8 ** FileData,
IN OUT UINT32 * FileSize )

Moves file pointer and size to point to x86 slice in case FAT Mach-O is used.

Parameters
[in,out]FileDataPointer to pointer of the file's data.
[in,out]FileSizePointer to file size of FileData.
Returns
EFI_SUCCESS if no FAT, or a valid 32-bit arch exists.

Definition at line 142 of file MachoFat.c.

◆ FatFilterArchitecture64()

EFI_STATUS FatFilterArchitecture64 ( IN OUT UINT8 ** FileData,
IN OUT UINT32 * FileSize )

Moves file pointer and size to point to x86_64 slice in case FAT Mach-O is used.

Parameters
[in,out]FileDataPointer to pointer of the file's data.
[in,out]FileSizePointer to file size of FileData.
Returns
EFI_SUCCESS if no FAT, or a valid 64-bit arch exists.

Definition at line 151 of file MachoFat.c.

◆ FatFilterArchitectureByType()

EFI_STATUS FatFilterArchitectureByType ( IN OUT UINT8 ** FileData,
IN OUT UINT32 * FileSize,
IN MACH_CPU_TYPE CpuType )

Moves file pointer and size to point to specified slice in case FAT Mach-O is used.

Parameters
[in,out]FileDataPointer to pointer of the file's data.
[in,out]FileSizePointer to file size of FileData.
[in]CpuTypeDesired CPU slice to use.
Returns
EFI_SUCCESS if no FAT, or arch was found in valid FAT image.

Definition at line 116 of file MachoFat.c.

◆ FatGetArchitectureOffset()

EFI_STATUS FatGetArchitectureOffset ( IN CONST UINT8 * Buffer,
IN UINT32 BufferSize,
IN UINT32 FullSize,
IN MACH_CPU_TYPE CpuType,
OUT UINT32 * FatOffset,
OUT UINT32 * FatSize )

Returns offset and size of specified slice in case FAT Mach-O is used. If no FAT is detected, FatOffset and FatSize are set to 0 and FullSize respectively.

Parameters
[in]BufferPointer to the buffer data.
[in]BufferSizeSize of Buffer.
[in]FullSizeFull file size, used to validate sizes within FAT structure.
[in]CpuTypeDesired CPU slice to use.
[out]FatOffsetPointer to offset of FAT slice.
[out]FatSizePointer to size of FAT slice.
Returns
EFI_SUCCESS if no FAT, or arch was found in valid FAT image.

Definition at line 27 of file MachoFat.c.