types.h: Add arch_uint_ptr to make comparing native pointer types easier
This commit is contained in:
@ -20,7 +20,7 @@
|
||||
|
||||
#include <atags.h>
|
||||
|
||||
extern uint32 atags_ptr;
|
||||
extern arch_uint_ptr atags_ptr;
|
||||
|
||||
int atag_valid(struct atag *a) {
|
||||
switch (a->tag) {
|
||||
|
11
kernel/mm.c
11
kernel/mm.c
@ -21,6 +21,7 @@
|
||||
#include <list.h>
|
||||
#include <mm.h>
|
||||
#include <print.h>
|
||||
#include <types.h>
|
||||
|
||||
struct dlist_node mm_free_page_list;
|
||||
|
||||
@ -56,13 +57,13 @@ void mm_add_free_region(void *start, void *end) {
|
||||
start = (char *)start + MM_PAGE_SIZE;
|
||||
|
||||
//make sure both start and end address are aligned to the size of a page
|
||||
if ((unsigned int)start % MM_PAGE_SIZE != 0)
|
||||
start = (char*)start + (MM_PAGE_SIZE - ((unsigned int)start % MM_PAGE_SIZE));
|
||||
if (((unsigned int)end + 1) % MM_PAGE_SIZE != 0)
|
||||
end = (char*)end - ((unsigned int)end + 1) % MM_PAGE_SIZE;
|
||||
if ((arch_uint_ptr)start % MM_PAGE_SIZE != 0)
|
||||
start = (char*)start + (MM_PAGE_SIZE - ((arch_uint_ptr)start % MM_PAGE_SIZE));
|
||||
if (((arch_uint_ptr)end + 1) % MM_PAGE_SIZE != 0)
|
||||
end = (char*)end - ((arch_uint_ptr)end + 1) % MM_PAGE_SIZE;
|
||||
|
||||
if ((char *)end + 1 - (char *)start < MM_PAGE_SIZE<<1) {
|
||||
print("Error: Supplied memory area(%x,%x) is smaller than the page size (%d)\n", (unsigned int)start, (unsigned int)end, MM_PAGE_SIZE);
|
||||
print("Error: Supplied memory area(%x,%x) is smaller than the page size (%d)\n", (arch_uint_ptr)start, (arch_uint_ptr)end, MM_PAGE_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user