mirror of https://github.com/acidanthera/audk.git
Add support for semihosting with GCC. Still needs more testing.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11168 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
e7cb469e3a
commit
d9629029f2
|
@ -0,0 +1,35 @@
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.text
|
||||||
|
.align 2
|
||||||
|
|
||||||
|
.globl ASM_PFX(GccSemihostCall)
|
||||||
|
INTERWORK_FUNC(GccSemihostCall)
|
||||||
|
|
||||||
|
/*
|
||||||
|
Semihosting operation request mechanism
|
||||||
|
|
||||||
|
SVC 0x123456 in ARM state (for all architectures)
|
||||||
|
SVC 0xAB in Thumb state (excluding ARMv7-M)
|
||||||
|
BKPT 0xAB for ARMv7-M (Thumb-2 only)
|
||||||
|
|
||||||
|
R0 - operation type
|
||||||
|
R1 - block containing all other parametes
|
||||||
|
*/
|
||||||
|
ASM_PFX(GccSemihostCall):
|
||||||
|
svc #0x123456
|
||||||
|
bx lr
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef struct {
|
||||||
UINT32 CommandLength;
|
UINT32 CommandLength;
|
||||||
} SEMIHOST_SYSTEM_BLOCK;
|
} SEMIHOST_SYSTEM_BLOCK;
|
||||||
|
|
||||||
#ifdef __CC_ARM
|
#if defined(__CC_ARM)
|
||||||
|
|
||||||
#if defined(__thumb__)
|
#if defined(__thumb__)
|
||||||
#define SWI 0xAB
|
#define SWI 0xAB
|
||||||
|
@ -141,6 +141,28 @@ _Semihost_SYS_SYSTEM(
|
||||||
#define Semihost_SYS_REMOVE(RemoveBlock) _Semihost_SYS_REMOVE(0x0E, RemoveBlock)
|
#define Semihost_SYS_REMOVE(RemoveBlock) _Semihost_SYS_REMOVE(0x0E, RemoveBlock)
|
||||||
#define Semihost_SYS_SYSTEM(SystemBlock) _Semihost_SYS_SYSTEM(0x12, SystemBlock)
|
#define Semihost_SYS_SYSTEM(SystemBlock) _Semihost_SYS_SYSTEM(0x12, SystemBlock)
|
||||||
|
|
||||||
|
#elif defined(__GNUC__) // __CC_ARM
|
||||||
|
|
||||||
|
#define SEMIHOST_SUPPORTED TRUE
|
||||||
|
|
||||||
|
UINT32
|
||||||
|
GccSemihostCall (
|
||||||
|
IN UINT32 Operation,
|
||||||
|
IN UINTN SystemBlockAddress
|
||||||
|
); // __attribute__ ((interrupt ("SVC")));
|
||||||
|
|
||||||
|
#define Semihost_SYS_OPEN(OpenBlock) GccSemihostCall(0x01, (UINTN)(OpenBlock))
|
||||||
|
#define Semihost_SYS_CLOSE(Handle) GccSemihostCall(0x02, (UINTN)(Handle))
|
||||||
|
#define Semihost_SYS_WRITE0(String) GccSemihostCall(0x04, (UINTN)(String))
|
||||||
|
#define Semihost_SYS_WRITEC(Character) GccSemihostCall(0x03, (UINTN)(Character))
|
||||||
|
#define Semihost_SYS_WRITE(WriteBlock) GccSemihostCall(0x05, (UINTN)(WriteBlock))
|
||||||
|
#define Semihost_SYS_READ(ReadBlock) GccSemihostCall(0x06, (UINTN)(ReadBlock))
|
||||||
|
#define Semihost_SYS_READC() GccSemihostCall(0x07, (UINTN)(0))
|
||||||
|
#define Semihost_SYS_SEEK(SeekBlock) GccSemihostCall(0x0A, (UINTN)(SeekBlock))
|
||||||
|
#define Semihost_SYS_FLEN(Handle) GccSemihostCall(0x0C, (UINTN)(Handle))
|
||||||
|
#define Semihost_SYS_REMOVE(RemoveBlock) GccSemihostCall(0x0E, (UINTN)(RemoveBlock))
|
||||||
|
#define Semihost_SYS_SYSTEM(SystemBlock) GccSemihostCall(0x12, (UINTN)(SystemBlock))
|
||||||
|
|
||||||
#else // __CC_ARM
|
#else // __CC_ARM
|
||||||
|
|
||||||
#define SEMIHOST_SUPPORTED FALSE
|
#define SEMIHOST_SUPPORTED FALSE
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
# VALID_ARCHITECTURES = ARM
|
# VALID_ARCHITECTURES = ARM
|
||||||
#
|
#
|
||||||
[Sources.ARM]
|
[Sources.ARM]
|
||||||
|
Arm/GccSemihost.S | GCC
|
||||||
Arm/SemihostLib.c
|
Arm/SemihostLib.c
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue