aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/user
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2025-05-06 13:40:42 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2025-05-06 13:40:42 +0000
commitc9f46f3773e7943ce114af888a44f50061c2ac1d (patch)
tree1c12055e7157da9fe08d6695d21d5195979117d7 /arch/x86_64/src/user
parent7d2e8bc16e6c1bacb3c676d21ea2245d8132218f (diff)
downloadteachos-c9f46f3773e7943ce114af888a44f50061c2ac1d.tar.xz
teachos-c9f46f3773e7943ce114af888a44f50061c2ac1d.zip
Remove user Mode Access to VGA / Heap and Kernel Methods.
Diffstat (limited to 'arch/x86_64/src/user')
-rw-r--r--arch/x86_64/src/user/main.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/x86_64/src/user/main.cpp b/arch/x86_64/src/user/main.cpp
index 3ddcb32..3e7b0ec 100644
--- a/arch/x86_64/src/user/main.cpp
+++ b/arch/x86_64/src/user/main.cpp
@@ -3,21 +3,31 @@
#include "arch/context_switching/syscall/main.hpp"
// TODO: Disallow this import
+#include "arch/kernel/cpu/if.hpp"
#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)});
+ kernel::cpu::clear_interrupt_flag(); // Causes crash Kernel Code (.text) is not mapped in User mMde
+
+ auto test = new int{20}; // Causes crash Heap is not mapped in User Mode
+ (void)test;
+
if (!error)
{
+ // Causes crash vga is not mapped in User Mode
video::vga::text::write("Successfully made a SYSCALL and returned with SYSRETQ!",
video::vga::text::common_attributes::green_on_black);
}
+
+ for (;;)
+ {
+ }
}
} // namespace teachos::arch::user