OSDev.org
https://forum.osdev.org/

How to run process from kernel
https://forum.osdev.org/viewtopic.php?f=1&t=33303
Page 2 of 2

Author:  tomsk [ Sat Nov 10, 2018 4:24 pm ]
Post subject:  Re: How to run process from kernel

So what should I do?

Author:  dseller [ Sat Nov 10, 2018 4:35 pm ]
Post subject:  Re: How to run process from kernel

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.

Author:  tomsk [ Sat Nov 10, 2018 4:40 pm ]
Post subject:  Re: How to run process from kernel

So if it is so easy you could show me solution of it :)

Author:  iansjack [ Sun Nov 11, 2018 12:45 am ]
Post subject:  Re: How to run process from kernel

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().

Author:  tomsk [ Sun Nov 11, 2018 2:40 am ]
Post subject:  Re: How to run process from kernel

But function is not a process, process is application.

Author:  iansjack [ Sun Nov 11, 2018 7:13 am ]
Post subject:  Re: How to run process from kernel

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.

Author:  tomsk [ Sun Nov 11, 2018 8:20 am ]
Post subject:  Re: How to run process from kernel

So without file system it is not possible? That it would load into memory at specific address?

Author:  iansjack [ Sun Nov 11, 2018 8:55 am ]
Post subject:  Re: How to run process from kernel

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?

Author:  glauxosdever [ Sun Nov 11, 2018 10:08 am ]
Post subject:  Re: How to run process from kernel

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

Author:  Combuster [ Mon Nov 12, 2018 9:02 am ]
Post subject:  Re: How to run process from kernel

Quote:
So if it is so easy you could show me solution of it

Was I supposed to repeat my second post here?

Page 2 of 2 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/