#Nullium
1 messages Ā· Page 4 of 1
yis
so to take 27 mb i need 6.75 tables
im gonna take 7 because i have a singular braincell that told me to
7 page tables for the kernel damn
at LEAST 7 actually
because its growing
im gonna make my pmm have permission values actually
or should it
idk
i want to put the permission values there so the vmm can actually read it and do something
it shouldnt be architecture specific because any modern architecture has permission thingies
damn
wait
the vmm is gonna be a clusterfuck
everything is gonna be a clusterfuck actually
programs are gonna think they start from 6 mb or smth
which is fine
but thats all programs
i have to constantly remap them to 6 mb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
multitasking idea probably:
(load program before this)
map program at top of memory
only allow access to the memory that it owns (no access to other programs
)
program do thing
go back to kernel
do for next program
i cant just not use the "owner" field in my pmm
would be quite a disappointment
each page-table takes up 1 4KB page iirc
1k - 1024 bytes
page - 4k
page table - 1024 pages so 4m
page directory - 1024 page tables, so 4g
oh
wait
misread
thats what it is on 32 bit?
big oopsies
64 bit page table has 1024 uint64_t's instead of 32
also includes whatever the fuck that is
more page tables bcs more memory š
im staying with 32 bit this looks like foreign bullshit to me
or using limine i think limine does all that automatically
all hail funny obscure boot protocol
64 bit page table has 512 entries
oh
stroke
dont quote me on anything i say abt 64bit
Due to the complexity of some of the Nullium functions, we will increase the stack size to 3 GB.
Previously it was 27 MB, but my code is too superior for such a small, limiting size.
So, due to my superior status over this entire server, backed by my 50 years at Blizzard Entertainment, the stack size is increased to a forgivable 3GB.
idfk
its 128kib
how
do you have like all your paging structures defined
kernel binary
everything
it counts everything
ld_end
yeah
what large data do you have in your binary
do you page
if so did you make all the paging structures be inside the binary
did you leave a large bitmap or something
im just guessing but yeah
i had a 511mb bitmap in my code this morning 
WHAT
you'll only need max 2mb of stack for a kernel
how recursive can your code be to require 3gb of stack?
Idk. I"m judy fkcold forjehskw dueuw
hjdk
Do t3 tjbe cose
hjkl
yeah, reasonable
don't forget to add support for x2apic so you can use up to 4mln CPUs
uhhhh
Ok
im gonna finish paging when i get home
hopefully
google chrome only needs a 1024kb stack
sounds like skill issue
cool
2mb? Heās on 32 bit and I am too
oh right
a 16 bytes stack will do the trick
yeah bc recursion is bad
and does a lot of heap allocation
š
I've never seen this thread
I assume the title is outdated considering the github saying
An A/UX inspired OS.
?
also, may I ask, what makes A/UX and/or Nullium different from other UNICES/UNIX-likes?
seven mutual servers is crazy
LMAO
every time I go to this server I feel guilty for sitll being unable to code 
I should learn, I really want to learn, I just can't get myself to keep going 
I don't even struggle with indecisiveness anymore just lack of motivation
if we have cloc (count lines of code) then when will we get ccoc (count columns of code)
cock
count occurrence of kernel
ues
it is
aux is classic mac os placed over unix
i actually want to do the opposite and do the unix thingies on a mac os like
oh, neat
I knew about the first bit, I was moreso reffering to the underlying unix š
are you gonna aim for compatibility with classic macos programs?
except with preemptive multitasking
idk if i can just make a 68000/ppc translation layer
Is that why itās so fucking dogshit for ram usage
it had compilers specific to it
idk maybe ig
Itās okay man
Just learn
Even if itās slow
:)
have certain system libraries compatible with classic mac os
learn basic c concepts
Yeah fr
userspace stuff
Data structures are extremely important too
Like
You need to know what a linked list and shit is
All of that
(void*)(u64)(*(u32*)((u8*)madt + offset + 4))
i just remembered the fact that i want to write an insanely expansive manual for nullium programming later
my big problem is that
I can't figure out what to write to learn more, every time I try to find a project it's either so trivial I finish it in like 20 minutes or it's too difficult so I spend an hour staring at a blank text file 
I hate poiner arithmetic on C++
Pointer arithmetic is so fucking cancer
What is wrong with c++
c++ is somewhat cancer
I literally have a certificate of proficiency in C++
if you get it working on commonly available hardware or working well in like qemu, I'll (try and) make stuff for it :)
And I still hate it
i havent found any of the features on it useful
warns a lot (ik I can disable it but I don't want to risk some wrong evaluation)
have you tried dlang?
Yes itās fucking amazing
I love dlang
for C/C++ replacements the one that most catches my eye is Zig
Itās one of the best systems programming languages out there
Rust :)
but I don't think it's stable yet
Jkjk
afk once i come back i can do paging š„
still better than carbon
rust is nice on the simple level until you get to async and await then it's the worst thing ever (imo)
Itās also shit for kernels
nah it gets bad when you start doing OOP
Sorry to my rust kernel devs
REAL AS FUCK
(im not a coder obviously so it's not like my input matters but yk)
no more buddy?
I don't care for rust itself, but, I do like cargo
my eventual dream project is a systems-programming-dedicated LISP dialect (primarily based on CL and Scheme, my favourite ones), and I'd want it to have a cargo-like build system probably
Like Iāll keep the alg
But
I need to make the code more modular and easy to read
Because pmm_alloc_pages is extremely hard to read
Like
so OCaml with some imagination
Really bad
I wish there was a good equivalent to C/C++, I tried cabin previously but it's kinda janky at least when I tried it
That may be a good project to try and write my own maybe
nvm OCaml is not LISP
lisp sucks, ocaml doesn't
Bro WHAT
you suck š” /j /lh
if it works it works
Lisp is goated
why is that suprising? sh is very simple and intuitive at least imo
- not natural syntax at all
- emacs uses it
No one uses it to build software
yeah, I wanna learn common lisp but idk if it's the best idea for a first lang really
Literally everyone uses make or something
Like
Makefile isnāt that hard
Itās really really not hard at all
You can learn it in 1 hour
I never said it was, I'm just lazy
I feel free when using Make
LET ME MAKE EXCUSES š
Yes itās good for userspace
Make is goated
Meson is cool too
But make is better for freestanding
Make is extremely customizable
I tried it and it's pretty confusing to use for freestanding
also custom commands suck
Itās not good for free standing
Yeah, thatās what make is the best at
Extremely customizable
Itās why Linux uses it
It doesnāt help you at all
Which is good for a kernel
I don't like autoconf, automake and all that though
I set variable config flags in my makefile
alright y'all convinced me, time to learn Makefile ig
what's the diff between gnu make and bsd make
I'll learn the latter just because I don't like gnu 
syntax
bsd make is more minimal
ah
Automake isnāt good
Me too!!!
thanks for putting up with my dumb questions btw š
bsd make is pretty strange, while you would do my_var := $(shell echo 0) in GNU, you have to do my_var != echo 0 in bsd
I do this
This is why I like make
Super super customizable
lmao CWARNINGS
Lol
Everyone
Shirt
I should get rid of
Interrupt flags
I used to handle interrupts with gnu interrupt attribute
Which requires general regs only
hell nah, I like having stubs that call the function and handle the return gracefully
fuck it, imma learn a BASIC 
they're quite simple, and https://discord.com/channels/440442961147199490/1083829658849652838 got me interested again
which is the standard way
Yeah I unfucked my isr not too long ago
I'm gonna ditch uACPI as I'm not using it, I'm parsing ACPI by myself (
). I'll probably use LAI though
LAI 
Funny name
Youāre Albanian
Kosovo is Serbia

