l4ka / pistachio

L4Ka::Pistachio micro-kernel
http://l4ka.org/projects/pistachio
273 stars 54 forks source link

L4_BootInfo_t on AMD64 #2

Closed mandrookin closed 12 years ago

mandrookin commented 12 years ago
unsigned int                    i;
L4_MemoryDesc_t     *   mbi_desc = 0;

    printf( "L4_NumMemoryDescriptors = %ld\n", L4_NumMemoryDescriptors(kip));
    for(i=0; i < L4_NumMemoryDescriptors(kip); i++)
    {
        L4_MemoryDesc_t * mdesc = L4_MemoryDesc( kip, i );
        if( L4_MemoryDescType (mdesc) == (L4_BootLoaderSpecificMemoryType | 0x10) )
        {
            printf("Found BootLoaderSpecificMemoryType at %p\n", (void*) L4_MemoryDescLow(mdesc));
            mbi_desc = mdesc;
            break;
        }
    }

This code works perfect on x86-32bit, but does not work on AMD64.

jkehne commented 12 years ago

Please define "does not work". Exactly what error are you seeing?

mandrookin commented 12 years ago

I see broken or misaligned MemoryDesc list. Hex-dunp of MemoryDesc does not match to "L4 eXperimental Kernel Reference Manual Version X.2.".

http://img-fotki.yandex.ru/get/5413/28696123.2/0_69d6f_9fa635b6_orig

jkehne commented 12 years ago

I'm sorry, but I can't reproduce that error. I put the code you posted above in the main method of the roottask, and it finds the memory descriptors you are looking for even on amd64. They do look different from the screenshot you postet though, some parts look like the order has been reversed. Are you accidentaly defining L4_BIG_ENDIAN somewhere?

mandrookin commented 12 years ago

I got the desired result with the following code:

L4_BootInfo_t * mbi = (L4_BootInfo_t*) L4_BootInfo(kip);

There is no need to access to memory descriptors. Thank you for responses.