[Top] [All Lists]

Re: [PATCH] mm/pg-r4k.c: Dump the generated code

To: Ralf Baechle <>
Subject: Re: [PATCH] mm/pg-r4k.c: Dump the generated code
From: Franck Bui-Huu <>
Date: Wed, 03 Oct 2007 14:17:56 +0200
Cc: Thiemo Seufer <>, "Maciej W. Rozycki" <>,
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; bh=LEjw1IGxUb19AsCD24Asb8F76gLImol6AkB5lPCw0x8=; b=QqeYP0C7KbHgCI9Jwvt5lOf3+OHS0chknOrhDR8d6Sbc3o5LJ1dMPF2SAJxqV9dgaVrssdvH3D9dCLX2kR872AlZp/ODOuh3VcyjCBgqgUnFOlGB1IFSo+pSLa3vlK5y2BypniKzDJe8cP3lMSnS9pXZMHYVQTAZFvswVN3szIs=
Domainkey-signature: a=rsa-sha1; c=nofws;; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=LjFC8q/9PIYrNeAekU3Il0QJuie0TTWmAfsW02PYrA8muAmz3fQGc409pOkoQ6ZiBJpfEM/9VT2OC8eO2sM2xfXdBJtkxxnqThBSXdg1zlT994zYokpswchWZmxiGKWO4aQDvtqdyRQD3M8hxC5g9o7GUlCBBPB7rc8WTnEy5tk=
In-reply-to: <>
Original-recipient: rfc822;
References: <> <> <>
User-agent: Thunderbird (X11/20070719)
Ralf Baechle wrote:
> I don't mind - it's just that I've never been a friend of leaving much
> debugging code or features around.  99% of the time it is just make the
> code harder to read and maintain.

Yeah this kind of code is really hard to follow and therefore hard to
maintain I guess.

I'm wondering if we couldn't try to implement such code generator by
using a tools/scripts during the build process. This tool could emit
the assembler code during the early phase of the build into an
assembler file and then it could compiled like any other one. I see a
3 main benefits:

  - It would simplify a lot the kernel code.
  - Decrease the size of the kernel
  - Easy to read the generated disassembly

One issue to deal with is that some instructions need to be emitted
according to the type of the cpu which can only be determined at run
time. In this case we could leave some rooms into the generated code
for additional instructions which could be filled/patched during the
boot time by using a 'patch table'. If the cpu doesn't need to patch
the generated code then the useless space would be discarded when
installing the handler in its final place.

Just a thought but I'm probably missing something.


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