pakistan
anyways what is nullium even about
I swear I find it easier than using premade implementations
I don't have to deal with kernel APIs implementations
Idk
Check out my os
and I know how the code works exactly
paging done?
no
shameless advertisement
sure
sorry for shameless plug
i said when i come back ill work on it
its ok ill just steal your code as payment

Wanna vc at some point
No worries
wont talk but maybe
shameless fucking plug bro, if you gonna do that then i gonna do that, check out my shitty OS
Show me
I scroll through your source code quite a bit
#1404638046175105215 im currently working on uh acpi and scheduler stuff... still havent committed tho im waiting until update finis
damn
brb my windows laptop shat itself again
(bluetooth headphone no work)
Sad
oh you're the debian transparent windows guy
I'll always remember that centered debian logo
im debianing it
RESB 16384 go brrr
this appalling piece of shit dies first though im sorry
i have to update discord on linux machine
:<
why cant i just start doing shit
nvm this is worse
Oh LORD
what the hell is that shit
lifetime blizzard
69 years blizzard entertainment
programmed microsoft windows
ceo of mann co
he did it all
it grew to 32 mb
what
what the fuck
whuh happened
what specifically is shitting itself this badly
the data segment ends at like 1 mb
uhhhh
a sec
ok so the bss is giant
its fucking huge
static allocations
bitmaps (fonts, etc), code(no shit), some arrays (pmm and paging and shit)
maybe theyre making everything big as shit but idk
code is not bss, what does your pmm look like
please tell me itās not statically allocated
uhhhhhh
it is not statically allocated ||(lie)||
ok fuck
time to slightly rewrite it
ok so um it was a big part of the problem apparently
time to use scratch
wowzers that's a big binary how large is your codebase
a few million loc?
holy smokes that's a huge binary
new windows is in town
absolute poo ass sized codebase
im gonna do two page tables for the init as a temporary solution
its just short of being less than 4 mb
;-;
Yeah what
That doesnāt make sense
What were you doing beforeā¦
Were you creating every page table on init
you can have only one page table active
you would have to switch it on page fault otherwise
i have to reserve a page table for 4 and something mb
one page table only covers 4
to cover all the space i might need to map a second one
identity maps and all that bullshit
this is so cooked
absolute clusterfuck
i am NOT getting out alive š
time to do random shit to my pmm and hope it works
christmas time is here... happiness and cheer...
reminder
i dont live in pakistan
What
it was the culprit behind the 27 mb stack space
im gonna reform it so it will not take as much damn space
im making my pmm more like paging
no more details provided until i actually finish it
WHA
(spoiler: tables in tables in tables
)
im going insane
i want medical help
paging is gonna be my #1 reason for the destruction of the universe
i swear to god
ok so uh here's some type of plan here
- pmm (fucking shit)
- paging (even more of a fucking shit)
i hate memory
why cant we just revert to monkey atp
ok anyway
nice
my pmm is basically the entire problem
- clogs up a shit ton of memory
- fucks up paging
so anyways pmm will now use memory addresses instead of page numbers
also im gonna try to make a buddy allocator
splits shit in half until something happens
anyways nothing is permanent until its done because i wasted all my braincells on unrelated things
dont quote me if i say something and then it turns out to be something else please
this project is basically fucked until i fix the pmm
ok thanks
ok so i figured out how to implement it
without absolutely fucking over the size of the kernel
ignore the crashout above
so geniune plan
- make a buddy allocator
- make it work WELL
- put paging (might be the simplest task after all this crap)
im like fully sure its definetely gonna be a buddy allocator
also to anyone who's gonna think im gonna do something really dumb again
- its gonna return actual memory addresses
- its not gonna be 26 mb š
make it parallelized and numa aware while you're at it
coz it needs to work WELL
read numa stuff?
no this is a joke don't do that just get it working first
if it doesnt work well i will commit a few war crimes rewriting it again
oh ok
i deadass need that pmm to be the best code i ever wrote
famous last words
mcr reference
Le budy(tm)
idk if its how its supposed to work
i shouldve finished it more so i can actually fucking explain this piece of code
a sec
help
my scroll wheel
this is what i assume it looks like
if its not then idc funny directory tree go brrr
basically means if its a free segment or not
uhhhhhhhhh

