From: "J.A. Magallon" <jamagallon@able.es>
To: "J.A. Magallon" <jamagallon@able.es>
Cc: Marcelo Tosatti <marcelo@conectiva.com.br>,
lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] AT_PLATFORM on HT-P4
Date: Sun, 6 Apr 2003 01:02:11 +0200 [thread overview]
Message-ID: <20030405230211.GC12746@werewolf.able.es> (raw)
In-Reply-To: <20030405224233.GA12746@werewolf.able.es>; from jamagallon@able.es on Sun, Apr 06, 2003 at 00:42:33 +0200
On 04.06, J.A. Magallon wrote:
>
> On 04.04, Marcelo Tosatti wrote:
> >
> > So here goes -pre7. Hopefully the last -pre.
> >
>
This makes P4 Xeon to report correct i686 platform. Without this,
all those people that think its ld.so automatically picks i686 libs
are wrong...
The original code takes u_platform for coyping ELF_PLATFORM, but
also supposes it is the top of stack. This changes when we have
siblings:
if(smp_num_siblings > 1)
u_platform = u_platform - ((current->pid % 64) << 7);
Later:
NEW_AUX_ENT(0, AT_PLATFORM, (elf_addr_t)(unsigned long) u_platform);
that on HT cpus is broken, isn't it ?
This separates the two things, stack top and u_platform. It could be
even cleaner, with something like
stack_top = p;
if (k_platform)
sz = strlen(k_platform)+1
u_platform = stack_top - sz
__copy_to_user(...)
stack_top -= sz
else
u_platform = NULL
...
if(smp_num_siblings > 1)
stack_top = stack_top - ((current->pid % 64) << 7);
...
if (u_platform)
NEW_AUX_ENT(...)
But I have not tested it. Current patch below.
--- linux/fs/binfmt_elf.c.orig 2002-12-28 00:12:32.000000000 +0100
+++ linux/fs/binfmt_elf.c 2002-12-28 00:32:37.000000000 +0100
@@ -116,11 +116,14 @@
elf_caddr_t *argv;
elf_caddr_t *envp;
elf_addr_t *sp, *csp;
+ char *stack_top;
char *k_platform, *u_platform;
long hwcap;
size_t platform_len = 0;
size_t len;
+ stack_top = p;
+
/*
* Get hold of platform and hardware capabilities masks for
* the machine we are running on. In some cases (Sparc),
@@ -135,8 +138,8 @@
platform_len = strlen(k_platform) + 1;
u_platform = p - platform_len;
__copy_to_user(u_platform, k_platform, platform_len);
- } else
- u_platform = p;
+ stack_top = u_platform;
+ }
#if defined(__i386__) && defined(CONFIG_SMP)
/*
@@ -149,15 +152,14 @@
* processors. This keeps Mr Marcelo Person happier but should be
* removed for 2.5
*/
-
if(smp_num_siblings > 1)
- u_platform = u_platform - ((current->pid % 64) << 7);
+ stack_top -= ((current->pid % NR_CPUS) << 7);
#endif
/*
* Force 16 byte _final_ alignment here for generality.
*/
- sp = (elf_addr_t *)(~15UL & (unsigned long)(u_platform));
+ sp = (elf_addr_t *)(~15UL & (unsigned long)(stack_top));
csp = sp;
csp -= (1+DLINFO_ITEMS)*2 + (k_platform ? 2 : 0);
#ifdef DLINFO_ARCH_ITEMS
--
J.A. Magallon <jamagallon@able.es> \ Software is like sex:
werewolf.able.es \ It's better when it's free
Mandrake Linux release 9.2 (Bamboo) for i586
Linux 2.4.21-pre7-jam1 (gcc 3.2.2 (Mandrake Linux 9.2 3.2.2-5mdk))
next prev parent reply other threads:[~2003-04-05 22:50 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-04 21:15 Linux 2.4.21-pre7 Marcelo Tosatti
2003-04-04 21:34 ` J.A. Magallon
2003-04-04 21:01 ` Alan Cox
2003-04-04 22:44 ` kernel
2003-04-05 0:31 ` J.A. Magallon
2003-04-05 16:55 ` Alan Cox
2003-04-05 0:43 ` J.A. Magallon
2003-04-05 0:50 ` [PATCH] AT_PLATFORM on HT-P4 J.A. Magallon
2003-04-05 1:18 ` Benjamin LaHaise
2003-04-05 1:22 ` J.A. Magallon
2003-04-05 1:24 ` Benjamin LaHaise
2003-04-05 0:50 ` [PATCH] redundant printk decl J.A. Magallon
2003-04-05 0:52 ` [PATCH] thread signaling J.A. Magallon
2003-04-05 16:53 ` Alan Cox
2003-04-05 0:53 ` [PATCH] detached clone J.A. Magallon
2003-04-05 0:55 ` [PATCH] e1000 close J.A. Magallon
2003-04-05 2:06 ` Linux 2.4.21-pre7 Marcelo Tosatti
2003-04-05 0:51 ` Nathan Poznick
2003-04-05 3:52 ` Linux 2.4.21-pre7 - hpt366.c does not build Eyal Lebedinsky
2003-04-21 16:33 ` Marcelo Tosatti
2003-04-05 16:03 ` Linux 2.4.21-pre7 Udo A. Steinberg
2003-04-05 21:49 ` Jerome Chantelauze
2003-04-05 22:42 ` J.A. Magallon
2003-04-05 23:02 ` J.A. Magallon [this message]
2003-04-05 23:03 ` J.A. Magallon
2003-04-05 23:06 ` [PATCH] config/dep bugs J.A. Magallon
2003-04-06 22:18 ` Karl Weigel
2003-04-05 23:08 ` [PATCH] thread signaling J.A. Magallon
2003-04-05 23:09 ` [PATCH] detached cloning J.A. Magallon
2003-04-07 23:13 ` Daniel Jacobowitz
2003-04-09 23:29 ` J.A. Magallon
2003-04-10 15:12 ` Daniel Jacobowitz
2003-04-05 23:12 ` [PATCH] e1000 close J.A. Magallon
2003-04-06 14:53 ` Alan Cox
2003-04-08 16:28 ` Linux 2.4.21-pre7 Kaj-Michael Lang
2003-04-09 9:55 ` mikpe
2003-04-09 10:09 ` Benjamin Herrenschmidt
2003-04-09 10:20 ` mikpe
2003-04-09 11:01 ` Benjamin Herrenschmidt
2003-04-09 14:27 ` Ruth Ivimey-Cook
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030405230211.GC12746@werewolf.able.es \
--to=jamagallon@able.es \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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