Page 1 of 1

I'm sorry about that. Or rather, I want to make my own OS, but what should I do? , risc-v or arm or x86

Posted: Thu Jan 16, 2025 10:38 pm
by nora23169
I'm sorry about that. Or rather, I want to make my own OS, but what should I do? , risc-v or arm or x86

Re: I'm sorry about that. Or rather, I want to make my own OS, but what should I do? , risc-v or arm or x86

Posted: Fri Jan 17, 2025 3:31 pm
by thewrongchristian
nora23169 wrote: Thu Jan 16, 2025 10:38 pm I'm sorry about that. Or rather, I want to make my own OS, but what should I do? , risc-v or arm or x86
All and none.

Write the majority of you code as if you don't care.

Then use machine independent abstractions to hide the machine differences.

For example, when you want to map a virtual address to a physical address, the different CPUs have different ways of doing that mapping, so you expose the mapping in a manner that doesn't assume a particular method of encoding the page table:

Code: Select all


#define MAP_NONE 0x0
#define MAP_READ 0x1
#define MAP_WRITE 0x2
#define MAP_EXEC 0x4

/**
 * Map virtualaddress to a physical page
 */
void arch_map_virtual(void * virtualaddress, paddr_t physicaladdress, unsigned prot);
/**
 * Map virtualaddress range to a physical page range
 */
void arch_map_virtual_range(void * vfrom, void * vto, paddr_t physicaladdress, unsigned prot);
Initial implementation using x86 or x64 probably probably has more documentation and example code available, and I dare say more people on here have x86/x64 experience, so help will likely be more becoming, as well as easily accessible hardware available for testing should you make it that far.

But do also read:
Required_Knowledge

Re: I'm sorry about that. Or rather, I want to make my own OS, but what should I do? , risc-v or arm or x86

Posted: Tue Jan 21, 2025 9:54 am
by junjie
x86 hardware is easy to get and setup. Limine barebones is also a good start for a new OS kernel. :D