because if its not free then it is either a parent or a page
ok ykw free makes more sense
free time
why are there two addrs
why not call them left and right then
oh
and point to other buddy page structs
we have trees at home
uhhhhhhhh
it's not a huge issue just funny
truly
typically you say NULL š„
coputer
buddy_InitSlice.free = false;
buddy_InitSlice.left = NULL;
buddy_InitSlice.right = NULL;
buddy_InitSlice.tier = 0;
fantastic
now it is somewhat peak
changed free to used
because if its 1 its not free
void buddy_mkBranch(buddySlice_t* slice, bool direction){
// direction: left is 0, right is 1
buddySlice_t new_slice;
new_slice.tier = slice->tier + 1;
new_slice.used = false;
new_slice.left = NULL;
new_slice.right = NULL;
if (direction){
slice->right = &new_slice;
} else {
slice->left = &new_slice;
}
}
le code
i forgot to add the statement if its like the max tier it can be
whatever
this is basically the code for multiplying that
the declaration for the new slice itself is gonna be changed
also the problem with all this bullshit is that there are like a million tiers
this is gonna be absolute diarrhea in memory
lemme check if im doing all this right
this is going to give you a UAR

a what
Use After Return
new_slice only exists on the stack during the duration of that function, after it returns, it is gone
it erases and shits itself
š„
this is basically my plan for memory thing described in shitty mspaint

