2#include "../microfmt.hpp"
21 static
void write(
void *,
microfmt::string_view sv) noexcept {
27#if defined(__aarch64__)
28 register uint64_t reg_sysnum __asm__(
"x0") = 0x03;
29 register const char *reg_ptr __asm__(
"x1") = &c;
31 __asm__
volatile(
"hlt #0xf000" :
"+r"(reg_sysnum) :
"r"(reg_ptr) :
"memory",
"cc");
32#elif defined(__arm__) || defined(__thumb__)
33 register uint32_t reg_sysnum __asm__(
"r0") = 0x03;
34 register const char *reg_ptr __asm__(
"r1") = &c;
36 __asm__
volatile(
"bkpt #0xab" :
"+r"(reg_sysnum) :
"r"(reg_ptr) :
"memory",
"cc");
38#error "Unsupported architecture for semihosting_sink"
48 return sink{.ctx =
nullptr, .write_fn = &semihosting_sink::write};
ARM Semihosting Sink for AArch64 freestanding environments.
Definition semihosting.hpp:12
constexpr sink as_sink() const noexcept
Adapts this semihosting sink into a type-erased microfmt::sink.
Definition semihosting.hpp:47
constexpr semihosting_sink() noexcept=default
#define MICROFMT_API_CLASS
Definition compat.hpp:181
reloco::sink sink
Type-erased, zero-allocation output sink.
Definition microfmt.hpp:46