From: Arun Sharma <arun.sharma@intel.com>
The current Linux implementation of shmat() insists on SHMLBA alignment even
when shmflg & SHM_RND == 0. This is not consistent with the man pages and
the single UNIX spec, which require only a page-aligned address.
However, some architectures require a SHMLBA alignment for correctness in all
cases. Such architectures use __ARCH_FORCE_SHMLBA.
#ifndef _ASM_SHMPARAM_H
#define _ASM_SHMPARAM_H
+#define __ARCH_FORCE_SHMLBA 1
+
#define SHMLBA 0x40000 /* attach addr a multiple of this */
#endif /* _ASM_SHMPARAM_H */
#ifndef _ASMPARISC_SHMPARAM_H
#define _ASMPARISC_SHMPARAM_H
+#define __ARCH_FORCE_SHMLBA 1
+
#define SHMLBA 0x00400000 /* attach addr needs to be 4 Mb aligned */
#endif /* _ASMPARISC_SHMPARAM_H */
#ifndef _ASMSPARC_SHMPARAM_H
#define _ASMSPARC_SHMPARAM_H
+#define __ARCH_FORCE_SHMLBA 1
+
extern int vac_cache_size;
#define SHMLBA (vac_cache_size ? vac_cache_size : \
(sparc_cpu_model == sun4c ? (64 * 1024) : \
#include <asm/spitfire.h>
+#define __ARCH_FORCE_SHMLBA 1
/* attach addr a multiple of this */
#define SHMLBA ((PAGE_SIZE > L1DCACHE_SIZE) ? PAGE_SIZE : L1DCACHE_SIZE)
if (shmflg & SHM_RND)
addr &= ~(SHMLBA-1); /* round down */
else
- return -EINVAL;
+#ifndef __ARCH_FORCE_SHMLBA
+ if (addr & ~PAGE_MASK)
+#endif
+ return -EINVAL;
}
flags = MAP_SHARED | MAP_FIXED;
} else {