anwyays
uhhhhhh
sanity
sanity
oh no this is becoming a clusterfuck
š„
how tf do i allocate buddy tier things
huh
dumbest solution would just have 1/4 of the entire ram to be dedicated to fucking buddy segments
actually no that would suck ass
in multiple ways
4GB RAM (3GB usable)
that
can i put a struct in a struct for some ungodly reason
wdym
for left and right put structs in it because idk how do i allocate it without the kernel growing to ungodly sizes
struct a {
int boom;
};
struct b {
struct a a;
};``` is valid
you cannot do
struct b {
struct b b;
};```
shit(TM)
i have an idea
nevermind
nevermind hold up it might work
cant really describe it yet
tldr reserve some pages for block info
ok this is a good idea
Why wouldnāt you do that
Just reserve some pages for a page info struct
Very simple
rust async not that bad vro
huh
its like the simplest oop ever
the borrow checker makes it way more complex than C++
as I have to be mindful when to either set a lifetime or allocate on heap
and whenever you set a lifetime you encounter borrowing problems
lifetime is so ez
it might complicate things but it nukes some ub
(at least some š„)
thats what i wanna do
yesterday i couldnt figure out how i wanted it to be
increasing the stack to 4 tb š„
legendary
lol ok
guys
geniune tip
if you have a choicer
and you can pick only ONE thing on it
please use fucking radio buttons
i can not deal with this shit
also as an attempt to save the kernel binary size im gonna consider compressing all the bitmaps except the font
bcs theres too much symbols already im lazy
not home yet though
nvm im way too lazy for this
i wanna store all bitmaps on a file on your hd
except i cant currently
how large is your codebase bro that is a massive kernel image
i've made smaller linux images
crazy
somewhat small, also shitty pmm
its being rewritten
what does small mean, small is relative
my codebase is 32,000 lines and I consider it quite small wheras others find that large
uhhh
(my binary is like 450kb)
idfk i didnt count
ok i will count it
i need to consider something now
old code btw the new one takes way less space
only 3000?
how is the binary that big
ah wait and 1,500 of those lines are for bitmaps
how many times do i have to tell you my old pmm was fucking stupid
no but like this is actually fascinating
how did you get the binary that big
am curious
StuPMM 
it statically allocated a million structs š
smart
My kernel is like 150-200kb
dang what techniques do you use to shrink it
this
I haven't done cloc in a while so like 1000-1300 lines
it's smol
what tool is this btw
oh nvm
cloc
oh ok
You can also use wc
once i get home ima send the results of the new binary
word count
its like 3 mb at most
not sure how much bitmaps take maybe i can compress them
ok no i def can
im pretty sure you can make a struct that manipulates individual bits
nvm these are called bit fields
ok so im gonna compress the fonts so they wont be disappointingly big
they probably take the 2 mb out of 3
(1st one is linker start)
oh wait so kernel bin is 2 mb then
i can reduce it to 1 or less tldr
how many phyiscal memory allocatros do you have
none that are working its getting rewritten

