#Nyaux

1 messages · Page 60 of 1

surreal path
#

wanna know something funny in the scheduler

IVE BEEN DOING THIS THE ENTIRE TIME AS WELL

#

😭

#

thats not how fork works

#

alright

#

welp the funny waitpid issue is solved

mossy belfry
surreal path
#

@elder shoal should i disable usb legacy support the wiki is telling me to do so???? but i want the usb keyboard to act as a ps2 keyboard and also the wiki says it will interfere with the init of the ps2 controller??

#

im asking you since i want this to work on real hw, with usb emulated ps2 keyboards

#

and i think you got that working with astral after hell

#

so im just asking for your approach on this

elder shoal
#

I did not

surreal path
#

by the lack of response im guessing so lol

elder shoal
#

I was busy

#

But I have no ida

surreal path
#

all good, infy says to use PNP so thats what im doing lol

kind root
surreal path
#

my laptop has a usb keyboard

#

screwed

kind root
#

U sure?

surreal path
#

yep

kind root
#

How

surreal path
#

rayan@athena ~]$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 0408:4036 Quanta Computer, Inc. Acer FHD User Facing
Bus 003 Device 003: ID 05af:766a Jing-Mold Enterprise Co., Ltd USB-HID Gaming Keyboard (D)
Bus 003 Device 004: ID 04f3:0c4f Elan Microelectronics Corp. ELAN:Fingerprint
Bus 003 Device 005: ID 8087:0033 Intel Corp. AX211 Bluetooth
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

kind root
#

The internal keyboard is wired via USB?

surreal path
#

yep

kind root
#

What the fuck

surreal path
#

yea this laptop is cursed

kind root
#

Which model is this

surreal path
#

acer predator triton PT14-51

thorn bramble
#

least fucked laptop hardware

kind root
#

Well give it a try who knows maybe u will still get emulation

#

U could ask uACPI to not enable acpi mode to see if it makes any diff

surreal path
#

nahh

#

its fine

kind root
#

I don't recommend leaving that flag on tho

#

No idea why they decided to route it like that lmao

surreal path
#

WHY CANT IT FIND THE FUNCTION

#

i did the cplusplus guard in my header file

#

its trolling me

thorn bramble
#

you need to mark it as extern “C” in the source file

surreal path
#

oh

#

huh??

#

but i dont in fb.cpp

#

and it runs fine

#

that didnt fix it

#

header file is just this

#
#pragma once
#include <controllers/i8042/i8042.h>
#include <fs/devfs/devfs.h>
#include "fs/vfs/vfs.h"
#include <mem/kmem.h>
#include <term/term.h>
#include <arch/x86_64/syscalls/syscall.h>
#include <cppglue/glue.hpp>

#ifdef __cplusplus
extern "C" {
#endif
void devkbd_init(struct vfs *curvfs);
#ifdef __cplusplus
}
#endif
#

keyboard.cpp does include keyboard.hpp

#

and the function is declared there

#

as well

#

function declarations matching

#

didnt add it to my meson to build im stupid

mossy belfry
thorn bramble
#

go away

mossy belfry
#

I got device addressing working with xhci in 2 days

#

not too bad trust me

thorn bramble
#

i got usb hid boot protocol, msd and cdc ncm in like 1 day

mossy belfry
thorn bramble
#

generic xhci

broken depot
surreal path
#

insane

#

robot may need to

#

quit factorio

#

anyways mornin

#

i fell asleep writing ps2 code

#

which is insane

broken depot
surreal path
#

other new hobby oses are surpassing us

broken depot
#

It used to be true that I had more stuff but I think you've either already passed me or are about to.

surreal path
#

doesnt badger os have signals and shit

#

and pipes

#

nyaux has none of that

thorn bramble
#

wow they have signals and u don't, it must mean they are ahead

broken depot
#

Nyaux, my good friend.

thorn bramble
#

can badgeros run doom tho?

broken depot
#

You have DOOM running in userspace.

broken depot
surreal path
#

thats piss easy tho

#

its just some fuckin fbdev shit

#

i dont even have input for doom yet

broken depot
#

BadgerOS doesn't have framebuffers at all and it doesn't support all the POSIX syscalls I want, it also doesn't have any userspace libc at all.

surreal path
#

oh

#

right okay

broken depot
#

All testing I've been doing is either in-kernel, or a tiny app directly invoking syscalls.

surreal path
#

i see

broken depot
#

It doesn't even support fork or exec

surreal path
#

oh damn

broken depot
#

Only a weird kind of spawn function not compatible with posix_spawn.

surreal path
#

i see

maiden ridge
#

What

broken depot
#

You've been working actively on Nyaux where I've been doing other projects.

surreal path
#

very slowly tho tm

broken depot
maiden ridge
#

Oh ok

#

So there is a mechanism for process creation alright

broken depot
#

So I'll be converting that into posix_spawn compatible first, I can deal with fork and exec later.

maiden ridge
#

Ah

edgy pilot
#

ilobilix doesn't even have mmap
what are you on nyaux

surreal path
#

my scheduler is shit bro

edgy pilot
#

anyway, monkuous can fast forward your kernel

surreal path
#

and somehow nyaux has a fuckin oom issue after executing doomgeneric mutiple times

surreal path
edgy pilot
#

@ monkuous nyaux needs signals

surreal path
#

nah thats insane

#

ah yes just get monkuous to write nyaux

#

real

edgy pilot
#

real though

surreal path
#

nahh

thorn bramble
#

@\monkuous pls write my kernel kthx

edgy pilot
#

epic escape fail

surreal path
#

monkuous make weston run on nyaux real

thorn bramble
#

if you try to escape the @ it will show the <@ numbers> + it will still ping

thorn bramble
#

i prefer @\ over @<space> :^)

surreal path
#

\

#

\n

thorn bramble
#

good job

surreal path
#

so doing 2 slashes

cinder plinth
#

Pretty sure you can \ @

surreal path
#

makes only one slash

#

insane

thorn bramble
#

wow thats crazy

#

its almost as if

#

as if

#

you escaped it

surreal path
#

@\iretq

#

doesnt work

#

trolled

thorn bramble
#

yeah obviously

surreal path
#

cooked

cinder plinth
#

@thorn bramble

thorn bramble
#

its not supposed to ping

cinder plinth
#

Ah

thorn bramble
#

and that did ping me

cinder plinth
#

Bruh

supple robin
#

@ iretq

thorn bramble
#

and that has a space

#

😭

#

ugly ahh fake ping

cinder plinth
#

You used to be able to

supple robin
#

@\iretq

surreal path
#

im going to my moms today at 7pm

thorn bramble
#

@​iretq

surreal path
#

after not seeing her for 4 months

thorn bramble
#

yooo zwsp trolled

supple robin
#

@thorn bramble

#

bruh

thorn bramble
#

lmao

thorn bramble
surreal path
#

shes still my mom

supple robin
#

👎

thorn bramble
#

true but wrong server

surreal path
#

oh right

#

solved

thorn bramble
#

trolling

surreal path
surreal path
thorn bramble
#

i think that means

#

he disagrees with your opinion

surreal path
#

your gonna tell me she adopted me?

surreal path
supple robin
#

i stop talking to people that annoy me

#

i usually shut them out of everything

#

i've only had to do that once

thorn bramble
#

REAL

#

same

surreal path
#

i did this with my mom but like i still love her even if shes awful

thorn bramble
#

they might or might not still be messaging me to this day...

supple robin
#

it costs 0€ to be nice

#

atp it's effort to be miserable 24/7

ebon needle
surreal path
#

because no

maiden ridge
surreal path
#

become a discord kitten

worldly condor
maiden ridge
#

This

mossy belfry
#

say i was wondering how nyaux does any caching at all for things like the FS, (vfs nodes), and things

#

the codebase is too horrid for me to go and read it so i just wanted to ask here

edgy pilot
#

real

flat nymph
flat nymph
forest blaze
#

hi

#

bye

surreal path
#

insane

ebon needle
surreal path
#

most useful nyaux convo

ebon needle
#

like

surreal path
#

yes

ebon needle
#

why your embed keyboard is usb

surreal path
#

blame them

#

lol

ebon needle
surreal path
#

when i got xorg

#

we ball at 8 as usual

#

cause of fuckin heat

#

as usual

mossy belfry
surreal path
#

been working on ps2

#

ive gotten the ps2 controller to send an ACK

#

so we gamer

#

i just need to setup interrupts with the fuckin

#

controller

#

i.e. talk to the ioapic to get shit routed

#

then we ball we ball

kind root
#

will nyaux support multiplexed ps/2 and synaptics touchpads

surreal path
#

what is multiplexed ps2

kind root
#

ps2 with up to 4 devices

surreal path
#

is that real?

#

docs and spec for this?

kind root
#

laptops sometimes have 3 devices: keyboard, touchpad, and the joystick mouse

surreal path
#

my laptop uses usb so

#

cooked

#

fried

kind root
#

wel yours is fucked

surreal path
#

tho i have a spare laptop here

kind root
#

but normal ones do

surreal path
#

it has a touchpad

silver yarrow
#

"normal ones"

surreal path
#

and keyboard

kind root
#

the specs are pretty simple

silver yarrow
#

lolololo

surreal path
#

probs ps2

surreal path
kind root
surreal path
#

epic

kind root
#

all laptops i have use this spec ^

silver yarrow
#

those are going into my stash

kind root
#

there is one magic value u must write which only linux has, and the spec mentions but doesnt actually provide lol

#

(for the touchpad to report multiple fingers in separate packets)

silver yarrow
#

fucking sick

#

because of course

silver yarrow
#

spec == "look at the linux driver"

#

synonym really

