mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH-RFC] arch/i386/kernel/: kill some sparse warnings
Date: Sun, 16 Jan 2005 12:57:14 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0501161237350.8178@ppc970.osdl.org> (raw)
In-Reply-To: <20050116202335.GA11791@mars.ravnborg.org>



On Sun, 16 Jan 2005, Sam Ravnborg wrote:
> 
> loadsegment take the pointer to second argument and cast it to unsigned
> int *. Using a properly sized variable as argument to loadsegment kills
> this warning.

I think the bug here is in "loadsegment".

I don't really see why it uses "m" in the first place, since you can 
certainly move to a segment register from a reg too.

Afaik, that

	"m" (*(unsigned int *)&(value)))

is likely from some old bogus code for totally historical reasons, and it 
should likely just be

	"rm" (value)

instead.

Of course, there may be some strange mis-use of the thing somewhere which 
explains why the code does something that strange, and thus it might be 
best to check that all users are ok.

> For this fix I wonder what happened to the upper bits in the old
> implmentation - they were undefined per definition.

They are ignored by the definition of the instruction, and the 32-bit 
version (without a data size override) is selected just because it is 
faster. Which may be why it does that strange cast too: to make sure that 
the size of the operand matches (not that it should _matter_ for a memory 
op).

Oh, and the "%0" in the asm descriptor should probably have the operand 
character override for a full word, to make sure that the operand size 
(when we use a register - where it _does_ matter) matches the "movl". 

I think that means it should be "%k0" instead of "%0", ie something like

	"movl %k0,%%" #seg "\n"

for the move itself, along with the fix for the strange value thing.

Willing to see if that works ok?

		Linus

      reply	other threads:[~2005-01-16 20:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-16 20:23 Sam Ravnborg
2005-01-16 20:57 ` Linus Torvalds [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=Pine.LNX.4.58.0501161237350.8178@ppc970.osdl.org \
    --to=torvalds@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®