#Nyaux

1 messages Β· Page 43 of 1

flat nymph
#

embedded hardware

kind root
#

Embedded devs love crappy proprietary solutions to already solved problems

broken depot
tawdry mirage
#

for controllers that expose a window into the config space:

  1. configure the pcie controller to show you the config space of the function you want to show to the os
  2. have mcfg point to the window, and say that only 1 function is available there
  3. the os will see the device you wanted to show as XXXX:00:00.0
broken depot
#

Because I've seen that one too.

tawdry mirage
kind root
#

Hmm but how, you would still have to make sure the entire space is mapped at some address

tawdry mirage
#

for windows support

thorn bramble
#

apparently not even original solutions to already solved problems, just copy and paste existing solutions and change them ever so slightly to fuck people over :^)

kind root
broken depot
tawdry mirage
surreal path
#

wait i need to impl a way to exit a thread

#

like

#

destroy the thread

#

from ze queue

broken depot
surreal path
#

yea

kind root
#

That's why I kinda don't wanna invest into the aarch64 version of the kernel if I start making one, it just sucks and u have to have 9999999 drivers per chip

surreal path
kind root
#

Idk if that has a sane board

flat nymph
#

I think

#

besides x86

thorn bramble
kind root
flat nymph
#

raspberry pi

thorn bramble
#

or one single random version of the rpi

flat nymph
#

it even has uefi

#

And windows

#

unofficial

kind root
#

Isnt the latest pi proprietary af

#

Even their usb

flat nymph
#

and a lot of proprietary garbage

flat nymph
#

with risc-v there's no good hardware

#

(from what I gathered at least)

#

I also want something physical for my RISC-V port

#

But I have a bunch of raspberry pi s

#

So pmOS ARM port???

tawdry mirage
# kind root Even their usb

usb on the pi5 is just xhci iirc? but it's on their weird rp1 chip which has everything smushed into one pcie function at different offsets into the pci bar

kind root
#

I see much more value in supporting my old abandoned laptops than a pi, at least those have a proper GPU and their own screens and stuff

flat nymph
kind root
molten grotto
#

no pi5 also has a xhci

tawdry mirage
broken depot
molten grotto
#

its a dwc3 tho so no public official specs for that

flat nymph
kind root
#

Ah ok then

tawdry mirage
#

so it's fine

flat nymph
#

and a lot of "let's do baremetal dev" kinds off tutorials/things

kind root
tawdry mirage
# kind root Also wtf is that latter part

so for the rpi5 they moved a bunch of peripherals off of the main soc onto a second chip (a la southbridge) that's connected over pcie, and that chip is a custom design, so ofc it only has one pcie function with a large bar that has the mmio regions of all the peripherals in it

molten grotto
tawdry mirage
#

the way you're supposed to discover the individual pieces is with acpi/dtb

#

or just hardcode them if you find a pci device with their vendor:device ids

kind root
#

Least scuffed embedded design

flat nymph
#

how do you even discover that stuff with acpi?

#

also I guess acpi is emulated on them

tawdry mirage
#

look for device nodes with specific _HID and _CID values

flat nymph
#

like not native

tawdry mirage
#

well acpi is only available if you use the uefi firmware for it

tawdry mirage
tawdry mirage
#

and what's fun is that it has some arm microcontroller cores that you can run code on :^)

kind root
#

The southbridge?

tawdry mirage
#

yeah

kind root
#

Damn

tawdry mirage
#

and the arm core has access to all the peripherals, including a dma peripheral, so you can program the southbridge to dma to the host ram or whatever

kind root
#

So dma would be just code in the sb doing a manual memcpy?

tawdry mirage
#

it has an actual dma controller too

kind root
#

Ah

tawdry mirage
#

but yeah the host physical memory window is mapped into the rp1 address space too

#

i think the dma peripheral is generic and you just point it to the host ram window for dma across pcie

#

but this is unrelated to things like xhci etc (although ig you could point xhci into the internal rp1 ram instead of host ram?)

kind root
#

Is rp1 the name of this thing?

#

U never mentioned it

tawdry mirage
#

yes

kind root
#

Ah

tawdry mirage
tawdry mirage
#

because the 32-bit addr space is too small so it doesn't fit along with all the peripherals

