All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Alexander Clouter <alex@digriz.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Re: [PATCH v1] MIPS: fix vmlinuz build when only 32bit math shell is available
Date: Tue, 19 Jan 2010 18:27:29 +0800	[thread overview]
Message-ID: <1263896850.29352.23.camel@falcon> (raw)
In-Reply-To: <20100119095556.GF32413@chipmunk>

Hi,

On Tue, 2010-01-19 at 09:55 +0000, Alexander Clouter wrote:
[...]
> >
> As a passing query, why do we have the high 32bit (0xffffffff....) spiel 
> if later we can just make VMLINU[XZ]_LOAD_ADDRESS the low half?  I see 
> the output of 'nm' shows:
> ----
> alex@berk:/usr/src/wag54g/linux$ nm vmlinux | head -n1
> 941019e4 t .ex0
> alex@berk:/usr/src/wag54g/linux$ nm vmlinuz | head -n1
> 944abb50 B .heap
> ----
> 

Mine:

$ mips64el-unknown-linux-gnu-nm vmlinux | head -n1
ffffffff80202304 t .ex0
$ mips64el-unknown-linux-gnu-nm vmlinuz | head -n1
ffffffff80b174e0 B .heap

and exactly, here is why we need to reserve the high 32bit:

$ cat arch/mips/Makefile | grep ^load | grep -v 0xffffffff
load-$(CONFIG_MIPS_SIM)		+= 0x80100000
load-$(CONFIG_SGI_IP27)		+= 0xc00000004001c000
load-$(CONFIG_SGI_IP27)		+= 0xa80000000001c000
load-$(CONFIG_SGI_IP28)		+= 0xa800000020004000

(Hi, Ralf, can we use the low 32bit directly?)

> However I am guessing it's some 64bit CPU requirement as my x86_64 
> kernel seems to have 0xffffffff....  Which raises the question, why is 
> AR7 not just using VMLINUX_LOAD_ADDRESS=0x94100000?
> 
> > 1. Append "the high 32bit of VMLINUX_LOAD_ADDRESS" as the prefix if it
> > exists.
> > 
> > 2. Get the sum of "the low 32bit of VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE"
> > with printf "%08x" (08 herein is used to prefix the result with 0...)
> > 
> > The corresponding shell script is:
> > 
> >   A=$VMLINUX_LOAD_ADDRESS;
> >   # Append "the high 32bit of VMLINUX_LOAD_ADDRESS" as the prefix if it exists.
> >   [ "${A:0:10}" != "${A}" ] && echo -n ${A:2:8};
> >   # Get the sum of "the low 32bit of VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE"
> >   printf "%08x" $(($VMLINUX_SIZE + 0x${A:(-8)}))
> > 
> Eugh, bash-ism's...
> ----
> alex@berk:/usr/src/wag54g/linux$ bash -c 'A=1234567890; echo ${A:0:5}'
> 12345
> alex@berk:/usr/src/wag54g/linux$ dash -c 'A=1234567890; echo ${A:0:5}'
> dash: Bad substitution
> ----

Ooh! really forget to test it with the dash, dash.... So, this revision
is also broken ;(

> 
> Your 'punishment', use Plan9 for a period of no less than a week! :)
>

I have never played with Plan9, but ubuntu, archlinux, gentoo... and
created my user with "useradd -s /bin/bash ....", so, I only work with
bash ;)

> You have to use the pattern matching approach I used in my original 
> patch, that's portable.  Look at 'man 1 dash' and search for 'substr' 
> for more details.

To consider "portable" and "good-looking", Perhaps it's better to use C
language here ;)

Thanks!

Regards,
	Wu Zhangjin

      reply	other threads:[~2010-01-19 10:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-19  9:43 [PATCH v1] MIPS: fix vmlinuz build when only 32bit math shell is available Wu Zhangjin
2010-01-19  9:43 ` Wu Zhangjin
2010-01-19  9:55 ` Alexander Clouter
2010-01-19 10:27   ` Wu Zhangjin [this message]

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=1263896850.29352.23.camel@falcon \
    --to=wuzhangjin@gmail.com \
    --cc=alex@digriz.org.uk \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.