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

How OSKit obtains drive_info



When oskit boots up it calls the function oskit_linux_dev_init()
(from file [oskit]/linux/dev/init.c). That function contains the lines

osenv_mem_map_phys(0, PAGE_SIZE, &kaddr, 0);
x = *((unsigned *)(kaddr + 0x104));
memcpy(&drive_info, (void *)(x + (addr & (~PAGE_MASK))), 16);

(code was slightly edited for clarity.) If the global variable
phys_mem_va is not initialized it defaults to 0, and after macro
expansion kaddr has value of 0 as well. This means that the address
0 + 0x104 = 0x104 is being acessed for a pointer to data which will
be moved to drive_info.

My question is: when and how does that information get to be at address
0x104? I checked the linux source code, and it expects drive info to
point to offset 0x80 within a 2kB block of data copied from the address
0x90000 during the very first stage of boot up. I assume that information
comes from the BIOS.

Does OSKit do something similar? How does it make sure that the address
(kaddr + 0x104) is actually accessible and contains the correct values?

Thanks in advance.

P.S.: I'm using the Debian source package for oskit, version
oskit_0.97.20010214