OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Jun 18, 2019 2:48 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: How to run process from kernel
PostPosted: Sat Nov 10, 2018 4:24 pm 
Offline

Joined: Sat Sep 22, 2018 2:38 pm
Posts: 18
So what should I do?


Top
 Profile  
 
 Post subject: Re: How to run process from kernel
PostPosted: Sat Nov 10, 2018 4:35 pm 
Offline
Member
Member

Joined: Thu Jul 03, 2014 5:18 am
Posts: 72
Location: The Netherlands
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.

_________________
My blog: http://www.rivencove.com/


Top
 Profile  
 
 Post subject: Re: How to run process from kernel
PostPosted: Sat Nov 10, 2018 4:40 pm 
Offline

Joined: Sat Sep 22, 2018 2:38 pm
Posts: 18
So if it is so easy you could show me solution of it :)


Top
 Profile  
 
 Post subject: Re: How to run process from kernel
PostPosted: Sun Nov 11, 2018 12:45 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3368
Location: Chichester, UK
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().


Top
 Profile  
 
 Post subject: Re: How to run process from kernel
PostPosted: Sun Nov 11, 2018 2:40 am 
Offline

Joined: Sat Sep 22, 2018 2:38 pm
Posts: 18
But function is not a process, process is application.


Top
 Profile  
 
 Post subject: Re: How to run process from kernel
PostPosted: Sun Nov 11, 2018 7:13 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3368
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: How to run process from kernel
PostPosted: Sun Nov 11, 2018 8:20 am 
Offline

Joined: Sat Sep 22, 2018 2:38 pm
Posts: 18
So without file system it is not possible? That it would load into memory at specific address?


Top
 Profile  
 
 Post subject: Re: How to run process from kernel
PostPosted: Sun Nov 11, 2018 8:55 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3368
Location: Chichester, UK
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?


Top
 Profile  
 
 Post subject: Re: How to run process from kernel
PostPosted: Sun Nov 11, 2018 10:08 am 
Offline
Member
Member

Joined: Wed Jun 17, 2015 9:40 am
Posts: 501
Location: Athens, Greece
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


Top
 Profile  
 
 Post subject: Re: How to run process from kernel
PostPosted: Mon Nov 12, 2018 9:02 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9284
Location: On the balcony, watching the Swedish Chef
Quote:
So if it is so easy you could show me solution of it

Was I supposed to repeat my second post here?

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: Freggar and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group