kind root
#

nah its mostly correct

#

just this thing is borked

flat nymph
#

Touchpad usually goes over smbus?

kind root
#

its exposed via both usually

flat nymph
#

what are you supposed to do if you have drivers for both?

silver yarrow
#

pick one

flat nymph
#

but like how do you know that those are not two different devices?

kind root
#

i2c is better than ps/2, i think linux prefers it

#

idk, it has some code for that

flat nymph
#

ACPI would tell you?

kind root
#

probably

flat nymph
#

So documentation is linux again

#

cool

silver yarrow
#

i2c ❤️

kind root
#

i never had an i2c driver so

flat nymph
#

I think I'll finally write the init server, then I'll do smbus

kind root
#

ye

surreal path
#

im working hard on the ps2 driver

#

just

#

the funny thing is that the wiki page is vague on a lot of things

#

so i had to discover some shit on my own

flat nymph
#

just read the datasheet

surreal path
#

theres a datasheet?

flat nymph
#

yes

surreal path
#

where

flat nymph
#

google

surreal path
#

insane

edgy pilot
#

oooo this is messing with my brain

surreal path
#

huh

#

whats up

edgy pilot
#

too similar

surreal path
#

😭

edgy pilot
surreal path
#

@flat nymph are you my brother

flat nymph
surreal path
#

yea im looking

#

i fixed that shit

surreal path
#

lets fucking go

#

the cutoff part says its a mouse

#

so port 1 has a mouse lol

#

at least for qemu

kind root
#

do u use acpi to discover ps/2?

surreal path
#

yes

#

pnp ids stolen from managarm lol

kind root
#

ah

surreal path
#

time to check port 2

#

and setup the information structs

surreal path
#

so um

#

mint told me port 1 should be a kbd

#

but its reporting as mouse

#

i want to cry

surreal path
#

@elder shoal i am having a astral ps2 curse part 2

surreal path
#

okay so

#

all im figuring out is

#

its always timeing out

#

which is bad

surreal path
#

im dying

mossy belfry
# surreal path im dying

wait ru sure that ps2 will work on ur laptop or are you just sending your hopes and prayers that it will lol

#

this is intersting

#

never head of usb laptop inbuilt KBs and whatever

surreal path
#

im not even testing on real hw

#

im testing on fucking qemu bro

#

i hate ps2 i hate ps2 i HATE ps2

#

fuck this ive been up for 4 hours im going sleep

maiden ridge
#

My laptop uses i2c

#

But it emulated a ps2 mouse

#

Some systems firmware do emulate usb ones as ps2 but that varies from system to system

thorn bramble
#

maybe its routed both via ps2 and usb

surreal path
#

yo iretq

thorn bramble
#

and the usb one is favoured

surreal path
#

im dying

#

help

thorn bramble
#

i just woke up

surreal path
#

fair

thorn bramble
#

its so cold

surreal path
#

how

#

its summer bro

#

ive been awake

#

all night

#

banging my head againist this stupid fucking little chip

#

who wont listen to me

thorn bramble
#

i have never written a ps2 driver before so

surreal path
#

i know

#

im just letting you know the pain im in rn

#

fucking xhci would be easier then this shit atp

daring juniper
#

With how painful this sounds, it may just be better to pretend ps2 doesn't exist lol

surreal path
#

no because i need input

#

and im not writing xhci

#

im too retarded

daring juniper
#

fair

#

the third message got sent after I said fair XD

#

fair to the first two parts

mossy belfry
surreal path
#

im not doing it

mossy belfry
#

i am almost at address space init but i took a detour to do other work

#

oh ok

surreal path
#

not rn

thorn bramble
#

its not easy easy

#

its just not hard

#

similar to nvme in complexity

#

drivers for all the usb drivers on the other hand is gonna be more work, but at least hid boot protocol is pretty simple

maiden ridge
#

I remember it being an issue on a dell gaming laptop

#

Where the keyboard doesn't work under Windows but does in the UEFI firmware

#

Turns out a resistor was blown on the usb data lines on the keyboard and replacing that it worked

#

But yeah there are some cursed laptops like this

flat nymph
#

My PS/2 driver is semi-ok I think

#

Except that it doesn't return the keyboard layout on my laptop, and just 'ACK's

#

But I'm suspecting it's not my fault troll

ebon needle
#

nah my ps/2 driver is just find ps/2 keyboard with uacpi

ebon needle
#

@surreal path where do you find wads for doomgeneric

ebon needle
silver yarrow
#

I can send u the original one

#

🙂

cinder plinth
#

and doom shareware is free so this is legal!

edgy pilot
silver yarrow
cinder plinth
#

doom shareware is just like the first few levels

silver yarrow
#

ah

ebon needle
#

lmao

silver yarrow
#

lol

edgy pilot
cinder plinth
#

it was meant as a demo (you can order the full game via the phone number in the game)

tawdry mirage
silver yarrow
#

