summaryrefslogtreecommitdiffstats
path: root/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-07-04 20:22:02 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-07-04 20:22:02 +0000
commit3bb46df2a3456929e2776470a5547e4827937853 (patch)
treeb471761496513829ce507bc2fe00015bd868a6b5 /ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
parent7422411e38523446c3d0e6b37bfbaaf90d8726f7 (diff)
downloadedk2-3bb46df2a3456929e2776470a5547e4827937853.tar.gz
edk2-3bb46df2a3456929e2776470a5547e4827937853.tar.bz2
edk2-3bb46df2a3456929e2776470a5547e4827937853.zip
ArmPkg/SemihostFs: Fixed DataAbort in Semihosting File System
Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13501 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c')
-rw-r--r--ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
index a9d1c37c5c..e6604ba0e2 100644
--- a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
+++ b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
@@ -263,18 +263,22 @@ FileDelete (
Fcb = SEMIHOST_FCB_FROM_THIS(File);
- // Get the filename from the Fcb
- NameSize = AsciiStrLen (Fcb->FileName);
- FileName = AllocatePool (NameSize + 1);
+ if (!Fcb->IsRoot) {
+ // Get the filename from the Fcb
+ NameSize = AsciiStrLen (Fcb->FileName);
+ FileName = AllocatePool (NameSize + 1);
- AsciiStrCpy (FileName, Fcb->FileName);
+ AsciiStrCpy (FileName, Fcb->FileName);
- // Close the file if it's open. Disregard return status,
- // since it might give an error if the file isn't open.
- File->Close (File);
-
- // Call the semihost interface to delete the file.
- Status = SemihostFileRemove (FileName);
+ // Close the file if it's open. Disregard return status,
+ // since it might give an error if the file isn't open.
+ File->Close (File);
+
+ // Call the semihost interface to delete the file.
+ Status = SemihostFileRemove (FileName);
+ } else {
+ Status = EFI_UNSUPPORTED;
+ }
return Status;
}
@@ -358,14 +362,19 @@ FileSetPosition (
Fcb = SEMIHOST_FCB_FROM_THIS(File);
- Status = SemihostFileLength (Fcb->SemihostHandle, &Length);
- if (!EFI_ERROR(Status) && (Length < Position)) {
- Position = Length;
- }
+ if (!Fcb->IsRoot) {
+ Status = SemihostFileLength (Fcb->SemihostHandle, &Length);
+ if (!EFI_ERROR(Status) && (Length < Position)) {
+ Position = Length;
+ }
- Status = SemihostFileSeek (Fcb->SemihostHandle, (UINT32)Position);
- if (!EFI_ERROR(Status)) {
+ Status = SemihostFileSeek (Fcb->SemihostHandle, (UINT32)Position);
+ if (!EFI_ERROR(Status)) {
+ Fcb->Position = Position;
+ }
+ } else {
Fcb->Position = Position;
+ Status = EFI_SUCCESS;
}
return Status;