Use uint32_t rather than int for memory modes.
Change-Id: I12b4d0cb0582d80bf86ca5dd99c7e462d776320f
diff --git a/inc/hf/arch/mm.h b/inc/hf/arch/mm.h
index a7a155a..e8cfa36 100644
--- a/inc/hf/arch/mm.h
+++ b/inc/hf/arch/mm.h
@@ -146,17 +146,17 @@
/**
* Converts the mode into stage-1 attributes for a block PTE.
*/
-uint64_t arch_mm_mode_to_stage1_attrs(int mode);
+uint64_t arch_mm_mode_to_stage1_attrs(uint32_t mode);
/**
* Converts the mode into stage-2 attributes for a block PTE.
*/
-uint64_t arch_mm_mode_to_stage2_attrs(int mode);
+uint64_t arch_mm_mode_to_stage2_attrs(uint32_t mode);
/**
* Converts the stage-2 block attributes back to the corresponding mode.
*/
-int arch_mm_stage2_attrs_to_mode(uint64_t attrs);
+uint32_t arch_mm_stage2_attrs_to_mode(uint64_t attrs);
/**
* Initializes the arch specific memory management.
diff --git a/inc/hf/cpu.h b/inc/hf/cpu.h
index 56f7982..7535454 100644
--- a/inc/hf/cpu.h
+++ b/inc/hf/cpu.h
@@ -67,7 +67,7 @@
ipaddr_t ipaddr;
vaddr_t vaddr;
vaddr_t pc;
- int mode;
+ uint32_t mode;
};
struct vcpu {
diff --git a/inc/hf/mm.h b/inc/hf/mm.h
index 44b51b8..613e6e5 100644
--- a/inc/hf/mm.h
+++ b/inc/hf/mm.h
@@ -33,10 +33,10 @@
#define MM_PTE_PER_PAGE (PAGE_SIZE / sizeof(pte_t))
/* The following are arch-independent page mapping modes. */
-#define MM_MODE_R 0x0001 /* read */
-#define MM_MODE_W 0x0002 /* write */
-#define MM_MODE_X 0x0004 /* execute */
-#define MM_MODE_D 0x0008 /* device */
+#define MM_MODE_R UINT32_C(0x0001) /* read */
+#define MM_MODE_W UINT32_C(0x0002) /* write */
+#define MM_MODE_X UINT32_C(0x0004) /* execute */
+#define MM_MODE_D UINT32_C(0x0008) /* device */
/*
* Memory in stage-1 is either valid (present) or invalid (absent).
@@ -66,9 +66,9 @@
*
* Modes are selected so that owner of exclusive memory is the default.
*/
-#define MM_MODE_INVALID 0x0010
-#define MM_MODE_UNOWNED 0x0020
-#define MM_MODE_SHARED 0x0040
+#define MM_MODE_INVALID UINT32_C(0x0010)
+#define MM_MODE_UNOWNED UINT32_C(0x0020)
+#define MM_MODE_SHARED UINT32_C(0x0040)
#define MM_FLAG_COMMIT 0x01
#define MM_FLAG_UNMAP 0x02
@@ -105,19 +105,19 @@
bool mm_vm_init(struct mm_ptable *t, struct mpool *ppool);
void mm_vm_fini(struct mm_ptable *t, struct mpool *ppool);
bool mm_vm_identity_map(struct mm_ptable *t, paddr_t begin, paddr_t end,
- int mode, ipaddr_t *ipa, struct mpool *ppool);
+ uint32_t mode, ipaddr_t *ipa, struct mpool *ppool);
bool mm_vm_unmap(struct mm_ptable *t, paddr_t begin, paddr_t end,
struct mpool *ppool);
bool mm_vm_unmap_hypervisor(struct mm_ptable *t, struct mpool *ppool);
void mm_vm_defrag(struct mm_ptable *t, struct mpool *ppool);
void mm_vm_dump(struct mm_ptable *t);
bool mm_vm_get_mode(struct mm_ptable *t, ipaddr_t begin, ipaddr_t end,
- int *mode);
+ uint32_t *mode);
struct mm_stage1_locked mm_lock_stage1(void);
void mm_unlock_stage1(struct mm_stage1_locked *lock);
void *mm_identity_map(struct mm_stage1_locked stage1_locked, paddr_t begin,
- paddr_t end, int mode, struct mpool *ppool);
+ paddr_t end, uint32_t mode, struct mpool *ppool);
bool mm_unmap(struct mm_stage1_locked stage1_locked, paddr_t begin, paddr_t end,
struct mpool *ppool);
void mm_defrag(struct mm_stage1_locked stage1_locked, struct mpool *ppool);
diff --git a/inc/hf/spci_internal.h b/inc/hf/spci_internal.h
index 2bb1457..38bfd73 100644
--- a/inc/hf/spci_internal.h
+++ b/inc/hf/spci_internal.h
@@ -27,10 +27,10 @@
#define SPCI_VERSION_MAJOR_OFFSET 16
struct spci_mem_transitions {
- int orig_from_mode;
- int orig_to_mode;
- int from_mode;
- int to_mode;
+ uint32_t orig_from_mode;
+ uint32_t orig_to_mode;
+ uint32_t from_mode;
+ uint32_t to_mode;
};
/* TODO: Add device attributes: GRE, cacheability, shareability. */
@@ -69,6 +69,6 @@
bool spci_msg_check_transition(struct vm *to, struct vm *from,
enum spci_memory_share share,
- int *orig_from_mode, ipaddr_t begin,
+ uint32_t *orig_from_mode, ipaddr_t begin,
ipaddr_t end, uint32_t memory_to_attributes,
- int *from_mode, int *to_mode);
+ uint32_t *from_mode, uint32_t *to_mode);