indeed
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
i wanna cry man
ok this shouldnt be in progress report
paging?
unrelated
anyways im gonna try to compress fonts
by compress i mean make them not take a byte instead make the pixels take 1 bit
le efiecentyc
did they not beforeā¦
no... :(
nobody told me to so i just went with the easiest option
thats ultra fucked
ULTRASHIT
how big are you characters
byte for each
wait no
byte for each pixel š
i mean like 8x8 8x16
i would make it 8 * 11
š
like
true
i have a few letters that may not work with 8x11
(also ngl i want a second terminal font that is 8x8)
maybe idk
and dont render the spacing in the terminal
if you do
then it would make more sene for 8x12 tho
and just leave a empty row and column
m
and have spacing built into the font tm
ok fair im gonna have empty space
and then its veri simple
byte 1 - row 1
byte 2 - row 2
ā¦
byte 12 - row 12
the bitmaps are 7x11 but the font is treated as 8x12 basically
since each pixel = bit and 8 pixels = 8 bits and each byte has 8 bits
shrink them
i can just remake them theres only 2 really
yeah
im just gonna use that idrc about the size of the c files
oh
ykw im taking this for the terminal font i dont particularly want to write a terminal font
the 8x8 idea
im keeping the gui one
aight
Such a random font size
the letter "x" looks better on non even numbers
deadass the reason
what the fuck the more i look at spleen the more i fall in love with it
Disagree tho
Look
Iām using default Flanterm font
The x looks fine
thx
Thereās plenty of decent fonts
Right now Iām adding font changing
Well
After I get to userspace I will
i think since i have a kernel shell i think i might want to add everything switching
i cant just dump everything in the kernel
i already had the problem of it being 27 mb big
are we cookig
ok im turning all the font arrays into bits 
12 bytes per letter
instead of um
165
i thought 12 was shit but then i remembered the old number
also my kernel binary itself is 91 KB
or maybe thats because i already shrinked it to death
anyways it takes way more in memory than it does on the hard drive
both are too big i dont have shit in them
very important
Then use -O6
what does that do
G minor optimizations
That's enough dude
no i just compressed the fonts
by making them 1 byte
per row
everything else in nullium works ok
printing works
nvm its 84 mb
KILOBYTES
NOT MB
FUCK
kernel still 4 mb
in memory
hello everynyan
my binary is 864kb and my codebase is currently 5258 LoC
864kb are way too many
I shall optimize
optimizations š„
i have a better idea for my buffer
its gonna be faster than the current one
way faster
it might be the second worst problem with the size of the kernel
also framebuffer btw
its really only used for mouse cursor
ITS 1 MB NOW
IT WAS THE PROBLEM
LETS GOOOOOOOOOOOO
oh no it's fucking flanterm bump_alloc_pool with size 852kb
that's basically 96% of the whole binary size
biggest weight loss arc š„
lmao
anyways my kernel is now truly small
i won humanity
it went from 27 mb to 3 to now 1
oh damn
are all of yall using flanterm
lame /hugeJ
it's really convenient
I'll make my own VT someday
I don't want to deal with geometry rn though
maybe
idk im gonna write my own VT probablt
basically vga text mode
I hate the expression "godspeed"
i dont even get it
what is it even supposed to mean
bruh did nullium forget how to load stage 3 (the one with mouse cursor and stuff)
i think i did something goofy
holy shit the framebuffer is fast as shit now
something like may god prosper you, something like "inshallah" for arabic (?)
but everytime I read it I think about something going at the speed of god
lmao
Lol I still use the bump alloc pool
paging should work theoretically because entire kernel fits into 1 mb
or 1.5
at least not 4
do i add on page tables only when i need them?
that is typically the approach yes
and you can even take this one step further by only adding on page tables when you actually touch the pages
In computer operating systems, demand paging (as opposed to anticipatory paging) is a method of virtual memory management. In a system that uses demand paging, the operating system copies a disk page into physical memory only when an attempt is made to access it and that page is not already in memory (i.e., if a page fault occurs). It follows th...
my mouse buffer is still absolute dookie farts
i want to repair it
:|
so the mouse buffer is a 16x16 square that should keep up with everything behind it, so when the mouse moves it can safely remove the mouse cursor from the screen
without doing any funny shit to anything that was behind it
the off brand finland was an attempt to check if pixels were drawn over that square
AAAAAAAAAAAAA
my sanity
vs
two 15 second unskippable youtube ads
fucking kill me already
unrelated but i feel like my bones are gonna collapse
ykw it will slightly be laggy for now
not as bad as that fucking double buffer that took up 3 mb of memory before
my buffer is so good i triple faulted my os :D
i have a mouse cursor again
let me just give it an icon and then im gonna stop for today my eyes hurt
or a drawing
what is it even called
(easiest questions ever cant be answered when you have a fucking stroke)
im so done for that i somehow put the x variable and the y variable in the wrong places
why the fuck is the dependency for a graphics driver the mouse driver
this pssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssr bv
me cursor work
i wish open source projects had paychecks
matrix
(tm)
are we doing graphics to cope with no paging
š¢
no
i had my mouse cursor before and i want it back now
i dont think im getting it back because im deadass in physical pain
I WILL FUCKING KILL SOMEONE IF I WITNESS A YOUTUBE AD ON MY SCREEN AGAIN
enabling an adblock is just gonna make it say "lol disable ts we see you"
a sprite?
maybe
honestly im just gonna use a regular bitmap for sprites
i meant mouse cursor
s
they only take a single kilobyte anyway
or 2
nvm
a coca cola
personally I don't like working on external devices before having working internals, you'll get in a mess and you'll have to rewrite the whole driver at some point
the driver works i just want to draw a cursor
pepsi
new bugatti wake up in me
I touched userspace!
how do you touch that
with your toes
maybe
automatically generated by rust bindgen
yeah wrong thread
rust of all time
how do i add images to starting thread thing i dont think i even can :^(
also im gonna make every text mode window in nullium have a 90x60 thing
i want 3 window types
- raster - useful for games, deadass the entire window is a bitmap
- vector -
placeText(10,10,"Hello World"); - text mode - fucking vga bruh
tldr
idk if i should permit changing sizes for 90x60 text mode windows
maybe that would be maximum size
only if the program wants the size changed
by "vga bruh" i actually mean (SIMULATED IN A WINDOW) vga text mode
maybe i can add bold text and other formatting but idk
its not on 0xb80000 though no shit
Why not userspace first š¢
because kernel shell
a windowing system is required for program operation anyways
what about text based programs
Yes and every sane window manager is in userspace ā¦.
You realize WHY we donāt put these things in kernel space right?
Any exception will crash your shit
Operating systems are MEANT to run userspace programs
Itās just meant to allow the programs to get services from the kernel
Like
Syscalls exist for a reason
Because a syscall wonāt nuke your system
But a bare file operation in kernel mode might
Lots of people end up doing their entire file systems in userspace
Microkernels
For this exact reason
You should read up on some theory more brotha
what about Windows? Isn't it
oops
I was gonna say I thought Windows' WM was in kernel space
or am I remembering wrong?
Noā¦
nvm then 
winndow as well
it took them that long to put it in userspace?
yeesh XD
if you end explorer.exe then you can still make windows
idk maybe the wm is some other executable
wtf am i supposed to do just resort to a framebuffer terminal???
anyhow, uh yeah, kernel shell (emulating a user space shell) is generally bad
Before they put it in userspace, the window manager did run in kernel space but the win32 api accessed it through userspace itās kinda stupid
Like win32k.sys was in kernel mode but
user32.dll and gdi32.dll were user mode components to access it
The dllās provided an api to forward calls to the kernel
Look above
how silly lol
š¤£
T h e n
And your paging
Finish that first lmao
If you can make a good scheduler
Youāre good
(paging) currently not
we alr started talking about this so i just want to know what a sane person does
whar
gdt->idt->pmm->paging->vmm->vfs->tmpfs->sched
I would recommend making a vmm
Probably
That would help
And if you donāt have a kernel heap allocator
You should get onto that
Look up āthe slab allocatorā
Yes
isnt wayland better nowadays
You just need syscalls
fair
Most people would say Wayland
gnome is dropping x support soon (sad)
Dude itās horrible lmao
where on god's green earth is the minimize button
Never used it lol
Yeah itās nice imo
cinnamon is literally michael windows
I like KDE :3
