#Nyaux
1 messages · Page 60 of 1
real
is this live footage of Astral uACPI AML parsing speed
@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
I did not
so i guess i should just skip this step ?
by the lack of response im guessing so lol
all good, infy says to use PNP so thats what im doing lol
If you're using a laptop it will have a ps2 keyboard, on PCs you won't get any emulation because you enable acpi mode
oh

my laptop has a usb keyboard
screwed
U sure?
yep
How
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
The internal keyboard is wired via USB?
yep
What the fuck
yea this laptop is cursed
Which model is this
acer predator triton PT14-51
least fucked laptop hardware
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
I don't recommend leaving that flag on tho
No idea why they decided to route it like that lmao
WHY CANT IT FIND THE FUNCTION
i did the cplusplus guard in my header file
its trolling me
you need to mark it as extern “C” in the source file
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
just write a simple usb controller driver
go away
i got usb hid boot protocol, msd and cdc ncm in like 1 day
oooh awesome what controller did you use
generic xhci

insane
robot may need to
quit factorio
anyways mornin
i fell asleep writing ps2 code
which is insane

nyaux is really behind in a lot of things

other new hobby oses are surpassing us

You're still surpassing me atm :P
It used to be true that I had more stuff but I think you've either already passed me or are about to.
how??
doesnt badger os have signals and shit
and pipes
nyaux has none of that
wow they have signals and u don't, it must mean they are ahead
Nyaux, my good friend.
can badgeros run doom tho?
You have DOOM running in userspace.
Absolutely not.
thats piss easy tho
its just some fuckin fbdev shit
i dont even have input for doom yet
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.
All testing I've been doing is either in-kernel, or a tiny app directly invoking syscalls.
i see
It doesn't even support fork or exec
oh damn
Only a weird kind of spawn function not compatible with posix_spawn.
i see
You've been working actively on Nyaux where I've been doing other projects.
very slowly tho tm
Processes are created by the syscall pcreate, which is incompatible with posix_spawn
So I'll be converting that into posix_spawn compatible first, I can deal with fork and exec later.
Ah
ilobilix doesn't even have mmap
what are you on nyaux
my scheduler is shit bro
anyway, monkuous can fast forward your kernel
and somehow nyaux has a fuckin oom issue after executing doomgeneric mutiple times
wha
real though
nahh
@\monkuous pls write my kernel kthx
epic escape fail
monkuous make weston run on nyaux real
if you try to escape the @ it will show the <@ numbers> + it will still ping
i prefer @\ over @<space> :^)
good job
so doing 2 slashes
Pretty sure you can \ @
yeah obviously
cooked
@thorn bramble
its not supposed to ping
Ah
and that did ping me
Bruh
@ iretq
You used to be able to
@\iretq
im going to my moms today at 7pm
@iretq
after not seeing her for 4 months
yooo zwsp trolled
lmao
unlucky
shes still my mom
👎
true but wrong server
trolling

why thumbs down
your gonna tell me she adopted me?
fair
i stop talking to people that annoy me
i usually shut them out of everything
i've only had to do that once
i did this with my mom but like i still love her even if shes awful
why not to use trial subscription
because no
If you are a girl then it's easy
my strategy is to out-annoy them so they do that to me
This
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
real
Not necessarily
I don't have signals
it doesnt
insane
what
most useful nyaux convo
yes
why your embed keyboard is usb
when nyaux ace of penguins port
as in basketball or as in you have no AC and have to wait all day to do any work because it is hot
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
will nyaux support multiplexed ps/2 and synaptics touchpads
what is multiplexed ps2
ps2 with up to 4 devices
laptops sometimes have 3 devices: keyboard, touchpad, and the joystick mouse
wel yours is fucked
tho i have a spare laptop here
but normal ones do
it has a touchpad
"normal ones"
and keyboard
the specs are pretty simple
lolololo
probs ps2
can i see them?
epic
those are going into my stash
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)
Touchpad usually goes over smbus?
its exposed via both usually
what are you supposed to do if you have drivers for both?
pick one
but like how do you know that those are not two different devices?
ACPI would tell you?
probably
i2c ❤️
i never had an i2c driver so
spec, documentation, linux code
all the same word
I think I'll finally write the init server, then I'll do smbus
that little red nub?
ye
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
just read the datasheet
theres a datasheet?
yes
where
insane
too similar
😭
sky
@flat nymph are you my brother
Also bottom of osdev wiki
gamer
lets fucking go
the cutoff part says its a mouse
so port 1 has a mouse lol
at least for qemu
do u use acpi to discover ps/2?
ah
so um
mint told me port 1 should be a kbd
but its reporting as mouse


