#define EFI_IMAGE_MACHINE_IA32 0x014c\r
#define EFI_IMAGE_MACHINE_IA64 0x0200\r
#define EFI_IMAGE_MACHINE_X64 0x8664\r
+#define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01c2\r
+\r
//\r
// #define EFI_IMAGE_MACHINE_FCODE 0xfc0d\r
//\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2004 - 2008, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ EfiBind.h\r
+\r
+Abstract:\r
+\r
+ Processor or Compiler specific defines and types for IA-32.\r
+ We are using the ANSI C 2000 _t type definitions for basic types.\r
+ This it technically a violation of the coding standard, but they\r
+ are used to make EfiTypes.h portable. Code other than EfiTypes.h\r
+ should never use any ANSI C 2000 _t integer types.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_BIND_H_\r
+#define _EFI_BIND_H_\r
+\r
+\r
+#define EFI_DRIVER_ENTRY_POINT(InitFunction) \r
+#define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT\r
+\r
+\r
+//\r
+// Make sure we are useing the correct packing rules per EFI specification\r
+//\r
+#ifndef __GNUC__\r
+#pragma pack()\r
+#endif\r
+\r
+\r
+//\r
+// Assume standard IA-32 alignment. \r
+// BugBug: Need to check portability of long long\r
+//\r
+typedef unsigned long long uint64_t;\r
+typedef long long int64_t;\r
+typedef unsigned int uint32_t;\r
+typedef int int32_t;\r
+typedef unsigned short uint16_t;\r
+typedef short int16_t;\r
+typedef unsigned char uint8_t;\r
+typedef char int8_t;\r
+\r
+//\r
+// Native integer size in stdint.h\r
+//\r
+typedef uint32_t uintn_t;\r
+typedef int32_t intn_t;\r
+\r
+//\r
+// Processor specific defines\r
+//\r
+#define EFI_MAX_BIT 0x80000000\r
+#define MAX_2_BITS 0xC0000000\r
+\r
+//\r
+// Maximum legal IA-32 address\r
+//\r
+#define EFI_MAX_ADDRESS 0xFFFFFFFF\r
+\r
+//\r
+// Bad pointer value to use in check builds.\r
+// if you see this value you are using uninitialized or free'ed data\r
+//\r
+#define EFI_BAD_POINTER 0xAFAFAFAF\r
+#define EFI_BAD_POINTER_AS_BYTE 0xAF\r
+\r
+#define EFI_DEADLOOP() { volatile UINTN __iii; __iii = 1; while (__iii); }\r
+\r
+//\r
+// Inject a break point in the code to assist debugging for NT Emulation Environment\r
+// For real hardware, just put in a halt loop. Don't do a while(1) because the\r
+// compiler will optimize away the rest of the function following, so that you run out in\r
+// the weeds if you skip over it with a debugger.\r
+//\r
+#define EFI_BREAKPOINT EFI_DEADLOOP()\r
+\r
+\r
+//\r
+// Memory Fence forces serialization, and is needed to support out of order\r
+// memory transactions. The Memory Fence is mainly used to make sure IO\r
+// transactions complete in a deterministic sequence, and to syncronize locks\r
+// an other MP code. Currently no memory fencing is required.\r
+//\r
+#define MEMORY_FENCE()\r
+\r
+//\r
+// Some compilers don't support the forward reference construct:\r
+// typedef struct XXXXX. The forward reference is required for \r
+// ANSI compatibility.\r
+//\r
+// The following macro provide a workaround for such cases.\r
+//\r
+\r
+\r
+#ifdef EFI_NO_INTERFACE_DECL\r
+ #define EFI_FORWARD_DECLARATION(x)\r
+#else\r
+ #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x\r
+#endif\r
+\r
+\r
+//\r
+// Some C compilers optimize the calling conventions to increase performance.\r
+// _EFIAPI is used to make all public APIs follow the standard C calling \r
+// convention.\r
+//\r
+#define _EFIAPI \r
+\r
+\r
+\r
+//\r
+// For symbol name in GNU assembly code, an extra "_" is necessary\r
+//\r
+#if defined(__GNUC__)\r
+ ///\r
+ /// Private worker functions for ASM_PFX()\r
+ ///\r
+ #define _CONCATENATE(a, b) __CONCATENATE(a, b)\r
+ #define __CONCATENATE(a, b) a ## b\r
+\r
+ ///\r
+ /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix\r
+ /// on symbols in assembly language.\r
+ ///\r
+ #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)\r
+\r
+#endif\r
+\r
+#endif\r
+\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2004 - 2006, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ EfiPeOptionalHeader.h\r
+\r
+Abstract:\r
+ Defines the optional header in the PE image per the PE specification. This\r
+ file must be included only from within EfiImage.h since \r
+ EFI_IMAGE_DATA_DIRECTORY and EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES are defined\r
+ there.\r
+\r
+--*/\r
+\r
+#ifndef _EFI_PE_OPTIONAL_HEADER_H_\r
+#define _EFI_PE_OPTIONAL_HEADER_H_\r
+\r
+#define EFI_IMAGE_MACHINE_TYPE (EFI_IMAGE_MACHINE_ARMTHUMB_MIXED)\r
+\r
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \\r
+ (((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED) || ((Machine) == EFI_IMAGE_MACHINE_EBC))\r
+\r
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE) \r
+\r
+#define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC\r
+typedef EFI_IMAGE_OPTIONAL_HEADER32 EFI_IMAGE_OPTIONAL_HEADER;\r
+typedef EFI_IMAGE_NT_HEADERS32 EFI_IMAGE_NT_HEADERS;\r
+\r
+#endif\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2004 - 2006, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ TianoBind.h\r
+\r
+Abstract:\r
+\r
+ Tiano's Processor or Compiler specific defines and types for IA-32 \r
+ besides EfiBind.h.\r
+\r
+--*/\r
+\r
+#ifndef _TIANO_BIND_H_\r
+#define _TIANO_BIND_H_\r
+\r
+#include <EfiBind.h>\r
+\r
+#define EFI_DXE_ENTRY_POINT(InitFunction)\r
+#define EFI_SMI_HANDLER_ENTRY_POINT(InitFunction)\r
+\r
+#endif\r
\r
#define _EFI_INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))\r
\r
-#if defined(__GNUC__)\r
+#if defined(__CC_ARM)\r
+//\r
+// RVCT ARM variable argument list support.\r
+//\r
+\r
+///\r
+/// Variable used to traverse the list of arguments. This type can vary by \r
+/// implementation and could be an array or structure. \r
+///\r
+#ifdef __APCS_ADSABI\r
+ typedef int *va_list[1];\r
+ #define VA_LIST va_list\r
+#else\r
+ typedef struct __va_list { void *__ap; } va_list;\r
+ #define VA_LIST va_list\r
+#endif\r
+\r
+#define VA_START(Marker, Parameter) __va_start(Marker, Parameter)\r
+\r
+#define VA_ARG(Marker, TYPE) __va_arg(Marker, TYPE)\r
+\r
+#define VA_END(Marker) ((void)0)\r
+\r
+#define VA_COPY(Dest, Start) __va_copy (Dest, Start)\r
+\r
+#elif defined(__GNUC__)\r
//\r
// Use GCC built-in macros for variable argument lists.\r
//\r
\r
#define VA_END(Marker) __builtin_va_end (Marker)\r
\r
+#define VA_COPY(Dest, Start) __builtin_va_copy (Dest, Start)\r
+\r
#else\r
\r
//\r
#define VA_START(ap, v) (ap = (VA_LIST) & (v) + _EFI_INT_SIZE_OF (v))\r
#define VA_ARG(ap, t) (*(t *) ((ap += _EFI_INT_SIZE_OF (t)) - _EFI_INT_SIZE_OF (t)))\r
#define VA_END(ap) (ap = (VA_LIST) 0)\r
+#define VA_COPY(dest, src) ((void)((dest) = (src)))\r
\r
#endif\r
\r
VOID *\r
memset (\r
OUT VOID *Dest,\r
- IN UINTN Char,\r
+ IN int Char,\r
IN UINTN Count\r
)\r
{\r
@return The pointer to the first instruction of a function given a function pointer.\r
\r
**/\r
-#define FUNCTION_ENTRY_POINT(FunctionPointer) (FunctionPointer)\r
+#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
\r
#endif\r
ASM_PFX(AsmMwait):\r
mov %ecx,%eax\r
mov %edx,%ecx\r
- mwait %rax,%rcx\r
+ mwait %eax,%ecx\r
ret\r
ASM_GLOBAL ASM_PFX(InternalAsmThunk16)\r
\r
# define the structure of IA32_REGS\r
-.equ _EDI, 0 #size 4\r
-.equ _ESI, 4 #size 4\r
-.equ _EBP, 8 #size 4\r
-.equ _ESP, 12 #size 4\r
-.equ _EBX, 16 #size 4\r
-.equ _EDX, 20 #size 4\r
-.equ _ECX, 24 #size 4\r
-.equ _EAX, 28 #size 4\r
-.equ _DS, 32 #size 2\r
-.equ _ES, 34 #size 2\r
-.equ _FS, 36 #size 2\r
-.equ _GS, 38 #size 2\r
-.equ _EFLAGS, 40 #size 8\r
-.equ _EIP, 48 #size 4\r
-.equ _CS, 52 #size 2\r
-.equ _SS, 54 #size 2\r
-.equ IA32_REGS_SIZE, 56\r
+.set _EDI, 0 #size 4\r
+.set _ESI, 4 #size 4\r
+.set _EBP, 8 #size 4\r
+.set _ESP, 12 #size 4\r
+.set _EBX, 16 #size 4\r
+.set _EDX, 20 #size 4\r
+.set _ECX, 24 #size 4\r
+.set _EAX, 28 #size 4\r
+.set _DS, 32 #size 2\r
+.set _ES, 34 #size 2\r
+.set _FS, 36 #size 2\r
+.set _GS, 38 #size 2\r
+.set _EFLAGS, 40 #size 8\r
+.set _EIP, 48 #size 4\r
+.set _CS, 52 #size 2\r
+.set _SS, 54 #size 2\r
+.set IA32_REGS_SIZE, 56\r
\r
.data\r
\r
movl $0xc0000080,%ecx\r
movq %rax, %cr0\r
rdmsr\r
- andb $0b11111110, %ah \r
+ andb $0xfe, %ah # $0b11111110\r
wrmsr\r
movq %rbp, %cr4\r
movl %esi,%ss # set up 16-bit stack segment\r
.byte 0x66 # make the following retf 32-bit\r
lret # transfer control to user code\r
\r
-.equ CODE16, ASM_PFX(_16Code) - .\r
-.equ DATA16, ASM_PFX(_16Data) - .\r
-.equ DATA32, ASM_PFX(_32Data) - .\r
+.set CODE16, ASM_PFX(_16Code) - .\r
+.set DATA16, ASM_PFX(_16Data) - .\r
+.set DATA32, ASM_PFX(_32Data) - .\r
\r
ASM_PFX(NullSeg): .quad 0\r
ASM_PFX(_16Code):\r
.byte 0xcf # 16-bit segment, 4GB limit\r
.byte 0\r
\r
-.equ GDT_SIZE, . - ASM_PFX(NullSeg)\r
+.set GDT_SIZE, . - ASM_PFX(NullSeg)\r
\r
#------------------------------------------------------------------------------\r
# IA32_REGISTER_SET *\r
pushq %rsi\r
pushq %rdi\r
\r
- movq %ds, %rbx\r
+ movl %ds, %ebx\r
pushq %rbx # Save ds segment register on the stack\r
- movq %es, %rbx\r
+ movl %es, %ebx\r
pushq %rbx # Save es segment register on the stack\r
- movq %ss, %rbx\r
+ movl %ss, %ebx\r
pushq %rbx # Save ss segment register on the stack\r
\r
.byte 0x0f, 0xa0 #push fs\r
sgdt 0x60(%rsp) # save GDT stack in argument space\r
movzwq 0x60(%rsp), %r10 # r10 <- GDT limit \r
lea ((ASM_PFX(InternalAsmThunk16) - SavedCr4) + 0xf)(%rcx), %r11 \r
- andq $0xfffffff0, %r11 # r11 <- 16-byte aligned shadowed GDT table in real mode buffer \r
+ andq $0xfffffffffffffff0, %r11 # r11 <- 16-byte aligned shadowed GDT table in real mode buffer \r
\r
movw %r10w, (SavedGdt - SavedCr4)(%rcx) # save the limit of shadowed GDT table\r
movq %r11, (SavedGdt - SavedCr4 + 0x2)(%rcx) # save the base address of shadowed GDT table\r
.byte 0x0f, 0xa1 # pop fs\r
\r
popq %rbx\r
- movq %rbx, %ss\r
+ movl %ebx, %ss\r
popq %rbx\r
- movq %rbx, %es\r
+ movl %ebx, %es\r
popq %rbx\r
- movq %rbx, %ds\r
+ movl %ebx, %ds\r
\r
popq %rdi\r
popq %rsi\r