Subject: Re: Add a MAP_ALIGNED flag for mmap(2).
To: Matt Thomas <matt@3am-software.com>
From: Andrew Brown <atatat@atatdot.net>
List: tech-kern
Date: 03/02/2003 23:39:30
>+/*
>+ * Alignment (expressed in log2). Must be >= log2(PAGE_SIZE) and
>+ * < # bits in a pointer (25 (acorn26), 32 or 64).
>+ */
>+#define MAP_ALIGNMENT_MASK 0xff000000
>+#define MAP_ALIGNMENT_SHIFT 24
>+#define MAP_ALIGNMENT_64KB 0x10000000 /* 2^16 */
>+#define MAP_ALIGNMENT_16MB 0x18000000 /* 2^24 */
>+#define MAP_ALIGNMENT_4GB 0x20000000 /* 2^32 */
>+#define MAP_ALIGNMENT_1TB 0x28000000 /* 2^40 */
>+#define MAP_ALIGNMENT_256TB 0x30000000 /* 2^48 */
>+#define MAP_ALIGNMENT_64PB 0x38000000 /* 2^56 */
why not simply
#define MAP_ALIGNMENT_MASK 0xff000000
#define MAP_ALIGNMENT_SHIFT 24
#define MAP_ALIGN(n) (n<<MAP_ALIGNMENT_SHIFT)
#define MAP_ALIGNMENT_64KB MAP_ALIGN(0x08)
#define MAP_ALIGNMENT_16MB MAP_ALIGN(0x10)
#define MAP_ALIGNMENT_4GB MAP_ALIGN(0x18)
#define MAP_ALIGNMENT_1TB MAP_ALIGN(0x20)
#define MAP_ALIGNMENT_256TB MAP_ALIGN(0x28)
#define MAP_ALIGNMENT_64PB MAP_ALIGN(0x30)
so that someone (nathan?) can request something aligned to 256k via
MAP_ALIGN(0x14)?
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
werdna@squooshy.com * "information is power -- share the wealth."