This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PAGE_SIZE definition for MIPS XLP


MIPS' sys/user.h currently has a constant definition for PAGE_SIZE, and the other related settings. This is not appropriate for XLP (and other MIPS?) where the actual page size is a kernel configuration option.

Apart from the general principle of not having incorrect definitions, the actual problem that needs to be solved is in sysdeps/unix/sysv/linux/ifaddrs.c in which PAGE_SIZE is used by preference as an optimization. Most of the other possible use cases prefer to call __getpagesize or use sysconf, and so are unaffected.

Clearly, keeping the constant definition is desirable on at least some MIPS variants, in order to keep the optimization, but not for XLP.

The attached patch makes the definition conditional, rather than removing it completely. It's not clear to me whether the HOST_* definitions are similarly affected, but other platforms that do not define PAGE_SIZE also choose not to define those, so I've extended the ifndef similarly.

I this OK to commit? Should it be solved a different way?

Testcase tst-limits does check PAGE_SIZE matches, if defined, but not in this case because that test case does not include sys/user.h. Should I create a new test case for this, or include that header in the existing test?

Thanks

Andrew
2013-11-18  Andrew Stubbs  <ams@codesourcery.com>

	ports/
	* sysdeps/unix/sysv/linux/mips/sys/user.h: Don't define page
	characteristics on XLP.

diff --git a/ports/sysdeps/unix/sysv/linux/mips/sys/user.h b/ports/sysdeps/unix/sysv/linux/mips/sys/user.h
index 37fc568..c0d1505 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/sys/user.h
+++ b/ports/sysdeps/unix/sysv/linux/mips/sys/user.h
@@ -206,6 +206,7 @@ struct user {
 
 #endif
 
+#ifndef _MIPS_ARCH_XLP
 #define PAGE_SHIFT		12
 #define PAGE_SIZE		(1UL << PAGE_SHIFT)
 #define PAGE_MASK		(~(PAGE_SIZE-1))
@@ -214,5 +215,6 @@ struct user {
 #define HOST_TEXT_START_ADDR	(u.start_code)
 #define HOST_DATA_START_ADDR	(u.start_data)
 #define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
+#endif
 
 #endif	/* _SYS_USER_H */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]