mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-26 23:36:32 +00:00
Fix CheckPtr and CheckCodePtr missing else and return.
This commit is contained in:
parent
1d74c8116e
commit
422414aa87
1 changed files with 8 additions and 0 deletions
|
@ -1,13 +1,21 @@
|
||||||
Bool CheckPtr(U8 *ptr)
|
Bool CheckPtr(U8 *ptr)
|
||||||
{//Check if address is valid pointer.
|
{//Check if address is valid pointer.
|
||||||
|
CZXE *zxe = mem_boot_base - sizeof(CZXE);
|
||||||
|
|
||||||
if (mem_heap_base <= ptr <= mem_mapped_space)
|
if (mem_heap_base <= ptr <= mem_mapped_space)
|
||||||
return *MemPageTable(ptr) & 1;
|
return *MemPageTable(ptr) & 1;
|
||||||
|
else
|
||||||
|
return mem_boot_base < ptr < mem_boot_base + zxe->file_size - 1 - sizeof(CZXE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool CheckCodePtr(U8 *ptr)
|
Bool CheckCodePtr(U8 *ptr)
|
||||||
{//Check if address is valid code address.
|
{//Check if address is valid code address.
|
||||||
|
CZXE *zxe = mem_boot_base - sizeof(CZXE);
|
||||||
|
|
||||||
if (mem_heap_base <= ptr <= mem_heap_limit)
|
if (mem_heap_base <= ptr <= mem_heap_limit)
|
||||||
return *MemPageTable(ptr) & 1;
|
return *MemPageTable(ptr) & 1;
|
||||||
|
else
|
||||||
|
return mem_boot_base < ptr < mem_boot_base + zxe->file_size - 1 - sizeof(CZXE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool CheckOnStack(U8 *ptr, CTask *task=NULL)
|
Bool CheckOnStack(U8 *ptr, CTask *task=NULL)
|
||||||
|
|
Loading…
Reference in a new issue