2014-08-19 15:29:52 +02:00
|
|
|
#------------------------------------------------------------------------------
|
2013-01-25 12:28:06 +01:00
|
|
|
#
|
|
|
|
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
|
|
|
#
|
2019-04-04 01:03:18 +02:00
|
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
2013-01-25 12:28:06 +01:00
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
2016-08-10 14:39:26 +02:00
|
|
|
#include <AsmMacroIoLib.h>
|
2013-01-25 12:28:06 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
Semihosting operation request mechanism
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2013-01-25 12:28:06 +01:00
|
|
|
SVC 0x123456 in ARM state (for all architectures)
|
|
|
|
SVC 0xAB in Thumb state (excluding ARMv7-M)
|
|
|
|
BKPT 0xAB for ARMv7-M (Thumb-2 only)
|
2014-08-19 15:29:52 +02:00
|
|
|
|
|
|
|
R0 - operation type
|
2013-01-25 12:28:06 +01:00
|
|
|
R1 - block containing all other parametes
|
2014-08-19 15:29:52 +02:00
|
|
|
|
|
|
|
lr - must be saved as svc instruction will cause an svc exception and write
|
2013-01-25 12:28:06 +01:00
|
|
|
the svc lr register. That happens to be the one we are using, so we must
|
2014-08-19 15:29:52 +02:00
|
|
|
save it or we will not be able to return.
|
2013-01-25 12:28:06 +01:00
|
|
|
*/
|
2016-08-10 14:39:26 +02:00
|
|
|
ASM_FUNC(GccSemihostCall)
|
2014-08-19 15:29:52 +02:00
|
|
|
stmfd sp!, {lr}
|
|
|
|
svc #0x123456
|
2010-12-15 03:39:00 +01:00
|
|
|
ldmfd sp!, {lr}
|
2013-01-25 12:28:06 +01:00
|
|
|
bx lr
|
|
|
|
|
|
|
|
|