#EvalynOS

1 messages · Page 16 of 1

hazy saddle
#

Rather pre fill them in?

cyan bison
#

idk...

#

i allocate them for the init process and that's it

#

i leave the rest to handle cloning done by fork or god knows what

hazy saddle
#

So pid1 gets them

#

And then fork() and whatever does that

#

Does bash need clone?

cyan bison
#

no

hazy saddle
#

Or only fork

cyan bison
#

fork() and exec()

hazy saddle
#

I wonder if it will need source modification

#

Same with core utils

cyan bison
#

if u use mlibc u shouldnt have to patch bash

hazy saddle
cyan bison
#

except for config.sub

hazy saddle
#

What’s that

cyan bison
cyan bison
hazy saddle
cyan bison
#

config.sub is autotools tomfuckery

hazy saddle
#

I do wonder if the mods would want this in #curated-resources ?

#

It’s pretty top quality but I’d have to reword the message

#

Also when I get my fucking 8tb hard drives

cyan bison
#

also TCP is funny because you find out what a RST packet and it's like "oh hehe it's like the computer is telling the other to go fuck itself"

hazy saddle
#

Like the gcc tarballs and stuff

cyan bison
#

i was gonna make a joke about what you should mirror but nvm

cyan bison
#

pov tcp

#

hjwiusjofchjdskfhjnsdp

hazy saddle
hazy saddle
rotund furnace
#

the qemu log analyzer is still broken as fuck because I haven't bothered to fix it

hazy saddle
#

Did you make that site?

rotund furnace
#

no

#

wux did

#

I just did the qemu log shit

hazy saddle
#

Well rb trees from openBSD are really good

#

Atleast at memory efficiency

#

So hmmCat

#

After a talk with @cyan bison

#

I’m going to use two of them

#

One for free vmemory

#

And one for used

#

So allocations are fast etc

#

And same for finding used regions

#

Because an O(n) method is bad

sterile plank
#

how did u get cool role

cyan bison
#

she implemented FRED

hazy saddle
sterile plank
#

hmm

hazy saddle
#

I was the first to do it

peak cloak
#

5 or 6 nights at freddy

hazy saddle
#

ppc and aarch64 added

#

and the other sections have gotton plenty more manuals added

rancid viper
#

copyparty ftw

urban mulch
#

Oh this is not your os

hazy saddle
peak cloak
hazy saddle
rotund furnace
#

