Subversion Repositories HelenOS-historic

Rev

Rev 814 | Rev 820 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 814 Rev 816
Line 39... Line 39...
39
 
39
 
40
#define ONE_FRAME   0
40
#define ONE_FRAME   0
41
 
41
 
42
#define ZONES_MAX       16      /**< Maximum number of zones in system */
42
#define ZONES_MAX       16      /**< Maximum number of zones in system */
43
 
43
 
44
#define ZONE_JOIN       0x1  /**< If possible, merge with neighberhood zones */
44
#define ZONE_JOIN       0x1 /**< If possible, merge with neighberhood zones */
45
 
-
 
46
 
45
 
47
#define FRAME_KA        0x1 /* skip frames conflicting with user address space */
46
#define FRAME_KA        0x1 /* skip frames conflicting with user address space */
48
#define FRAME_PANIC     0x2 /* panic on failure */
47
#define FRAME_PANIC     0x2 /* panic on failure */
49
#define FRAME_ATOMIC            0x4 /* do not panic and do not sleep on failure */
48
#define FRAME_ATOMIC            0x4 /* do not panic and do not sleep on failure */
50
#define FRAME_NO_RECLAIM        0x8     /* Do not start reclaiming when no free memory */
49
#define FRAME_NO_RECLAIM        0x8     /* do not start reclaiming when no free memory */
51
 
50
 
52
#define FRAME_OK        0   /* frame_alloc return status */
51
#define FRAME_OK        0   /* frame_alloc return status */
53
#define FRAME_NO_MEMORY     1   /* frame_alloc return status */
52
#define FRAME_NO_MEMORY     1   /* frame_alloc return status */
54
#define FRAME_ERROR     2   /* frame_alloc return status */
53
#define FRAME_ERROR     2   /* frame_alloc return status */
55
 
54
 
Line 65... Line 64...
65
    return 0;
64
    return 0;
66
}
65
}
67
 
66
 
68
static inline __address PFN2ADDR(pfn_t frame)
67
static inline __address PFN2ADDR(pfn_t frame)
69
{
68
{
70
    return (__address)(frame << PAGE_WIDTH);
69
    return (__address)(frame << FRAME_WIDTH);
71
}
70
}
72
 
71
 
73
static inline pfn_t ADDR2PFN(__address addr)
72
static inline pfn_t ADDR2PFN(__address addr)
74
{
73
{
75
    return (pfn_t)(addr >> PAGE_WIDTH);
74
    return (pfn_t)(addr >> FRAME_WIDTH);
76
}
75
}
77
 
76
 
78
static inline pfn_t SIZE2PFN(__address size)
77
static inline pfn_t SIZE2PFN(__address size)
79
{
78
{
80
    if (!size)
79
    if (!size)
81
        return 0;
80
        return 0;
82
    return (pfn_t)((size-1) >> PAGE_WIDTH)+1;
81
    return (pfn_t)((size-1) >> FRAME_WIDTH)+1;
83
}
82
}
84
 
83
 
85
#define IS_BUDDY_ORDER_OK(index, order)     ((~(((__native) -1) << (order)) & (index)) == 0)
84
#define IS_BUDDY_ORDER_OK(index, order)     ((~(((__native) -1) << (order)) & (index)) == 0)
86
#define IS_BUDDY_LEFT_BLOCK(zone, frame)    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
85
#define IS_BUDDY_LEFT_BLOCK(zone, frame)    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
87
#define IS_BUDDY_RIGHT_BLOCK(zone, frame)   (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
86
#define IS_BUDDY_RIGHT_BLOCK(zone, frame)   (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
88
#define IS_BUDDY_LEFT_BLOCK_ABS(zone, frame)    (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
87
#define IS_BUDDY_LEFT_BLOCK_ABS(zone, frame)    (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
89
#define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame)   (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
88
#define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame)   (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
90
 
89
 
91
 
-
 
92
#define frame_alloc(order, flags)               frame_alloc_generic(order, flags, NULL, NULL)
90
#define frame_alloc(order, flags)               frame_alloc_generic(order, flags, NULL, NULL)
93
#define frame_alloc_rc(order, flags, status)            frame_alloc_generic(order, flags, status, NULL)
91
#define frame_alloc_rc(order, flags, status)            frame_alloc_generic(order, flags, status, NULL)
94
#define frame_alloc_rc_zone(order, flags, status, zone)     frame_alloc_generic(order, flags, status, zone)
92
#define frame_alloc_rc_zone(order, flags, status, zone)     frame_alloc_generic(order, flags, status, zone)
95
 
93
 
96
extern void frame_init(void);
94
extern void frame_init(void);