1
0

types.h: Add arch_uint_ptr to make comparing native pointer types easier

This commit is contained in:
Aaron Lindsay 2012-11-15 00:27:49 -05:00
parent a1fb385d97
commit ccd5a9025a
5 changed files with 12 additions and 8 deletions

View File

@ -19,3 +19,5 @@
*/ */
#include <arch-generic/types.h> #include <arch-generic/types.h>
#define arch_uint_ptr uint32

View File

@ -18,4 +18,5 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
typedef unsigned int uint32; typedef unsigned long uint32;
typedef unsigned long long uint64;

View File

@ -42,7 +42,7 @@ struct atag_core {
struct atag_mem { struct atag_mem {
uint32 size; /* size of the area */ uint32 size; /* size of the area */
uint32 start; /* physical start address */ arch_uint_ptr start; /* physical start address */
}; };
struct atag { struct atag {

View File

@ -20,7 +20,7 @@
#include <atags.h> #include <atags.h>
extern uint32 atags_ptr; extern arch_uint_ptr atags_ptr;
int atag_valid(struct atag *a) { int atag_valid(struct atag *a) {
switch (a->tag) { switch (a->tag) {

View File

@ -21,6 +21,7 @@
#include <list.h> #include <list.h>
#include <mm.h> #include <mm.h>
#include <print.h> #include <print.h>
#include <types.h>
struct dlist_node mm_free_page_list; 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; start = (char *)start + MM_PAGE_SIZE;
//make sure both start and end address are aligned to the size of a page //make sure both start and end address are aligned to the size of a page
if ((unsigned int)start % MM_PAGE_SIZE != 0) if ((arch_uint_ptr)start % MM_PAGE_SIZE != 0)
start = (char*)start + (MM_PAGE_SIZE - ((unsigned int)start % MM_PAGE_SIZE)); start = (char*)start + (MM_PAGE_SIZE - ((arch_uint_ptr)start % MM_PAGE_SIZE));
if (((unsigned int)end + 1) % MM_PAGE_SIZE != 0) if (((arch_uint_ptr)end + 1) % MM_PAGE_SIZE != 0)
end = (char*)end - ((unsigned int)end + 1) % MM_PAGE_SIZE; end = (char*)end - ((arch_uint_ptr)end + 1) % MM_PAGE_SIZE;
if ((char *)end + 1 - (char *)start < MM_PAGE_SIZE<<1) { 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; return;
} }