i want to cry

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
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
The laptop does emulate ps2
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
maybe its routed both via ps2 and usb
yo iretq
and the usb one is favoured
i just woke up
fair
its so cold
how
its summer bro
ive been awake
all night
banging my head againist this stupid fucking little chip
who wont listen to me
i have never written a ps2 driver before so
i know
im just letting you know the pain im in rn
fucking xhci would be easier then this shit atp
With how painful this sounds, it may just be better to pretend ps2 doesn't exist lol
fair
the third message got sent after I said fair XD
fair to the first two parts
it's really easy
im not doing it
not rn
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
If the os offers a usb driver it's used
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
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 
nah my ps/2 driver is just find ps/2 keyboard with uacpi
@surreal path where do you find wads for doomgeneric
i dont finding them 😭
"doom wads"
and doom shareware is free so this is legal!
https://archive.org/details/theultimatedoom_doom2_doom.wad
this was the first result on google
well there is that one that isnt I think?
doom shareware is just like the first few levels
ah
i was getting some random russian sites
lmao
lol
get a better country
it was meant as a demo (you can order the full game via the phone number in the game)
it's the first episode
lmao
is that phone number still active
can we discuss piracy outside my thread please
🏴☠️ 🏴☠️ 🏴☠️ 🏴☠️ 🏴☠️
insane
9
damn
8 main levels + secret
More evidence of Nyaux thread is just another #lounge-0
all doom 1 episodes are 9 levels long
how do you get to the secret level
I forgot you were a doom nerd
secret exit in e1m3 (or m4?)
yea lmao, i mean i dont mind but like piracy in my thread is a bit much. for reasons of discord TOS
nyaux thread needs to become to darknet
this isnt piracy
it's not piracy if it's shareware
okay
doom is free
The WAD isn't covered by the shareware clause
the link I sent is piracy though
probably, there were also addresses and stuff idk
they aint gonna delete one thread
lol
The DOOM executable is shareware
they'll nuke the server and id be the one to blame lol
wont matter much when the entire discord is bye bye
also it's literally id software, which is the most chill game company ever
there's shareware wad
no
nah uh
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?
freedoom yeah
so it's not an issue
I would like to inform whomever reacted to this message that that is not the USA flag
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
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
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
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?
i can get the issue to consisently happen if i spam the keyboard on qemu
i could also cause issues in my kernel by spamming keyboard during boot
solution is simple: don't 
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
🎉
@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
by thread here you mean core right
it's a little confusing to say thread when you mean a physically independent processor on the topology of the CPU lol
no i mean thread
oh interesting 🤔
im not talking about the cpu
how did you type on the console before this
serial
yes
another day more ps2 code
after we get this wired up we can put more focus on the oom issue

isn't finding ps/2 devices with uacpi is easier than ps/2 driver
i use uacpi for it now
discovering the preseence using acpi is one thing
actually talking to it is another thing
^
are u going to do proper oom handling
no, i need to figure out the oom issue
if i oom i panic
thats not the issue
the way i handle that
i shouldnt be ooming in the first place
ah
Nice
ik im ballin
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

Ok but I made garlic bread
Real
No

Ok
lets gooo

