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.ld
Code: Select all
OUTPUT_FORMAT(elf32-i386)
ENTRY(start)
SECTIONS
{
. = 0x100000;
.text : { *(.text) }
.data : { *(.data) }
.bss : { *(.bss) }
}
Code: Select all
bits 32
section .text
align 4
dd 0x1BADB002
dd 0x00
dd - (0x1BADB002+0x00)
global start
extern kernel_main
start:
cli
call kernel_main
hlt
Code: Select all
#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);
}
}
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: Select all
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