#Lumen

1 messages ยท Page 1 of 1 (latest)

last jungle
#

I will make a git later

rain badger
#

Severance?

last jungle
rain badger
#

Show

last jungle
fathom shuttle
#

osdev starter pack: limine template

halcyon breach
#

They didntuse the template as stated in chat

fathom shuttle
#

what chat?

halcyon breach
#

#osdev-misc-0 message

fathom shuttle
#

yes... I should know about all the message being sent everywhere

near grail
#

bad on your part if you don't

#

smh

fathom shuttle
#

mb

near grail
#

so uh, what this

fathom shuttle
#

I'll connect my brain to discord

near grail
#

I just saw thread button and clicked cause bored

last jungle
#

anyway

#

next step : printing text

fathom shuttle
#

flanterm

#

osdev starter pack item 2

last jungle
#

my bad

#

maybe I should make a filesystem driver first

fathom shuttle
#

no

last jungle
#

lmao

fathom shuttle
#

what's the point of having a filesystem if you don't even output anything?

last jungle
#

always start with the starter pack

near grail
#

just write a shitty audio driver and make it just play never gonna give you up on boot

#

and do nothing else

last jungle
#

shit that's a great idea

fathom shuttle
#

make it read out your logs, instead of printing

#

port some voice synthesiser

near grail
#

THIS

#

make it the perfect meme os

#

actually make it display a single image, the caked up luigi

fathom shuttle
#

but you need to actually use the framebuffer, so just loop nyan cat

last jungle
#

good idea from my friends : make it a python interpreter (without libs)

near grail
#

why without liberals

#

what did the liberals do

last jungle
#

libraries

near grail
last jungle
#

oh nvm

#

got it

fathom shuttle
#

own them liberals and write nyan cat in that python interpreter

last jungle
#

gotta make myself something to eat first

bitter reef
rain badger
#

its used for microdata refinement

last jungle
#

it has confidential informations

dim oriole
#

the colorful line drawing algorithm

#

must keep it secure

last jungle
#

now the question is

#

how am I gonna display text with the framebuffer

stoic path
#

Displaying text isn't too hard

unkempt breach
#

and nanoprintf for printf

stoic path
last jungle
#

welp that works

#

I'd like to be lib independant later but for now it does the job

#

it was actually very simple lol

#

btw what res is the limine framebuffer ?

unkempt breach
#

you can get it from the response

#

or

#

set it yourself

last jungle
#

I guess it isn't 1920x1080

unkempt breach
#

the fb response has the values

last jungle
#

let's see now that I can print text ๐Ÿ˜Ž

unkempt breach
#

you can set it like this

last jungle
#

or do that

last jungle
last jungle
last jungle
#

now what should I do ?
memory management ?

last jungle
#

first I'm gonna work on a good kprintf implementation

stoic path
last jungle
#

not yet

stoic path
#

Ah okay, yeah you have to set those up first

last jungle
#

I am still working on my kprintf

#

then I'll do these

stoic path
#

After you finish that ofc

last jungle
#

hell yeah

stoic path
#

Awesome!

last jungle
#

now time for the GDT and IDT

#

ok I don't understand anything

#

that's so cool

#

maybe I should stop there for today

#

enough coding

last jungle
stoic path
last jungle
#

oke

last jungle
#

ok I'm lost

#

my brain doesn't want to understand somehow

#

I'm pretty sure it's something actually easy

#

I've been looking there and there and I also asked chatgpt to explain to me

fathom shuttle
#

why don't newbies understand that using llm for this results in literally nothing

#

it makes your situation works, because you offload your thinking to chatgpt

stoic path
last jungle
#

I think I am getting it

last jungle
#

if I'm not wrong that's the way

last jungle
#

L: Long-mode code flag. If set (1), the descriptor defines a 64-bit code segment. When set, DB should always be clear. For any other type of segment (other code types or any data segment), it should be clear (0).

#

does this mean I should set it to 0 for my data seg ?

#

(sounds stupid but we never know I just wanna be sure)

stoic path
#

I believe so?

last jungle
#

I believe so too

#

at this point we'll see if it works or breaks lmao

#

maybe I'm doing shit

#

programming be like

#

now I guess I need to do a smol bit of assembly to load the gdt

last jungle
#

yep I'm defo wrong either on the asm or in the gdt

#

I guess it's not in the gdt itself if I can do lgdt without problems

#

or is it ?

#

man idk

stoic path
#

Or I suppose a better way of phrasing it is changes in the GDTR don't take affect until the segment registers are reloaded

last jungle
#

because I tried doing that with inline assembly (with as syntax ofc)

stoic path
#

What segments do you have in your GDT?

last jungle
#

code and data

stoic path
#

Also I believe it's recommended to write a assembly subroutine instead of using inline assembly

last jungle
#

null as first entry

stoic path
#

Okay

#

What's happening when you reload the segment registers?

last jungle
#

the kernel crashes and qemu restarts

#

also here's the code

stoic path
last jungle
#

oke

#

thanks to you I just saw an error in my makefile

#

I defined my qemu flags in a variable QEMU_FLAGS and it was referenced as QEMUFLAGS so it wouldn't work

stoic path
#

oh, yeah that would be a problem XD

last jungle
#

there's a lot of things

stoic path
#

just send the entire log

last jungle
#

uh

#

it's very long

stoic path
last jungle
#

nah I'm putting it all in a txt file

