tech-kern archive

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

loadable verbose message modules (was Re: Kernel panic codes)



On Sun, Apr 15, 2012 at 10:57:54PM +1000, Nat Sloss wrote:
> Hi.
> 
> I have been working on a program that uses bluetooth sco sockets and I am 
> having frequent kernel panics relating to usb.
> 
> I am receiving trap type 6 code 0 and trap type 6 code 2 errors.

I've been thinking that it would be nice if there were more kernel
modules that replaced or supplemented anonymous numbers with their name
or description.  Thus

        trap type 6 code 0

and
        trap type 6 code 2

would become something like

        trap type 6(T_PAGEFLT) code 0

and

        trap type 6(T_PAGEFLT) code 2<PGEX_W>

if and only if the module was loaded.  The existing printf() in
trap_print()

        printf("trap type %d code %x ...\n", type, frame->tf_err, ...);

would change (just for example) to

        printf("trap type %d%s code %x%s ...\n", type, trap_type_string(type),
            frame->tf_err, trap_code_string(type, frame->tf_err), ...);

By default, the number -> string conversion functions,

        const char *trap_type_string(int type);
        const char *trap_code_string(int type, int code);

would be weak aliases for a single function that returns the empty
string.  The kernel module would override the defaults by providing
strong aliases to actual implementations.

For that weak/strong alias thing to work on a loadable module, I
think that Someone(TM) will need to make the kernel linker DTRT when
a modules with overriding strong aliases is added.  If the module is
not unloadable, Someone(TM)'s work is through.  There are some gotchas
making the kernel *un*loadable.  BTW, I also desire this function in the
kernel linker for Other Reasons.

Dave

-- 
David Young
dyoung%pobox.com@localhost    Urbana, IL    (217) 721-9981


Home | Main Index | Thread Index | Old Index