lkml.org 
[lkml]   [1996]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: Jettisoning init code (was: nfsroot anyone?)
    On Mar 21,  7:15am, H. Peter Anvin wrote:
    > Subject: Re: Jettisoning init code (was: nfsroot anyone?)
    > It seems to me that the way to do it would be to have another segment
    > for this. I *think* ELF can support more segments than .code and
    > .data. Is there any way to get gas/gcc to use them, and if not, how
    > hard would it be to hack them to support .initcode and .initdata
    > segments?

    This most certainly would work. I even made a half-hearted attempt
    to implement something like this last May. When I did it, I ran across
    assembler bugs which prevented the kernel from booting, but perhaps
    these are fixed now. I suggest starting with a small user-mode
    application first just to make sure that gas/ld work OK with multiple
    text sections.

    I still have the diffs - I can send them to people who want to
    want to look into it to polish it up. They were based on 1.2.8
    (most of the work involved is locating the functions which can
    safely be moved to the .text.boot section).

    The general approach is to use something like:

    #ifdef __ELF__
    #ifndef MODULE
    #define SECTION_NAME(X) __attribute__((section(X)))
    #endif
    #endif

    #ifndef SECTION_NAME
    #define SECTION_NAME(X)
    #endif

    And then function declarations can be made like:

    unsigned long inode_init(unsigned long start, unsigned long end)
    SECTION_NAME(".text.boot");

    unsigned long inode_init(unsigned long start, unsigned long end)
    {
    /* Function body here... */
    }

    When I was fooling with it, it looked like the attribute needed to be part
    of the prototype and could not be part of the actual function declaration
    itself. Maybe this is no longer true for newer compilers.

    -Eric


    --
    "The woods are lovely, dark and deep. But I have promises to keep,
    And lines to code before I sleep, And lines to code before I sleep."


    \
     
     \ /
      Last update: 2005-03-22 13:36    [W:0.021 / U:30.348 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site