klange changed the topic of #osdev to: Operating System Development || Don't ask to ask---just ask! || For 3+ LoC, use a pastebin (for example https://gist.github.com/) || Stats + Old logs: http://osdev-logs.qzx.com New Logs: https://libera.irclog.whitequark.org/osdev || Visit https://wiki.osdev.org and https://forum.osdev.org || Books: https://wiki.osdev.org/Books
<kof673> why do you need a new motherboard? or what is slow?
SGautam has quit [Quit: Connection closed for inactivity]
zxrom has quit [Quit: Leaving]
spareproject has quit [Remote host closed the connection]
netbsduser has quit [Ping timeout: 268 seconds]
Yoofie has joined #osdev
<geist> it’s not too bad
Gooberpatrol66 has quit [Remote host closed the connection]
voidah has joined #osdev
navi has quit [Ping timeout: 252 seconds]
Arthuria has joined #osdev
Arthuria has quit [Killed (NickServ (GHOST command used by Guest684531))]
Arthuria has joined #osdev
gbowne1 has quit [Remote host closed the connection]
gbowne1 has joined #osdev
<mcrod> kof673: memory training leading to 20 minute POSTs
<heat> why are you memory training so often?
<kof673> didn't mean to be nosy, just was wondering if it was a particular app
<Ermine> maybe flash died
duckworld has quit [Server closed connection]
duckworld has joined #osdev
vdamewood has joined #osdev
gog has quit [Ping timeout: 240 seconds]
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #osdev
srjek has quit [Ping timeout: 256 seconds]
m3a has quit [Ping timeout: 252 seconds]
Affliction has quit [Server closed connection]
Affliction has joined #osdev
vdamewood has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Arthuria has quit [Ping timeout: 246 seconds]
eck has quit [Quit: PIRCH98:WIN 95/98/WIN NT:1.0 (build 1.0.1.1190)]
eck has joined #osdev
MrCryo has joined #osdev
xenos1984 has quit [Read error: Connection reset by peer]
gildasio has quit [Ping timeout: 260 seconds]
xenos1984 has joined #osdev
gildasio has joined #osdev
GeDaMo has joined #osdev
node1 has joined #osdev
gbowne1 has quit [Remote host closed the connection]
gbowne1 has joined #osdev
gbowne1 has quit [Read error: Connection reset by peer]
zxrom has joined #osdev
zxrom has quit [Quit: Leaving]
zxrom has joined #osdev
<ddevault> here we go again
<ddevault> no serial IRQs for you, Drew
<ddevault> I remember banging my head against this problem the last time I did an interrupt-driven serial port driver
Left_Turn has joined #osdev
node1 has quit [Quit: Client closed]
<ddevault> ah, in this case it's a different problem from last time
<ddevault> I tried to configure interrupts for it before initializing the PIC (since the very first thing my system does on boot is set up a working serial console)
gog has joined #osdev
pog has joined #osdev
gog has quit [Ping timeout: 268 seconds]
<nikolar> That ought to make it easier
<ddevault> backspace doesn't work, I forgot how this works
<ddevault> I know it doesn't just send \b
<nikolar> ¯⁠\⁠_⁠(⁠ツ⁠)⁠_⁠/⁠¯
<ddevault> lol
<ddevault> got it
<ddevault> it sends \x7f
<nikolar> Ah lol
<bslsk05> ​lore.kernel.org: [PATCH] tmpfs: don't interrupt fallocate with EINTR
<mjg> lol
<kazinsal> ddevault: yeah, a lot of terminal emulators send \x7f instead of ^H for backspace by default, even over SSH. best to handle both.
<kazinsal> eg. this is PuTTY's default control sequence setup https://usercontent.irccloud-cdn.com/file/FMReEnGw/image.png
<ddevault> ty k4m1
kazinsal has quit [Quit: Updating details, brb]
kazinsal has joined #osdev
<kazinsal> (note to self: editing certain sections of your irccloud profile forcibly reconnects you to all servers...
tanto has quit [Quit: Adios]
vancz has quit []
pie_ has quit []
tanto has joined #osdev
vancz has joined #osdev
pie_ has joined #osdev
<nikolapdp> heh
<nikolapdp> ddevault that's just console over serial right
<kazinsal> fun fact: the DEL character was originally punched in by a paper tape punch key labeled RUB OUT
<kazinsal> this got transferred to the Teletype Model 33 which is why it's a valid equivalent to \b
<ddevault> nikolapdp: yeah
zy_ is now known as zy
pog has quit [Remote host closed the connection]
pog has joined #osdev
pog has quit [Remote host closed the connection]
pog has joined #osdev
<mjg> does rust recommend yoda style comparisons?
<mjg> :asking:tough:stuff:
<kazinsal> rust recommends making up new shit to cause the ecosystem to be even more impenetrable to the people who it's ostensibly targeted for
<mjg> maybe there is a crate for if statements
<nikolapdp> what are yoda style comparison
<nikolapdp> *comparisons
<kazinsal> I'd assume do {} vs. do not {}
<GeDaMo> 1 == a
<GeDaMo> In case you typo or thinko 1 = a
<mjg> ye except this does not seem to be of practial use
<GeDaMo> That's never stopped programmers before! :P
<mjg> word
<mjg> i mean in c with any tooling dated past the end of WW2
<mjg> this plausibly is a great idea in a shite like js
<kazinsal> man copyright lawyers attached to the estates of psychotic weirdos suck
<nikolapdp> lawyers suck
<nikolapdp> there fixed it
<kazinsal> I cannot for the life of me find a good full version of the rant that Kevin Smith did about his attempt at doing a documentary with noted weido Prince
<mjg> heh, so i just checked it out over at https://playcode.io/javascript
<bslsk05> ​playcode.io: JavaScript Playground
<kazinsal> because even beyond the fucking grave Prince's lawyers are an insane power cult
<kazinsal> despite me personally remembering within a 10 cm accuracy of where I was when I heard that Prince died
<mjg> it fails to warn
<dostoyevsky2> Is Linux still a monolithic kernel when you see all these kernel proceses in the ps output?
<dostoyevsky2> *kernel threads even
<kazinsal> kthreads are just other threads on (optionally) other cores running in the same global address space as the core kernel, so, yes
<bslsk05> ​www.youtube.com: An Evening With Kevin Smith Pt 1 - YouTube
<dostoyevsky2> > Aren't microkernels slow? Microkernels do have some performance disadvantages over monolithic kernels. managarm tries to mitigate some of those issues by providing good abstractions
<dostoyevsky2> And yet when you use a userland TCP/IP stack on Linux it's much faster
<kazinsal> GeDaMo: unfortunately the nightmare legion that is Prince's lawyers from beyond the grave copyright striked all the Prince parts
<GeDaMo> :/
<kazinsal> man was an absolute psycho in life, his lawyers ensure his psychoticness in death
<mjg> a javascript linter does warn tho
heat has quit [Ping timeout: 255 seconds]
<GeDaMo> kazinsal: you may have to resort to flying the skull and crossbones to find a full version
<kazinsal> yeah I'm gonna need to find a whole ass copy of An Evening With part 1
<kazinsal> I've got 2 and 3, just not 1 after a catastrophic RAID failure
<kazinsal> which sucks because the Prince bit is the best part of 1
<pog> i think his experience with the recording industry turned him into a control freak wrt his IP
<kazinsal> doesn't help that he was a Jehovah's Witness, one of the most insane levels of "mainstream" weirdo gutter christ in the west
<pog> that's the weirdest part to me
<kazinsal> it's baffling that the guy who wrote Darling Nikki could also be a friggin JW
<kazinsal> possibly one of the horniest songs ever committed to tape
zxrom has quit [Ping timeout: 260 seconds]
srjek has joined #osdev
<pog> ohhh he converted in 2001
<kazinsal> huh
<kazinsal> interesting, because he'd been jesusy since the 80s
<dostoyevsky2> I guess when you are world-famous something cult-like becomes the only way you can stODODODODODODODODill meet people like a normal person
<kazinsal> there's some backmasking on When Doves Cry that's all about the coming of the lord
<kazinsal> which is doubly interesting because that's one of the first radio pop hits with no bass track
heat has joined #osdev
srjek has quit [Ping timeout: 255 seconds]
netbsduser has joined #osdev
zxrom has joined #osdev
npc has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
navi has joined #osdev
edr has joined #osdev
<ddevault> phew
<ddevault> ttys and framebuffers refactored
<ddevault> now I can port doom
<ddevault> and it should be easier to implement proper terminal emulation too
<ddevault> totally split up the pre-MMU framebuffer console from the post-MMU vt code
<ddevault> much cleaner
<nikolapdp> huh nice
<nikolapdp> knew it was going to be relatively simple
heat has quit [Remote host closed the connection]
heat has joined #osdev
<ddevault> I mean, it took like 4 hours
MrCryo_ has joined #osdev
Arthuria has joined #osdev
MrCryo has quit [Ping timeout: 255 seconds]
MrCryo_ is now known as MrCryo
<nikolapdp> oh well
MrCryo has quit [Ping timeout: 268 seconds]
wlemuel has joined #osdev
node1 has joined #osdev
npc has quit [Remote host closed the connection]
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
MrCryo has joined #osdev
sprock has quit [Ping timeout: 268 seconds]
sprock has joined #osdev
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
node1 has quit [Quit: Client closed]
<bslsk05> ​git.sr.ht: ~sircmpwn/bunnix: sys: implement termios basics - sourcehut git
<nikolapdp> nice
voidah has quit [Ping timeout: 272 seconds]
sbalmos has quit [Quit: WeeChat 4.2.2]
<sortie> You were scared of termios mere days ago
<sortie> At this rate we need to shut down international travel to contain ddevault
<ddevault> well I needed to do ioctls and wanted to do a couple of standard ioctls before implementing custom ones (for framebuffer)
Arthuria has quit [Ping timeout: 268 seconds]
<nikolapdp> i imagine that fb is basically, check if you can use it, mmap
<ddevault> need width/height/stride/pixel format too
<nikolapdp> ah yea
<bslsk05> ​github.com: mini-rv32ima/fbdoom-overlay/i_video_fbdev.c at nix · cleverca22/mini-rv32ima · GitHub
<clever> nikolapdp: this tells you how many bits are used for red/green/blue/alpha, and what bit offset each of them are at
<nikolapdp> i know
<nikolapdp> it just needs to be written :)
heat_ has quit [Remote host closed the connection]
<sortie> A real framebuffer gets complicated too, like you need to specify which display, which offset in the video memory, additional margins, and lots of more meta information
heat_ has joined #osdev
<nikolapdp> i don't think ddevault is going to be dealing with multiple displays any time soon
<ddevault> nah
<clever> ive been dealing with simple-framebuffer in linux mostly, so i havent had to deal with all of that
<nikolapdp> ddevault: you can just hardcode display id = 0 or whatever
<nikolapdp> so you can potentially add support at some point without breaking everything
<heat_> ddevault, my condolences
<heat_> have fun implementing job control!
<heat_> the best part about tty job control is
sbalmos has joined #osdev
<kof673> <carrier lost>
pog has quit [Quit: Konversation terminated!]
TkTech has joined #osdev
gsekulski has joined #osdev
<nikolapdp> that was fast
<nikolapdp> congrats :)
<ddevault> still needs a lot of work
<kazinsal> you will be a proper unix when I can match my episode 1 speedrun under bunnix
<nikolapdp> what's the time
<kazinsal> not great lmao
<nikolapdp> lol
<ddevault> derp
<kazinsal> I'm an "enjoy doom" type and not a TAS type
<ddevault> I just realized I need nonblocking access to the keyboard device
<ddevault> and... O_NONBLOCK is not trivially added to my kernel design
<nikolapdp> yeah i've played all doom games up until eternal
<nikolapdp> i am on the expansion now
<kazinsal> I replay D1 and D2 usually 10-12 times a year just out of fun
<nikolapdp> yeah it's pretty fun
<kazinsal> so E1 is usually a 45-50 minute affair
<kazinsal> on UV
<nikolapdp> E>ddevault: how do you handle keyboard input
gsekulski has left #osdev [#osdev]
<nikolapdp> kazinsal: not bad honestly
<kazinsal> all of DOOM is usually 4 hours or so
<nikolapdp> lol i've played all of the doom games on my steamdeck
<kazinsal> but if I'm not going for my best times I like to try to remember where all the suboptimal secrets are
<ddevault> I don't
<ddevault> I have a /dev/kbd device but reading keys from it blocks
<ddevault> I have to implement O_NONBLOCK
<kazinsal> not quite 100% but enough of the dumb shit to get some extra points
<nikolapdp> ddevault: why does it block, can't it just check if there are keys in the buffer
<bslsk05> ​github.com: mini-rv32ima/fbdoom-overlay/i_input_evdev.c at nix · cleverca22/mini-rv32ima · GitHub
<kazinsal> gotta speed everything up for interrupt times
<nikolapdp> kek
<kazinsal> gotta match the last of the V8 interceptors mate
<clever> ddevault: the biggest problem i ran into, is that virtio-input on linux, only allows for 64 events in the ringbuffer, and the mouse is rather spammy, so i needed a seperate device for keyb and mouse
<heat_> Implements a RISC-V rv32ima/Zifencei†+Zicsr (and partial su), with CLINT and MMIO.
<heat_> >Is about 400 lines of actual code.
<heat_> how???
<nikolapdp> well you can write c like int main() { printf("hello\n"); }
<nikolapdp> so :)
<clever> heat_: https://github.com/cleverca22/mini-rv32ima/blob/nix/mini-rv32ima/mini-rv32ima.h this header is the core of the cpu implementation
<bslsk05> ​github.com: mini-rv32ima/mini-rv32ima/mini-rv32ima.h at nix · cleverca22/mini-rv32ima · GitHub
<kazinsal> if you give few enough shits, any code is a get out of jail free card
<clever> everything else is peripherals
<heat_> that file itself is 600
<heat_> but still insane tight
<heat_> riscv really is a hello world architecture
<clever> its grown since i added more irq support
<clever> upstream version is 550
<clever> but a lot of the lines are just {, due to upstreams code formatting style
<clever> the upstream version can boot linux but is serial only
<dostoyevsky2> how does qemu using virtio appear to the guest OS? Just some usb devices that are reachable via pci commands?
<clever> i added simple-framebuffer and virtio
<heat_> virtio devs are normal pci devs
<clever> dostoyevsky2: virtio has 3 transports, pci, mmio, and something for a weird arch
<heat_> or some special mmio devices that pop up in your device tree (depends on the machine and device type)
<kazinsal> dostoyevsky2: virtio devices just exist on the pci bus
<kazinsal> detect them, work from there
<clever> virtio-pci require you to first have a working pci controller in the guest
<clever> while virtio-mmio just need device tree to point at an address, and you r/w from there
<dostoyevsky2> kazinsal: and how does the guest communicate with the pci? interrupts?
<heat_> normally
<kazinsal> same as any other PCI device
<bslsk05> ​docs.oasis-open.org: Virtual I/O Device (VIRTIO) Version 1.2
<clever> dostoyevsky2: you use the MMIO registers to tell the host where 3 ringbuffers are in guest ram
<kazinsal> fucking goddammit hiccups again
<kazinsal> third time tonight
<kazinsal> someone hand me a fucking rope
<clever> one ringbuffer is for holding descriptors chains (singly linked lists), that give a direction/addr/size of a buffer in guest ram
<heat_> what r u going 2 do with tha rope
<dostoyevsky2> clever: ah, so a bit similar like video being mapped into ram
<clever> one ringbuffer holds the start of a descriptor chain, that is being sent to the host
<clever> and the 3rd ringbuffer is written by the host, with the same start from before, to signal completion
<bslsk05> ​github.com: mini-rv32ima/mini-rv32ima/virtio-blk.c at nix · cleverca22/mini-rv32ima · GitHub
<clever> dostoyevsky2: and then in the case of virtio-blk, every request must have 3 descriptors in the chain, the first is a guest->host containing a struct (with the command), the second can be either direction (the actual buffer for the r/w), and the 3rd is a 1 byte status from host->guest
<clever> the guest writes a chain to guest ram, puts the start in a guest ringbuffer, and then hits an mmio to wake the host
<clever> when the host is done performing the action, it puts the same start in a completed ringbuffer, and hits an irq to wake the guest
<clever> xhci and nvme work in a very similar manner
<clever> dostoyevsky2: its more like shared video ram, because all of the control structures exist in regular ram, and the host/"device" will just use dma to mess with guest ram, so the guest doesnt stall going across any slow bus like pci, or trapped writes
<clever> and that lets all of the slow parts (host/"device" accessing things) be async
<clever> the only real complaint i have, is that a given transport node (a pci device in virtio-pci, or an mmio device in virtio-mmio), can only emulate a single instance of a single type of device
<clever> so if you want a keyboard, mouse, disk, and gpu, thats 4 pci devices
<clever> but that design also lets each device implement a different version of the virtio protocol
<clever> i also cant see any reason why you cant implement virtio on a physical device
<clever> so you could make a regular old pcie card, that claims to be a virtio-blk device
theyneversleep has joined #osdev
<kazinsal> not playing on UV, doesn't count
<clever> i still need to add audio, it just isnt right with the game being mute
bauen1 has quit [Ping timeout: 256 seconds]
<ddevault> I am highly tempted to attempt an audio driver
<dostoyevsky2> is virtio some generic device that e.g. qemu can use to emulate many other devices, whereas othertimes every usb/pci device might have its own protocol on top of those bus systems?
<clever> dostoyevsky2: virtio has protocols for network, block, console, entropy, scsi, gpu, input, crypto, socket, filesystem, sound, gpio, some ram hotplug, and a few things i dont recognize
<bslsk05> ​docs.oasis-open.org: Virtual I/O Device (VIRTIO) Version 1.2
<clever> ah, a few more in that table, that arent listed in the table of contents
bauen1 has joined #osdev
<dostoyevsky2> so virtio is like usb/pci but requires no hardware?
<clever> yeah
<dostoyevsky2> so I could write a virtiodriver that proxies a gpu over the network or the like... interesting
<clever> virtio-gpu has 2 layers, a 2d and 3d layer
<clever> this explains how the 2d stuff works
<bslsk05> ​docs.oasis-open.org: Virtual I/O Device (VIRTIO) Version 1.2
<clever> VIRTIO_GPU_CMD_RESOURCE_CREATE_2D to create an image on the host, VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING to connect that image to a display, VIRTIO_GPU_CMD_TRANSFER_TO_HOST_2D to update the image
<clever> and page flipping can be done by creating a 2nd image on the host, and using VIRTIO_GPU_CMD_SET_SCANOUT to change which image is being displayed
<clever> since its all async, you could just copy those images over the network and let the "host" be very remote, and just irq when your done
<clever> hte mouse pointer is handled mostly the same way, create an image on the host, assign it as the pointer, and set the XY
<clever> but there is a dedicated ringbuffer just for setting the XY/cursor, so the pointer can move smoothly, even when the main queue is clogged with draws
<clever> and a 3rd ringbuffer for 3d ops
<clever> but ive not implemented virtio-gpu yet, still using simple-framebuffer
sprock has quit [Ping timeout: 260 seconds]
<clever> Symbol: DRM_VIRTIO_GPU [=n]
<clever> Depends on: HAS_IOMEM [=y] && DRM [=y] && VIRTIO_MENU [=y] && MMU [=n]
<clever> uh oh......
<dostoyevsky2> can one implement DRM and just always say: DRM is working fine
<clever> dostoyevsky2: i think so, but ive not done much with DRM
<clever> i do know that its capabilities can vary wildly
<clever> x86 gpu's tend to only support 2 or 3 planes, 1 plane covers the entire screen, 1 plane for the cursor, and 1 plane for xvideo overlay
<clever> while the rpi gpu can do 100 planes, within certain limits
sprock has joined #osdev
<clever> but drm has no way to describe those limits, and nobody wants to write DRM code that only works on the rpi
<clever> so everybody ignores the capabitilies of the pi, and just use opengl to composite layers together
<ddevault> anyone got an IHD audio implementation for their OS lying around?
<ddevault> I dunno of any hobby OSes that have bothered
Turn_Left has joined #osdev
<clever> ok, so if virtio-gpu is out of the question, lets do audio!
<bslsk05> ​docs.oasis-open.org: Virtual I/O Device (VIRTIO) Version 1.2
<clever> first, its using device id 25, and it has 4 queues
<bslsk05> ​github.com: zircon/system/dev/audio/usb-audio/usb-audio-device.cpp at master · pandarong/zircon · GitHub
<ddevault> no
<bslsk05> ​github.com: zircon/system/dev/audio/intel-hda at master · pandarong/zircon · GitHub
<ddevault> thx
<ddevault> I also have 9front as a reference
Left_Turn has quit [Ping timeout: 272 seconds]
<ddevault> there's also a public spec
<heat_> i could never give a crap about audio
<heat_> mostly due to the need for a whole stack around it
<ddevault> I feel like "write pcm into /dev/snd and have it come out the speakers" is relatively straightforward
<ddevault> though you do have to muck about with some stuff
<heat_> yeah but IRL that's not how things work, and then you have ALSA, and then you have pulseaudio or jack or pipewire or...
<heat_> dealing with a bunch of drivers and a whole stack on something i'm really really far from an expert... yeah not looking forward to that
<heat_> same thing with wifi * 10
<clever> heat_: pulseaudio tends to just use alsa behind the scenes
<clever> so thats purely a userland thing
<clever> if you dont want mixing, you can just go naked alsa
navi has quit [Read error: Connection reset by peer]
<dostoyevsky2> why did they invent virtio, so that you could proxy hardware from one computer to another? Because emualors like qemu could just emulate devices on pci/usb, no?
<heat_> they invented virtio as a lower-overhead way of virtualizing hardware
<clever> dostoyevsky2: do you could emulate something like a disk drive, without having to emulate all of the garbage from the original ata controller
<clever> yeah, what heat_ said, something that is simple to emulate, and has low overhead
<clever> [ 0.689473] virtio_snd virtio0: failed to initialize virtqueues
<clever> now, what have i done to offend linux.....
<dostoyevsky2> clever: this message is from when you boot riscv linux in your emulator?
<clever> dostoyevsky2: yep
<dostoyevsky2> heat_: I think emulating a CPU is so much less work compared to trying to write a OS... hence 400 LoC can get you quite far
Matt|home has joined #osdev
<dostoyevsky2> I hope you like modrm
<clever> aha, i see why
<clever> the virtio host, has to advertise the max size of the ringbuffer for each queue
<clever> and currently, that is hard-coded, at 4096 for queue0, 64 for queue 1, and 0 for all others
<clever> audio goes thru queues 2 and 3
<nikolapdp> dostoyevsky2: when are you teaching me go so we can write that sqlite fs :P
<clever> [ 0.712403] virtio_snd virtio0: Bad virtqueue length 4006
<clever> it helps if i dont typo
<clever> [ 0.868451] ALSA device list:
<clever> [ 0.883343] #0: VirtIO SoundCard at platform/10003000.virtio/virtio0
<clever> dostoyevsky2: and boom, it now claims to have a sound card, despite every single function being a no-op, lol
<dostoyevsky2> clever: Does your soundcard just need to accept a PCM stream or would you also need to implement concurrent tracks, and loading and sequencing samples?
<bslsk05> ​github.com: start virtio-snd · cleverca22/mini-rv32ima@95e10ea · GitHub
<clever> thats enough that linux accepts it as a valid sound card
<clever> any time linux tries to send pcm samples to it, virtio_snd_process_command will be called
<bslsk05> ​docs.oasis-open.org: Virtual I/O Device (VIRTIO) Version 1.2
<clever> next, i need to look at the configuration layout, it seems to be read only, so i need to make virtio_snd_config_load return that
<clever> that tells linux how many jacks, streams, and channel maps it supports
<bslsk05> ​github.com: add virtio-snd config · cleverca22/mini-rv32ima@4957ea2 · GitHub
<clever> dostoyevsky2: and with this, linux now believes this card has a single jack, stream, and channel map, which caused linux to write a 3 thing long entity to the controlq, and 63 things to the eventq
<dostoyevsky2> clever: I guess you should unload the beep driver from the linux kernel ;-)
<clever> i'm not even sure that one is loaded
<dostoyevsky2> sudo rmmod pcspkr
<clever> the kernel was built without module support!
<clever> let me add more debug to the command processing...
<dostoyevsky2> but sounds (sic!) very interesting to learn to write an emulator with Linux booting as it has some diagnostic messages that can guide you in the right directions
<clever> virtio_snd_process_command(0x429620, 0x4298a0, length 3, queue 0, 0)
<clever> 0: 0x7ffff474d4c8 16 flags 1
<clever> 2: 0x7ffff44c1450 24 flags 2
<clever> 1: 0x7ffff474d4d8 4 flags 3
<clever> so, this was written to the control queue, it contains 3 byffers, that are 16, 4, and 24 bytes in length (my virtio layer converted every guest ptr into a host virtual ptr)
<clever> a 2 in the flags, means its a host->guest transfer, and a 1 means there is another packet following
<clever> so this is 16 bytes of guest->host, 4 bytes of host->guest, and 24 bytes of host->guest
<clever> section 5.14.5 of the docs, says that the guest must first read the jacks field, and query each jack, then repeat on each stream and channel map
<clever> that explains why it didnt read the jack and channel map counts
<clever> > All control messages are placed into the control queue and all notifications are placed into the event queue
<clever> ahhh
<clever> so the 64 buffers (8 bytes each) in the event queue, are for host->guest messaging
<clever> the guest has pre-allocated a place for 64 messages, and the host can just populate one and irq whenever an event happens
<dostoyevsky2> ah, the sync for the buffers comes from an irq, so linux doesn't have to poll all the time
<clever> yep, every reply in virtio does that
<clever> weirdly, the docs claim the first packet should be 8 bytes, but i see 16
<dostoyevsky2> how many irqs are there still available these days? If one wanted to communicate between host and guest with a new IRQ
<clever> virtio does allow irq sharing
<clever> but it all depends on the irq controller your emulating
navi has joined #osdev
<clever> a jack has a type attached to it, lineout, speaker, headphone, spdif, other, mic, linein
<clever> but how is it querying that...
<clever> ah there, sound/virtio/virtio_ctl_msg.c
<clever> virtsnd_ctl_query_info
xenos1984 has quit [Ping timeout: 255 seconds]
xenos1984 has joined #osdev
<clever> dostoyevsky2: and with a few more lines of code, i can see that linux is sending control code 1, VIRTIO_SND_R_JACK_INFO
<dostoyevsky2> clever: You should run your emulator in qemu and then just display what qemu replies to these requests :) (c&p answers in your code)
<clever> part of the issue there, is that the emulator is implementing the host side of the protocol
<clever> while qemu also implements the host side
<clever> so you cant have 2 hosts talking together
<Ermine> heat_: I think alsa is much easier to port than drm
<Ermine> And for something basic you don't really need pulseaudio or pipewire
<clever> yeah
<clever> VIRTIO_SND_R_JACK_INFO start=0 count=1 size=24
<clever> my debug now reveals, that linux wants to know about 1 jack, starting at jack 0, and it gave me a 24 byte buffer for it
<Ermine> and oss is probably even easier to port than alsa
<clever> i forgot oss even existed!
xenos1984 has quit [Ping timeout: 268 seconds]
node1 has joined #osdev
qubasa has quit [Remote host closed the connection]
xenos1984 has joined #osdev
bitoff has joined #osdev
<clever> [ 0.852681] virtio_snd virtio0: SID 0: no supported PCM sample formats found
<mcrod> hi
<clever> dostoyevsky2: so, i can now successfully respond to 2 queries, but i'm not declaring any supported pcm formats
gbowne1 has joined #osdev
gbowne1 has quit [Remote host closed the connection]
gbowne1 has joined #osdev
<bslsk05> ​github.com: mini-rv32ima/mini-rv32ima/virtio-snd.c at nix · cleverca22/mini-rv32ima · GitHub
<clever> dostoyevsky2: and with this, linux now believes there is an alsa card with 1 jack, it is capable of a single stream of mono 48khz signed 16bit pcm
gog has joined #osdev
<clever> now i need to start investigating audio clients
<clever> if i want the emulator to actually play audio, it needs to connect to something on the host (such as pulseaudio) and send the samples there
<nikolapdp> you could try miniaudio
<nikolapdp> it's a single header c library
<nikolapdp> i used it and it worked great
<clever> nikolapdp: already have my eye on https://github.com/cntools/cnfa
<bslsk05> ​cntools/cnfa - Foundational audio drivers (14 forks/27 stargazers/MIT)
<clever> i'm already using half of his other projects, and this one isupports windows, linux(pulse/alsa), and i think its also single-header
<nikolapdp> there's a CNFA.c
<nikolapdp> so eh
zy has quit [Quit: WeeChat 4.2.2]
<nikolapdp> btw miniaudio is also cross platform
<clever> there was .c files in rawdraw as well, but the makefile bundles them all into a single .h
<clever> but shared libraries dont bother me much
<nikolapdp> ah i am not sure if i'd count that lol
node1 has quit [Quit: Client closed]
<nikolapdp> eh not even shared libraries, just annoying to have subprojects
<nikolapdp> so you plop a single file and call it a day
<clever> the nix package manager makes that trivial, i'll push when its done and show you
<nikolapdp> i mean if it's already built, sure, every package manager makes it trivial lol
<nikolapdp> *built as a .so
<clever> what i mean, is that nix makes it trivial to add more packages to your project
<clever> ones not in the package manager
<zid> nikolapdpadpar
<zid> When tertiary area
<nikolapdp> pdpadpar?
<zid> nikola + pdp + adp + a + r, i guess
<nikolapdp> what's an adp
<zid> adenosine diphosphate
<zid> It's the thing you recharge with energy in a cell to make ATP, the carrier molecule
<bslsk05> ​github.com: add cnfa · cleverca22/mini-rv32ima@6f8a0e9 · GitHub
<nikolapdp> so you just write out instructions to build it?
<clever> nikolapdp: yep
<nikolapdp> so a glorified shell script :P
<zid> k guess no tertiary area
<nikolapdp> no, but what about terry
<clever> nikolapdp: but every package is built in its own sandbox, with networking disabled, and all inputs hashed
<zid> yes, terrible aria!
<clever> nikolapdp: there is basically no way for it to depend on something nix isnt tracking, and if the inputs change in any way, it triggers a rebuild
<clever> so it automatically rebuilds things when needed
<clever> nikolapdp: and ow my ears!, undefined data!!!
<nikolapdp> kek
<nikolapdp> be careful when working with sound
MrCryo has quit [Remote host closed the connection]
<zid> nikolapdp you done talking to heat now so we can play?
<zid> err clever
<nikolapdp> sure
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
frkazoid333 has quit [Ping timeout: 268 seconds]
Left_Turn has joined #osdev
Matt|home has quit [Ping timeout: 255 seconds]
Turn_Left has quit [Ping timeout: 272 seconds]
<gorgonical> God damn squash hands
zhiayang has quit [Quit: oof.]
zhiayang has joined #osdev
xvmt has quit [Ping timeout: 256 seconds]
nickster1 has joined #osdev
khrbtxyz_ has joined #osdev
remexre_ has joined #osdev
vismie has quit [Read error: Connection reset by peer]
hanemile has quit [Read error: Connection reset by peer]
gjn has quit [Read error: Connection reset by peer]
asymptotically has quit [Read error: Connection reset by peer]
vismie has joined #osdev
pitust has quit [Read error: Connection reset by peer]
patwid has quit [Read error: Connection reset by peer]
staceee has quit [Read error: Connection reset by peer]
tommybomb has quit [Read error: Connection reset by peer]
jleightcap has quit [Read error: Connection reset by peer]
noeontheend has quit [Read error: Connection reset by peer]
whereiseveryone has quit [Read error: Connection reset by peer]
nagitsu has quit [Read error: Connection reset by peer]
rselim has quit [Read error: Connection reset by peer]
gjn has joined #osdev
ursa-major has quit [Read error: Connection reset by peer]
asymptotically has joined #osdev
khrbtxyz has quit [Ping timeout: 246 seconds]
graphitemaster has quit [Ping timeout: 246 seconds]
tommybomb has joined #osdev
lh has joined #osdev
noeontheend has joined #osdev
jleightcap has joined #osdev
sskras has quit [Ping timeout: 268 seconds]
hl_ has joined #osdev
sskras has joined #osdev
khrbtxyz_ is now known as khrbtxyz
raggi has quit [Remote host closed the connection]
froggey has quit [Read error: Connection reset by peer]
<heat_> Ermine, iz all gpl codez
hl has quit [Remote host closed the connection]
XgF has quit [Remote host closed the connection]
devurandom has quit [Quit: Ping timeout (120 seconds)]
remexre has quit [Ping timeout: 268 seconds]
xvmt has joined #osdev
remexre_ is now known as remexre
<heat_> i've considered relicensing onyx (or most of it) to gpl anyway, but yeah, as things stand you can't merge it
devurandom has joined #osdev
nickster1 is now known as nickster
nickster has quit [Ping timeout: 256 seconds]
Goodbye_Vincent has quit [Quit: Ping timeout (120 seconds)]
hbag has quit [Read error: Connection reset by peer]
Goodbye_Vincent has joined #osdev
whereiseveryone has joined #osdev
ursa-major has joined #osdev
XgF has joined #osdev
<heat_> to be clear, DRM is dual licensed MIT-GPL, which is why it's possible to be used in the BSDs and onyx in the first place
hanemile has joined #osdev
froggey has joined #osdev
rselim has joined #osdev
pitust has joined #osdev
raggi has joined #osdev
patwid has joined #osdev
nagitsu has joined #osdev
staceee has joined #osdev
stux has quit [Ping timeout: 268 seconds]
graphitemaster has joined #osdev
rpnx has joined #osdev
<dostoyevsky2> clever: do you get to see the pcm in the host if you try to `cat wav > /dev/audio' on the linux guest?
stux has joined #osdev
<dostoyevsky2> nikolapdp: I wonder if there is a best practices documented somewhere on how to develop audio applications.. I once wrote an mp3 player and writing to the audio device was always scary... but I think macos has some checks in place so you can't easily break the speakers etc
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 268 seconds]
<clever> dostoyevsky2: tried that, it gave an error
<clever> i think you need to set it up with an ioctl first
<clever> and alsa-lib wants tls by default
rpnx has quit [Ping timeout: 268 seconds]
<dostoyevsky2> tls I only know from https/web requests
<dostoyevsky2> clever: I guess once got a pcm stream you could save it as a wav and then look at it in audacity first
scaleww has joined #osdev
Left_Turn has joined #osdev
Turn_Left has quit [Ping timeout: 268 seconds]
Turn_Left has joined #osdev
air has quit [Quit: cria 0.2.9cvs17 -- http://cria.sf.net]
Left_Turn has quit [Ping timeout: 268 seconds]
air has joined #osdev
<Ermine> heat_: oh damn, licensing
Matt|home has joined #osdev
<heat_> indeed
Left_Turn has joined #osdev
Turn_Left has quit [Ping timeout: 255 seconds]
GeDaMo has quit [Quit: 0wt 0f v0w3ls.]
rpnx has joined #osdev
Matt|home has quit [Quit: Leaving]
rpnx has quit [Ping timeout: 268 seconds]
rpnx has joined #osdev
rpnx has quit [Ping timeout: 260 seconds]
altf2o has joined #osdev
agent314 has joined #osdev
agent314 has quit [Client Quit]
heat_ has quit [Remote host closed the connection]
agent314 has joined #osdev
zxrom has quit [Quit: Leaving]
theyneversleep has quit [Remote host closed the connection]
scaleww has quit [Quit: Leaving]
Left_Turn has quit [Ping timeout: 256 seconds]
Left_Turn has joined #osdev
netbsduser has quit [Ping timeout: 240 seconds]