Clean up DxeIpl:

1. Remove the assembly by using IoLib & BaseLib in MdePkg
2. Refine code to pass CYGWIN GCC tool chain build 

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7404 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8
2009-02-03 00:48:56 +00:00
parent 3eb90413ba
commit 9008db4a28
14 changed files with 232 additions and 384 deletions

View File

@@ -1,62 +0,0 @@
title CpuIoAccess.asm
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation
; 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.
;
; Module Name:
; CpuIoAccess.asm
;
; Abstract:
; CPU IO Abstraction
;
;------------------------------------------------------------------------------
.686
.MODEL FLAT,C
.CODE
UINT8 TYPEDEF BYTE
UINT16 TYPEDEF WORD
UINT32 TYPEDEF DWORD
UINT64 TYPEDEF QWORD
UINTN TYPEDEF UINT32
;------------------------------------------------------------------------------
; UINT8
; CpuIoRead8 (
; IN UINT16 Port
; )
;------------------------------------------------------------------------------
CpuIoRead8 PROC PUBLIC Port:UINT16
mov dx, Port
in al, dx
ret
CpuIoRead8 ENDP
;------------------------------------------------------------------------------
; VOID
; CpuIoWrite8 (
; IN UINT16 Port,
; IN UINT32 Data
; )
;------------------------------------------------------------------------------
CpuIoWrite8 PROC PUBLIC Port:UINT16, Data:UINT32
mov eax, Data
mov dx, Port
out dx, al
ret
CpuIoWrite8 ENDP
END

View File

@@ -1,27 +0,0 @@
UINT8
EFIAPI
CpuIoRead8 (
IN UINT16 Port
)
{
UINT8 Data;
asm ( "inb %1, %0"
: "=a"(Data)
: "d"(Port)
);
return Data;
}
VOID
EFIAPI
CpuIoWrite8 (
IN UINT16 Port,
IN UINT32 Data
)
{
asm ( "outb %1, %0"
: /* No outputs */
: "d"(Port)
, "a"((UINT8)Data)
);
}

View File

@@ -1,64 +0,0 @@
TITLE EnterDxeCore.asm: Assembly code for the entering DxeCore
;------------------------------------------------------------------------------
;*
;* Copyright 2006, Intel Corporation
;* 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.
;*
;* EnterDxeCore.asm
;*
;* Abstract:
;*
;------------------------------------------------------------------------------
.686p
.model flat
.code
.stack
.MMX
.XMM
;
; VOID
; EnterDxeMain (
; IN VOID *StackTop,
; IN VOID *DxeCoreEntryPoint,
; IN VOID *Hob,
; IN VOID *PageTable
; )
;
EnterDxeMain PROC C \
StackTop:DWORD, \
DxeCoreEntryPoint:DWORD, \
Hob:DWORD, \
PageTable:DWORD
mov eax, PageTable
; mov cr3, eax ; load page table
; mov eax, cr4
; bts eax, 4 ; enable CR4.PSE
; mov cr4, eax
; mov eax, cr0
; bts eax, 31 ; enable CR0.PG
; mov cr0, eax
mov ecx, DxeCoreEntryPoint
mov eax, StackTop
mov esp, eax
mov edx, Hob
push edx
push 0
jmp ecx
; should never get here
jmp $
ret
EnterDxeMain ENDP
END

View File

@@ -0,0 +1,31 @@
/** @file
IA32 specific code to enter DxeCore
Copyright (c) 2006 - 2007, Intel Corporation
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.
**/
#include "DxeIpl.h"
VOID
EnterDxeMain (
IN VOID *StackTop,
IN VOID *DxeCoreEntryPoint,
IN VOID *Hob,
IN VOID *PageTable
)
{
SwitchStack (
(SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
Hob,
NULL,
StackTop
);
}

View File

@@ -1,16 +0,0 @@
VOID
EnterDxeMain (
IN VOID *StackTop,
IN VOID *DxeCoreEntryPoint,
IN VOID *Hob,
IN VOID *PageTable
)
{
__asm__ ( "movl %0, %%esp \n\t"
"pushl %2 \n\t"
"pushl $0 \n\t"
"movl %1, %%ecx \n\t"
"jmp %%ecx"
::"q"(StackTop), "q"(DxeCoreEntryPoint), "q"(Hob)
);
}