Page 2 of 2
Re: How to run process from kernel
Posted: Sat Nov 10, 2018 4:24 pm
by tomsk
So what should I do?
Re: How to run process from kernel
Posted: Sat Nov 10, 2018 4:35 pm
by dseller
Combuster wrote:dseller wrote:The code for your executable resides at the end of your kernel. Because that’s where you placed it.
Not even that.
The code for that executable is appended after a proper ELF file. qemu has a built-in bootloader that knows how to read ELF files, so it will look at the ELF headers and load what those headers state. It will not see the second ELF file, as there is no entry for that - its just garbage at the end.
There is also no way to tell a linker you are going to append blobs
later - after all, that requires a file offset outside of the initial file which is illegal.
Yeah, that's what I meant to say. I guess "after" would have been a better word choice.
tomsk wrote:
So what should I do?
This is pretty basic stuff. My honest advice for you is to go and learn the fundamentals of system programming.
Re: How to run process from kernel
Posted: Sat Nov 10, 2018 4:40 pm
by tomsk
So if it is so easy you could show me solution of it
Re: How to run process from kernel
Posted: Sun Nov 11, 2018 12:45 am
by iansjack
If you are going to combine the "process" with your kernel, just do it at the source code stage. Define it as another function that you call from main().
Re: How to run process from kernel
Posted: Sun Nov 11, 2018 2:40 am
by tomsk
But function is not a process, process is application.
Re: How to run process from kernel
Posted: Sun Nov 11, 2018 7:13 am
by iansjack
Not the way that you are trying to do it. You are trying to build it as part of the kernel and then call it. What makes that any different from a simple function?
OK. You need to implement a file system and an elf loader. Then you can load the application from storage at the appropriate address and then run it.
Re: How to run process from kernel
Posted: Sun Nov 11, 2018 8:20 am
by tomsk
So without file system it is not possible? That it would load into memory at specific address?
Re: How to run process from kernel
Posted: Sun Nov 11, 2018 8:55 am
by iansjack
I'm not convinced that you really know what you want to do.
What makes a process, or application, any different from a function in your kernel?
Re: How to run process from kernel
Posted: Sun Nov 11, 2018 10:08 am
by glauxosdever
Hi,
In order to be able to run a process, you need to get some code and data in a separate user-space address space. How you will get this code and data is another matter.
But I'm getting the impression you are putting the cart before the horse. Start with the kernel core, i.e. interrupt handling, memory management and in-kernel thread management and scheduling. Then try to do user-space processes.
Regards,
glauxosdever
Re: How to run process from kernel
Posted: Mon Nov 12, 2018 9:02 am
by Combuster
So if it is so easy you could show me solution of it
Was I supposed to repeat my second post here?