lmao

silver yarrow
surreal path
#

can we discuss piracy outside my thread please

edgy pilot
surreal path
#

insane

cinder plinth
#

like 5?

tawdry mirage
#

9

cinder plinth
#

damn

tawdry mirage
#

8 main levels + secret

broken depot
#

More evidence of Nyaux thread is just another #lounge-0

tawdry mirage
#

all doom 1 episodes are 9 levels long

cinder plinth
#

how do you get to the secret level

cinder plinth
tawdry mirage
surreal path
ebon needle
edgy pilot
cinder plinth
#

shareware is free

#

they literally gave it to people as a demo

surreal path
#

okay

broken depot
#

The WAD isn't covered by the shareware clause

edgy pilot
#

the link I sent is piracy though

cinder plinth
silver yarrow
#

lol

broken depot
#

The DOOM executable is shareware

surreal path
#

they'll nuke the server and id be the one to blame lol

silver yarrow
#

wont matter much when the entire discord is bye bye

cinder plinth
#

also it's literally id software, which is the most chill game company ever

edgy pilot
cinder plinth
cinder plinth
#

doom is literally open source

#

the wad (which contains the game assets like the map and sprites) is shareware

#

there are also completely FOSS wads like freedoom I think it's called?

tawdry mirage
#

freedoom yeah

cinder plinth
#

so it's not an issue

broken depot
surreal path
#

im not doing anythin rn cause

#

im at my moms

#

and im not happy

#

plus im really stressed

#

and a little burned out tbf

#

so im just taking a break today

surreal path
#

no im not taking a break today

#

because

#

i have nothing else to do

#

no matter what i do i cannot get gdb to attach relibably to any ps2 related function in qemus code

#

so not only am i cooked

#

but im double cooked

#

atp ill recompile qemu to add prints

#

and if that doesnt work idk

#

cloning qemu rn ig

surreal path
#

okay so

#

when ps2 fails on a run in qemu

here is some of the shit i printed from qemu ps2 code

[rayan@athena build]$ ./qemu-system-x86_64 -M q35 -m 1G -cdrom ../../NyauxKC/nyaux.iso 
got cmd ffffffff
reset keyboard
ps2 read val fa
ps2 read val aa
got cmd ffffffff
reset keyboard
ps2 read val fa
got cmd ffffffff
ps2 read val fa
got cmd f0
ps2 read val fa
got cmd ffffffff
ps2 read val fa
ps2 read val 1c
ps2 read val 9c
ps2 read val 11
ps2 read val 91
ps2 read val 1d
got cmd ffffffff
unknown cmd ffffffff
ps2 read val fe
#

and when shit succeds

#

succedding run

got cmd ffffffff
reset keyboard
ps2 read val fa
ps2 read val aa
got cmd ffffffff
reset keyboard
ps2 read val fa
got cmd ffffffff
ps2 read val fa
got cmd f0
ps2 read val fa
got cmd ffffffff
ps2 read val fa
ps2 read val 1c
ps2 read val 9c
ps2 read val 1c
ps2 read val 9c
got cmd ffffffff
unknown cmd ffffffff
got cmd ffffffff
reset keyboard
ps2 read val fa
ps2 read val aa
#

oaky so

#

ps2 read val 11 vs ps2 read val 1c

#

whats going on

surreal path
#

okay so

#

after this loop

#

it all dies

#

being consisent

#

@kind root you know a lot abt ps2, do u think its the order im doing things here?

kind root
#

last time i worked on ps2 was 4 years ago

#

i remmeber literally nothing

surreal path
#

oh damn

surreal path
#

i can get the issue to consisently happen if i spam the keyboard on qemu

thorn bramble
#

i could also cause issues in my kernel by spamming keyboard during boot

#

solution is simple: don't trl

surreal path
#

nah i genuinely want this to work

#

the port 1 clock was enabled the whole time in the config byte

#

i.e. destroying my shit when i read back after sending a command

#

cooking me

#

it now works now

#

tho the idenitiy shit isnt correct and differs that is to be expected tm

#

WE ARE BALLING

daring juniper
#

🎉

surreal path
#

@brisk zenith some weird shit after i added prints to the reaper thread

#

trying to debug the oom issue

#

could this be a race condition

#

idk im lost whats going on

#

ill try to debug it some more but

#

i doubt ill find anything

#

hopefully when you wake up you can check this out, maybe this bit of information may help us get closer to this bug

mossy belfry
#

it's a little confusing to say thread when you mean a physically independent processor on the topology of the CPU lol

surreal path
mossy belfry
#

oh interesting 🤔

surreal path
#

im not talking about the cpu

mossy belfry
#

how did you type on the console before this

surreal path
#

serial

mossy belfry
#

wait that's a thing

#

oh thanks for informing me

surreal path
#

yes

surreal path
#

another day more ps2 code

#

after we get this wired up we can put more focus on the oom issue

