Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/mm/frame.h

    r8d308b9 r96b02eb9  
    6262
    6363/** Convert the frame address to kernel VA. */
    64 #define FRAME_KA          0x1
     64#define FRAME_KA          0x01
    6565/** Do not panic and do not sleep on failure. */
    66 #define FRAME_ATOMIC      0x2
     66#define FRAME_ATOMIC      0x02
    6767/** Do not start reclaiming when no free memory. */
    68 #define FRAME_NO_RECLAIM  0x4
    69 /** Do not reserve / unreserve memory. */
    70 #define FRAME_NO_RESERVE  0x8
     68#define FRAME_NO_RECLAIM  0x04
    7169
    7270typedef uint8_t zone_flags_t;
    7371
    7472/** Available zone (free for allocation) */
    75 #define ZONE_AVAILABLE  0x0
     73#define ZONE_AVAILABLE  0x00
    7674/** Zone is reserved (not available for allocation) */
    77 #define ZONE_RESERVED   0x8
     75#define ZONE_RESERVED   0x08
    7876/** Zone is used by firmware (not available for allocation) */
    7977#define ZONE_FIRMWARE   0x10
     
    8785        uint8_t buddy_order;  /**< Buddy system block order */
    8886        link_t buddy_link;    /**< Link to the next free block inside
    89                                    one order */
     87                               one order */
    9088        void *parent;         /**< If allocated by slab, this points there */
    9189} frame_t;
     
    9391typedef struct {
    9492        pfn_t base;                    /**< Frame_no of the first frame
    95                                             in the frames array */
     93                                        in the frames array */
    9694        size_t count;                  /**< Size of zone */
    9795        size_t free_count;             /**< Number of free frame_t
    98                                             structures */
     96                                        structures */
    9997        size_t busy_count;             /**< Number of busy frame_t
    100                                             structures */
     98                                        structures */
    10199        zone_flags_t flags;            /**< Type of the zone */
    102100       
    103101        frame_t *frames;               /**< Array of frame_t structures
    104                                             in this zone */
     102                                        in this zone */
    105103        buddy_system_t *buddy_system;  /**< Buddy system for the zone */
    106104} zone_t;
     
    148146    ((~(((sysarg_t) -1) << (order)) & (index)) == 0)
    149147#define IS_BUDDY_LEFT_BLOCK(zone, frame) \
    150     (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
     148    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0)
    151149#define IS_BUDDY_RIGHT_BLOCK(zone, frame) \
    152     (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
     150    (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 1)
    153151#define IS_BUDDY_LEFT_BLOCK_ABS(zone, frame) \
    154     (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0)
     152    (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 0)
    155153#define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame) \
    156     (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
     154    (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x01) == 1)
     155
     156#define frame_alloc(order, flags) \
     157    frame_alloc_generic(order, flags, NULL)
    157158
    158159extern void frame_init(void);
    159160extern void *frame_alloc_generic(uint8_t, frame_flags_t, size_t *);
    160 extern void *frame_alloc(uint8_t, frame_flags_t);
    161 extern void *frame_alloc_noreserve(uint8_t, frame_flags_t);
    162 extern void frame_free_generic(uintptr_t, frame_flags_t);
    163161extern void frame_free(uintptr_t);
    164 extern void frame_free_noreserve(uintptr_t);
    165162extern void frame_reference_add(pfn_t);
    166 extern size_t frame_total_free_get(void);
    167163
    168 extern size_t find_zone(pfn_t, size_t, size_t);
     164extern size_t find_zone(pfn_t frame, size_t count, size_t hint);
    169165extern size_t zone_create(pfn_t, size_t, pfn_t, zone_flags_t);
    170166extern void *frame_get_parent(pfn_t, size_t);
Note: See TracChangeset for help on using the changeset viewer.