aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/io.cpp
blob: 8e9e411fc45d8afcbb9c406a9722a22b1258413a (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
26
27
28
#include "kern/print.hpp"
#include "x86_64/vga/text.hpp"

namespace teachos::arch::io
{

  auto init() -> void
  {
    x86_64::vga::text::cursor(false);

    teachos::set_print_handler(
        [](auto text) { return x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::green_on_black); });
    teachos::set_println_handler([](auto text) {
      x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::green_on_black);
      x86_64::vga::text::newline();
    });

    teachos::set_print_error_handler(
        [](auto text) { return x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::red_on_black); });
    teachos::set_println_error_handler([](auto text) {
      x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::red_on_black);
      x86_64::vga::text::newline();
    });

    teachos::println("[x86-64] Basic VGA text output initialized.");
  }

}  // namespace teachos::arch::io