ebon needle
ebon needle
#

or nyaux is only tryhard ways kernel

surreal path
#

i use uacpi for it now

thorn bramble
#

discovering the preseence using acpi is one thing

#

actually talking to it is another thing

surreal path
#

^

silver yarrow
surreal path
#

if i oom i panic

#

thats not the issue

#

the way i handle that

#

i shouldnt be ooming in the first place

silver yarrow
#

ah

surreal path
#

i got interrupts from the ps2 keyboard and mouse now

#

cool

broken depot
#

Nice

surreal path
#

ik im ballin

surreal path
# maiden ridge W

fun fact, you can reset the whole system without even triple faulting the cpu. its called writing an unknown command to the ps2 controller ™

#

learnt that the hard way

#

or actually

#

no its an known command

#

it just

#

does somet weird electritty magic

#

smthin about a reset line

surreal path
#

can i have some??

maiden ridge
#

Real

maiden ridge
surreal path
surreal path
maiden ridge
#

Ok

surreal path
#

lets gooo

#

today i became friends with a hammer

#

i am talking to myself essentially because hammers are not sentiant

#

i am going crazy

maiden ridge
#

Ps 2

#

Oh yeah qemu mouse emulation is fucky

surreal path
maiden ridge
#

During the first 2-3 seconds qemu sends some weird fuck ass packets

surreal path
#

on boot or after resetting the mouse?

maiden ridge
#

Boot

surreal path
#

oh then im fine

#

i dont init the ps2 mouse until

#

a bit

maiden ridge
#

Still
The work around I had was ignore the mouse interrupt till a specific time period passed (usually 5 seconds)

surreal path
#

nah i should be fineee

#

nyaux aint loading in 3 seconds to ps2 mouse init

#

thats done before userspace init

#

and it takes a while for nyaux to unpack the tar

#

lol

ebon needle
#

idk how ps/2 but with usb its good

maiden ridge
#

Yeah usb it's fine

#

Ps2 is funky

surreal path
#

i think this is a good abstraction

surreal path
#

@elder shoal explain yourself

#

your only getting one byte???

#

when keys are mutiple bytes????

#

how does that work

tawdry mirage
#

it still doesn't handle whatever the key with a 6 byte scan code was

surreal path
tawdry mirage
#

this at most expects that a scan code is 2 bytes

#

but one key (print screen? idr) is like 6 bytes long

surreal path
#

yeaaa

#

and im gonna use scancode set 2

#

so

#

thats gonna cause more problems

surreal path
#

cause i actually wanna support this

#

lol

tawdry mirage
#

need a bigger state machine

surreal path
#

how so?

brisk zenith
surreal path
brisk zenith
#

hello

tawdry mirage
#

e.g. in the initial state if you see 0xf0, you go to the release state, then from there if you get another byte, e.g. 0xab (ignoring longer codes) you know that the whole sequence was 0xf0 0xab

#

repeat for all prefixes

surreal path
#

wdym by ignoring longer codes

#

also how does byte f0 mean released

tawdry mirage
#

i am omitting them from the explanation for simplicity

surreal path
#

oh right

surreal path
#

im seeing f0 means released for any key that is well

#

released

surreal path
#

lemme think cause

#

i wanna do this in a way

#

thats reasonable

#

and not shit

kind root
#

considering it doesnt work on any real hw lol

surreal path
kind root
#

welll

#

linux

#

or

#

maybe old ultra

surreal path
#

llinux sounds like pain

kind root
#

if you're familiar with the patterns they use etc its not that bad but yeahg

surreal path
#

ill try looking at it

surreal path
#

epic

kind root
#

but its c++

surreal path
#

i have c++

#

basic knowledge

kind root
#

oh ok

tawdry mirage
#

the state graph looks something like this if i didn't fuck it up

#

edges indicate an incoming byte, states remember what came before

surreal path
#

you mean the line

tawdry mirage
#

(i'm also ignoring some broken states like F0 E1 xx and E1 F0 xx)

surreal path
#

also what is "any"

tawdry mirage
#

any byte value

surreal path
#

and what is rest

tawdry mirage
#

"rest" is any byte other than those on other edges

#

so from "initial" rest is all bytes but F0, E0, E1

surreal path
surreal path
#

i dont know what edges mean here, are they the lines in the graph 😭

tawdry mirage
#

yes

surreal path
#

okay

surreal path
#

then reset the intial state

#

wait nvm

#

my brain rn

#

😭

flat nymph
surreal path
flat nymph
#

Though it's refusing to work on my laptop

#

Or like not really, but the controller doesn't give me the keyboard layout

tawdry mirage
#

i mean, if the user presses enter on the keypad the keyboard will send 0xE0 0x1C:
you start in the initial state
you get 0xE0
you move to the E0 state
you get 0x1C
you know you got the combination 0xE0 0x1C and you can decode it, and you go back to the initial state

surreal path
#

OHHHH

#

THAT MAKES SO MUCH SENSE

#

THANKS LOL

#

that sounds easy

tawdry mirage
#

actually i did fuck up the graph

surreal path
#

oh

tawdry mirage
#

there is no F0 before E0, that simplifies it :^)

