aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src')
-rw-r--r--arch/x86_64/src/interrupt_handling/generic_interrupt_handler.cpp3
-rw-r--r--arch/x86_64/src/memory/heap/bump_allocator.cpp4
2 files changed, 3 insertions, 4 deletions
diff --git a/arch/x86_64/src/interrupt_handling/generic_interrupt_handler.cpp b/arch/x86_64/src/interrupt_handling/generic_interrupt_handler.cpp
index 7afd87d..60fb50c 100644
--- a/arch/x86_64/src/interrupt_handling/generic_interrupt_handler.cpp
+++ b/arch/x86_64/src/interrupt_handling/generic_interrupt_handler.cpp
@@ -4,15 +4,12 @@
namespace teachos::arch::interrupt_handling
{
-
- [[gnu::interrupt]] [[gnu::section(".interrupt_text")]]
auto generic_interrupt_handler(interrupt_frame * frame) -> void
{
(void)frame;
video::vga::text::write("An Interrupt occurred.", video::vga::text::common_attributes::green_on_black);
}
- [[gnu::interrupt]] [[gnu::section(".interrupt_text")]]
auto syscall_interrupt_handler(interrupt_frame * frame) -> void
{
// RDI, RSI, RDX, RCX, R8, R9
diff --git a/arch/x86_64/src/memory/heap/bump_allocator.cpp b/arch/x86_64/src/memory/heap/bump_allocator.cpp
index df95346..525f45c 100644
--- a/arch/x86_64/src/memory/heap/bump_allocator.cpp
+++ b/arch/x86_64/src/memory/heap/bump_allocator.cpp
@@ -24,11 +24,13 @@ namespace teachos::arch::memory::heap
auto bump_allocator::allocate(std::size_t size) -> void *
{
+ // Reading the value only has to be done once, because compare_exchange_weak updates the value as well if the
+ // exchange failed, becuase the value was not the expected one.
+ auto alloc_start = next.load(std::memory_order::relaxed);
// Repeat allocation until it succeeds, has to be done, because another allocator could overtake it at any time
// causing the value to differ and the calculation to have to be redone.
for (;;)
{
- auto alloc_start = next.load(std::memory_order::relaxed);
auto const alloc_end = saturating_add(alloc_start, size);
arch::exception_handling::assert(alloc_end <= heap_end, "[Heap Allocator] Out of memory");
// Check if the atomic value is still the one initally loaded, if it isn't we have been overtaken by another