BAN: Update ASSERT api
its now much harder to mix < with <= and > with >=
This commit is contained in:
parent
71ecdd7245
commit
ca34ece8ef
|
@ -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>
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue