public inbox for
 help / color / mirror / Atom feed
From: Andrew Stubbs <>
To: <>
Subject: [PATCH] PAGE_SIZE definition for MIPS XLP
Date: Mon, 18 Nov 2013 12:51:00 -0000	[thread overview]
Message-ID: <> (raw)

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

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 



[-- Attachment #2: xlp-page-size.patch --]
[-- Type: text/x-patch, Size: 783 bytes --]

2013-11-18  Andrew Stubbs  <>

	* 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 {
+#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	/* _SYS_USER_H */

             reply	other threads:[~2013-11-18 12:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18 12:51 Andrew Stubbs [this message]
2013-11-18 13:42 ` Andreas Schwab
2013-11-19 20:56   ` Maciej W. Rozycki
2013-11-18 13:45 ` Joseph S. Myers
2013-11-18 18:21 ` Joseph S. Myers
2013-11-19  3:28 ` Andrew Pinski
2013-11-19 14:57   ` Joseph S. Myers
2013-11-19 20:19     ` Andrew Stubbs
2013-11-20 19:57   ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).