update codes
This commit is contained in:
@@ -127,7 +127,7 @@ struct e820map {
|
||||
* that convert Page to other data types, such as phyical address.
|
||||
* */
|
||||
struct Page {
|
||||
atomic_t ref; // page frame's reference counter
|
||||
int ref; // page frame's reference counter
|
||||
uint32_t flags; // array of flags that describe the status of the page frame
|
||||
unsigned int property; // used in buddy system, stores the order (the X in 2^X) of the continuous memory block
|
||||
int zone_num; // used in buddy system, the No. of zone which the page belongs to
|
||||
|
||||
@@ -121,22 +121,24 @@ pde2page(pde_t pde) {
|
||||
|
||||
static inline int
|
||||
page_ref(struct Page *page) {
|
||||
return atomic_read(&(page->ref));
|
||||
return page->ref;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_page_ref(struct Page *page, int val) {
|
||||
atomic_set(&(page->ref), val);
|
||||
page->ref = val;
|
||||
}
|
||||
|
||||
static inline int
|
||||
page_ref_inc(struct Page *page) {
|
||||
return atomic_add_return(&(page->ref), 1);
|
||||
page->ref += 1;
|
||||
return page->ref;
|
||||
}
|
||||
|
||||
static inline int
|
||||
page_ref_dec(struct Page *page) {
|
||||
return atomic_sub_return(&(page->ref), 1);
|
||||
page->ref -= 1;
|
||||
return page->ref;
|
||||
}
|
||||
|
||||
extern char bootstack[], bootstacktop[];
|
||||
|
||||
@@ -35,7 +35,7 @@ struct mm_struct {
|
||||
pde_t *pgdir; // the PDT of these vma
|
||||
int map_count; // the count of these vma
|
||||
void *sm_priv; // the private data for swap manager
|
||||
atomic_t mm_count; // the number ofprocess which shared the mm
|
||||
int mm_count; // the number ofprocess which shared the mm
|
||||
semaphore_t mm_sem; // mutex for using dup_mmap fun to duplicat the mm
|
||||
int locked_by; // the lock owner process's pid
|
||||
|
||||
@@ -68,22 +68,24 @@ bool copy_to_user(struct mm_struct *mm, void *dst, const void *src, size_t len);
|
||||
|
||||
static inline int
|
||||
mm_count(struct mm_struct *mm) {
|
||||
return atomic_read(&(mm->mm_count));
|
||||
return mm->mm_count;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_mm_count(struct mm_struct *mm, int val) {
|
||||
atomic_set(&(mm->mm_count), val);
|
||||
mm->mm_count = val;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mm_count_inc(struct mm_struct *mm) {
|
||||
return atomic_add_return(&(mm->mm_count), 1);
|
||||
mm->mm_count += 1;
|
||||
return mm->mm_count;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mm_count_dec(struct mm_struct *mm) {
|
||||
return atomic_sub_return(&(mm->mm_count), 1);
|
||||
mm->mm_count -= 1;
|
||||
return mm->mm_count;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
||||
Reference in New Issue
Block a user