need to get paging working
imma do some identity pages

finally got identity paging working
hmmm i think i'm gonna do a kernel with only one address space

i'm disappointed that crystal doesn't have much low level support; i had to resort to using c for a lot of things

finally i got hello world in vga working in protected mode

okay i finally got timers and actual terminal scrolling working

alright i finally got interrupts working without getting stack overflown
ok i rly need sleepies

think i'm gonna port an existing heap memory allocator
or maybe i should do keyboard and mouse

i just realised i have to deal with meltdown and spectre
oh well can't leak kernel memory to userspace if everything runs in kernel mode

think i should do conservative gc to scan roots + precise gc to scan heap

alright got IDE+ATA working
now to do fat16

should i use C:\ or / to symbolize paths :blobthinking:

@fluff Isn't crystal garbage collected? I know you can write OSs in gc'd languages but don't you have to port the runtime to work on baremetal first?

@hunter yeah crystal has a runtime, however that can be disabled by passing some compiler flags
for now i'll implement the simplest os, then add in a stack/heap scanning gc later

@rice @hunter i meant the simplest freestanding binary that can take input and plop out output (and maybe do some multitasking along the way)

@fluff > fun kmain()

yeah! that looks like fun













sorry for the bad pun

@toffy just a lil crystal cross compile + manual linking
i'll put it on a github soon(tm)

@fluff there's existing projects which do it in nothing but crystal and some ASM for the initial entrypoint

@kurisu honestly, just bit fields in structs, is there a way to make an integer that spans n bits?

@fluff not yet, but you can write a struct with getters and setters which extract the right bits.
@fluff it's just manually doing what the compiler would be doing manually


some people even wrote macros for it

@kurisu yeah i really need to do that, i have better things to do right now though....

@fluff yeah, but it'd be neat to have it all in crystal

I'm glad that's all you're missing honestly, because it's one of those easy features you can add after 1.0
@kurisu @fluff High level programming languages are meant to have a high level of abstraction so it's going to be difficult to handle things such as structs and bits instead of classes and such. Because structs are replaced with classes.

Most of these include some kind of "workaround" in the form of "unsafe code", or additional libraries that lets you handle bytes as if they were data structure or classes in some way. But it's not the same as doing it in C.

@proxeus @kurisu luckily crystal is low level enough that you can cast a struct as a byte array, albeit it's more verbose (without macros ofc)

@proxeus @fluff crystal handles them fine, and has structs.

Doesn't need unsafe code at all to use structs, although crystal has unsafe code and kernels of course make good use of this.

@kurisu @proxeus out of curiosity does crystal rearrange struct fields, i currently wrap structs where i need to know its offsets correctly inside ffi blocks and i was wondering if i could just use the native crystal structs

@fluff @proxeus it does not rearrange struct fields, although it might in the future.

Of course there'll just be an annotation to turn it off.

@kurisu @proxeus does it add any extra type information like it does with classes?

@fluff @proxeus i don't see that changing in the future either.

Either way, @[Extern] might need to be added later. Though don't add it now, it's not very well used.
@fluff @proxeus the low-level ability of crystal is something thats dear to me so I keep it in mind

@fluff not quite the same, but Proxmox Cluster File System (pmxcfs) uses a database as "filesystem"

@miup looks like a frontend to an actual file system if you ask me

@fluff well, it keeps track of the files in it like a FS... but anyway, thats a special case, for clustering to be consistent...

@fluff I thought Crytal compiled to Erlang's VM bytecode

@leo its main target is native code
also i did have to write a lot of c glue code because crystal doesn't support things like bitfields

@fluff What sites/blogs/books/whatevers have you been reading to learn how this all works and how to make it? Would be awesome to be able to make a little OS.

@OTheB wiki.osdev.org, plus reading source code from other hobby oses

Sign in to participate in the conversation
niu.moe

Welcome to your niu world ! We are a cute and loving international community οΌ―(≧▽≦)οΌ― !