#

also for E1

surreal path
#

ah oki

tawdry mirage
#

for the E1 xx state you do need to store what the xx is somewhere though

#

or you can add 256 individual states trl

surreal path
#

@kind root in Ultra you never call handle_action?

tawdry mirage
#

btw there's also another approach that might be simpler

#

instead of a state machine in the isr, in the isr just put the bytes in a queue and wake up a worker thread

#

then the worker thread just pulls bytes from the queue, and if the queue is empty it goes to sleep

surreal path
#

rando question

#

i forgor about this

#

sorry for the stupid question lol

surreal path
# tawdry mirage

also how do you know you reached the end of the scancode sequence

surreal path
#

at all

tawdry mirage
surreal path
kind root
surreal path
#

you never call it anywhere in the kernel

#

i used github search

kind root
tawdry mirage
surreal path
#

insane

surreal path
tawdry mirage
#

because E1 F0 xx F0 only has one edge leaving it

#

so it's all bytes

surreal path
#

okay let me try to get this, edge meaning transition to state, any meaning any key pressed, rest meaning decode and set state and then go back to the inital state

#

@tawdry mirage

#

is this correct?

tawdry mirage
#

any means any byte value, rest means any byte value apart from what the other edges have (so all except e.g. F0)

surreal path
#

OHHHH

#

thanks for explaining this @tawdry mirage

elder shoal
kind root
#

lol

surreal path
#

check this shit out

#

doom with input

tawdry mirage
surreal path
#

pressing one key skips 2 menu selections

tawdry mirage
#

you can change the typematic rate with some command

surreal path
#

ik

#

also qookie i have a question

#

so you know when u reenable scanning for the ps2 kbd

tawdry mirage
surreal path
#

i spam the keyboard

#

i dont get any interrupts at all

#

for some reason

surreal path
surreal path
tawdry mirage
#

oh yeah no idea

surreal path
#

fair

surreal path
#

still suffering from the no interrupt tho

mossy belfry
#

cool port bro

elder shoal
#

audio when

surreal path
#

oh yeah

#

i fixed most of the input shit

#

so you can play doom start to finish on nyaux

#

still having the funny interrupt ps2 spam bug tho

#

i mean

#

i lit am

#

im having fun

surreal path
#

fixed the issue with the interrupt shit

edgy pilot
#

ah good ol' days when doing my hobbies were fun

surreal path
#

just had to clear the data buffer

surreal path
#

im very much empty and depressed

edgy pilot
#

real

surreal path
#

only reason i do this project is cause distraction

edgy pilot
#

sadly I haven't been able to do anything recently

surreal path
#

now that ive fniished the ps2 shit and doom input

#

now i have to figure out that oom issue

#

guess ill get to work

mossy belfry
# surreal path guess ill get to work

yo rayan a bit off topic but aren't you having trouble getting girls

