data = 0xc5ce25

Hi,
I'm just curios, when my system starts I can see a message saying that:
Code:
data=0xc5c325
and after that a list of modules loaded with the corresponding text addresses. If I wrote the number right that corresponds to an address starting around 12 MB, so I guess something near the DMA zone (that should be first 16 MB). Anybody can give me an hint about such message?
 
From /usr/src/sys/boot/common/load_elf.c:
Code:
printf("data=0x%lx", (long)phdr[i].p_filesz);
if (phdr[i].p_filesz < phdr[i].p_memsz)
  printf("+0x%lx", (long)(phdr[i].p_memsz -phdr[i].p_filesz));
printf(" ");

The "data=<hex>+<hex>" is the size and offset of the data segment of the kernel/module.

You can find these values by using the readelf(1) command:

% readelf -l /boot/kernel/kernel
 
Thanks. So this means the kernel has a data space of around 12 MB, right? Now I've got two quesions:
1) what does kernel module means? This confuses my vision of a kernel that loads modules, but is not a module by itself...
2) this data has something to do with the kernel stack space and heap?
 
fluca1978 said:
Thanks. So this means the kernel has a data space of around 12 MB, right?
It depends on what you mean with "data space". The kernel is actually an executable in ELF format and has a well-defined structure (see elf(5)). An ELF file is divided in several sections (again, see elf(5)), and one of this is named ".data".
Well, the "data=<hex>+<hex>" that you see is actually the size+offset of the .data section of your kernel.

The modules are in ELF format too.

fluca1978 said:
1) what does kernel module means? This confuses my vision of a kernel that loads modules, but is not a module by itself...
With "kernel/module" I mean "kernel or module(s)". Sorry for not being clear.

fluca1978 said:
2) this data has something to do with the kernel stack space and heap?
Yes and no.

When a process is loaded in memory, the OS assigns some space (called process address space) which is divided roughly in this manner:
Code:
+---------------+
| Stack         |
+---------------+
| ...           |
| ...           |
| ...           |
+---------------+
| Data Segment  |
+---------------+
| Text Segment  |
+---------------+

So no, the stack has nothing to do with the data segment.
However, the heap is part of the data segment.

You can find more information here and here.
 
This confuses my vision of a kernel that loads modules, but is not a module by itself...

Yes it is. /boot/loader loads main kernel and modules into memory.

If would be easier if the "kernel" file was named "core" or something. So the kernel is modular with main module being "core".

Code:
 1   69 0xffffffff80100000 a0adc0   kernel
 2    1 0xffffffff80b0b000 202848   zfs.ko
 3    2 0xffffffff80d0e000 4998     opensolaris.ko
 4    3 0xffffffff80d13000 44458    linux.ko
 5    1 0xffffffff80d58000 413d8    if_bwn.ko
 6    2 0xffffffff80d9a000 ca78     siba_bwn.ko
 7    1 0xffffffff80da7000 250c0    snd_hda.ko
 8    2 0xffffffff80dcd000 75768    sound.ko
 9    1 0xffffffff80e43000 2d1e8    bwn_v4_lp_ucode.ko
10    1 0xffffffff80e71000 11718    ahci.ko
11    3 0xffffffff80e83000 4c018    vboxdrv.ko
12    1 0xffffffff80ed0000 5ad8     cuse4bsd.ko
13    1 0xffffffff80ed6000 7f0c0    radeon.ko
14    2 0xffffffff80f56000 22c68    drm.ko
15    2 0xffffffff81012000 290e     vboxnetflt.ko
16    2 0xffffffff81015000 8e24     netgraph.ko
17    1 0xffffffff8101e000 1532     ng_ether.ko
18    1 0xffffffff81020000 e5c      vboxnetadp.ko
19    1 0xffffffff81021000 3f7b     linprocfs.ko
20    1 0xffffffff81025000 a0d      linsysfs.ko
21    1 0xffffffff810af000 1575f    smbfs.ko
22    2 0xffffffff810c5000 2286     libiconv.ko
23    2 0xffffffff810c8000 ca1      libmchain.ko
 
Back
Top