stoic path
#

Ah, you're getting a Page fault and then a General Protection Fault

last jungle
#

so it means ?

stoic path
#

Uhh, I don't totally know XD. But my guess is you're loading the GDT wrong

last jungle
#

lmao

#

thanks for the help tho

stoic path
#

np!

last jungle
#

I'm gonna write it in a separate .asm file

#

with nasm syntax I guess it should be easier

#

I just copy pasted what was written in the wiki gdt tutorial page (as long as I understand what I'm writing it's okay ig)

#

well at least now I know the problem comes from my gdt

stoic path
#

That's a start!

last jungle
#

because the asm should be good now

#

so the fault comes from the gdt

#

holy shit it works

#

I found the problem

#

find the difference between this :

last jungle
#

-# I feel very stupid rn

stoic path
last jungle
#

that's a big hell yeah

#

now time for the IDT

#

for now I don't need a more complicated gdt as I'm not going in usermode for now nor dealing with multitasking

humble abyss
last jungle
#

problems are the (un)funny part of programming

#

oh wait no

#

the problem is still here

#

-# I feel stupider

#

-# I didn't look at the window title being "QEMU (paused)"

stoic path
#

oof

#

I know how that feels

last jungle
#

I think I know where I messed up

#

gimme a sec

#

ah

#

I'm using the whole gdt as the address of the gdt

#

that's a problem

#

well that's a thing but qemu still crashes

last jungle
#

seems like my gdtr.base doesn't even have a value

#

that could be causing the crash

last jungle
#

asked it to print 0 in hex and then the value in hex and it shows me this

#

so it's not my kprintf impl that is causing a problem

#

apparently my gdt doesn't have an address

#

it's not null it's just

#

im gonna cry

last jungle
#

here's the real one

#

(0xFFFFFFFF was just for testing)

stoic path
last jungle
#

I might aswell just rewrite my entire gdt code

last jungle
#

BIGGEST HELL YEAH IN LIFE

#

QEMU DIDN'T PAUSE

#

WHICH MEANS IT WORKS

#

IT'S 4:30 AM I CAN FINALLY GO TO SLEEP

stoic path
#

๐ŸŽ‰ ๐ŸŽ‰ ๐ŸŽ‰

last jungle
#

I crave sleeping

#

but now I can sleep in peace

stoic path
#

great job!

last jungle
#

and now it's all pushed on github

#

debug ? โŒ
kprintf everywhere ๐Ÿ˜Ž

last jungle
#

now I'm gonna work on the IDT

last jungle
#

well that's even more confusing than the gdt

fathom shuttle
#

gdt
idt
confusing

#

I don't think you're ready for osdev

last jungle
#

but I'll understand

#

I understood the gdt

fathom shuttle
#

not by not reading

last jungle
#

and I will understand the idt too

last jungle
fathom shuttle
#

reading what?

#

sdm?

last jungle
#

right now the osdev wiki page

#

then I'll take a look at the sdm

uncut void
#

I recommend using code formatter if you don't use it already. Makes code look all good lookin

last jungle
#

never thought about it

uncut void
uncut void
young crystal
#

a code formatter

#

๐Ÿคฎ

#

(/s)

uncut void
#

What's wrong with it?

#

Ah

#

Okay

last jungle
#

honestly I like the way I write my code

uncut void
#

Code formatter lets you make it format code how you want

young crystal
#

I mean I see pretty little need for a formatter. It's not super hard to format clean code yourself as you go.

#

I get it if it's a project with multiple people where your editors might do different things automatically

#

but that's not really the case for a personal project

uncut void
#

It's up the Tiwim tbh

#

if they want they will use it

last jungle
#

for now I don't have a big codebase, even if I wanted to format my code I'd do it by hand

#

and for now I want to get to work on the isr

#

wait can I use the interrupt gcc attribute so I can write my handler in C ?

#

but it also limits my control over it...

#

meh better do some asm

young crystal
#

you can but I recommend just doing it in asm

last jungle
#

can I make the base of it in asm, and then call a c function for like displaying information ?

young crystal
#

yes

last jungle
#

good

#

so basically what I need to do is :

  • pushad
  • call the c func
  • popad
  • iret
    ?
#

oh wait

#

no pushad and no popad in long mode

young crystal
#

yeah

last jungle
#

so I'll have to push all regs myself

young crystal
#

just make a macro to push/pop everything

last jungle
#

I haven't learnt macros in asm yet

#

oh ok I see

normal oar
last jungle
#

by the way for the idt do I need to do something after lidt [idtr] ?

#

oh yeah

#

sti

last jungle
#

I think I'm done with the IDT

#

qemu doesn't crash

last jungle
#

I'm gonna stop there for the week end

halcyon breach
#

if you can get past setting up paging i will officially consider myself dumb

last jungle
#

bet

last jungle
#

ok so right now I have a physical memory allocator ig

#

time for paging itself

#

(I didn't work much these last days now I'm back (I think ?) )

last jungle
#

ok it's been some time

#

I can map and unmap pages now

uncut void
#

@halcyon breach you stupid af gang

halcyon breach
#

yes im stupid

#

i dunno how i coudlnt get past implementing paging

young crystal
#

most useless comment on a thread

#

for hobby osdev

#

don't be a dickhead

young crystal
uncut void
#

I'm not an asshole

dry delta
last jungle
#

took me a few weeks to get something working

#

now I'm resting a bit