[Top] [All Lists]

Re: Illegal instruction - a workaround or fix ?

To: Pete Popov <>
Subject: Re: Illegal instruction - a workaround or fix ?
From: Florian Lohoff <>
Date: Fri, 20 Apr 2001 21:58:41 +0200
Cc: Ralf Baechle <>,
In-reply-to: <>; from on Fri, Apr 20, 2001 at 12:05:03PM -0700
Organization: rfc822 - pure communication
References: <> <> <> <>
User-agent: Mutt/1.3.15i
On Fri, Apr 20, 2001 at 12:05:03PM -0700, Pete Popov wrote:
> I'm bringing this up again because none of the related patches on this
> topic have been applied to the latest cvs kernel.  The patch Florian
> refers to above oopses for me as well.  This patch below, from Florian,
> but updated against the latest cvs kernel, works (at least the few
> simple tests I've run do work now).  

The patch is definitly only a workaround and not a fix - The problem
is that the sysmips saves registers on the stack in the function
prolog. When taking the shortcut exit which is needed to not garble
the return code which can be "unsigned int" and not interpret it
as an -ESOMETHING. When doing this you need to skip a couple of instructions in
scall_o32.S which makes the shortcut necessary. On the shortcut
the compiler does not generate a correct epilgue (How should it know)
so the registers get garbled in the syscall which lets your programs

The asm variant tries to only touch registers already saved in
scall_o32.S (and also restored on exit) which are not anymore
used or register we are allowed to change anyway (caller saved).

A different solution would be to take the usual exit in sysmips via
the return at the end (for which the compiler generated a correct
epilogue) and modify the return address - This is an very ugly hack
and you cant tell where the compiler stores the ra on the stack.

Florian Lohoff                     +49-5201-669912
     Why is it called "common sense" when nobody seems to have any?

<Prev in Thread] Current Thread [Next in Thread>