aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include/arch/kernel/cpu/call.hpp
blob: 3c4330448c163029f852f1186a247713764f7242 (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
29
30
#ifndef TEACHOS_ARCH_X86_64_KERNEL_CPU_JMP_HPP
#define TEACHOS_ARCH_X86_64_KERNEL_CPU_JMP_HPP

#include "arch/context_switching/interrupt_descriptor_table/segment_selector.hpp"

#include <cstdint>

namespace teachos::arch::kernel::cpu
{
  /**
   * @brief Far Pointer. Address to function located in another code segment.
   */
  struct far_pointer
  {
    void (*function)();  ///< Address of the function we want to call. (0-63)
    context_switching::interrupt_descriptor_table::segment_selector
        selector;  ///< Segment selector pointing to the GDT entry we want to load into register CS. (64-79)
  };

  /**
   * @brief Far call - A call to an instruction located in a different segment than the current code segment but at the
   * same privilege level.
   *
   * @param pointer 64-bit operand size far pointer that we want to call.
   */
  auto call(far_pointer pointer) -> void;

}  // namespace teachos::arch::kernel::cpu

#endif  // TEACHOS_ARCH_X86_64_KERNEL_CPU_JMP_HPP