tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Modularizing net80211 (was: link_set info needed)



On Sat, 28 Apr 2012, Paul Goyette wrote:

For built-in modules, we don't (seem to) have a list of the kernel's program sections, and the module's mod->mod_kobj is NULL. So we can't use the section table to get the start address or size of the section. We do have the start/end symbols that __link_set_foreach() uses to enumerate the members.

For non-built-in modules (whether loaded by boot loader, or later from the file system), we have the section info (it's in the kobj->ko_progtab member), but we don't seem to get the start/end symbols. (Perhaps this could be resolved with some crt*.o type magic, but it appears that the user-land crt stuff is GPL'd so not suitable for kernel use?)

So it seems that we just can't get a single mechanism to work for all modules regardless of source (built-in, boot, or filesys).

I'd still like to find a way forward with this issue.

Since we can differentiate (both at compile time and at run-time) between the two modes (built-in vs loaded), I'd like to propose adding the data to support both modes into the mod_info_t structure:

typedef union {
        struct {                        /* For built-in modules */
                void *list_start;
                void *list_end;
        } func_list;
        const char *section;            /* For loaded modules */
} func_list_t;
....
typedef struct module {
....
        u_int                   mod_fbtentries; /* DTrace FBT entrie count */
        int                     mod_flags;
        func_list_t             mod_ctors, mod_dtors;
#define MODFLG_MUST_FORCE       0x01
#define MODFLG_AUTO_LOADED      0x02

} module_t;
....

Then the MODULE (or MODULE_NEW) macro can intialize the appropriate members of the unions, and the run-time code can find the start and end of the link_set section.


Comments?



-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index