I am trying to write a OS and make it total with something new, take ideas from my mind and just dont copy from the internet i have done it everywhere i could as memory management process creation, multitasking and more, its all code and engineering by me.
But im running into a problem, when im running tasks the program does not know where it is and use addresses as low as the program, for example if i declare a variable and it is stored in 0x800, when i run the program the cpu is going to search for it in that location, but there is a offset, the program offset, so i need to add the program offset to that 0x800 to get the real value, the next code will give you an idea
int a = 10;
if(a == 10)
{
//more code
}
this does not work becouse the variable a is on a wrong address
I know there is paging but the way the os is already created with multitasking and process management i would need to recreate those functions
Is there a way to give the kernel or the cpu that program address offset so it would run with the correct addresses