Hello, I would like to know how can I load and start process from my kernel in the most simplest way.

I don't have filesystem in my OS, so in my opinion it should work like this (I don't know if it is correct), so my process have to be loaded on some specific address and then from kernel I move instruction pointer to that specific address where starts binary code of that loaded process.

and I have process saved in file hello.bin which print string Hello World written in Assembly without Syscalls (because my kernel doesn’t support it yet).

So I just wonder how can I load that hello.bin into specific address and then run instructions from that address from my kernel (I don’t have a filesystem so I think linker have to load it to some specific address).

What you have is a minimal piece of code that boots. Its does not qualify as a "kernel" in the formal definition of the word, and it still depends on undefined behaviour, such as using GRUB's stack. Then you want a process, which is a rather vague term that depends on how you define it - Even factories have processes, and they are not generally defined in terms of software.

So unless you just want to add a print statement before the last curly brace and call that a process, you should rather start thinking about what defines your "process", and from that you can deduce the kind of components you need.

_________________"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 ]

By process I mean application, as I said I have Hello World application in Assembly language which outputs Hello World to screen through VideoMemory. So I just want to load it to specific address and run it from kernel (move instruction pointer to that specific address).

Yes I know that incbin is for including binary code, but I don't understand how when I don't have a filesystem and I don't have access to system libraries.

Memcpy is for copying and I don't know how to jump to absolute address.

Isn't possible to just say linker to load that process to some address? For example my kernel starts at address 0x100000 then I could say that my process will starts at address 0x200000 for example and then in kernel I move instruction pointer to 0x200000 somehow.

Yes I know that incbin is for including binary code, but I don't understand how when I don't have a filesystem and I don't have access to system libraries.

So basically, you don't

The purpose of such tools is to take any file, and convert it to source code so you can include it in a binary. You get a block of data that then works just like any other variable initialised at compile time: its stored directly in your binary, and you don't need any other further effort to load it from disk. There's no filesystem involved, there are no system libraries involved.

The other two things you mentioned are things that can easily be researched.

_________________"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 ]

Isn't possible to just say linker to load that process to some address? For example my kernel starts at address 0x100000 then I could say that my process will starts at address 0x200000 for example and then in kernel I move instruction pointer to 0x200000 somehow.

It is not. The code for your executable resides at the end of your kernel. Because that’s where you placed it.If you want it to be at the arbitrary address 0x500000 then you need to put it there first.

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.

_________________"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 ]

Who is online

Users browsing this forum: Bing [Bot] and 8 guests

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