From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miguel Bolanos Subject: Re: ELKS memcpy_fromfs() failing. Wrong variable offsets Date: Thu, 03 Jun 2004 08:19:45 -0600 Sender: linux-8086-owner@vger.kernel.org Message-ID: <1086272385.3227.6.camel@talena.hsol.net> References: <609c173af82cc283@mayday.cix.co.uk> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <609c173af82cc283@mayday.cix.co.uk> List-Id: Content-Type: text/plain; charset="us-ascii" To: Robert de Bath Cc: Eduardo Pereira Habkost , Linux-8086 I can't apply this patch as this is for dev86.. this should go to Bruce Evans... I will forward it to him. Thanks Mike On Wed, 2004-06-02 at 02:47, Robert de Bath wrote: > 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? :-) -- --------------------miguel bolanos, systems administrator, linuxlabs ... ........ ..... .... 230 peachtree st nw ste 2701 the original linux labs atlanta.ga.us 30303 -since 1995 http://www.linuxlabs.com office 404.577.7747 fax 404.577.7743 --------------------------------------------------------------------