kind root
#

They call the entire cpu an application processor

#

Kinda funny

broken depot
#

That's just silly

tawdry mirage
#

or well, not to the full space, afaics there is an ATU window thats 1G (which i assume is programmed to point somewhere into the host address space)

broken depot
kind root
#

And in x86 land an AP is something else

#

Basically just any cores started by bsp

tawdry mirage
#

this seems about right

#

you select which 1G chunk you want to look at

#

and program that into ATU_REGION

#

since the direct window is 512G in size, the ATU window is 1G in size, and ATU_REGION is 9 bits long

#

(1<<9 = 512)

broken depot
#

Actually calling something an application processor is pretty common (in the MCU space at least) for whatever the developer and/or end user is supposed to program.

kind root
#

Yeah name collisions as per usual

broken depot
#

Always.

#

It gets to a point where I sometimes do a double-take going "this thing doesn't contain XYZ, does it?"

tawdry mirage
kind root
#

Ye

broken depot
#

Like calling the shitty single-level "page table" that ESP32s have for their memory-mapped FLASH an "MMU".

kind root
#

Lol

broken depot
#

That made me do a double-take because I was convinced they hadn't had an MMU.

#

Lo and behold, they didn't, in fact, have an MMU in the sense any programmer would reasonably understand it.

kind root
#

Its hard to come up with original names for things ig

broken depot
#

Names are hard indeed

#

I have come up with a completely original name for a project exactly once to date.

kind root
#

Badger?

broken depot
#

Nobody had named a RISC-V CPU "Boa RISC-V" before I did.

broken depot
kind root
broken depot
#

Oh yes.

#

I have made quite a few by now.

kind root
#

Did you run it on an FPGA?

elder shoal
#

that means good risc v in portuguese

broken depot
#

The CPUs I made before RISC-V were all custom ISAs (and therefor the disadvantage of not having a toolchain).

broken depot
#

I know more ticks now that could make it faster but I haven't properly started another CPU project since.

#

It supports hardware atomics too, which I'm very pleased with.

kind root
#

Very cool

broken depot
#

I posted about it in #risc-v back when it was actually a recent thing.

#

So keep your eyes on there occasionally if you want to hear of the next oneℒ️.

kind root
#

Yee

broken depot
#

But this is getting off-topic

surreal path
#

it has been for the past 40 messages

#

πŸ’€

#

i dont rlly mind tho lol

broken depot
#

I try to respect channel's topics and this one's topic is your hobby OS

surreal path
#

currently waiting on monkous to respond about me trying to understand his scheduler desgn

#

in #schedulers ofc

surreal path
#

heres what im going to impl

#
i will add states to threads like running, ready, zombie

u can create a new thread its ref count will be initally 1, because someone in the freelist is referencing it

thread does thing, maybe later down the line thread might have something more then 1 because idk thread communication idfk how that works

if this new thread calls exit_thread()
it will decrement its ref count and put it in the zombie queue
the reaper thread will check if its ref count is 0
if it is free the resource
#

is this a good way to impl exiting threads

#

anyone know?

#

