Subversion Repositories HelenOS

Rev

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

Rev 1787 Rev 1854
Line 25... Line 25...
25
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
28
 */
29
 
29
 
30
 /** @addtogroup genericmm
30
/** @addtogroup genericmm
31
 * @{
31
 * @{
32
 */
32
 */
33
/** @file
33
/** @file
34
 */
34
 */
35
 
35
 
36
#ifndef __FRAME_H__
36
#ifndef KERN_FRAME_H_
37
#define __FRAME_H__
37
#define KERN_FRAME_H_
38
 
38
 
39
#include <arch/types.h>
39
#include <arch/types.h>
40
#include <typedefs.h>
40
#include <typedefs.h>
41
#include <adt/list.h>
41
#include <adt/list.h>
42
#include <synch/spinlock.h>
42
#include <synch/spinlock.h>
Line 59... Line 59...
59
 
59
 
60
#define FRAME_KA        0x1 /* skip frames conflicting with user address space */
60
#define FRAME_KA        0x1 /* skip frames conflicting with user address space */
61
#define FRAME_ATOMIC            0x2 /* do not panic and do not sleep on failure */
61
#define FRAME_ATOMIC            0x2 /* do not panic and do not sleep on failure */
62
#define FRAME_NO_RECLAIM        0x4     /* do not start reclaiming when no free memory */
62
#define FRAME_NO_RECLAIM        0x4     /* do not start reclaiming when no free memory */
63
 
63
 
64
#define FRAME_OK        0   /* frame_alloc return status */
-
 
65
#define FRAME_NO_MEMORY     1   /* frame_alloc return status */
-
 
66
#define FRAME_ERROR     2   /* frame_alloc return status */
-
 
67
 
-
 
68
static inline uintptr_t PFN2ADDR(pfn_t frame)
64
static inline uintptr_t PFN2ADDR(pfn_t frame)
69
{
65
{
70
    return (uintptr_t)(frame << FRAME_WIDTH);
66
    return (uintptr_t)(frame << FRAME_WIDTH);
71
}
67
}
72
 
68
 
Line 86... Line 82...
86
#define IS_BUDDY_LEFT_BLOCK(zone, frame)    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
82
#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)
83
#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)
84
#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)
85
#define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame)   (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
90
 
86
 
91
#define frame_alloc(order, flags)               frame_alloc_generic(order, flags, NULL)
87
#define frame_alloc(order, flags)       frame_alloc_generic(order, flags, NULL)
92
 
88
 
93
extern void frame_init(void);
89
extern void frame_init(void);
94
extern void * frame_alloc_generic(uint8_t order, int flags, int *pzone);
90
extern void * frame_alloc_generic(uint8_t order, int flags, int *pzone);
95
extern void frame_free(uintptr_t frame);
91
extern void frame_free(uintptr_t frame);
96
extern void frame_reference_add(pfn_t pfn);
92
extern void frame_reference_add(pfn_t pfn);
Line 109... Line 105...
109
extern void zone_print_list(void);
105
extern void zone_print_list(void);
110
void zone_print_one(int znum);
106
void zone_print_one(int znum);
111
 
107
 
112
#endif
108
#endif
113
 
109
 
114
 /** @}
110
/** @}
115
 */
111
 */
116
 
-