Page 1 of 1

A call does not work

Posted: Sun Aug 10, 2014 5:54 am
by ateno3
Hello everybody.
I have a little problem with my OS. In the initial loading of my OS, GRUB loads a initrd (Initial RAM Disk) which contains a plain binary that I copy to another address in the memory which is controled by the OS and it's preparated to run applications. After I copy the binary, I try to call it, because I know where the entry point is. Besides, to know if the call has properly worked, the code writes in an address that I also know some numbers that I can read from the debugger.
The code is something like that:
My OS:

Code: Select all

void (*call)(void* param) = ((void(*)(void* param)) address; // The address is in the MB 16 and, yes, it's mapped.
call(data); // where data is a struct which contains some information that application needs. Besides, there are also a CRC so
               // I can check whether the code have done its work fine. The problem is that the code seems not to work (in fact, it seems
               // that it is not called at all ) because the structure isn't modified (when the struct. must have been changed). Moreover, 
               // when I look at the address I said before, there are nothing.

Binary

Code: Select all

unsigned int* address2check = (unsigned int*)0x1400000; // Again, it's mapped and there are no mmio mapped to that address.
*addres2chechk = 0x1234567; // A random number I put.
// Then I use the struct info and I modify its contents.
PS. My English is not my mother tongue and, as you all can see, my level isn't too high so, sorry :oops:
PS2. If everyone needed more information, or code, do not doubt to ask me for it.

Re: A call does not work

Posted: Sun Aug 10, 2014 8:47 am
by sortie
Don't use flat binaries. Use the ELF container format. Use paging and load the ELF executable at the location it was linked at.

Re: A call does not work

Posted: Sun Aug 10, 2014 9:56 am
by ateno3
The problem about doing what you're saying, is I have not implemented it yet. Moreover, VirtualBox allows me to see the RAM to check if the code is properly, and it is.
But thank you a lot!!!