A call does not work

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ateno3
Member
Member
Posts: 25
Joined: Sun Oct 02, 2011 3:36 am
Location: Spain

A call does not work

Post 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.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: A call does not work

Post 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.
ateno3
Member
Member
Posts: 25
Joined: Sun Oct 02, 2011 3:36 am
Location: Spain

Re: A call does not work

Post 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!!!
Post Reply