Get BlockIo mapping interfaces working. Still need to work on detecting block size of devices, but you can map a .dmg file no problem at this point.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11724 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
andrewfish
2011-06-03 03:31:32 +00:00
parent 26fab514ee
commit 033d0e5ff6
14 changed files with 597 additions and 765 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -405,8 +405,58 @@ GasketPosixFileSystmeThunkClose (
IN EMU_IO_THUNK_PROTOCOL *This
);
EFI_STATUS
EFIAPI
GasketEmuBlockIoReset (
IN EMU_BLOCK_IO_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
EFI_STATUS
GasketEmuBlockIoReadBlocks (
IN EMU_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA LBA,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
);
EFI_STATUS
EFIAPI
GasketEmuBlockIoWriteBlocks (
IN EMU_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA LBA,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
);
EFI_STATUS
GasketEmuBlockIoFlushBlocks (
IN EMU_BLOCK_IO_PROTOCOL *This,
IN OUT EFI_BLOCK_IO2_TOKEN *Token
);
EFI_STATUS
GasketEmuBlockIoCreateMapping (
IN EMU_BLOCK_IO_PROTOCOL *This,
IN EFI_BLOCK_IO_MEDIA *Media
);
EFI_STATUS
EFIAPI
GasketBlockIoThunkOpen (
IN EMU_IO_THUNK_PROTOCOL *This
);
EFI_STATUS
EFIAPI
GasketBlockIoThunkClose (
IN EMU_IO_THUNK_PROTOCOL *This
);
#endif

View File

@@ -1533,7 +1533,7 @@ PosixFileSystmeThunkClose (
}
if (This->Private != NULL) {
if (Private->VolumeLabel == NULL) {
if (Private->VolumeLabel != NULL) {
free (Private->VolumeLabel);
}
free (This->Private);

View File

@@ -116,7 +116,10 @@ main (
//
AddThunkProtocol (&gX11ThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuGop), TRUE);
AddThunkProtocol (&gPosixFileSystemThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuFileSystem), TRUE);
AddThunkProtocol (&gBlockIoThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuVirtualDisk), TRUE);
//
// Emulator other Thunks
//

View File

@@ -46,6 +46,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/EmuIoThunk.h>
#include <Protocol/EmuGraphicsWindow.h>
#include <Protocol/EmuThread.h>
#include <Protocol/EmuBlockIo.h>
#include <Guid/FileInfo.h>
#include <Guid/FileSystemInfo.h>
@@ -318,6 +319,6 @@ extern EMU_THUNK_PROTOCOL gEmuThunkProtocol;
extern EMU_IO_THUNK_PROTOCOL gX11ThunkIo;
extern EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo;
extern EMU_IO_THUNK_PROTOCOL gPthreadThunkIo;
extern EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo;
#endif

View File

@@ -35,6 +35,7 @@
X11GraphicsWindow.c
Pthreads.c
PosixFileSystem.c
BlockIo.c
[Sources.X64]
X64/Gasket.S # convert between Emu x86_64 ABI and EFI X64 ABI
@@ -68,8 +69,8 @@
gEmuIoThunkProtocolGuid
gEmuGraphicsWindowProtocolGuid
gEmuThreadThunkProtocolGuid
gEmuBlockIoProtocolGuid
gEfiSimpleFileSystemProtocolGuid
[Guids]
gEfiFileSystemVolumeLabelInfoIdGuid # SOMETIMES_CONSUMED

View File

@@ -1022,9 +1022,143 @@ ASM_PFX(GasketPosixFileSystmeThunkClose):
popq %rbp
ret
ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReset)
ASM_PFX(GasketEmuBlockIoReset):
pushq %rbp // stack frame is for the debugger
movq %rsp, %rbp
pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
pushq %rdi
movq %rcx, %rdi // Swizzle args
movq %rdx, %rsi
call ASM_PFX(EmuBlockIoReset)
popq %rdi // restore state
popq %rsi
popq %rbp
ret
ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReadBlocks)
ASM_PFX(GasketEmuBlockIoReadBlocks):
pushq %rbp // stack frame is for the debugger
movq %rsp, %rbp
pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
pushq %rdi
movq %rcx, %rdi // Swizzle args
movq %rdx, %rsi
movq %r8, %rdx
movq %r9, %rcx
movq 0x30(%rbp), %r8
movq 0x38(%rbp), %r9
call ASM_PFX(EmuBlockIoReadBlocks)
popq %rdi // restore state
popq %rsi
popq %rbp
ret
ASM_GLOBAL ASM_PFX(GasketEmuBlockIoWriteBlocks)
ASM_PFX(GasketEmuBlockIoWriteBlocks):
pushq %rbp // stack frame is for the debugger
movq %rsp, %rbp
pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
pushq %rdi
movq %rcx, %rdi // Swizzle args
movq %rdx, %rsi
movq %r8, %rdx
movq %r9, %rcx
movq 0x30(%rbp), %r8
movq 0x38(%rbp), %r9
call ASM_PFX(EmuBlockIoWriteBlocks)
popq %rdi // restore state
popq %rsi
popq %rbp
ret
ASM_GLOBAL ASM_PFX(GasketEmuBlockIoFlushBlocks)
ASM_PFX(GasketEmuBlockIoFlushBlocks):
pushq %rbp // stack frame is for the debugger
movq %rsp, %rbp
pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
pushq %rdi
movq %rcx, %rdi // Swizzle args
movq %rdx, %rsi
call ASM_PFX(EmuBlockIoFlushBlocks)
popq %rdi // restore state
popq %rsi
popq %rbp
ret
ASM_GLOBAL ASM_PFX(GasketEmuBlockIoCreateMapping)
ASM_PFX(GasketEmuBlockIoCreateMapping):
pushq %rbp // stack frame is for the debugger
movq %rsp, %rbp
pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
pushq %rdi
movq %rcx, %rdi // Swizzle args
movq %rdx, %rsi
call ASM_PFX(EmuBlockIoCreateMapping)
popq %rdi // restore state
popq %rsi
popq %rbp
ret
ASM_GLOBAL ASM_PFX(GasketBlockIoThunkOpen)
ASM_PFX(GasketBlockIoThunkOpen):
pushq %rbp // stack frame is for the debugger
movq %rsp, %rbp
pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
pushq %rdi
movq %rcx, %rdi // Swizzle args
call ASM_PFX(EmuBlockIoThunkOpen)
popq %rdi // restore state
popq %rsi
popq %rbp
ret
ASM_GLOBAL ASM_PFX(GasketBlockIoThunkClose)
ASM_PFX(GasketBlockIoThunkClose):
pushq %rbp // stack frame is for the debugger
movq %rsp, %rbp
pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
pushq %rdi
movq %rcx, %rdi // Swizzle args
call ASM_PFX(EmuBlockIoThunkClose)
popq %rdi // restore state
popq %rsi
popq %rbp
ret