Execute other machine code from kernel
Execute other machine code from kernel
Hello. I am new to OS developing and I started working on my very first operating system. So far it is just one kernel file in a iso, but I was wondering how would I be able to make a C function that would execute a .asm or a machine code file in the same directory? Would I have to do stuff with file management? Thank you for your time.
Re: Execute other machine code from kernel
Yes, you'd need some kind of file system and some kind of memory manager and probably also a scheduler and a bunch of device drivers (timer, disk, keyboard/display/UART)...
Or you could fake most of it by showing different pictures in response to keyboard input. But then it wouldn't be an OS, obviously.
Or you could fake most of it by showing different pictures in response to keyboard input. But then it wouldn't be an OS, obviously.
Re: Execute other machine code from kernel
It's a long way until you'll be able to load additional files from disk.
At the beginning, the easiest way is to link everything together into a single kernel binary.
Once you really start to feel need for separate binaries (userspace programs, etc.) the next step might be to configure bootloader (e.g. GRUB) to load them as modules. Bootloader will place them somewhere in the memory, you'll have to figure out the exact addresses by parsing the information (Multiboot structures), it passes to your kernel.
At the beginning, the easiest way is to link everything together into a single kernel binary.
Once you really start to feel need for separate binaries (userspace programs, etc.) the next step might be to configure bootloader (e.g. GRUB) to load them as modules. Bootloader will place them somewhere in the memory, you'll have to figure out the exact addresses by parsing the information (Multiboot structures), it passes to your kernel.
If something looks overcomplicated, most likely it is.