types.h: Add arch_uint_ptr to make comparing native pointer types easier
This commit is contained in:
		| @@ -19,3 +19,5 @@ | ||||
|  */ | ||||
|  | ||||
| #include <arch-generic/types.h> | ||||
|  | ||||
| #define arch_uint_ptr uint32 | ||||
|   | ||||
| @@ -18,4 +18,5 @@ | ||||
|     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||||
|  */ | ||||
|  | ||||
| typedef unsigned int uint32; | ||||
| typedef unsigned long uint32; | ||||
| typedef unsigned long long uint64; | ||||
|   | ||||
| @@ -42,7 +42,7 @@ struct atag_core { | ||||
|  | ||||
| struct atag_mem { | ||||
| 	uint32 size;	/* size of the area */ | ||||
| 	uint32 start;	/* physical start address */ | ||||
| 	arch_uint_ptr start;	/* physical start address */ | ||||
| }; | ||||
|  | ||||
| struct atag { | ||||
|   | ||||
| @@ -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