DragonFly users List (threaded) for 2007-07
DragonFly BSD
DragonFly users List (threaded) for 2007-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Help with confusing C code in loader?

From: "Matt Emmerton" <matt@xxxxxxxxxxxxx>
Date: Sun, 29 Jul 2007 22:23:24 -0400

"walt" <wa1ter@myrealbox.com> wrote in message
> I'm trying to debug a problem in /boot/loader but I'm stumped by
> this line in sys/boot/common/module.c:
> error = (file_formats[i]->l_load)(filename, loadaddr, &fp);
> This seems to refer to a line in common/bootstrap.h:
> int (* l_load)(char *filename, u_int64_t dest, struct preloaded_file
> And that's where I lose the thread.  I can't figure out what the
> (* l_load) means because 'l_load' doesn't seem to be defined in
> any obvious place.

l_load is a function pointer, and a member of struct file_formats, which is
declared "extern struct file_format *file_formats[]" in common/bootstrap.h.
The comments say that this structure is provided by the consumer, so more
digging is required.

sys/boot/ARCH/loader/conf.c appears to be the "consumer", as each defines

In the ARCH=pc32 case, the array contains pointers to two file formats:
i386_elf and amd64_elf.  These are declared extern, so their definitions
reside somewhere else.  Yet more digging.

These two are defined in sys/boot/pc32/libi3864/elf32_freebsd.c and

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