Subversion Repositories Kolibri OS

Rev

Rev 1066 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1066 Rev 2971
Line 9... Line 9...
9
 
9
 
Line 10... Line 10...
10
 
10
 
11
typedef struct
11
typedef struct
12
{
12
{
13
  link_t buddy_link;        /**< link to the next free block inside one  order */
13
  link_t  buddy_link;         /**< link to the next free block inside one  order */
14
  u16_t   refcount;           /**< tracking of shared frames  */
14
  u16_t   refcount;           /**< tracking of shared frames  */
15
  u16_t   buddy_order;        /**< buddy system block order */
15
  u16_t   buddy_order;        /**< buddy system block order */
16
  void *parent;             /**< If allocated by slab, this points there */
16
  void   *parent;             /**< If allocated by slab, this points there */
Line -... Line 17...
-
 
17
} frame_t;
17
} frame_t;
18
 
18
 
19
 
19
typedef struct
20
typedef struct
20
{
21
{
21
  SPINLOCK_DECLARE(lock);   /**< this lock protects everything below */
22
  SPINLOCK_DECLARE(lock);     /**< this lock protects everything below */
22
  pfn_t base;               /**< frame_no of the first frame in the frames array */
23
  pfn_t    base;              /**< frame_no of the first frame in the frames array */
23
  count_t count;            /**< Size of zone */
24
  count_t  count;             /**< Size of zone */
24
 
25
 
25
  frame_t *frames;          /**< array of frame_t structures in this zone */
26
  frame_t *frames;            /**< array of frame_t structures in this zone */
Line 26... Line 27...
26
  count_t free_count;       /**< number of free frame_t structures */
27
  count_t  free_count;        /**< number of free frame_t structures */
27
  count_t busy_count;       /**< number of busy frame_t structures */
28
  count_t  busy_count;        /**< number of busy frame_t structures */
Line 28... Line 29...
28
 
29
 
29
  u32_t max_order;
30
  u32_t    max_order;
Line 30... Line 31...
30
  link_t order[21];
31
  link_t   order[21];
31
 
32
 
Line 43... Line 44...
43
    u32_t   state;
44
    u32_t   state;
44
}md_t;
45
}md_t;
45
 
46
 
Line 46... Line 47...
46
 
47
 
47
#define PG_MAP        1
48
#define PG_MAP          1
48
#define PG_WRITE      2
49
#define PG_WRITE        2
49
#define PG_USER       4
-
 
50
 
-
 
51
#define PG_SW         3
-
 
Line -... Line 50...
-
 
50
#define PG_USER         4
-
 
51
 
Line 52... Line 52...
52
#define PG_UW         7
52
#define PG_SW           3
53
 
53
#define PG_UW           7
Line 61... Line 61...
61
# define KA2PA(x) (((addr_t) (x)) - OS_BASE)
61
# define KA2PA(x) (((addr_t) (x)) - OS_BASE)
62
 
62
 
Line 63... Line 63...
63
static inline count_t SIZE2FRAMES(size_t size)
63
static inline count_t SIZE2FRAMES(size_t size)
64
{
64
{
65
	if (!size)
65
    if (!size)
66
		return 0;
66
        return 0;
67
  return (count_t) ((size - 1) >> PAGE_WIDTH) + 1;
67
  return (count_t) ((size - 1) >> PAGE_WIDTH) + 1;
68
}
68
}
Line 69... Line 69...
69
 
69
 
70
static inline addr_t PFN2ADDR(pfn_t frame)
70
static inline addr_t PFN2ADDR(pfn_t frame)