I was skating today and some girl asked me out (but yk I don't swing that way) how can I setup a DNS or whatever and redirect their attraction to u 🙏🙏🙏

maiden ridge
maiden ridge
#

Also Linus Torvalds is in the diddy files

surreal path
#

qhat??????????/#

surreal path
maiden ridge
surreal path
#

real

maiden ridge
#

Linus Torvalds was at the diddy party

surreal path
#

i cook and leave no crumbs

magic kernel
#

Nice work on doom

#

And I saw something about init systems way back

surreal path
#

thanks

magic kernel
#

Necroposting

#

But

#

Systemd or ban right meme

surreal path
surreal path
magic kernel
#

Oh the init system comment is old idk how old but old

#

Responding to old shit is also called necroposting

surreal path
#

fair

magic kernel
#

But yeah systemd

#

Or ban

#

Ezpz

surreal path
#

true

#

😭

magic kernel
#

(Unless no Linux interfaces planned and/or desired, then idk InitWare? Sysvinit? Openrc?)

surreal path
#

nah we def doing systemd

magic kernel
#

Aight

#

We ball

thorn bramble
#

ah yes nyaux netlink, cgroups, proc and sysfs

#

coming right up

surreal path
#

real

magic kernel
#

No time limit

#

So take your time

#

And cgroups can be stubbed to fuck lol

#

Look at Managarm, it does fuck all

#

Just does some hardcoded files and makes some directories

#

And identifies as cgroupv2 to please fstatat and friends

#

Honestly looked like the biggest painpoint but was in the end not too much work to get systemd to work with it

surreal path
#

fair

#

whats the biggest painpoint with system

#

what interface is the worsed

magic kernel
#

The details from dev and sysfs are meh (mostly udev related)
Netlink isn’t nice per se
I’d say epoll, timerfd, inotify, signalfd aren’t too bad

#

But there’s Managarm source code as a reference nowadays

#

Better than Linux only

surreal path
#

ah oki i see

surreal path
#

ok BEFORE we spend weeks trying to debug the oom issue only for @brisk zenith to find it in 10 minutes lemme hook up the ps2 keyboard to the fuckin tty

silver yarrow
#

lmao

surreal path
#

i mean

#

its true

#

that guy is a fuckin 20000 iq genius holy shit

#

default discord pfps are either the most intelligent people on earth or some 9 year old brainlet

#

its never in between

#

i swear

surreal path
#

ok i got input working with the tty

#

now heres a problem we encounter

#

doom wants to use the ps2 keyboard but the fuckin tty is already using it

#

because the ps2 keyboard uses a ring buffer

#

the tty gets the packet

#

and doom gets none

#

the tty

#

looking like

#

that but the doomgeneric program is just crying

ebon needle
supple robin
#

terrible advice

mossy belfry
#

in true unix fashion

surreal path
#

ok idea

#

after reading linux source code and thinking for a straight minute what we could do is have a subscriber system, everytime the keyboard writes a packet to the device file its "broadcasted" to every subscriber in some kind of list. each subscriber could have its own ring buf and whenever read is called it checks its fd handle data field for any subscriber ptr then reads from the subscriber ptr's buf and gives it to the read syscall

the only problem with this approach is that i need to fuckin implement vfs op open for the kernel nooo nyaux does not have fds for kernel code yet, like userspace can get fds and eat it and chew it and swallow it but kernel code gets no water like africa so i need to have some vfs op

#

this is probs a day effort ™

mossy belfry
#

you can just have the fd represent an index in an array of vnodes, no?

#

what is harpenin

mossy belfry
#

😢

rigid fable
#

Thats a gem

thorn bramble
#

your choice

worldly condor
#

open files have extra info

#

e.g. whether it is for read or write

thorn bramble
#

oh LMAO i did not even fucking read it properly

worldly condor
#

and the current position in the file

thorn bramble
#

that's INSANEEEE

#

WAHT IS THIS GUY SAYINGGG G

#

AHAHUFASUOIJLKGDS

mossy belfry
#

silly and whimsical suggestion

worldly condor
#

that's barely a step up compared to another proposal I've seen

worldly condor
mossy belfry
mossy belfry
#

idk why does it make a char array

bleak cedar
#

it's a local variable name

mossy belfry
#

oh oops

worldly condor
#

this diagram from Wikipedia sorta shows how it's supposed to work

surreal path
#

^

bleak cedar
worldly condor
#

substitute inode by vnode on modern OSes

#

cuz

#

confusingly

#

in ancient UNIX, there was the familiar on-disk inode as a file system structure

#

and the in-core inode, which is what one would now call a vnode

#

or like

#

the file system-specific struct

#

cuz uh ... UNIX used to hard code support for only one file system

#

and VFS was added later to accomodate network file systems, FAT12 for floppy disks, etc ...

mossy belfry
#

wait so are open and close here just to create resource locks on nodes so we don't have like a bunch of requests trying to run at the same time or what

#

I never got around to doing those properly

surreal path
#

wtf is a resource lock 1. and 2. thats not how it works. open creates a fd handle, gives you that fd and whenever you wanna do shit you use ur fd to get the fd handle to which u do ur shit

bleak cedar
#

Ok I got a silly idea
Don't take it seriously
The three most insignificant bits of the fd could specify if it's

  • readable
  • writable
  • executable

like
bit interpretation [actual file descriptor number | executable | writable | readable ]
bit number [31 .. 3| 2 | 1 | 0 ]

remember, this is only satirical

mossy belfry
surreal path
mossy belfry
#

lockless nyaux 😲😲😲

#

omg

#

peak codebase I will try to read it now

surreal path
#

i dont do locks where i should do, whenever i get around to implementing fuckin load balancing ill figure it out

mossy belfry
#

so if core A and core B wanna access the same thing you just let the race condition happen

#

understandable

surreal path
#

yes because all shit is running on core A rn

#

because no load balancing

bleak cedar
#

Gummi when a there's unfinished stuff in the development of an OS on a discord called Operating System Development

mossy belfry
#

uniprocessor multicore

mossy belfry
surreal path
#

at least for qemu

#

real hw tho is a different story....

mossy belfry
#

I think I might already have this

surreal path
#

also @elder shoal i dont remember correctly but the way you inited the ps2 controller didnt seem correct? im not sure

surreal path
mossy belfry
surreal path
#

IT IS WHAT ARE U ON ABOUT

#

😭

mossy belfry
#

what is bad about it

surreal path
#

bro...

#

literarly everything

mossy belfry
#

hmm ok I already had a macro to do this

#

this was older code ig I'll use that

surreal path
#

all it does is replacing the return of the function with iretq

#

which is retarded

mossy belfry
#

"we have attribute interrupt at home"

surreal path
#

you need to save context

surreal path
#

remove that on all your interrupt handlers please

bleak cedar
mossy belfry
#

I think

#

idk I fogot

surreal path
#

remove it everywhere

#

do a fucking rg "attribute((interrupt))"

mossy belfry
#

whatever

#

I'll remove it all

bleak cedar
#

Context switches when @surreal path switches her gender:

surreal path
ebon needle
#

@surreal path dont i know something about you 🤔🤔🤔

surreal path
#

IM NOT TRANS

#

😭

mossy belfry
#

famous last words

mossy belfry
mossy belfry
# surreal path wtf is a resource lock 1. and 2. thats not how it works. open creates a fd handl...

I think I now rember how fd works

int sys_open(const char *path, uint32_t flags) {
    struct vfs_node *node = vfs_lookup(path);
    if (!node)
        return -ENOENT;

    if (node->ops && node->ops->open) {
        enum errno err = node->ops->open(node, flags);
        if (err != E_OK)
            return -err;
    }

    struct file *f = kmalloc(sizeof(struct file));
    f->node = node;
    f->flags = flags;
    f->offset = 0;
    f->read = node->ops->read;
    f->write = node->ops->write;
    f->close = node->ops->close;
    f->private_data = NULL;

    int fd = find_free_fd(current_process);
    if (fd < 0)
        return -EMFILE;

    current_process->fd_table[fd] = f;
    return fd;
}```
#

or something idk

#

whatever 💥

surreal path
#

ish

#

ishhhh

#

theres a lot of things it shouldnt do tho

worldly condor
mossy belfry
surreal path
#

im playing factorio ill tell u in a bit

elder shoal
surreal path
#

now i have 3 BUGS

#

3 HEISEN BUGS

mossy belfry
#

shockingly few

surreal path
#

oom issue + cat somehow locking up the whole system if i spam any ps2 key hard enough and its EXTREMELY difficult to trigger which makes it even worse + load elf somehow getting an error attempting to read the elf into memory

surreal path
#

because they are so hard to trigger

#

why cant i write code thats decent

#

why.

silver yarrow
#

relatable

errant mantle
#

just use rust /j

nova fox
silver yarrow
#

rust wouldn't really solve most of the bugs I encounter

surreal path
#

im getting gpt to write a script to use the QEMU qmp protocol to spam text into the guest

#

then it will be possible to trigger this

surreal path
#

okay i can now get the cat /dev/keyboard bug to happen everytime

#

thanks to the script ™

surreal path
#

cat is closing stdout

#

wtf

#

somehow keyboard interrupt isnt firing anymore

#

lets check rflasg

#

ITS A DEADLOCK

#

YOO LETS FUCKING GO I FOUND THIS BUG

#

ITS DEADLOCKING SOMEWHERE

edgy pilot
#

my brain deadlocked

#

isn't that what clinical depression is

surreal path
#

yea real

edgy pilot
#

I need to wake up in less than 3 hours

surreal path
#

it deadlocks with the memory lock

#

????

#

wtf

surreal path
#

thanks to JW we can do this shit to debug our deadlock

#

i would do that but

#

im tired rn

#

maybe later

mossy belfry
#

did you fix it 😲😲😲

surreal path
#

no

#

i just know which lock it dies on

thorn bramble
#

@surreal path

#

in the ps2 keyboard interrupt

#

you are supposed to read all bytes the keyboard has queued up

#

not just one

#

the controller won't fire another interrupt until you have read everything

#

which would explain why it dies when you spam it

surreal path
#

?

thorn bramble
#

honestly idk

surreal path
#

also

#

that wouldnt explain why it deadlocks the memory lock

#

if this is the cause

thorn bramble
#

u said u don't get interrupts

surreal path
#

yea i just deadlock in the mem lock

thorn bramble
#

that's not a reason to not get interrupts

#

unless you disable them

surreal path
#

yea tbf

thorn bramble
#

idk what a mem lock is lol

surreal path
#

its a lock around the kmalloc and kfree functions

thorn bramble
#

ok

surreal path
#

yea pretty much

thorn bramble
#

idk i still think you should read bytes until you can't

#

the apic can only buffer one interrupt

#

so if you press a key and you get an irq

#

then you press another key before you eoi

#

that will generate an interrupt

#

which will be delivered after you eoi

surreal path
#

and that gets buffered with the apic?

#

ah i see

#

okay

thorn bramble
#

but if you press two keys before you send an eoi

surreal path
#

thats probs why then

thorn bramble
#

you lose one interrupt

#

so you have two bytes in the buffer

#

but only one irq

surreal path
#

yea i see

brisk zenith
#

also if you happen to press two keys within a single irq critical section you'll only get one irq at the end of the critical section

#

so reading until the hardware says there's no more to read is important

thorn bramble
#

wow first actually good advice coming from me, that's crazy

#

time to get back to my kernel

surreal path