public inbox for linux-8086@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert de Bath <robert$@mayday.cix.co.uk>
To: Eduardo Pereira Habkost <ehabkost@conectiva.com.br>
Cc: Linux-8086 <linux-8086@vger.kernel.org>
Subject: Re: ELKS memcpy_fromfs() failing. Wrong variable offsets
Date: Wed, 2 Jun 2004 09:47:25 +0100 (BST)	[thread overview]
Message-ID: <609c173af82cc283@mayday.cix.co.uk> (raw)
In-Reply-To: <20040601222140.GV21172@duckman.distro.conectiva>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1828 bytes --]

On Tue, 1 Jun 2004, Eduardo Pereira Habkost wrote:

> I am forwarding these messages to you, to check if you have any clue on
> why this happened, and why the function worked on older versions.
>
> I've changed the function to use [bp-2] for the 'ds' variable, and now
> the kernel works flawlessly.
>
> Do you have an explanation on how this function.off stuff works, and if
> this have changed on older versions?

Oh my, confusion reigns.

Okay first the si and di variables are usually defined as callee saves
unless you're compiling with the '-Mc' option.

The "memcpy_fromfs.off" stuff is generated for optimising the push/pop
of the si and di variables. It's a reasonably recent addition so all
accesses of si and si can be eliminated if they are unused. However,
it's only turned on if you use '-O'.

Ie: this is working as it should.

You have highlighted a bug though, the definition some of the 'set'
variables is actually wrong, they should have memcpy_fromfs.off added
when it might be non-zero.

BTW: You should really be using those variables to access C arguments
and locals, the '_memcpy_fromfs.ds' is for stack pointer relative the
'.memcpy_fromfs.ds' is for 'bp' relative.

I can fix the bug in one of two ways; either actually add the
'memcpy_fromfs.off' variable to the 'set' variables or simply
have the compiler assume that any '#asm' will use si and di.
(The asm("...") function will not however.)

Actually I think assuming that #asm uses si/di is best because as this
example has shown it is quite likely to be true, plus, it's the failsafe
option.

(PS: It's also very easy to do :-) see attached. )

So do you want me to make it like it was before? :-)

-- 
Rob.                          (Robert de Bath <robert$ @ debath.co.uk>)
                                       <http://www.cix.co.uk/~mayday>


[-- Attachment #2: Type: TEXT/PLAIN, Size: 545 bytes --]

diff -Nurd linux86.old/bcc/table.c linux86/bcc/table.c
--- linux86.old/bcc/table.c	Sun Jul 28 08:43:13 2002
+++ linux86/bcc/table.c	Wed Jun  2 09:37:56 2004
@@ -400,6 +400,11 @@
     register struct symstruct *symptr;
     int i;
 
+    if (framep && optimise && !callersaves) {
+       regfuse |= callee1mask;
+       outnstr("! Assuming #asm uses all callee saves registers");
+    }
+
     for (i = 0; i < HASHTABSIZE; ++i)
 	for (symptr = hashtab[i]; symptr != NULL; symptr = symptr->next)
 	    if (symptr->storage == LOCAL)

       reply	other threads:[~2004-06-02  8:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040601222140.GV21172@duckman.distro.conectiva>
2004-06-02  8:47 ` Robert de Bath [this message]
2004-06-02 12:52   ` ELKS memcpy_fromfs() failing. Wrong variable offsets Eduardo Pereira Habkost
2004-06-02 16:10   ` [bcc patch] Fix variable offset macros for #asm (was: Re: ELKS memcpy_fromfs() failing. Wrong variable offsets) Eduardo Pereira Habkost
2004-06-03 14:20     ` Miguel Bolanos
2004-06-03 14:19   ` ELKS memcpy_fromfs() failing. Wrong variable offsets Miguel Bolanos

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=609c173af82cc283@mayday.cix.co.uk \
    --to=robert$@mayday.cix.co.uk \
    --cc=ehabkost@conectiva.com.br \
    --cc=linux-8086@vger.kernel.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