blob: 163fac6aabb3282477e78456d4eda06bbb1c8bad (
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
31
32
33
34
35
36
37
|
#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 jump - A jump to an instruction located in a different segment.
*/
struct [[gnu::packed]] far_pointer
{
std::size_t function; ///< Address of the function we want to jump too. (0- 63)
context_switching::interrupt_descriptor_table::segment_selector
selector; ///< Segment selector that shows the segment we want to jump into. (64 - 79)
};
/**
* @brief Near jump - A jump to an instruction within the current code segment.
*
* @param address Address we want to jump to.
*/
auto jmp(std::size_t address) -> void;
/**
* @brief Far jump - A jump 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 should jump too.
*/
auto jmp(far_pointer pointer) -> void;
} // namespace teachos::arch::kernel::cpu
#endif // TEACHOS_ARCH_X86_64_KERNEL_CPU_JMP_HPP
|