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

#include "arch/context_switching/syscall/main.hpp"

// TODO: Disallow this import
#include "arch/video/vga/text.hpp"

namespace teachos::arch::user
{
  [[gnu::section(".user_text")]]
  auto main() -> void
  {
    char constexpr syscall_message[] = "Successfully entered user mode and wrote to VGA buffer via syscall!";
    auto const error = context_switching::syscall::syscall(context_switching::syscall::type::WRITE,
                                                           {reinterpret_cast<uint64_t>(&syscall_message)});

    if (!error)
    {
      video::vga::text::write("Successfully made a SYSCALL and returned with SYSRETQ!",
                              video::vga::text::common_attributes::green_on_black);
    }
  }
}  // namespace teachos::arch::user