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.
This is how my OS looks like:
linker.ldCode:
OUTPUT_FORMAT(elf32-i386)
ENTRY(start)
SECTIONS
{
. = 0x100000;
.text : { *(.text) }
.data : { *(.data) }
.bss : { *(.bss) }
}
loader.asmCode:
bits 32
section .text
align 4
dd 0x1BADB002
dd 0x00
dd - (0x1BADB002+0x00)
global start
extern kernel_main
start:
cli
call kernel_main
hlt
kernel.cCode:
#include "drivers/keyboard.h"
int kernel_main()
{
clearScreen();
print("TomOS v0.1 ");
putchar('\n');
putchar('\n');
//here it should call my process to write Hello World
while (1)
{
string ch = readStr();
print(ch);
}
}
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).
I start my OS with these commands:
Code:
ld -m elf_i386 -T linker.ld -o iso/boot/kernel.bin obj/loader.o obj/kernel.o obj/hardware_communication.o obj/string.o obj/display.o obj/keyboard.o
qemu-system-i386 -kernel iso/boot/kernel.bin
Thank you very much