mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Erwin Rol <mailinglists@erwinrol.com>
Cc: barebox@lists.infradead.org
Subject: Re: x86 weirdness
Date: Tue, 31 Jul 2012 15:13:19 +0200	[thread overview]
Message-ID: <20120731131319.GY30009@pengutronix.de> (raw)
In-Reply-To: <5017B839.7070806@erwinrol.com>

Hi Erwin,

On Tue, Jul 31, 2012 at 12:49:29PM +0200, Erwin Rol wrote:
> Hey x86-asm-experts,

Surely you do not mean me ;)

> 
> On 31-7-2012 0:36, Erwin Rol wrote:
> 
> So when I use the memset code the asm looks like this below. As you
> can see the memset gets its 3 parameters from the stack (see
> comments below in the asm src). But when you look at the location
> when memset is called it looks like the caller tries to pass the
> parameters in registers. After looking into the Makefile I noticed
> the arch/x86/boot/* sources get compiled with -mregparm=3, but the
> other sources use normal calling convention. This means code from
> arch/x86/boot/* can not call any other barebox functions when they
> are not of type void f(void). The file arch/x86/boot/regs.c also
> calls memset but it seems the compiler notices that regs.c is 16bit
> code and so it inlines a 16bit memset version (I at least don't see
> a call function).
> 
> Is there any GCC or LD magic we can use to prevent error like this?
> Wouldn't it be better to _not_ change the calling convention in the
> Makefile, but mark the functions that need it with __attribute__ ?

Maybe it's easier and more straight forward to just use a for-loop here
instead of playing magic games with attributes and or flags? Are there
more functions affected or is it just memset?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-07-31 13:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30 22:36 Erwin Rol
2012-07-31 10:49 ` Erwin Rol
2012-07-31 13:13   ` Sascha Hauer [this message]
2012-07-31 15:16     ` Erwin Rol
2012-07-31 15:51       ` Jean-Christophe PLAGNIOL-VILLARD
2012-07-31 16:16         ` Erwin Rol
2012-07-31 17:07       ` Sascha Hauer

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=20120731131319.GY30009@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=mailinglists@erwinrol.com \
    /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