Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small bugfixes: segment signed promotion and PMM overlapping names #255

Merged
merged 2 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/arch/x86/segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions include/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions mm/pmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,23 +383,23 @@ 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;
}

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;
Expand Down