Subversion Repositories Kolibri OS

Rev

Rev 859 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
854 serge 1
 
2
{
3
  link_t buddy_link;        /**< link to the next free block inside one  order */
4
  count_t refcount;         /**< tracking of shared frames  */
5
  u32_t buddy_order;        /**< buddy system block order */
6
  void *parent;             /**< If allocated by slab, this points there */
7
} frame_t;
8
9
 
10
  SPINLOCK_DECLARE(lock);   /**< this lock protects everything below */
11
  pfn_t base;               /**< frame_no of the first frame in the frames array */
12
  count_t count;            /**< Size of zone */
13
14
 
15
  count_t free_count;       /**< number of free frame_t structures */
16
  count_t busy_count;       /**< number of busy frame_t structures */
17
18
 
19
  link_t order[21];
20
21
 
22
} zone_t;
23
24
 
25
 
26
# define KA2PA(x) (((u32_t) (x)) - OS_BASE)
27
28
 
29
#define FRAME_WIDTH  12
30
31
 
32
33
 
34
{
35
	if (!size)
36
		return 0;
37
  return (count_t) ((size - 1) >> FRAME_WIDTH) + 1;
38
}
39
40
 
41
{
42
  return (addr_t) (frame << FRAME_WIDTH);
43
}
44
45
 
46
{
47
	return (pfn_t) (addr >> FRAME_WIDTH);
48
};
49
50
 
51
52
 
53
54
 
55
pfn_t __stdcall alloc_pages(count_t count) __asm__ ("_alloc_pages") __attribute__ ((deprecated));
56
57
 
58
void frame_free(pfn_t frame);
59