diff --git a/include/arch/x86/segment.h b/include/arch/x86/segment.h index f04c0693..2d00bf95 100644 --- a/include/arch/x86/segment.h +++ b/include/arch/x86/segment.h @@ -183,7 +183,7 @@ static inline void set_gate32_offset(struct x86_gate32 *gate, unsigned long offs } static inline uint32_t get_gate32_offset(const struct x86_gate32 *gate) { - return (gate->offset_hi << 16) | gate->offset_lo; + return (_u(gate->offset_hi) << 16) | gate->offset_lo; } static inline void set_gate32(struct x86_gate32 *gate, uint8_t type, uint16_t selector, @@ -223,7 +223,7 @@ static inline void set_gate64_offset(struct x86_gate64 *gate, unsigned long offs } static inline uint64_t get_gate64_offset(const struct x86_gate64 *gate) { - return ((uint64_t) gate->offset_hi << 32) | (gate->offset_mi << 16) | gate->offset_lo; + return (_ul(gate->offset_hi) << 32) | (_ul(gate->offset_mi) << 16) | gate->offset_lo; } static inline void set_gate64(struct x86_gate64 *gate, uint8_t type, uint16_t selector, diff --git a/include/compiler.h b/include/compiler.h index 44991fd3..f77ae2a0 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -54,6 +54,7 @@ typedef uint64_t off_t; #define _ptr(val) ((void *) (unsigned long) (val)) #define _ul(val) ((unsigned long) (val)) +#define _u(val) ((unsigned int) (val)) #define _int(val) ((int) (val)) #endif diff --git a/mm/pmm.c b/mm/pmm.c index 34d6f27d..382dd225 100644 --- a/mm/pmm.c +++ b/mm/pmm.c @@ -383,13 +383,13 @@ static inline bool return_frame(frame_t *frame) { return false; } -static frame_t *find_mfn_frame(list_head_t *frames, mfn_t mfn, unsigned int order) { +static frame_t *find_mfn_frame(list_head_t *list, mfn_t mfn, unsigned int order) { frame_t *frame; - if (!has_frames(frames, order)) + if (!has_frames(list, order)) return NULL; - list_for_each_entry (frame, &frames[order], list) { + list_for_each_entry (frame, &list[order], list) { if (frame->mfn == mfn) return frame; } @@ -397,9 +397,9 @@ static frame_t *find_mfn_frame(list_head_t *frames, mfn_t mfn, unsigned int orde return NULL; } -static frame_t *find_larger_frame(list_head_t *frames, unsigned int order) { +static frame_t *find_larger_frame(list_head_t *list, unsigned int order) { while (++order <= MAX_PAGE_ORDER) { - frame_t *frame = get_first_frame(frames, order); + frame_t *frame = get_first_frame(list, order); if (frame) return frame;