Share your repls and programming experiences

← Back to all posts
QEMU on replit!
CSharpIsGud (436)

Ever wanted to make an OS on repl.it but couldn't get an emulator running? Now you can!

Developing, Compiling, Linking an OS is up to you!
Simply fork the repl and do whatever you want with qemu.

Commentshotnewtop
Coder100 (2741)

Nice work!
Don't know how to use this but I'll learn :)

Highwayman (1289)

Now we can make a ReplOS XD

sugarfi (493)
mov eax, nice
int 69
cli
hlt
nice: db 'Nice'
sugarfi (493)

Nice! I have tried a few times to get this to work, but I never could. I can write an OS, now I just have to get one working!

CSharpIsGud (436)

@sugarfi I have an OS with segmentation, keyboard input and vga output, Once I finish up "userland"(I didn't use paging) im going to put it on repl talk.

sugarfi (493)

@CSharpIsGud nice! I started once and got as far as GRUB and paging, then I tried again later and I set up my own 4-stage bootloader that entered protected mode. Then I accidentally deleted all my code.

CSharpIsGud (436)

@sugarfi How did you get paging, by the time I got to that part of the book I was reading I had already done a lot and I couldn't actually identity map anything.

sugarfi (493)

@CSharpIsGud I basically followed a tutorial, with a couple of modifications: https://wiki.osdev.org/Setting_Up_Paging. Once you enable it and set up a table and directory, you just have to use table[vaddr >> 12] = phyaddr to map addresses.

CSharpIsGud (436)

@sugarfi Oh yeah thats essentially what I had, at one point I managed to make it work without faults but the addresses weren't accurately mapped and I couldn't use the framebuffer anymore.

sugarfi (493)

@CSharpIsGud yeah, the mapping goes by pages, not addresses, so it can be inaccurate. I don't know why you couldn't see the framebuffer, though. Did you map the whole lower 1mb?

CSharpIsGud (436)

@sugarfi Pretty sure that part got mapped otherwise it probably would of just exploded

sugarfi (493)

@CSharpIsGud if you try to access unmapped memory, at least in qemu, there is a segfault or triple fault or something and the machine reboots.

CSharpIsGud (436)

@sugarfi My most working solution didn't crash, its just the framebuffer wasn't at the spot I wanted it to be in, just writing a huge chunk of data somewhere would eventually write into the framebuffer at some point

LiamDonohue (278)

how do you load a os into it?

CSharpIsGud (436)

@LiamDonohue Assuming you have one just run qemu like you normally would like qemu-system-x86_64 IMAGE.iso or qemu-system-x86_64 -kernel KERNELIMAGE

RobertFurr (43)

why did you turn the first 2 lines into comments

CSharpIsGud (436)

@RobertFurr The first line wasn't supposed to be a comment, I fixed that. I need to find some way to keep it from reinstalling qemu every time if its already installed and I was testing it.
the second line is actually a comment, you can put whatever there like commands to compile a kernel

RobertFurr (43)

@CSharpIsGud okay. Can you put a comment with an example as to what someone should do so they don't have to figure it out yourself?

CSharpIsGud (436)

@RobertFurr I thought of adding an example OS, but the point of the post is to show qemu working on repl.it not developing an OS.