17SemihostConnectionSupported (
21 return SEMIHOST_SUPPORTED;
34 if (FileHandle ==
NULL) {
39 if (*FileName ==
'\\') {
43 OpenBlock.FileName = FileName;
44 OpenBlock.Mode = Mode;
47 Result = SEMIHOST_SYS_OPEN (&OpenBlock);
66 SeekBlock.Handle = FileHandle;
67 SeekBlock.Location = Offset;
69 Result = SEMIHOST_SYS_SEEK (&SeekBlock);
90 if ((Length ==
NULL) || (Buffer ==
NULL)) {
94 ReadBlock.Handle = FileHandle;
95 ReadBlock.Buffer = Buffer;
96 ReadBlock.Length = *Length;
98 Result = SEMIHOST_SYS_READ (&ReadBlock);
100 if ((*Length != 0) && (Result == *Length)) {
117 if ((Length ==
NULL) || (Buffer ==
NULL)) {
121 WriteBlock.Handle = FileHandle;
122 WriteBlock.Buffer = Buffer;
123 WriteBlock.Length = *Length;
125 *Length = SEMIHOST_SYS_WRITE (&WriteBlock);
139 if (SEMIHOST_SYS_CLOSE (&FileHandle) == -1) {
154 if (Length ==
NULL) {
158 Result = SEMIHOST_SYS_FLEN (&FileHandle);
191 if (Buffer ==
NULL) {
195 TmpNameBlock.Buffer = Buffer;
196 TmpNameBlock.Identifier = Identifier;
197 TmpNameBlock.Length = Length;
199 Result = SEMIHOST_SYS_TMPNAME (&TmpNameBlock);
217 if (*FileName ==
'\\') {
221 RemoveBlock.FileName = FileName;
224 Result = SEMIHOST_SYS_REMOVE (&RemoveBlock);
247 IN CHAR8 *NewFileName
253 if ((FileName ==
NULL) || (NewFileName ==
NULL)) {
257 RenameBlock.FileName = FileName;
258 RenameBlock.FileNameLength =
AsciiStrLen (FileName);
259 RenameBlock.NewFileName = NewFileName;
260 RenameBlock.NewFileNameLength =
AsciiStrLen (NewFileName);
262 Result = SEMIHOST_SYS_RENAME (&RenameBlock);
272SemihostReadCharacter (
276 return SEMIHOST_SYS_READC ();
280SemihostWriteCharacter (
284 SEMIHOST_SYS_WRITEC (&Character);
292 SEMIHOST_SYS_WRITE0 (String);
297 IN CHAR8 *CommandLine
302 SystemBlock.CommandLine = CommandLine;
303 SystemBlock.CommandLength =
AsciiStrLen (CommandLine);
305 return SEMIHOST_SYS_SYSTEM (&SystemBlock);
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
#define RETURN_INVALID_PARAMETER
RETURN_STATUS SemihostFileTmpName(OUT VOID *Buffer, IN UINT8 Identifier, IN UINTN Length)
RETURN_STATUS SemihostFileRename(IN CHAR8 *FileName, IN CHAR8 *NewFileName)