update main #1

Merged
Sinipelto merged 240 commits from Bananymous/banan-os:main into main 2023-11-20 13:20:51 +02:00
3 changed files with 12 additions and 12 deletions
Showing only changes of commit 120f7329b1 - Show all commits

View File

@ -20,11 +20,11 @@
} while (false) } while (false)
#define ASSERT_LT(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_LT", <) #define ASSERT_LT(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_LT", <)
#define ASSERT_LE(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_LE", <=) #define ASSERT_LTE(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_LTE", <=)
#define ASSERT_GT(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_GT", >) #define ASSERT_GT(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_GT", >)
#define ASSERT_GE(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_GE", >=) #define ASSERT_GTE(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_GTE", >=)
#define ASSERT_EQ(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_EQ", ==) #define ASSERT_EQ(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_EQ", ==)
#define ASSERT_NE(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_NE", !=) #define ASSERT_NEQ(lhs, rhs) __ASSERT_BIN_OP(lhs, rhs, "ASSERT_NEQ", !=)
#define ASSERT_NOT_REACHED() Kernel::panic("ASSERT_NOT_REACHED() failed") #define ASSERT_NOT_REACHED() Kernel::panic("ASSERT_NOT_REACHED() failed")
#else #else
#include <assert.h> #include <assert.h>

View File

@ -215,7 +215,7 @@ namespace Kernel
void PageTable::map_fast_page(paddr_t paddr) void PageTable::map_fast_page(paddr_t paddr)
{ {
ASSERT(s_kernel); ASSERT(s_kernel);
ASSERT_GE(paddr, 0); ASSERT_NEQ(paddr, 0);
ASSERT(!interrupts_enabled()); ASSERT(!interrupts_enabled());
constexpr vaddr_t uc_vaddr = uncanonicalize(fast_page()); constexpr vaddr_t uc_vaddr = uncanonicalize(fast_page());
@ -326,7 +326,7 @@ namespace Kernel
ASSERT(vaddr); ASSERT(vaddr);
ASSERT(vaddr != fast_page()); ASSERT(vaddr != fast_page());
if (vaddr >= KERNEL_OFFSET) if (vaddr >= KERNEL_OFFSET)
ASSERT_GE(vaddr, (vaddr_t)g_kernel_start); ASSERT_GTE(vaddr, (vaddr_t)g_kernel_start);
if ((vaddr >= KERNEL_OFFSET) != (this == s_kernel)) if ((vaddr >= KERNEL_OFFSET) != (this == s_kernel))
Kernel::panic("unmapping {8H}, kernel: {}", vaddr, this == s_kernel); Kernel::panic("unmapping {8H}, kernel: {}", vaddr, this == s_kernel);
@ -372,7 +372,7 @@ namespace Kernel
ASSERT(vaddr); ASSERT(vaddr);
ASSERT(vaddr != fast_page()); ASSERT(vaddr != fast_page());
if (vaddr >= KERNEL_OFFSET) if (vaddr >= KERNEL_OFFSET)
ASSERT_GE(vaddr, (vaddr_t)g_kernel_start); ASSERT_GTE(vaddr, (vaddr_t)g_kernel_start);
if ((vaddr >= KERNEL_OFFSET) != (this == s_kernel)) if ((vaddr >= KERNEL_OFFSET) != (this == s_kernel))
Kernel::panic("mapping {8H} to {8H}, kernel: {}", paddr, vaddr, this == s_kernel); Kernel::panic("mapping {8H} to {8H}, kernel: {}", paddr, vaddr, this == s_kernel);

View File

@ -189,9 +189,9 @@ namespace Kernel
return; return;
// Verify no overflow // Verify no overflow
ASSERT_LE(bytes, size()); ASSERT_LTE(bytes, size());
ASSERT_LE(offset, size()); ASSERT_LTE(offset, size());
ASSERT_LE(offset, size() - bytes); ASSERT_LTE(offset, size() - bytes);
if (m_kmalloc || &PageTable::current() == &m_page_table) if (m_kmalloc || &PageTable::current() == &m_page_table)
{ {