(I haven't touched arm support since paging)

hazy saddle
rotund furnace
#

fuck no

#

fuck powerpc

hazy saddle
#

@peak cloak

#

What do you think about this opinion

hazy saddle
hazy saddle
#

for virtual memory allocations

#

with POSIX mmap

#

can i clamp them down to page sizes?

#

is there a rule for clamping them etc

magic saffron
#

If addr is NULL, then the kernel chooses the (page-aligned) address at which to create the mapping

If addr is not NULL, then the kernel takes it as a hint about where to place the mapping; on Linux, the kernel will pick a nearby page boundary

from ⁨man 2 mmap⁩ on my system

hazy saddle
#

Ahh yeah it does

#

So my VMA can safely just store ranges of address of the allocation and not worry about them being funky and overlapping

#

Il make ends of ranges be -1 of a page?

#

So 0x1000 to 0x2000

#

Is stored as 0x1FFF?

#

Or is my brain fucking up?

#

That way range 0x2000 to 0x3000 can be sorted cleanly?

rotund furnace
hazy saddle
#

I’d ensure it’s a user pointer

#

Banning the last page before non canonical

#

To prevent sysret bug

rotund furnace
#

why the fuck would you allow the user to alloc up there anyway

hazy saddle
#

They can’t trigger the bug

hazy saddle
#

It just can’t use the final page

rotund furnace
#

they shouldn't beable to map in the kernel memory anyway

hazy saddle
#

Not that edge of memory

#

The upper page of user memory

#

That’s where the bug can happen

#

If you have code on the end of that page

#

And syscall

#

RCX becomes non canonical

#

That’s the silicon bug etc

rotund furnace
#

wdym?

#

OH

#

nvm

#

I'm stupid

hazy saddle
#

Lmfao

#

Or I could allow mapping that page even

hazy saddle
#

Just ensuring it’s NX always

rotund furnace
#

I forgot 0x0000800000000000 is also "non canonical"

hazy saddle
rotund furnace
hazy saddle
#

That program can go fuck its self

#

And il send patches

rotund furnace
#

you can't

#

that program is under government nda

#

(this program may or may not be an nsa exploit ngl)

hazy saddle
rotund furnace
#

make it a cmdline option

#

:P

hazy saddle
#

No

#

I want 100 thousand dollars

hazy saddle
#

Okay so I’m making the VMA today

#

Two RB trees

#

One for free memory

#

One for used memory

#

To allocate you take from the free one and insert it into the used memory

#

And you do the reverse for freeing memory

#

And I’m not going to do fixed mappings right now

#

And if the VMA allocate can’t get a large enough node at the part it will just goto the next node

#

And traverse it like a free list

#

But this allows fixed mappings to be good and fast because I can go right to the right node

hazy saddle
#

chat dont kill me trl

hazy saddle
#

for elf loading

#

i have to suport them

hollow crater
peak cloak
#

vmm freelist trl

hazy saddle
#

and then the sort function that i 100% DID NOT STEAL FROM @cyan bison

#

sorts ir properly

peak cloak
#

sorting algorithm moment

hollow crater
hazy saddle
hollow crater
#

but wait u sort them by size or by address

cyan bison
hollow crater
hollow crater
cyan bison
hazy saddle
#

im dunb

hollow crater
#

😭

peak cloak
hollow crater
# hollow crater 😭

I do something similar for an early boot allocator
tho using lists
but now I do vmem
cuz constant time >>>> logarithmic chad

hazy saddle
#

but this is vmem no

#

or somthing

#

idk

#

does proper vmem make things easier for fixes mappings @hollow crater

#

pls tell me

#

also what is vmem and how do you do it

#

because O(1) i need

hollow crater
#

its
THE
VMEM
idk whether its been superseded by more sophisticated stuff
well ig it did
afaik linux has 74748346356272 mechanisms for managing memory or something rn
that linux slub allocator is another hot shit out there

#

lads had slab, slob and slub
not even joking 🥀

#

vmem isnt an object allocator tho its just a general purpose range allocator

hazy saddle
#

im scared mommy

hollow crater
#

tho its kinda similar
or idk not really
well basically its like buddy allocator but instead of strict sizes it relies on lists of more sparingly sized blocks

hollow crater
#

dw

hazy saddle
#

but for this i need to alloacte huge ass regions of virtual memory

#

so idk if struct sizes works

hollow crater
#

mm I dont get what u mean here

hazy saddle
#

like a program MMAP's 2gb ram

#

i need to use this to allocate that

hollow crater
#

mm yes..

hazy saddle
#

well allocate the virtual bit

#

also this O{1}

#

as long as the size the prgram wants

#

is at the front

#

and its per program / address space

#

so as long as the program isnt goin buck wild

#

it should be fine

hollow crater
#

mmmm

rancid viper
#

because no

hazy saddle
#

yeah no

#

of course not

#

im making my VMA

#

not a heap or whatever

hollow crater
#

im dumb :P
like
shouldnt u have somewhere to allocate kernel memory from
which is separate from managing the rest of the address space
then have the rest be managed by an external allocator for memory objects
be it a program segment or per subsystem stuff

hazy saddle
#

I do

#

It’s called my heap

#

But I need to allocate address spaces

#

For like MMIO

rancid viper
#

address spaces for mmio? do you mean like regions or something

hazy saddle
#

So I can get a free address in virtual space? To map to

rancid viper
#

one address space is generally like

#

the entire address space is what people mean by it

#

so one pml4/5 == one address space

hazy saddle
#

I’m mistyping

#

I meant ranges

rancid viper
#

yeah

hazy saddle
#

Just fucking hell

#

Idk if there is a better way to do this

#

other than a free list

#

or some such

rancid viper
#

wdym

hazy saddle
#

and then im gonna remove it split it and then put it back in

#

and then also put it in the used list

rancid viper
#

seems fine

hollow crater
#

ye it will work

#

eh ig astral survived with its vmm being based on a list of regions or somethign so basically like
🔥

#

or so I heard trl

rancid viper
#

btree of regions (and holes like u do) is a pretty common way to do it

#

totally fine

hazy saddle
#

Mine is an rb tree

#

Is there even really a better way to handle this?

hazy saddle
hollow crater
#

well idk about the specifics of it but urs should be better in principle I think O_o

hazy saddle
#

And for fixed mappings

#

I can go right to the range

#

And split it there

#

Or deny it if it’s not there for no replace mappings

#

And then I will use the used tree @hollow crater

#

So I can free all the mappings

#

By digging the PTEs for them etc

hollow crater
#

aha
well sounds good actually
now that im thinking about it i might keep my used ranges in an rbtree too lel
idk if it'll be an overkill I was gonna do a hashmap :P

hazy saddle
#

Honestly rbtree is better tbh

#

Because you can go directly to a used region to free it

#

And iterate easily

#

And you don’t have to deal with buckets

#

Just steal the openBSD one too @hollow crater

hazy saddle
hollow crater
#

mm fair

#

well once im done with the pmm rewrite first trl

hazy saddle
#

Buddy allocator

hazy saddle
hollow crater
#

well yea but I meant that for only the structure holding the used nodes
where i wouldnt need to do any coalescing or anything
so it would work no worse than a tree o_O

rancid viper
#

I am failing to see how a hashmap would work well for this

#

worst case for a hashmap is O(n)

#

I suppose if you have a good hash function u might be able to get some good perf for some amount of ranges

hollow crater
# hazy saddle Buddy allocator

I had buddy from the start but it was the way i implemented it that was wild
like
super wild
super super super wild
but was efficient
sad it had to go
now its still efficient but eh
less beautiful
much faster tho chad

hazy saddle
rancid viper
hazy saddle
hollow crater
hazy saddle
#

So for allocation I go by the one sorted by size

rancid viper
#

actually no its not

#

mb

#

lol

hazy saddle
#

But then I can just instantly find one big enough o(1)

#

At the cost of more ram usage

#

I will consider that for later

rancid viper
#

well not O(1)

#

O(log n)

hazy saddle
#

If it becomes an issue*

hazy saddle
#

I always would just need the first node that’s the largest

rancid viper
#

well then there is no reason to do an rbtree

hazy saddle
rancid viper
#

lol

hollow crater
hazy saddle
#

I could have a varrible for pinning the largest known allocation?

rancid viper
hazy saddle
#

Nah it would still be o logn

#

Because I have to find the node in the original tree anyways

rancid viper
#

I dont know the fancy math but worst case with a hashmap is all the entries fall into the same bucket and u just have a linked list

#

and when u can achieve binary search because the key is just a number that seems like the clear choice

hollow crater
# rancid viper I dont know the fancy math but worst case with a hashmap is all the entries fall...

but a good hash function and large enough buckets wouldnt have pathological patterns being common?
and for an address space ig a very large number of buckets is justified
welp idk
like I might as well just place the load of keeping track of allocated regions on the callers anyway
like
return a pointer to the bookkeeping structure instead of a pointer to the start of the region
simce the use of that layer is internal anyway
a vm_object could as well hold references to its own region

#

idk 🤷‍♂️

hazy saddle
#

The rbtree does hold book keeping objects tho @hollow crater

hazy saddle
hollow crater
#

yea im aware
but its like
im not sure if traversing that used regions structure (regardless of what it is) is actually necessary
especially since unlike object allocations where it'd be totally unreasonable to have the callers hold pointers for their allocations other than just yk, the pointers
vm regions are usually allocated for a much longer time and arent used directly

#

afaik reference counting for like
shared objects isnt done at that level either

#

aight its 1am already ig im hallucinating rn

hazy saddle
#

@hollow crater POSIX requires that you are able to map fixed regions and when unmapping it can be in the middle of a region

hollow crater
#

mmmmmmmmmmmm
welp thats crazy 🥀
I mean
I can still do it that way trl

hazy saddle
#

just use an rbtree

hollow crater
#

fair lmao

#

I basically thought i can force callers to store the handles as list heads instead to get around this pain
and therefore unmapping a partial region will have the list head passed to vmm
vmm would split the region and gut out the part being unmapped and thus the region (well list of subregions regions) would be returned

hazy saddle
#

just use an rbtree

#

🙏

hollow crater
#

😭 KEKW

#

okay I concede

hollow crater
hazy saddle
#

if it cannot find memory

#

kill it

hollow crater
#

last time I checked chrome uses half as much for a single about blank tab chad chad

hazy saddle
#

well then chrome can go suck a lemon

hollow crater
#

LMFOA

hazy saddle
#

hows this look

hollow crater
#

well looks good flush

hazy saddle
#

this is better lol

hollow crater
#

idk if variable alignment >= page_size is a requirement for anything but for a starter it looks fine to me

hazy saddle
#

it has to be page aligned

#

so i ensure all allocations happen on that

hollow crater
#

I was wondering if there's anything that may require allocations being a multiple of that
for some reason
but i'll take this as no trl

hazy saddle
#

so like

#

it has to be rounded

hollow crater
#

fair

hazy saddle
#

i uhh also now need to just put a chunk of free memory in there

#

and let her rip

#

atleast for the kenrel

#

i need to implement these after

#

i thinkin for the kernel

#

i could put 8 terrabytes after 16 terrabytes offset of the HHDM?

#

the heap starts here

hollow crater
#

floshed
well idk i just leave the higher half entirely for the kernel subsystems
barring the hhdm and the pfndb
with kernel non contiguous heap so that i dont have to care about the spacing

hazy saddle
#

my valloc needs the heap

hollow crater
#

same
for that I just let both manage their own structures internally trl

#

this's basically where I left that part and I havent fully figured it out yet tbh lol

#

this's the point where everything fell apart that I had to rewrite my pmm kekw

hazy saddle
#

well i can presume the HHDM wont be over 8 TiB right

#

atleast for 4 level paging systems

hollow crater
hazy saddle
#

i mean what system will have more than 8 tib ram

hollow crater
hazy saddle
#

esp one without 4 level paging

#

there i could do diffrent values

#

later™

hollow crater
#

well
guess it cant trl
or wait idk
is there any cpu out there with 48bit pa width that lacks 57bit address space

hazy saddle
hollow crater
#

anyways imma just
eep
😴

hazy saddle
#

wait one sec

hollow crater
hazy saddle
#
HHDM   0xffff000000000000 - 0xffff080000000000 (08TB)
VALLOC 0xffff080400000000 - 0xffff480400000000 (64TB)
HEAP   0xffff810000000000 - .................. (????)
KRNL   0xffffffff80000000 - 0xffffffffffffffff (02GB)
#

@hollow crater hows this look

#

for the mem map

hollow crater
#

o
well the heap doesnt need too much vm space does it
like
ig even some 256mb would be an overkill

hazy saddle
#

how about

#
HHDM   0xffff000000000000 - 0xffff080000000000 (08TB)
VALLOC 0xffff080000000000 - 0xffff480000000000 (64TB)
HEAP   0xffff480000000000 - .................. (????)
KRNL   0xffffffff80000000 - 0xffffffffffffffff (02GB)
#

uhh err

#

that heap GPFs

#

wtf

hollow crater
hazy saddle
#

errm what the sigma

hollow crater
#

lmao

#

well that one is legal tho

hazy saddle
#

all i did was
#define KERNEL_HEAP_START 0xFFFF810000000000
to
#define KERNEL_HEAP_START 0xffff480000000000

hazy saddle
#

im not even using my valoc

peak cloak
#

shame on thee

hazy saddle
#

maybe its corupting shit

hollow crater
hazy saddle
#

fuck you mean

peak cloak
#

calculator

urban mulch
hazy saddle
#

fuck im gonna have to redo my god damn heap

#

because the person i took this from

#

fucking made this mess

hollow crater
hazy saddle
#

So uhhh I just allocate some free list nodes from the PMM and HHDM it

#

🥀

#

And then that’s enough to bootstrap

#

Or some crap

peak cloak
#

is hhdm higher half mapping or something

hazy saddle
peak cloak
#

oh ok

#

insane crap

hollow crater
#

real

peak cloak
#

real

hazy saddle
#

How should I do this fucking heap 🥀

peak cloak
hazy saddle
#

Been meaning to redo it anyways

hazy saddle
peak cloak
#

uhhh crap

#

no idea

hazy saddle
#

@hollow crater any tips 🥀

peak cloak
hollow crater
# hazy saddle

well waiaiaiaiiaiiat a sec
I think yea
its not canonical

#

sign extension here should match the last pml4 bit

hazy saddle
#

Oh 🥀

peak cloak
#

is the address signed??? nooo

hazy saddle
#

Kinda

peak cloak
#

w h a t

#

literally psychotic behavior

hazy saddle
#

There is an upper half and a lower half

#

And in the middle is nothing

hollow crater
peak cloak
hazy saddle
#

I could use a

#

Bump allocator

#

To bootstrap it

#

🥀

#

To get the starting freelist nodes

hollow crater
#

ohhh
I do that

peak cloak
#

yall's virtual memory structures look like a total mess ngl

hollow crater
#

gummi does that too

#

everybody does that

#

u should as well trl

hazy saddle
#

I could also just use the PMM to allocate one free list node PSP1G_pspTrollar

#

Wait

#

FUCK

#

I have to make a buddy allocator for this too

peak cloak
#

realization

hazy saddle
#

Don’t I

peak cloak
#

bro what

#

what buddy allocator

peak cloak
#

if this is for the kernel then why does your kernel need a malloc, i mean its memory efficient but in that case just dont allocate a lot trl

hazy saddle
hazy saddle
#

Linux has a malloc

peak cloak
#

but why nooo

hazy saddle
#

Dynamic memory allocation

magic saffron
peak cloak
#

obviously

hazy saddle
#

But I want to rewrite anyways

peak cloak
#

allegedly

hazy saddle
#

And make my PMM a buddy allocator anyways

#

So like yaaar

hollow crater
hollow crater
#

real

#

ANYWAY IMMA EEP

#

😴

hollow crater
peak cloak
#

now do a 3 hour OSdev session

hazy saddle
#

im taking a break today

hollow crater
peak cloak
#

please beware that there's maintenance performed on the houses of evil monsters

#

they chose to sleep under your bed if thats fine

#

👍

hollow crater
# hazy saddle im taking a break today

I just cant
skewl is starting again next week and all in all I havent done shit in this break so im sprinting in hope that I can achieve something before im back into the grind 💔 🥀

hollow crater
#

theyre

#

welcome

peak cloak
#

WHAT CAN I SAY EXCE-

severe marlin
#

~ some dumbass probably

hazy saddle
#

to that dumbass im doing 16TIb

#

checkmate

severe marlin
#

Well damn

#

ram shortage solved everyone

#

Time to pack it up

#

Openai can have all their ram now

#

Everyone say thank you Evalyn for solving economics

hazy saddle
#
HHDM   0xFFFF800000000000 - 0xFFFF900000000000 (16TB)
VALLOC 0xFFFFA00000000000 - 0xFFFFE00000000000 (64TB)
HEAP   0xFFFFF00000000000 - .................. (????)
KRNL   0xFFFFFFFF80000000 - 0xFFFFFFFFFFFFFFFF (02GB)
#

this mem map should be correct

severe marlin
#

Lol

#

What's the limit for ram with canonical addressing anyway?

#

It can't be too much more

hazy saddle
#

512TiB total for 4 level paging

#

256 for each region

#

so i got room to shmoove this

#

if needed

severe marlin
#

I was just thinking if you support 8tib physical ram there's only so much more you can get before you need a CPU that doesn't even exist

hazy saddle
#

tf you mean lmao?

#

thats HHDM

#

so if it dosnt exist it wont be mapped

#

its just the range im reserving for it

#

it wont need it

#

infact i support features that only exist on CPUs that came out last month

severe marlin
#

Oh yeah no just thinking about reasonable maximum memory limits

hazy saddle
#

"16TiB ought to be enough for anybody.”

severe marlin
#

I mean realistically 8mb ought to be enough for anybody but then someone invented emacs

hazy saddle
severe marlin
#

😭 I use chrome on my work laptop and rn the average tab ram usage is like 500MB per tab

hazy saddle
hazy saddle
#

i think it may be time to retire this tbh

#

i need a smaller panic logo

#

and maybe switch to a better font

#

(il make it a compile option for the legacy one)

#
  • i may make a compile option for these
#

as its bloating the binary a little

#

or maybe have it in the initramfs?

#

god i love overloading

#

now clang just add templates to C

#

and then its perfect

#

you can do NASTY things with them

#

and i wana do it

#

thowback to the time i put C++ shared/raw pointers into lua

rotund furnace
rancid viper
#

how do they get mangled

#

is it 1:1 cpp

hazy saddle
#

iirc it is

#

Clang provides support for C++ function overloading in C. Function overloading in C is introduced using the overloadable attribute.

rotund furnace
hazy saddle
#

Given these declarations, one can call tgsin with a float value to receive a float result, with a double to receive a double result, etc. Function overloading in C follows the rules of C++ function overloading to pick the best overload given the call arguments, with a few C-specific semantics:

rotund furnace
#

yeah they are just c++ named

hazy saddle
#

this also means no gcc for my kernel

rancid viper
#

btw why are u using that old nasty attribute syntax

rotund furnace
#

⁨⁨```c

int attribute((overloadable)) test(int a) {
return x;
}

float attribute((overloadable)) test(float x) {
return x;
}⁩⁩ resolve to ⁨⁨
_Z4testi
_Z4testf

rancid viper
#

when ⁨⁨[[clang::overloadable]]⁩⁩ exists

hazy saddle
#

dosnt work

rancid viper
#

yes it does

rancid viper
#

it needs to be before the function

hazy saddle
#

ahh

#

wondefull

rancid viper
#

: )

hazy saddle
#

thank u

rancid viper
#

no worries

#

I despise the gcc attribute syntax

#

and since C23 has a well defined attribute syntax might as well

hazy saddle
#

i fucking hate GCC

#

it tripple faults my kernel

#

before flanterm even opens

severe marlin
#

And stallman can eat a drain pipe

true oak
#

who even cleans up memory?

#

i just set magic to 0 so the picker wont pick the thread

hazy saddle
#

goin to sleep in a sec

#

anyone got a moment to code review as a sanity check trl

hazy saddle
#

then you will OOM

#

super fast

hazy saddle
hazy saddle
#

well i diddnt sleep

#

and im open sourcing my riscv emulator finnaly

#

il test the other code today after i sleep

hazy saddle
#

And then il do a final pass of code quality and do the last two rewrites I’ve been meaning (buddy allocator and SLAB)

#

Il be so happy to have beta1-rc1 working

#

But then

#

I have to make SMP work

true oak
hazy saddle
true oak
#

im fighting the urge to say the other p word

mortal bane
true oak
#

pp

#

cool acronym

cyan bison
#

is it really a good OS if it cant survive a fork bomb?

mild glacier
cyan bison
#

one of them

mild glacier
#

i wanna know

cyan bison
#

I forgot which one

#

survive here means it doesnt crash btw

mild glacier
cyan bison
#

not that it actually survives

cyan bison
mild glacier
#

tbh if u can detect what executable a process is then u can detect if there are more than some limit of processes of the same executable and if so kill all copies

mortal bane
true oak
#

windows 95 trl

hazy saddle
#

lets fuckin gooo

hazy saddle
#

huh wtf

#

trying to do 1gb mappings

#

hats not right

#

and its the exact same with less

rotund furnace
#

hm?

hazy saddle
#

its doin somthing

#

not right

hazy saddle
#

it was working a bit ago

#

but REALLY slow

#

and then crashing

rotund furnace
#

well that's not right :P

hazy saddle
#

whats not

rotund furnace
#

normally it just crashes

hazy saddle
#

yeah :p

#

and the framebuffer was nuked

#

so theres that

#

but E9 worked

hazy saddle
#

i fixed it!! @rotund furnace @cyan bison

#

thus is the cycle of osdev

hazy saddle
#

NEVERMIND

#

2mb pages

#

are severely FUCKED

hazy saddle
#

It’s working now!

#

I’m queen of the world

#

And it’s 2:30am

#

And I should sleep

#

But also it seems program loading times are heavily reduced using 1GB pages

mortal bane
#

then sleep trl

hazy saddle
#

(For HHDM)

#

(Because I load programs using the HHDM)

mortal bane
#

no user virtual base?

hazy saddle
#

Because it may be read only in user mappings

#
  • it reduces TLB misses with way using the big ass pages
#

Which I may call internally big CHUNGUS pages

mortal bane
mortal bane
peak cloak
hazy saddle
#

Also I ended up making it look better

peak cloak
hazy saddle
#

What bugs do you see

peak cloak
#

add bugs

#

anyways the code looks fine

#

from my understanding

#

if it doesnt work then im sorry im tired

#

(as in my brain doesnt work straight up)

severe marlin
#

put a ladybird emoji or something in a comment

#

if you put all the bugs in yourself intentionally there won't be space for any other bugs

#

better a bug in the hand than two in the bush or something

hazy saddle
#

okay so

#

i need to get this commit ready

#

and then work on exit()

#

which should just be stop it from sheduling

#

and have a repear thread clean the thing up

#

go through the free list and clear all thoes nodes

#

go through the used list and the PTEs and free thoes pages

#

then free all the nodes

#

then free the last few structures and cleanup the shceudling linked list

#

then tasks wont be
while (1) {} ing

#

then il do a leak test

#

and PRAY i dont have a leak

#

💀

#

then its time to FORK

#

or well rather

#

il need to fix up how i spawn processes

#

THEN fork

#

(and then exec which will do a partial exit() and then reload the process but keeping the needed things)

#

then i can get bash

#

cleanup some code

#

ans then its uhh

#

well ofc x11

#

but thats a bit off from just bash + coreutils

hazy saddle
#

THEN fork

hazy saddle
hazy saddle
#

time to push this

#

then get the reaper thread and exit() workin nicely

#

maybe il even make my schedular aware of a "work buffer" type where it will check if it has work to have it never get scheduled if it has nothing to do?

#

but that should fix all leaks

#

which means VFS time and tmpfs

#

and then

true oak
#

threek nooo

hazy saddle
hollow crater
hollow crater
#

well ive stolen that other one too already chad

severe marlin
hollow crater
mild glacier
soft snow
#

Would need to work on stability.

#

and port more drivers

hazy saddle
peak cloak
true oak
# hazy saddle

when you accidentally decrease the instruction pointer on fork

hazy saddle
#

Okay so. I’m going to need to add processes. I’m thinking it’s a structure with of course the FDs and thier information and the other stuff. Then they contain pointers to all the threads they contain which have the actual stuff the scheduler works on.

#

And then processes have pointers to the parent and the children

#

Which would be a liked list of “siblings” and a linked list of “children”

hazy saddle
#

And then do it properly

#

Okay so question is

#

How long can I avoid this rework

#

I only need it for waitpid

#

And fork()

#

I think I can do the exit() and VFS shit without this

#

And then just make exit() zombie you later

#

Which would be really easy

hazy saddle
#

I think I’m gonna take a break today

#

To goto sleep on time

#

And be able to work proper tomorrow

#

Gonna try and get exit() working properly and not leaking anything

#

Gonna do a test of spawning threads and having them die and see etc

#

Then fix the VFS

#

And then it’s just get fork() exec() and waitpid()

#

Then bash and core utils

#

This should work

hazy saddle
hazy saddle
#

so for reclaiming all memory in a processes page tables i am going to dig for all pages in the lower levels and iterate through the entire thing skipping zeroed entires

#

and on seeing a valid page i will check the PFNdb and if its ref count is = 0 (non CoW) or its = 1 (last referer) free it otherwise decrement the ref count and move on

#

should be a basic ahh function

hazy saddle
#

lookin good so far

#

just have to properly reclaim & track all memory

#

But the system call is getting gotten

#

And the schedular notices said thread needs to be reaped

#

And then sends it over

#

This is really fucking thread unsafe

#

But I think I may implement lock free algorithms with 128 bit CAS pointers

#

Which means I have to drop support for CPUs from 2006

hazy saddle
#

the fuck

#

this line of all things?

#

and it goes away if i remove this free

#

the fuck

hazy saddle
#

and i need to get proper locks added to shit

hazy saddle
#

the fuck

#

this causes the crasf faster

#

just acting as if it were asleep

hazy saddle
#

still

#

i may or may not be dumb

#

I never initialized any of the RBtrees

#

For user processes

#

I uhhh

#

Would think that’s very undefined behavior

#

No wonder the kernel is shitting it’s pants

#

When it’s fucking with unintalized shit

hazy saddle
#

With nothing to allocate from at all

#

That’s uhhh

#

Not really good exactly

hazy saddle
#

okay that. wasnt it

#

😭

#

okay well

#

somthing is corupting the RB trees

hazy saddle
#

Okay so I’ve narrowed it down to my schedular

#

nvm??

#

idk

hazy saddle
#

But then I tried to fix it

#

And then somthing else is blowing the fuck up

#

I have no fucking idea

cyan bison
#

that was me

#

also like

#

if it ain't locked

#

idk why u expect it to work in a multithreaded environment

hazy saddle
hazy saddle
#

i should add some spinlocks

#

lmao

cyan bison
#

well u at least have spinlocks implemented right

hazy saddle
#

im makin a minimum repdrofuction

cyan bison
#

bro...

#

this is bad

hazy saddle
#

its lock free /s

#

as in

#

i have zero locks

#

anywehere

cyan bison
#

cro is not smp safe 🥀

hazy saddle
#

its not even single core safe

cyan bison
#

trust me ur gonna die when u try to add smp

hazy saddle
#

im gonna add locks laterrr

#

dontttt worryyyy

cyan bison
#

Not a good mentality.

hazy saddle
#

true

#

but

#

@cyan bison know what the issue was

cyan bison
#

no

hazy saddle
#

I wasn’t zeroing the memory

#

Of the RBtrees

#

I have now added zalloc() to my kernel

#

So I can just use that

#

And not need to manually zero the shit

#

what do you know

#

undefined behavior

#

makes shit crash

hazy saddle
#

well lets go

#

gonna leave this on

#

and hope it wont OOM

#

But I think my reaper is doing its job

#

Will need some extra work for CoW to not delete those pages etc

#

Maybe some optimizations too

#

BUT

#

Oh and I will have to turn them into zombies before a full clear

#

But good enough for now

hazy saddle
#

100k runs

#

no crash

#

this is with 64mb total ram and ~47mb detected by the kernel as usable

#

well

#

now its time to fix the VFS

#

and then

#

and then bash

true oak
#

thread reaper

hazy saddle
#

When a thread exists it’s put into a reaping state

#

If the scheduler attempts to run it it will instead put it into the reaping queue

#

And then all of its memory gets reclaimed

hazy saddle
#

When a program exits

#

Like the main function returns

#

And the the libc calls exit()

true oak
#

i got it you just said exists

hazy saddle
#

Everyone makes typos

true oak
#

im just evil and hate everybody ig letsgo

hazy saddle
#

much better

true oak
#

everyone who uses snake_case needs to be studied

hazy saddle
#

I use every kind of case

#

Whenever I feel like it

mild glacier
hazy saddle
hazy saddle
mortal bane
mild glacier
true oak
hazy saddle
#

Alright maybe we should get back on topic

hazy saddle
mild glacier
hazy saddle
#

@cyan bison happy now

#

here even better

#

i fixed the attribute

rotund furnace
#

where your spinlocks not atomic

hazy saddle
#

at all before

rotund furnace
#

oh

hazy saddle
#

is ts better @rotund furnace

rotund furnace
#

I don't use stdatomic

#

or inline asm :P (cli, sti, and pause are all arch functions, (disable/enable)_interrupts and arch_pause)

hazy saddle
#

:p

#

Then what the fuck am I meant to do

#

Oberrow said to use stdatomic

rotund furnace
#

it's just I don't

hazy saddle
#

Ah

rotund furnace
#

I use the builtin compiler intrinsics

hazy saddle
rotund furnace
#

__atmoic_exchange_n & __atmoic_store_n

hazy saddle
#

Is there even compiler intrinsics for pause and sti/cli

rotund furnace
#

well

#

it depends on how you implement ipis

#

my ipi code is terrible and has had deadlocks

hazy saddle
#

And then once they are enabled

#

It will pop up back

rotund furnace
#

yeah

hazy saddle
#

This spinlock should be fine as long as I don’t hold it for long right

#

And it should work cross core

rotund furnace
#

I switched to only using async ipis because sync ipi caused too many problems

hazy saddle
rotund furnace
#

and since shit like forcing other cores to die and tlb flushes can be async it's fine

hazy saddle
#

Now where should I slap this lock

#

But this will make my kernel slower

#

It will no longer be lock free /s

#

Okay so @rotund furnace I should maybe add one to

  • every VMM instance
  • the PMM
  • the heap
  • the reaper queue

I think that’s everything that’s cross thread?

mortal bane
#

stdatomic <3

hazy saddle
#

Okay so

#

Shit is fucked

mortal bane
#

and frequent level

cyan bison
#

no

#

it should save the previous interrupt state and restore it on spinlock release

hazy saddle
#

Still
Fucked

#

Check the secret group chat

#

Lmfao

wanton grove
hazy saddle
wanton grove
hazy saddle
#

The chat was originally made because @rotund furnace Played 19 hours of rust straight

#

It kinda just stuck around lmao

#

And got renamed

#

A few times

rotund furnace
#

lemme use my free time how I want

hazy saddle
#

Have fun playing your games

#

@wanton grove btw since your in here. Any idea why the fuck this is happening 💀

wanton grove
#

after what you get this

hazy saddle
#

😭

#

Honestly

#

I’m lowkey impressed it’s fucking up that bad

#

And adding locks made it worse

wanton grove
hazy saddle
#

No SMP

#

Just normal threading

wanton grove
#

send src ill compile this

hazy saddle
#

@rotund furnace Do you have your fucked up patch

#

That’s based on my fucked up patch

#

The corrupted frame buffer is mainline dev though on the repo

#

and they have crashes on that

#

That I can’t reproduce

#

💀

#

LMK if you need the compiled userspace apps to drop into the initramfs folder if you don’t wana build GCC

rotund furnace
wanton grove
#

how much it costs

rotund furnace
#

there is no patch

#

It was off clean origin/dev

hazy saddle
#

They are cheap as shit if you don’t need a short or fancy one

wanton grove
hazy saddle
#

My aunt pays it for me

hazy saddle
#

And the build system compiles it

#

And stuff

#

And if you don’t wana spend 40 minutes compiling GCC and binutils

#

I can give pre compiled binaries

wanton grove
#

yes i dont