today i became friends with a hammer
i am talking to myself essentially because hammers are not sentiant
i am going crazy
how so
During the first 2-3 seconds qemu sends some weird fuck ass packets
on boot or after resetting the mouse?
Boot
Still
The work around I had was ignore the mouse interrupt till a specific time period passed (usually 5 seconds)
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
no
idk how ps/2 but with usb its good
i think this is a good abstraction
@elder shoal explain yourself
your only getting one byte???
when keys are mutiple bytes????
how does that work
if the first byte is 0xE0 it sets a flag and bails out early at the top of the isr
it still doesn't handle whatever the key with a 6 byte scan code was
oh lol
then it gets another interrupt for the rest of the bytes?
wdym
this at most expects that a scan code is 2 bytes
but one key (print screen? idr) is like 6 bytes long
how could i get around this exactly
cause i actually wanna support this
lol
need a bigger state machine
how so?
in set 2 there's even an 8 byte one
yea pretty much also hiii!!!
hello
to keep track what bytes you've seen before in longer scan codes
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
i am omitting them from the explanation for simplicity
oh right
yea wait
im seeing f0 means released for any key that is well
released
wait how would this state machine look like?
lemme think cause
i wanna do this in a way
thats reasonable
and not shit
i wouldnt look at astrals code for ps2 lol
considering it doesnt work on any real hw lol
what would i look at
llinux sounds like pain
if you're familiar with the patterns they use etc its not that bad but yeahg
ill try looking at it
epic
but its c++
oh ok
the state graph looks something like this if i didn't fuck it up
edges indicate an incoming byte, states remember what came before
you mean the line
(i'm also ignoring some broken states like F0 E1 xx and E1 F0 xx)
also what is "any"
any byte value
and what is rest
"rest" is any byte other than those on other edges
so from "initial" rest is all bytes but F0, E0, E1
edge meaning incoming byte?
i dont know what edges mean here, are they the lines in the graph 😭
yes
okay
meaning if it got another 0xE0
then reset the intial state
wait nvm

my brain rn
😭
my PS/2 code is semi-ok 
And it's C
i read c++ too
Though it's refusing to work on my laptop
Or like not really, but the controller doesn't give me the keyboard layout
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
actually i did fuck up the graph
oh
ah oki
for the E1 xx state you do need to store what the xx is somewhere though
or you can add 256 individual states 
@kind root in Ultra you never call handle_action?
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
then you can just do what we do in managarm (except we do it with coroutines instead of threads): https://github.com/managarm/managarm/blob/master/drivers/kbd/src/main.cpp#L917-L963
is there a difference between a blocked and sleeping thread actually
rando question
i forgor about this
sorry for the stupid question lol
also how do you know you reached the end of the scancode sequence
all edges that go back to "initial" are final bytes
makes sense
what are we talking about
handle_action in your ps2keyboard.cpp
you never call it anywhere in the kernel
i used github search
Kernel/Drivers/PS2/PS2Device.h: bool handle_irq(RegisterState&) override { return handle_action(); }

insane
why is any not called rest for E1 F0 xx F0 state
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?
any means any byte value, rest means any byte value apart from what the other edges have (so all except e.g. F0)
no you should that way I wont feel bad about being the only os with shit ps2 code
lol
key repeat is because ps/2 keyboards do that on their own
pressing one key skips 2 menu selections
you can change the typematic rate with some command
ik
also qookie i have a question
so you know when u reenable scanning for the ps2 kbd
ah
even tho i have it set in the config byte not to send interrupts and to retry reenabling scanning if i didnt get an ACK, so basically if
i spam the keyboard
i dont get any interrupts at all
for some reason
yea pretty much
id assume you dont know whats going on from the lack of response
oh yeah no idea
solved by adding releaese key functionality
still suffering from the no interrupt tho
audio when
thats crazy
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
fixed the issue with the interrupt shit
ah good ol' days when doing my hobbies were fun
just had to clear the data buffer
im joking when im saying im having fun
im very much empty and depressed
real
only reason i do this project is cause distraction
sadly I haven't been able to do anything recently
now that ive fniished the ps2 shit and doom input
now i have to figure out that oom issue

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 🙏🙏🙏
Now give this iso to that one friend who will play a complete game of doom
real
Also Linus Torvalds is in the diddy files
qhat??????????/#
proof??
It was revealed to me when I was hyperactive
real
Linus Torvalds was at the diddy party
i cook and leave no crumbs
thanks

?
Oh the init system comment is old idk how old but old
Responding to old shit is also called necroposting
fair
(Unless no Linux interfaces planned and/or desired, then idk InitWare? Sysvinit? Openrc?)
nah we def doing systemd
real
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
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
ah oki i see
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
lmao
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
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
i just sending keycodes to all pipes which requested input from ps/2 keyboard
terrible advice
in true unix fashion
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
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 ™
I did almost the most
wait wdym vfs open op
you can just have the fd represent an index in an array of vnodes, no?
what is harpenin
no thats retarded
😢
Thats a gem
or you can do it properly
your choice
you can have multiple open files for the same vnode
open files have extra info
e.g. whether it is for read or write
oh LMAO i did not even fucking read it properly
and the current position in the file
silly and whimsical suggestion
that's barely a step up compared to another proposal I've seen
same person who made this pr btw
https://github.com/rayanmargham/NyauxKC/pull/10
namely open returning the on-disk directory index
yes I'm very professional and definitely remembered how that macro worked
it's not a macro
idk why does it make a char array
it's a local variable name
oh oops
this diagram from Wikipedia sorta shows how it's supposed to work
^
because the C Preprocessor doesn't know anything about the semantics of C including what function names are, it's basically just text substitution
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 ...
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
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
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
how are u doing smp things without resource locks
okay so um heres the thing
i dont do locks where i should do, whenever i get around to implementing fuckin load balancing ill figure it out
so if core A and core B wanna access the same thing you just let the race condition happen
understandable
Gummi when a there's unfinished stuff in the development of an OS on a discord called Operating System Development
uniprocessor multicore
real
real
since you have had firsthand experience would you say PS2 KB is hard
no i say i was being retarded and its really fucking easy
at least for qemu
real hw tho is a different story....
I think I might already have this
also @elder shoal i dont remember correctly but the way you inited the ps2 controller didnt seem correct? im not sure
ts is not that bad vro 🥀
what is bad about it
"we have attribute interrupt at home"
you need to save context
yea ur def fucking ur stack because u have attribute interrupt and ur also doing this
remove that on all your interrupt handlers please
@thorn bramble mentioned
it was only that one 🧀
I think
idk I fogot
hey wait a minute I don't think this is the case I remember it pushes callee saved registers
whatever
I'll remove it all
Context switches when @surreal path switches her gender:

wdym her
@surreal path dont i know something about you 🤔🤔🤔
famous last words
"cisgender rhymes with misgender" ahh statement
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 💥
that looks kinda correct
ish
ishhhh
theres a lot of things it shouldnt do tho
famous last words
wdym
im playing factorio ill tell u in a bit
I have not touched my ps2 code in over 6 months
fair
shockingly few
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
3 fuckin bugs that are so hard to debug
because they are so hard to trigger
why cant i write code thats decent
why.
relatable
just use rust /j
lmao i love the /j
rust wouldn't really solve most of the bugs I encounter
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
okay i can now get the cat /dev/keyboard bug to happen everytime
thanks to the script ™
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
yea real
I need to wake up in less than 3 hours
thanks to JW we can do this shit to debug our deadlock
i would do that but
im tired rn
maybe later
did you fix it 😲😲😲
@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
but shouldnt i get one interrupt per byte???
?
honestly idk
yea it should be one interrupt per byte?
also
that wouldnt explain why it deadlocks the memory lock
if this is the cause
u said u don't get interrupts
yea i just deadlock in the mem lock
yea tbf
idk what a mem lock is lol
its a lock around the kmalloc and kfree functions
ok
yea pretty much
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
but if you press two keys before you send an eoi
thats probs why then
yea i see
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
wow first actually good advice coming from me, that's crazy
time to get back to my kernel
nah you have tons of good advice
makes sense






