ReplOS - A *REAL* Operating System on repl.it!
With pure C and Assembly. This is very quirky, I had to change a lot of stuff moving it onto replit.
Due to the way I did gdt setup and other things I couldn't actually get paging or switching to user mode to work. I still made what was essentially a "user program" but it cant even be loaded on replit!
Im not going to be improving this any more due to its inability to enter user mode. After I failed paging I intended to just use segmentation but without being able to enter user mode users could just change their own segments to anything they wanted. The only way to implement user programs now is some kind of interpreter embedded into the kernel.
incredible job making something as complex as this... definitely deserves more recognition
so sloooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooow
i might appear dumb rn but where is the link to the repl?
@starstriker https://replit.com/@CSharpIsGud/ReplOS replit must have broke old repl talk posts
Where is it?
It says “exit status 127” when i start
@BryceBrower For some reason or something repl did, qemu no longer wants to work on repl.
So to run any real OSes on repl you now how to download them and compile/run them yourself. It sucks because I was working on a new OS in rust that could do way more than these. Now I can't even share it once I finish it.
Wow that's cool. How did you do it?
@DysonBird I copied a bunch of stuff from my computer to make qemu work
OMG. Thank you so much!
How did you do this? Also, could you actually compile this to make a standalone OS? I've been looking up how to make an OS, but have no idea how. I've been learning the C programming language, but don't know how to use it to make an OS. Also, do you know how to create a desktop OS? Of course, it is best to start with a command line OS, but a desktop OS is best for a final product.
@AmazingMech2418 Yes, it gets compiled to a standalone OS, but to test it without putting it on real hardware you need an emulator like qemu or bochs(preferred). I was going to add a gui but without paging it would not of been very useful, im going to be uploading an improved version of this which can enable paging and enter user mode once I finish it.
Littleosbook covers setting up the build environment and getting it working with C.
But you should also get familiar with assembly as you can't make an operating system in just C alone
@CSharpIsGud Why can't you use an assembler to convert C to Assembly?
@AmazingMech2418 its an assembler not a C compiler, and C already compiles to machine code
@CSharpIsGud Well, I know that you can at least compile C into an executable and then disassemble it to Assembly.
nice
Sooooooo slowlyyyyyy
But very good
My god that is cool!!!
Nice!
the only thing I know how to do is display help (spoiler alert there is none)
@RobertFurr All it can do is help, clear and exit
due to the shortcomings of how I made it, the mistakes I made and trying to make it work on replit
gud day 2 u orll
luv mee
hav a gr8t tiim
wil u b my frend
youl be jealous
his repl are sick
@Trent66 That guy has 1 cycle and literally no repls, consider him checked out
If he never posted anything, why does he have a cycle? You start at 0. @CSharpIsGud
@CodeABC123 I said he had no repls, not no posts/comments. He probably got it on a post or comment.
I looked. He doesn’t have anything at all on his account! @CSharpIsGud
@CodeABC123 You can delete your comments and posts.
Oh. @CSharpIsGud
@CSharpIsGud punk amjad will get you
luv harv xx
@CSharpIsGud your repls trash mate
@CSharpIsGud level 452 and your still woeful
jeeeez punk rocker
@Trent66 Not sure what your problem is.
@CSharpIsGud I’m looking through past threads and I see this xDxDxD, imagine being called a punk rocker lol. You’re not wrong though.
could do better however
good repl ;);(
boutta make snowflakeOS
I love your posts always.
Yknow what I want to do this in python
@Zexogon Same. Could I help you with it?
@JordanDixon1 Then it wouldn't be a real OS anymore though.
@CSharpIsGud How so? Isn't C a language as well?
@JordanDixon1 an OS cant be done in just any language.
@CSharpIsGud Why not?
@JordanDixon1 C and C++ compile to assembly, which is why you can use them in OS Dev. There are projects like Cosmos which allow you to use C# and some others which let you use languages that don't normally compile to assembly. but all of those projects you will find they compile the language to assembly first
@JordanDixon1 When a computer is booting it isn't running an OS that can understand executables like a python interpreter right off the bat, and to make an OS in python it would imply that the machine somehow has a hardware python interpreter built in
@CSharpIsGud Ok... Could you maybe teach me some C? It looks similar to Java (except Java sucks, because its so dang complicated)
@JordanDixon1 Java is fairly simple, no pointers, strings. No having to worry about segfaults.
In the case of OS Dev though, a segfault doesn't necessarily exist and you don't get any descriptive messages or even hints if your doing something wrong with memory
@CSharpIsGud I just dont like the fact you have to type SO much for SO little. Like how to print to the terminal is this (not including the main method):
System.out.println("Hello Java!");
@JordanDixon1 I get pinged every time you guys reply to my original comment =w=
@JordanDixon1, you have to use a low-level programming language, the are C, Assembly, and probably more. Python is a high-level programming language. If you use the right things then you may be able to, but Python is not structured to be a language to write an OS in.
@DeBeast591 You could use python to write an OS, but only if you make the interpreter in assembly
@TaylorLiang, yeah, but Python can't make the best graphical things, but it can make a cool terminal-only OS. (Like my PyDOS)
@DeBeast591 terminal-only console application*
@TaylorLiang Or a compiler to convert py source files to assembly
@Zexogon Just do:
import os
os.system("install-pkg qemu")
os.system("install-pkg nasm")
os.system("bash Compile.sh")
@CSharpIsGud you could use something like numba or micropython.
@RobertFurr not how that works...
@sugarfi Micropython is hardware, and Numba is a JIT compiler. You still need an interpreter, even if you manage to compile python to assembly without the risk of compilation mistakes.
- It would still be slower than when done in C and Assembly
- Python has no form of memory management
@CSharpIsGud not really - cpython is a JIT compiler. It compiles to python bytecode.
- You could write a python VM in asm and it would be very fast.
- If you wrote a python asm VM, you could simply build in some functions to call asm to do memory management
@sugarfi Im not talking about running speed, im talking about the extra steps it takes to do things C comes built in with.
You could try to add memory management into python, but it isn't built for that and C is, so when something goes wrong you might be questioning whether your doing something wrong or if the memory management itself is buggy
@CSharpIsGud you could also use something like cython, which compiles python to c and allows you to interact with c
@sugarfi Does it add pointers to python
@CSharpIsGud no, but you could: just have a function to do it for you. something like:
void pointer_set(int addr, char val) { char* p = (char*) addr; *p = val; }
@sugarfi All those extra steps aren't worth it just to make parts of an OS with forced indentation
@CSharpIsGud I know, I'm just saying you could do it if you wanted to. There was some guy who wrote a whole new JS VM just so he could write an OS in JS.
@JordanDixon1 Yes Java is verbose but it is also a very simple language. There's so much you can make, and it's one of the biggest languages out there.
dangit beat me to it
also how did you get qemu to work?
@TaylorLiang I copied all the library files it said it was missing from my computer.
@CSharpIsGud :/
Ooo, fancy. I like the idea of a windowed terminal.
Though, I wouldn't call this a real OS because that would imply that it is a bootable image on the computer, not just some overlay program.
@SixBeeps This is a real bootable OS, QEMU is an emulator. No implying necessary because it IS a bootable image on a computer.
@CSharpIsGud Oh, my bad. I thought QEMU was just some sort of console application. Good work with this!
@CSharpIsGud How would I go about making an OS that has a UI and stuff and not just a kernel?
@Foster_Bryant https://wiki.osdev.org/Drawing_In_Protected_Mode https://wiki.osdev.org/VGA_Resources
But this is something reserved for after you already have stuff like paging, user mode and interrupts.
@CSharpIsGud thx, any sources for were you learned OS development? I have an assembly book but idk where to start on os development
@Foster_Bryant http://littleosbook.github.io/#introduction
** FINALLY! **
@Highwayman they beat me to it...
@sugarfi not necessarily...
@Highwayman good, looks like i still have time to finish my latest os...
@sugarfi actually it looks like you’ll have forever...
Hope you get yours working I’m sure it’ll be awesome :)
@Highwayman hopefully...
@sugarfi Good luck with user mode, but don't just rush past gdt and forget about it as soon as you get segmentation working. do it right or you wont be able to finish it
@CSharpIsGud I know. I just now got syscalls working, and I am going to set up a shell and then user mode.
@sugarfi user mode first, shells do not run in kernel space.
@sugarfi Me, too. (Mine’s gonna have a command line)