1b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */ 23b4af9bcSShawn Guo#include <linux/linkage.h> 33b4af9bcSShawn Guo#include <asm/assembler.h> 43b4af9bcSShawn Guo 527523679SNicolas Pitre#ifndef CONFIG_DEBUG_SEMIHOSTING 627523679SNicolas Pitre 73b4af9bcSShawn Guo#include CONFIG_DEBUG_LL_INCLUDE 83b4af9bcSShawn Guo 93b4af9bcSShawn GuoENTRY(putc) 103b4af9bcSShawn Guo addruart r1, r2, r3 112c50a570SLinus Walleij waituartcts r3, r1 122c50a570SLinus Walleij waituarttxrdy r3, r1 133b4af9bcSShawn Guo senduart r0, r1 143b4af9bcSShawn Guo busyuart r3, r1 153b4af9bcSShawn Guo mov pc, lr 163b4af9bcSShawn GuoENDPROC(putc) 1727523679SNicolas Pitre 1827523679SNicolas Pitre#else 1927523679SNicolas Pitre 2027523679SNicolas PitreENTRY(putc) 2127523679SNicolas Pitre adr r1, 1f 2227523679SNicolas Pitre ldmia r1, {r2, r3} 2327523679SNicolas Pitre add r2, r2, r1 2427523679SNicolas Pitre ldr r1, [r2, r3] 2527523679SNicolas Pitre strb r0, [r1] 2627523679SNicolas Pitre mov r0, #0x03 @ SYS_WRITEC 2727523679SNicolas Pitre ARM( svc #0x123456 ) 28ee3eaee6SNicolas Pitre#ifdef CONFIG_CPU_V7M 29ee3eaee6SNicolas Pitre THUMB( bkpt #0xab ) 30ee3eaee6SNicolas Pitre#else 3127523679SNicolas Pitre THUMB( svc #0xab ) 32ee3eaee6SNicolas Pitre#endif 3327523679SNicolas Pitre mov pc, lr 3427523679SNicolas Pitre .align 2 3527523679SNicolas Pitre1: .word _GLOBAL_OFFSET_TABLE_ - . 3627523679SNicolas Pitre .word semi_writec_buf(GOT) 3727523679SNicolas PitreENDPROC(putc) 3827523679SNicolas Pitre 3927523679SNicolas Pitre .bss 4027523679SNicolas Pitre .global semi_writec_buf 4127523679SNicolas Pitre .type semi_writec_buf, %object 4227523679SNicolas Pitresemi_writec_buf: 4327523679SNicolas Pitre .space 4 4427523679SNicolas Pitre .size semi_writec_buf, 4 4527523679SNicolas Pitre 4627523679SNicolas Pitre#endif 47