aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/debug/qemu_output.cpp
blob: 535017d26610c0383dd67c85bd87d1a5823196e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "arch/debug/qemu_output.hpp"

#include "kapi/cio.hpp"

#include <algorithm>
#include <string_view>

namespace arch::debug
{

  qemu_output::qemu_output(output_device & lower)
      : m_lower{lower}
      , m_present{port::read() == port::address}
  {}

  auto qemu_output::write(kapi::cio::output_stream stream, std::string_view text) -> void
  {
    if (m_present)
    {
      std::ranges::for_each(text, port::write<port::value_type>);
    }
    m_lower.write(stream, text);
  }

}  // namespace arch::debug