From 9270c7be8b9d5d266a9e89090cf1e809e27e0268 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Sat, 16 May 2009 02:39:13 +0000 Subject: [PATCH] - Add MIPS_IS_KSEG0_ADDR, MIPS_IS_KSEG1_ADDR and MIPS_IS_VALID_PTR macroses thet check if address belongs to KSEG0, KSEG1 or both of them respectively. --- sys/mips/include/cpu.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/mips/include/cpu.h b/sys/mips/include/cpu.h index 20b41e2a0271..11b81df381b2 100644 --- a/sys/mips/include/cpu.h +++ b/sys/mips/include/cpu.h @@ -72,6 +72,15 @@ #define MIPS_KSEG0_TO_PHYS(x) ((unsigned)(x) & MIPS_PHYS_MASK) #define MIPS_KSEG1_TO_PHYS(x) ((unsigned)(x) & MIPS_PHYS_MASK) +#define MIPS_IS_KSEG0_ADDR(x) \ + (((vm_offset_t)(x) >= MIPS_KSEG0_START) && \ + ((vm_offset_t)(x) <= MIPS_KSEG0_END)) +#define MIPS_IS_KSEG1_ADDR(x) \ + (((vm_offset_t)(x) >= MIPS_KSEG1_START) && \ + ((vm_offset_t)(x) <= MIPS_KSEG1_END)) +#define MIPS_IS_VALID_PTR(x) (MIPS_IS_KSEG0_ADDR(x) || \ + MIPS_IS_KSEG1_ADDR(x)) + /* * Status register. */