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)
<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
<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]
<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
<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"); }
<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
<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>
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
<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?
<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>
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
<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>
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