aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/context_switching
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2025-05-18 14:45:05 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2025-05-18 14:46:17 +0000
commit8d39f3f67734bf39cada370c39243e6ef33bf4a0 (patch)
tree50493df40018c2ea9587280ac8d7bc3fb42a4990 /arch/x86_64/src/context_switching
parent1b5a771a34743a2973a82de5ebdfd22da030b841 (diff)
downloadteachos-8d39f3f67734bf39cada370c39243e6ef33bf4a0.tar.xz
teachos-8d39f3f67734bf39cada370c39243e6ef33bf4a0.zip
Make new usable for both kernel and user calls
Diffstat (limited to 'arch/x86_64/src/context_switching')
-rw-r--r--arch/x86_64/src/context_switching/interrupt_descriptor_table/segment_selector.cpp2
-rw-r--r--arch/x86_64/src/context_switching/syscall/syscall_handler.cpp6
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86_64/src/context_switching/interrupt_descriptor_table/segment_selector.cpp b/arch/x86_64/src/context_switching/interrupt_descriptor_table/segment_selector.cpp
index 8568447..27f0a3b 100644
--- a/arch/x86_64/src/context_switching/interrupt_descriptor_table/segment_selector.cpp
+++ b/arch/x86_64/src/context_switching/interrupt_descriptor_table/segment_selector.cpp
@@ -7,6 +7,8 @@ namespace teachos::arch::context_switching::interrupt_descriptor_table
return (std::bitset<3U>{_flags} & other) == other;
}
+ auto segment_selector::get_index() const -> uint16_t { return _index; }
+
auto segment_selector::operator|=(std::bitset<3U> other) -> void { _flags |= other.to_ulong(); }
segment_selector::operator uint16_t() const { return *reinterpret_cast<uint16_t const *>(this); }
diff --git a/arch/x86_64/src/context_switching/syscall/syscall_handler.cpp b/arch/x86_64/src/context_switching/syscall/syscall_handler.cpp
index 9cc6edf..cd1c8a2 100644
--- a/arch/x86_64/src/context_switching/syscall/syscall_handler.cpp
+++ b/arch/x86_64/src/context_switching/syscall/syscall_handler.cpp
@@ -60,6 +60,12 @@ namespace teachos::arch::context_switching::syscall
case type::EXPAND_HEAP:
result = expand_user_heap();
break;
+ case type::ASSERT:
+ if (!arg_0)
+ {
+ teachos::arch::exception_handling::panic(reinterpret_cast<const char *>(arg_1));
+ }
+ break;
default:
teachos::arch::exception_handling::panic("[Syscall Handler] Invalid syscall number");
break;