Changeset 89c57b6 in mainline for kernel/generic/include/macros.h


Ignore:
Timestamp:
2011-04-13T14:45:41Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88634420
Parents:
cefb126 (diff), 17279ead (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/macros.h

    rcefb126 r89c57b6  
    3939
    4040#include <typedefs.h>
     41#include <trace.h>
    4142
    4243/** Return true if the intervals overlap.
     
    4647 * @param s2  Start address of the second interval.
    4748 * @param sz2 Size of the second interval.
     49 *
    4850 */
    49 static inline int __attribute__((no_instrument_function))
    50     overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, size_t sz2)
     51NO_TRACE static inline int overlaps(uint64_t s1, uint64_t sz1, uint64_t s2,
     52    uint64_t sz2)
    5153{
    52         uintptr_t e1 = s1 + sz1;
    53         uintptr_t e2 = s2 + sz2;
     54        uint64_t e1 = s1 + sz1;
     55        uint64_t e2 = s2 + sz2;
    5456       
    5557        return ((s1 < e2) && (s2 < e1));
     58}
     59
     60/** Return true if the second interval is within the first interval.
     61 *
     62 * @param s1  Start address of the first interval.
     63 * @param sz1 Size of the first interval.
     64 * @param s2  Start address of the second interval.
     65 * @param sz2 Size of the second interval.
     66 *
     67 */
     68NO_TRACE static inline int iswithin(uint64_t s1, uint64_t sz1, uint64_t s2,
     69    uint64_t sz2)
     70{
     71        uint64_t e1 = s1 + sz1;
     72        uint64_t e2 = s2 + sz2;
     73       
     74        return ((s1 <= s2) && (e1 >= e2));
    5675}
    5776
     
    7392
    7493/* Compute overlapping of physical addresses */
    75 #define PA_overlaps(x, szx, y, szy) \
     94#define PA_OVERLAPS(x, szx, y, szy) \
    7695        overlaps(KA2PA((x)), (szx), KA2PA((y)), (szy))
    7796
     
    85104#define STRING_ARG(arg)  #arg
    86105
    87 #define LOWER32(arg)  (((uint64_t) (arg)) & 0xffffffff)
    88 #define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & 0xffffffff)
     106#define LOWER32(arg)  (((uint64_t) (arg)) & UINT32_C(0xffffffff))
     107#define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & UINT32_C(0xffffffff))
    89108
    90109#define MERGE_LOUP32(lo, up) \
    91         ((((uint64_t) (lo)) & 0xffffffff) \
    92             | ((((uint64_t) (up)) & 0xffffffff) << 32))
     110        ((((uint64_t) (lo)) & UINT32_C(0xffffffff)) \
     111            | ((((uint64_t) (up)) & UINT32_C(0xffffffff)) << 32))
    93112
    94113/** Pseudorandom generator
Note: See TracChangeset for help on using the changeset viewer.