Changeset e6c4b94 in mainline for kernel/generic/include/mm/frame.h


Ignore:
Timestamp:
2011-11-16T19:52:33Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fadb07a
Parents:
19c8030
Message:

Adjust matching of zone flags to suport low/high memory distinction.

  • Make ZONE_AVAILABLE a non-zero bit.
  • Remove zone_flags_available().
  • Define portion of the zone flag bits that need to match exactly. The rest of the bits in the flags need not match exactly.
  • Add FRAME_HIGHMEM and ZONE_HIGHMEM.
File:
1 edited

Legend:

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

    r19c8030 re6c4b94  
    5050typedef uint8_t frame_flags_t;
    5151
     52#define FRAME_NONE        0x0
    5253/** Convert the frame address to kernel VA. */
    5354#define FRAME_KA          0x1
     
    6061/** Allocate a frame which can be identity-mapped. */
    6162#define FRAME_LOWMEM      0x10
     63/** Allocate a frame which cannot be identity-mapped. */
     64#define FRAME_HIGHMEM     0x20
    6265
    6366typedef uint8_t zone_flags_t;
    6467
     68#define ZONE_NONE       0x0
    6569/** Available zone (free for allocation) */
    66 #define ZONE_AVAILABLE  0x0
     70#define ZONE_AVAILABLE  0x1
    6771/** Zone is reserved (not available for allocation) */
    68 #define ZONE_RESERVED   0x8
     72#define ZONE_RESERVED   0x2
    6973/** Zone is used by firmware (not available for allocation) */
    70 #define ZONE_FIRMWARE   0x10
     74#define ZONE_FIRMWARE   0x4
    7175/** Zone contains memory that can be identity-mapped */
    72 #define ZONE_LOWMEM     0x20
     76#define ZONE_LOWMEM     0x8
     77/** Zone contains memory that cannot be identity-mapped */
     78#define ZONE_HIGHMEM    0x10
    7379
    74 #define FRAME_TO_ZONE_FLAGS(ff) (((ff) & FRAME_LOWMEM) ? ZONE_LOWMEM : 0)
     80/** Mask of zone bits that must be matched exactly. */
     81#define ZONE_EF_MASK    0x7
     82
     83#define FRAME_TO_ZONE_FLAGS(ff) \
     84        ((((ff) & FRAME_LOWMEM) ? ZONE_LOWMEM : \
     85            (((ff) & FRAME_HIGHMEM) ? ZONE_HIGHMEM : ZONE_NONE)) | \
     86            (ZONE_AVAILABLE | ZONE_LOWMEM | ZONE_HIGHMEM))
     87
     88#define ZONE_FLAGS_MATCH(zf, f) \
     89        (((((zf) & ZONE_EF_MASK)) == ((f) & ZONE_EF_MASK)) && \
     90            (((zf) & ~ZONE_EF_MASK) & (f)))
    7591
    7692typedef struct {
     
    131147}
    132148
    133 NO_TRACE static inline bool zone_flags_available(zone_flags_t flags)
    134 {
    135         return ((flags & (ZONE_RESERVED | ZONE_FIRMWARE)) == 0);
    136 }
    137 
    138149#define IS_BUDDY_ORDER_OK(index, order) \
    139150    ((~(((sysarg_t) -1) << (order)) & (index)) == 0)
Note: See TracChangeset for help on using the changeset viewer.