aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/kernel/cpu/ss.cpp
blob: 0978ecae7113c56385b0f16562f3d17f427ebaf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "arch/kernel/cpu/ss.hpp"

namespace teachos::arch::kernel::cpu
{
  auto read_ss() -> context_switching::interrupt_descriptor_table::segment_selector
  {
    context_switching::interrupt_descriptor_table::segment_selector segment_selector{};
    asm volatile("mov %%ss, %[output]" : [output] "=m"(segment_selector));
    return segment_selector;
  }

  auto write_ss(context_switching::interrupt_descriptor_table::segment_selector selector) -> void
  {
    asm volatile("mov %[input], %%ss" : /* no output from call */ : [input] "m"(selector));
  }
}  // namespace teachos::arch::kernel::cpu