:(

#

??

silver yarrow
#

afaict its alright

surreal path
#

okokok

flat nymph
#

I don't have refcounts in my thread

#

It's either alive or dead

surreal path
#

somehow ive corrupted the stack???

#

i was cleaning up the scheduler code

#

stack is corrupted??

surreal path
#

cant even look at ze stack

#

thanks gdb

#

srry what

#

πŸ’€

#

does this look corrupt

#

i think it looks corrupt

#

wheres my fucking

#

thing

#

bro

#

wait hold on

#

what in the fuckj

#

oh nvm

flat nymph
#

You've asked to remind you to fix your sleep schedule

surreal path
#

cant sleep

flat nymph
#

Go to sleep now

surreal path
#

i cant

#

sorry

#

i somehow fucking corrupted the stack

#

it seems

#

i did not?

#

okay

#

okay

#

i have found something out

#

after getting preempted while ur in a thread

#

something happens and the return address is gone

#

wtf

#

???

surreal path
plush hearth
surreal path
plush hearth
#

then sleep

#

you will never fix your sleep schedule if you don't try to

surreal path
#

i tried already

plush hearth
#

try again

surreal path
#

like

#

what

#

what happened

plush hearth
#

you aren't pushing/popping the correct number of values?

surreal path
#

i should be

#

yea thats the return address

#

into kentry

#

not into kentry

#

rather

#

into return_from_kernel_in_new_thread

#

umm what the sigma

#

yea thats not right

#

i have no clue

#

whats causing this stack corruption

#

wtfff

#

no idea whats going on lol

#

i LITERARLY

#

just

#

functioned out the queue crap

#

πŸ’€

#

on github ig

#

it panics with why am i here

#

for some reason

#

only one core panics as well

#

and timer interrupts are still firing

#

idfk whats going

#

on

rigid fable
#

@surreal path hello my sweetie human 😍

surreal path
#

hey

#

im going to sleep i tried debugging this for a good bit but no 1 im way too tired no 2 im already out of ideas πŸ’€

#

night

surreal path
#

nvm it works now??

#

tf

#

weirddd

#

nvm not anymore

#

wtfff

#

now its not anymore??

#

@flat nymph

#

is this UB

#

i lit barely change the sched

#

it works

#

then i change it a little

#

it doesnt

surreal path
#

yea wtf

#

this is

#

so fucking weird

surreal path
#

its fucking iretqing into send eoi

#

wtf

#

this is getting even fucking weirder

silver yarrow
flat nymph
#

It's potentially normal?

flat nymph
kind root
#

Nyaux whats the current ec status

surreal path
#

when in context

#

wtf

surreal path
#

at all

surreal path
#

i couldnt tell u

#

cause the fucking scheduler killed itself

#

but if i can get the scheduler working

#

and i can get things like blocking and exiting threads complete

#

we will have a more stable ec driver

surreal path
#

but

#

i swear to god

#

read the source urself even

#

the interrupts ARE dsiabled

#

😭

#

i just send

#

on EOI

#

one*

#

thats insane

#

and then somehow the stack gets corrupted

#

and idfk whats going on

surreal path
surreal path
#

i think its a bug when exting out of a thread

#

exitingg*

#

as in

#

2nd preemption

#

cause ive seen it enter kentry

#

once

#

then some shit happened

#

idfk

#

ive been banging my head out

#

trying to debug this

#

chat this is so fucking weird

#

Like sometimes

#

it just decides

#

im gonna get stuck in send eoi somehow

#

and get preempted and then send another eoi and then get preempted

#

and make my iretq return address be send eoi

#

and sometimes

#

stack corrupting after 2nd preemption

#

@flat nymph no way ur awake

#

i think i will ask for help in #schedulers or something

#

now I COULD do that

#

or sleep

#

ill do it first

elder shoal
#

Sleep

surreal path
#

nahh

flat nymph
surreal path
surreal path
flat nymph
#

Maybe it's not switching stacks as it should idk

surreal path
#

im wtfing as well

surreal path
#

i checked with gdb

#

something fucky is going on

#

and all i did was cleanup the queueing code a little bit

flat nymph
#

Make sure you don't use the whatever mechanism there is to switch to a different stack on interrupt

surreal path
#

i didnt even touch the context switching

flat nymph
#

Idr

#

In TSS

surreal path
#

wdym, rsp0?

#

i still am switching out rsp0

#

whats wrong with that

#

even tried adding dummy bogus shit just to make the stack 16 byte aligned

#

which changed

#

NOTHING

#

i didnt even

#

change the thread struct

#

i just

#

changed the queuing

#

thats it

#

im so confused

thorny glen
#

it was probably always broken and u just did something that revealed the bug

surreal path
#

but the question is

#

what IS that bug

#

@flat nymph

#

i didnt change anything

#

it should work

flat nymph
surreal path
#

i dont know what the hell is going on

flat nymph
#

iretq would ideally do that for you

#

Not ideally

surreal path
flat nymph
#

It's noop

surreal path
#

still in send_eoi

surreal path
#

doesnt make a difference

flat nymph
#

Yeah because it doesn't do anything

surreal path
#

yea so im cooked

#

because

#

i have no idea whats going on and my eyes look like bags rn

#

literal bags lmao

hexed mango
#

Sleep!!!!!

surreal path
#

must grind

#

nyaux grind is foreveer

flat nymph
#

Ask someone smarter trl

surreal path
#

thats why i asked in #schedulers

flat nymph
surreal path
#

i didnt sleep since

hexed mango
surreal path
#

5pm yesterday

flat nymph
#

Lol

#

That's some really fucked up sleep schedule

surreal path
#

indeed

flat nymph
#

You enable interrupts right before you do send_eoi()

#

Thet's why it returns to it

#

I.e. it's working as expected

surreal path
#

uhhh no

#

i even removed that @flat nymph

#

still broken

rigid fable
surreal path
#

and i just woke up

rigid fable
surreal path
flat nymph
#

Nah

#

Now it's me having UB

surreal path
#

😭

#

guess we are both having

#

a bad time

flat nymph
#

My UB is worse

#

It's actual UB

#

Which disappears if I add assert

surreal path
#

fair

#

that sworse

#

im sorry ur experiencing that

#

okay disabling all other cpus doesnt change the behavior

#

but itll be easier to debug now

#

stack looks like this

flat nymph
surreal path
#

values of stack pointer rn

#

it seems like it never rets into return_from_kernel_into_new_thread

#

not only that

#

but the timer doesnt seem to fire anymore

#

i think i know why

#

i am overwriting the new threads stack

#

with the interrupt context

flat nymph
surreal path
#

with the thread pointing to itself

#

this makes sense

#

@flat nymph how do i fix this, i wanna fix this without doing some hacky idea

surreal path
#

:(

flat nymph
#

Fix what

flat nymph
#

Where's the code

surreal path
flat nymph
#

Ugh how are you overwriting it?

surreal path
#

look here

#

on first context switch it thinks we were previously running an old thread

#

because something is in the runqueue

#

and the next pointer points to itself

#

u understand?

surreal path
#

solved it

flat nymph
surreal path
#

laura is poop

edgy pilot
surreal path
#

@bleak cedar hi

surreal path
#

happy new year

#

@molten grotto happy new year

#

everyone else in the thread

#

happy new year

molten grotto
#

happy new year for you too! where I live it was already an hour ago

surreal path
#

fair

#

happy new year though

molten grotto
#

thanks

surreal path
#

npnp

plush hearth
silver yarrow
#

im still a good 9 hours away

finite summit
#

time travellers

#

(it's 6 hours away)

surreal path
#

@kind root happy new years

#

also ec works great on my laptop

#

so theres that

#

reason its iffy on other laptops is because i stilll need to impl scheduler things like blocking

#

im working on it

flat nymph
#

happy new years!

kind root
#

Happy new years

kind root
surreal path
# kind root Great to hear

theres no brightness control events so im thinking that has to do with something else, also it seems like the sensors are routed through the ec

#

there is lid close and lid open

kind root
#

Which

surreal path
#

hold on while i dump my dsdt

kind root
#

Which sensors

surreal path
#

i need to look at the aml to find that out

kind root
surreal path
#

i will reboot to linux i suppose

kind root
#

Same commands as Linux

silver yarrow
#

lol

surreal path
#

gives me an error

kind root
#

Which

thorn bramble
#

acpidump just works

kind root
#

Yup

surreal path
#

thatsh the error

#

@kind root

kind root
#

Thats because u dumped it as UTF8 with bom

#

Idk how u managed to do that

surreal path
#

idk

#

either

thorn bramble
#

did bro open it in notepad

surreal path
#

i just ran

#

no

#

i didnt open it

kind root
surreal path
#

no i didnt

kind root
#

Or its this shitty terminal

#

Use the normal cmd.exe

surreal path
#

ok

thorn bramble
#

if anything it would be powershell

#

but yeah try cmd.exe

surreal path
#

iyea works now

#

@kind root maybe u can read it for me, im not the best when it comes to understanding aml

kind root
#

Im on my phone about to go sleep in 10 minutes

surreal path
#

okay then

#

ill try to read it myself then

kind root
#

What is it that youre trying to understand

surreal path
#

Scopes and such

kind root
#

No like

#

What did you need the dump for

surreal path
#

find the sensors

#

if they are ec

#

thats lid open

#

and off

#

battery

kind root
surreal path
#

for sensors

#

idk

#

found it

kind root
#

Ah that stuff

#

Look for SEN2)

#

device

#

It should have a hid

surreal path
#

thats all references to sens2

kind root
#

its in SSDTs

surreal path
#

kk

#

@kind root

kind root
surreal path
kind root
#

Method _HID calls it

surreal path
#

that exists

kind root
#

On your screenshot

surreal path
#

yea

#

so um

#

whats going on lol

kind root
#

INTC10A0

thorn bramble
#

INTC10A1

#

not A0

kind root
#

Is the PNP ID of that sensor

kind root
surreal path
#

aahhhh okay so why is the ec getting events from it

kind root
#

Because some new values come in probably

thorn bramble
#

i was basing it off the fact it gets passed _UID which is SEN2, so it should return INTC10A1

surreal path
thorn bramble
#

but i dt understand it fully so

kind root
#

You can grep the Linux source for that PNP ID

surreal path
#

okok

kind root
#

To see which device it is and what it does

thorn bramble
#

inb4 not in linux

surreal path
#

it isnt in linux actually

kind root
thorn bramble
#

ah okay

#

i thought i was being retarded

#

lmao

#

turns out i can still follow simple control flow

kind root
#

Intel(R) Innovation Platform Framework Manager

kind root
surreal path
kind root
#

This is some device specific proprietary controller basically

#

Yeah as u can see its for thermals

surreal path
#

fair

kind root
#

When do you get this notify?

surreal path
#

every few seconds

#

i get an ec event

kind root
#

Temperature changes I guess

surreal path
#

yea

kind root
#

So it asks to re read

surreal path
#

anyways before i do anything im gonna add some cpu id instructions

#

as well

#

as fixing up the scheduler even more

kind root
broken depot
kind root
#

Well technically its allowed to be either string or integer

#

But yeah idk why they allow that

#

IMO its stupid

#

Clearly the word sensor there is redundant

broken depot
#

In the grand scheme of things it's not even close to the worst thing in standardsℒ️ for modern computers.

surreal path
#

actually first

#

im gonna take a kernel arugment to disable ec loading

surreal path
#

actually nah kinda stupid

#

nvm

kind root
#

Just make sure it either works or dont enable at all

surreal path
#

itll work soon once i finish scheduler shit

#

anyways

broken depot
#

How's the scheduler going so far?

surreal path
#

uhhh so well currently i added a current_thread ptr much like in obos

#

threads now have states

#

and well

#

i have a zombie thread thing

#

but i didnt impl the reaper thread yet

#

first

#

i need to cleanup the queueing evne more

#

next

#

i need to impl KCexit_thread()

#

then

#

i need to impl the reaper thread

#

plug that all in into uacpi for schedule work and such

#

and yea

broken depot
silver yarrow
#

so whats the function of the reaper thread

#

I just have a destroy state

broken depot
#

I use it for both the reaping of individual threads as well as processes.

silver yarrow
#

and when the scheduler gets to it, it cleans up the thread

surreal path
#

if it is

silver yarrow
#

couldnt the scheduler do this

surreal path
#

clean up resources

silver yarrow
#

or is it a thread for perf reasons

broken depot
#

What's the refcount for?

surreal path
#

perf reasons

broken depot
#

For the thread handle?

cinder plinth
surreal path
silver yarrow
#

yeah

broken depot
#

Couldn't you, in that case, have a custom free function for your refcount ptr and have said function add your thread to a "to-be-reaped" list?
That seems more efficient than checking all threads in the system to me.

silver yarrow
cinder plinth
kind root
#

Yeah freeing large tasks can be expensive

broken depot
#

BadgerOS' model is slightly different in that threads have a numeric handle, even in the kernel, so I don't have a need for refcount pointers.

#

And also it has a join/detach model.

#

Which is what causes thread cleanup in BadgerOS.

cinder plinth
#

Based object-based model

surreal path
#

nyaux will have handles soon

#

handles in threads

cinder plinth
#

I'll do that in my new kernel

#

Like NT

surreal path
#

yep

broken depot
#

BadgerOS uses numeric handles quite a lot, actually.

#

All of which in sorted arrays so it can be binary-searched.

silver yarrow
broken depot
#

Handles that could be pointers (e.g. a file handle or a thread handle) are numeric instead and the pointers (or structs if they're small enough) are stored in an array, sorted by ID.

desert haven
#

You use ids rather than pointers, so every attempt to access the object can be checked

desert haven
broken depot
#

You basically read my mind :P

desert haven
#

I'm in your head :p

broken depot
surreal path
silver yarrow
#

so how does this replace refcounting

#

I get that u wont have dangling pointers

broken depot
silver yarrow
#

mind explaining that one :p

broken depot
#

In #1153085124959809616, a thread that stops will be put in the "exited" state until a thread_join() is called with its ID. Threads can also be thread_detach()'ed if you're not interested in the event.

#

The latter case instructs the scheduler to clean up as soon as the thread exits (i.e. immediately add it to the reaping queue).

#

When a thread enters the reaping queue, it is officially dead and all that remains is the memory allocated to it (stack and thread control block).

#

Its ID becomes invalid at that time.

desert haven
broken depot
#

Definitely

#

I used to have raw pointers for things that now use integer handles.

#

And even with the few occurrences of the thread API actually being used back when the scheduler re-write started, I had to edit dozens of files just to comply with the new API.

surreal path
#

hi

#

just realized something

#

so basically if i am to kill a thread with the reaper

#

what about the process

#

will that ALSO be refcounted?

#

???

#

and if its 0 free the process

silver yarrow
#

something along those lines

surreal path
#

okok thanks

silver yarrow
#

if the last thread of a process exits, the process is dead

silver yarrow
broken depot
#

Yup

silver yarrow
#

dope

#

I need to look into doing this

#

seems a lot cleaner

broken depot
#

Obligatory #1153085124959809616 plug

#

IMHO the source code is relatively readable

silver yarrow
#

seems pretty readable from a quick look

#

one thing I noticed is that u use a lot of atomic fns

broken depot
#

I like atomics

#

They can avoid mutexes in certain circumstances

surreal path
#

well

#

seems like we've encountered a bug

#

it seems that trying to free the kernel stack

#

one of the addresses given to invlpg

#

is not a physical address

#

so there is a bug

#

in the vmm

#

no wait

#

thats normal right

#

wait

thorn bramble
#

invlpg takes a virtual address?

#

tlb is keyed by the virtual page not the physical page

surreal path
#

okay

#

so it seems

#

it dies at ret?

#

so wtf

#

FUCKING MORE UB

thorn bramble
#

you do something wrong != there's ub

surreal path
#

at ret

thorn bramble
#

why do u call everything ub lol

surreal path
#

because my code is always causing ub

#

lol

thorn bramble
#

i don't think you know what ub is

surreal path
#

ub is undefined behavior

thorn bramble
#

also, you have ubsan meaning most of the dumb ub your code would cause is caught

#

the fact your ubsan isn't fatal is another thing but oh well

surreal path
#

i got no ubsan warns

#

maybe its not ub

#

i dont know

thorn bramble
#

maybe it is

#

who knows

surreal path
#

maybe

#

who

thorn bramble
#

ubsan isn't perfect

surreal path
#

knows

thorn bramble
#

but you'=d have to royally screw up if it's something ubsan doesnt catch

#

read: your code poop go figure out whats fucking up ur stack

#

put a breakpoint at the ret

#

and check if the return address if correct

surreal path
#

okok

thorn bramble
#

maybe ur literally unmapping ur code

#

and the invlpg runs fine

#

but then it flushes taht entry out of the tlb

surreal path
#

well the invlpg does run fine

thorn bramble
#

and it dies lol? idfk

#

yeah no shit

#

but if u flush that page out of the tlb

#

and its now unmapped

#

how is the ret gonna run?

#

what kind of a pf do you get

#

on that ret

surreal path
#

non presnet

thorn bramble
#

read?

#

write?

#

execute?

#

kernel? user?

surreal path
#

just 0

thorn bramble
#

and what is that?

surreal path
#

0x0

thorn bramble
#

ok krenrle read

#

and what is tha address

#

i can see cr2

#

but like

surreal path
#

hold on

thorn bramble
#

rsp? rip?

#

id assume its the rsp

#

which means ur unmapping ur stack?

surreal path
#

not a real address

thorn bramble
#

no shit

#

its in the hhdm

#

show me ur regfister dump

surreal path
#

k hold on

#

i fucking unmapped my stack

thorn bramble
#

holding

surreal path
#

i unmapped my stack

thorn bramble
#

good job

#

i told u

#

why are u unmapping ur stack lmaop

#

its in the hhdm

#

why would u unmap that

plush hearth
surreal path
#

im trying unmap the thread in the reaper queue

thorn bramble
#

dont touch the hhdm bruh

surreal path
thorn bramble
#

only unmap memory you mapped first

plush hearth
#

Yeah, anything in HHDM memory shouldn't get unmapped

thorn bramble
#

hm

#

what does ur kfree do

#

code on github?

surreal path
#

yes

plush hearth
surreal path
#

woah

#

thats cool

plush hearth
#

Or are you using the one limine gives you?

surreal path
#

i allocate 2 stacks

#

for reaper thread and the test thread

#

im trying to exit

thorn bramble
#

fix that

surreal path
#

i will check if it is doing that

plush hearth
surreal path
#

hold on

surreal path
#

all memsetted

plush hearth
#

Why not just with your vma?

thorn bramble
#

it does use the vmm

plush hearth
#

It would be faster

surreal path
#

no @thorn bramble this assertion passes fine

thorn bramble
#

u said u will compare stack bases

#

not the thread pointers

surreal path
#

oh hold on

#

assertion still passes

thorn bramble
#

lol fun

#

vmm bug?

#

print addresses u unmap

surreal path
#

maybe?

#

kk\

thorn bramble
#

here

#

or in arch_unmap

#

whatever u prefer

surreal path
thorn bramble
#

only thing thats unmapped?

surreal path
#

yes

thorn bramble
#

the stack reaper runs on is within that range so

#

Β―_(ツ)_/Β―

surreal path
#

how are u sure

#

u dont even know the reapers stack

thorn bramble
#

0xffff800d4020c000 < 0xffff800d4020ff38 < 0xffff800d40210000
True

surreal path
#

nvm

thorn bramble
#

i can see the register dump

surreal path
#

oh no

#

its abug with the vmm

#

vmm region shit

#

ohhh noooo

thorn bramble
#

how do u know its a bug

#

what is it

#

im assuming u know what it is

#

if u say its a bug lol

surreal path
#

i dont know the exact bug but something to do with this if statement i think when creating regions

#

i could possibly be having overlapping regions

#

to verify this i will print all regions in the vmm on the pagemap

thorn bramble
#

whats arch_chekc_space

#

align up to page size + page size

#

wtf

surreal path
surreal path
thorn bramble
#

idk nothing i guess lol

surreal path
thorn bramble
#

just wondering why ur doing that + page size

surreal path
thorn bramble
#

iot's a bunch of addresses man

#

i dont even know waht hey are supposed to be

surreal path
#

the 2nd last vmm region

#

is the stack we allocated

#

that we tried to unmap

thorn bramble
#

why do u have a base 0xffff800000000000 in ur vmm list

#

LMAO

surreal path
#

so my vmm region checking thing works?

#

thats the hhdm

thorn bramble
#

thats funny but okay

#

it works

#

i guess

surreal path
#

yea they dont look overlapping

#

so wtf

thorn bramble
#

would be nice if u actually printed the length in hex

#

so i can do the math

surreal path
#

okay

#

hold on

thorn bramble
#

but kvmm_region_alloc looks fine regardless

#

maybe a little bit suboptimal

#

but fine regardless

surreal path
#

@thorn bramble thats base + length

#

yeaaa sooo

thorn bramble
#

thanks for not doing what i asked for

#

that works

surreal path
#

OKAY FINE

#

ILL PRINT IT IN HECX

thorn bramble
#

no

#

dont

surreal path
#

okay

thorn bramble
#

im joking

surreal path
#

😭

#

okay

thorn bramble
#

anyway the kernel stack being unmapped is the one being used by the reaper thread

#

like

#

lol

#

idk what to tell u

#

ur looking in the wrong place

#

figure out why its trying to unmap that stack

#

oh i see

surreal path
#

??

thorn bramble
#

u set kernel_stack_base to stack + stack size

#

so when u go to free the thread's stack

#

u actually free the region after

#

maybe

#

not sure

#

but like

#

thats waht you do with reaper thread stack at least

#

u set both base and ptr to the end of the stack

#

kernel_stack_base should be the base of the allocated region

#

kernel_stack_ptr should be base + size i guess

surreal path
#

i know how to fix this

thorn bramble
#

u do this here too

#

yeah its easy

#

but im js thats one bug i spotted

surreal path
#

yea i know

#

yea thats the bugggg

#

thanks @thorn bramble

thorn bramble
#

did it work after u fixed that?

surreal path
#

hold on

thorn bramble
#

well dont thank me yet then lol

surreal path
#

oh no

#

oh no

thorn bramble
#

i wanna go to sleep and dont really feel like cloning and building nyaux

surreal path
#

oh no

thorn bramble
#

wjhat

#

good talk

surreal path
#

nvm

#

i think it worked?

#

yea

#

it worked

#

thanks

thorn bramble
#

did it free a kernel stack?

surreal path
#

i believe so yes

thorn bramble
#

well i hope it worked lol

#

ur vague description of the current state of doings makes it hard to tell

#

but yw i guess

surreal path
#

letss gooo

thorn bramble
#

lfg

surreal path
#

lfg

#

go to bed lol

#

its 3am

thorn bramble
#

4

#

4:04

surreal path
#

4 for u

thorn bramble
#

sleep schedule not found

surreal path
#

yea U need to sleep

thorn bramble
#

ahahahhassdhuawshsdjaudqahjwesiikaeqfgjae

surreal path
#

😭

#

yea me too

thorn bramble
#

get it

#

404

#

HAHAAA

surreal path
#

HAHAHAHAA

thorn bramble
#

FUNNY

surreal path
#

HAHAHA

thorn bramble
#

KILL ME

surreal path
#

FUNNY

thorn bramble
#

godo night

surreal path
#

goodnight

surreal path
finite summit
#

good job

surreal path
#

yesss!

thorn bramble
#

fixing nyaux one bug at a time

surreal path
flat nymph
surreal path
#

maybe

flat nymph
#

(maybe I should fix the pmOS keyboard driver)

surreal path
#

lol u should

#

now i will abstract the scheduler a bit

#

clean up thread creating code

#

like seriously gotta clean that up

#

also fix the queueing code i forgot

#

but BEFORE that

#

ima add cpu id instruction and print out cpu manufactor

flat nymph
flat nymph
#

Why have them in threads, when they're either alive or not

flat nymph
flat nymph
finite summit
flat nymph
#

Though "It depends"

flat nymph
surreal path
#

cringe

flat nymph
#

Like you have a queue of ready threads, do you hold refcount for that, or maybe you use something similar to std::shared_ptr and use that for linked lists, but then it becomes obnoxious, and what if a thread dies and someone holds a reference to it, etc.

silver yarrow
#

so I can swap out the impl relatively easily

surreal path
#

guess whos

#

fucking lpaotp

#

laptop* broke?

#

mine!!!

#

okay so i was trying nobara some linux distro

#

wow i just crashed

#

okay

#

so bascially i ran it right, then it froze and then the screen got all glitched

#

and then the display was off

#

and it wouldnt come back

#

idk what linux did maybe it messed with the nvidia GSP firmware in a way that bricked it

#

to be fair this nobara distro claimed to have patches around nvidia

#

so i suspect they might have something to do with this

#

that or my laptop croaked out from too much osdev

#

anyways im using the family computer rn. my dad said when he wakes up he will take a look at it

#

or well

#

take a look at the fact that i even opened the laptop and disconnected its battery and cmos to which it did NOT fix it

#

am i even gonna get a new laptop

#

it cost fucking 2000 euro

#

i dont think he will buy a new one

#

he could try to get it repaired

#

but it would take weeks

#

and i already used the warnenity

#

im fucked

#

im royally fucked rn chat

surreal path
#

mess up a driver this bad

#

to the point of bricking the GPU

#

πŸ’€

haughty kite
#

it might not be the gpu

#

also isnt it a defective piece of hw if it can be bricked by bad sw

surreal path
#

maybe

#

also it probs is

#

cause external display output also doesnt come up

#

the display works fine it seems

#

the internal laptop display

#

as in

#

no output to the laptop display or the external display

#

via the hdmi port which i know is routed via the nvidia gpu directly