Search logs:

channel logs for 2004 - 2010 are archived at http://tunes.org/~nef/logs/old/ ·· can't be searched

#osdev2 = #osdev @ Libera from 23may2021 to present

#osdev @ OPN/FreeNode from 3apr2001 to 23may2021

all other channels are on OPN/FreeNode from 2004 to present


http://bespin.org/~qz/search/?view=1&c=osdev2&y=21&m=10&d=10

Sunday, 10 October 2021

06:11:00 <klange> finally got an audio driver for VMware's Ensoniq ES1371-series card. https://klange.dev/s/Screenshot%20from%202021-10-10%2015-10-46.png
06:12:00 <zid> ah yes, that one
06:12:00 <klange> Don't know if this driver works on a real instance of such hardware, don't care, it works in vmware and I can play Doom with all the shotgunny goodness.
06:16:00 <zid> I think my board that had it is long gone sadly
06:18:00 <vdamewood> Now I wish I had an old system to try and develop a driver for the physical hardware.
06:20:00 <zid> I do have one.. I'm not sure it *works*
06:21:00 <zid> a P35 chipset too like qemu
06:27:00 * moon-child 's assembler now generates over 1mloc of automatic test cases, verified against nasm
06:27:00 <moon-child> and I only had to put in two hacks to generate the same code as nasm!
06:28:00 <zid> nice, sounds easier to just use nasm though ngl
06:28:00 <zid> :p
06:29:00 <moon-child> technically I have an excuse, which is that nasm has mad complex macros and I want to avoid all that. Better separation of concern etc.
06:29:00 <moon-child> but really I just wanted an excuse to learn the instruction encodings
06:29:00 <moon-child> which i kinda regret but...¯\_(ツ)_/¯ too late now
06:30:00 <klange> What I would like is to have the patience to sit down and write an HDA driver. The Ensoniq was, beyond parsing its spec, about as straight-forward as the ICH AC'97 we've had a driver for for ages now, it was just a matter of banging out the right bits to get it to play.
06:35:00 <zid> Yea I figure most cheap sound cards are basically "This is the address you spam PCM samples to / this is the address you put the DMA location in" and some mute/vol/etc registers
06:36:00 <zid> maybe if they're really fancy, it's a couple of pages in a ring buffer
06:37:00 <klange> ICH AC'97 was pages in a ring buffer, this Ensoniq card is just up to 256k bytes of sample memory and you can ask it to irq you every so many samples.
06:38:00 <clever> at the lowest level (usually hidden), the rpi analog audio is just a pwm controller, and a dma controller in ringbuffer mode
06:38:00 <clever> and it has a sample rate of something like 400khz
06:38:00 <klange> I'll be poking an RPi4 soon enough.
06:38:00 <zid> klange: oh hey my intuition was pretty solid then
06:38:00 <clever> so you need to up-sample the audio to insane levels
06:39:00 <clever> but the closed firmware hides all of that, and presents a more sane 48khz api
06:39:00 <zid> 48kHz still requires me to resample literally everything tbh
06:39:00 <clever> i suspect the firmware can accept other rates
06:39:00 <clever> i havent investigated the api closely
06:39:00 <zid> 99.9% of my audio is 44.1, the other tiny bit is 48 yea
06:40:00 <zid> does 48000 have good prime factors?
06:40:00 <clever> > Stage 1 is source samplerate conversion (8kHz-48kHz -> 48828Hz) - this fractional conversion is required as the PWM source clock is not a power-of-two product of audio sample frequencies.
06:41:00 <zid> ooh yea pretty good
06:41:00 <clever> ah, so the firmware will accept 44.1khz, but internally needs it at 48.828 KHz
06:41:00 <klange> I added a dumb-as-bricks sample rate converter to my MP3 player, Quake is built to generate 48khz, and Doom needs a sample rate converter regardless.
06:41:00 <klange> (Doom sounds use variable sample rates)
06:42:00 <clever> > Stage 2 - Oversampling by factor x8 to 390625Hz using a length=512 FIR filter with a nice, sharp cut-off.
06:42:00 <clever> ~390khz, i was kinda close
06:43:00 <clever> > Stage 4 - 2nd-order quantisation noise shaping from 16-bit PCM at 781250Hz to 7-bit PWM samples.
06:43:00 <clever> ah, but then it goes ham, to ~781 KHz!
06:47:00 * clever heads to bed
07:59:00 <moon-child> god fucking dammit
08:00:00 <moon-child> I generate shorter code than nasm for this one thing
08:00:00 <moon-child> i don't wanna intentionally generate _longer_ code just to match
08:00:00 <j`ey> why does it need to match?
08:01:00 <zid> mv nasm/ moonasm/ done
08:01:00 <zid> now it produces identical output
08:01:00 <moon-child> j`ey: because nasm probably got it right, so I use it to test that I got it right
08:01:00 <moon-child> I found one nasm bug, it found probably 10 bugs in my code. Worthwhile trade
08:02:00 <moon-child> maybe two nasm bugs actually. idk if this rex.w things is actually harmless or not
08:02:00 <zid> nasm can't do jump size stuff perfectly
08:02:00 <zid> it's specifically only limited passes
08:02:00 <zid> and if you try to do it 'perfectly' you can get into annoying astable states
08:02:00 <j`ey> moon-child: sorry, I thought you were compiling to asm, didnt see that you were writing an assembler
08:03:00 <moon-child> :)
08:09:00 <moon-child> zid: does _anyone_ do the jump size stuff perfectly?
08:11:00 <moon-child> technically it's ambiguous--there can be multiple 'perfect' combinations. So I kinda wanna do PGO jump size as a stunt. But beyond that heuristic/sliding-window is good enough for real-world
08:18:00 <kingoffrance> what do you mean by: "but really I just wanted an excuse to learn the instruction encodings" "which i kinda regret but..." ? when you see how the sausage is made?
08:19:00 <moon-child> yes
08:19:00 <kingoffrance> lol
08:19:00 <moon-child> it is terrible
08:19:00 <moon-child> never do x86
08:19:00 <moon-child> go learn a nice arch like riscv or something idk
08:20:00 <moon-child> (well, riscv is a pita to use buut)
08:21:00 <zid> moon-child: It has multiple imperfect solutions is the real problem
08:21:00 <zid> lengthening one jump may shorten another
08:21:00 <moon-child> right, yes
08:22:00 <moon-child> and hypothetically that could actually make a difference if it makes one thing straddle a cache line
08:22:00 <moon-child> (though funny enough the problem only manifests if you have alignment directives! :P)
08:23:00 <moon-child> well, actually, i guess. Say you have 5 jumps, you can either have 2 short/3 long or 2 long/3 short, but the former configuration the 2 short are hotter. Can that come up? I'd have to think about it but I think so
08:29:00 <zid> I am hotter, that's all we need to know
08:29:00 <geist> huh TIL that JUSTIN BAILEY the metroid code was not hard coded, it was simply a coincidence that it passes the checksum
08:30:00 <zid> yea
08:30:00 <zid> There's some cool codes for act raiser 2 like that
08:30:00 <geist> really 1/256 random strings you typed in would work
08:30:00 <geist> though not all bit patterns result in something valid
08:30:00 <zid> But they actually unpack to like.. incredibly high difficulty modes and stuff
08:30:00 <geist> https://www.truepeacein.space/ is cute
08:30:00 <zid> It's checked, but the content encodes what it does to the game, instead of being real passwords
08:30:00 <geist> act raiser, now thats not a thing i've thought of in some time...
08:31:00 <zid> so there's like "401 mode" where it indexes the enemy health table wrong and everything has silly health etc
08:31:00 <kingoffrance> i thought act raiser was dead? you're uncle told you that </obi wan>
08:32:00 <kingoffrance> *your
08:32:00 <geist> ah looks like AR2 was only a side scroller
08:32:00 <geist> i actually liked the overheda map part of the first one
08:33:00 <zid> yea AR1 is like.. a city builder thing? idk
08:33:00 <zid> AR2 is a crazy difficult platformer
08:33:00 <geist> yeah it had a whole city builder thing, and then you would dive into a side scrolling boss battle thing
08:38:00 <zid> https://www.youtube.com/watch?v=dinYWgf00ic ah 202
09:14:00 <heat> so I've just upgraded to windows 11
09:14:00 <heat> it broke grub
09:14:00 <heat> yay
09:15:00 <zid> sounds like windows
09:16:00 <heat> i dont know why or how it broke, but it did
09:17:00 <j`ey> heat: hows ext4 progress?
09:17:00 <heat> never happened to me before
09:17:00 <heat> j`ey: hmm?
09:17:00 <zid> windows makes the drive 'bootable' as part of the install, that overwrites grub
09:17:00 <j`ey> heat: EDK2+ext4
09:17:00 <zid> you always have to install windows first
09:18:00 <heat> j`ey: that got pushed like a month or so ago
09:18:00 <heat> https://github.com/tianocore/edk2-platforms/tree/master/Features/Ext4Pkg
09:19:00 <j`ey> to.. edk2-platforms? but it's not a platform!
09:19:00 <heat> zid: yeah but I've upgraded from 8.1 -> 10 before and everything worked fine, I've upgraded through multiple windows 10 releases and everything worked fine, I've upgraded to w11 and it broke (somehow!). I don't even know how it broke considering grubx64.efi was still there, but I got booted straight to recovery
09:20:00 <zid> ah yea efi is a little less outright bricky
09:20:00 <zid> but I still don't trust windows :p
09:21:00 <heat> j`ey: yup, that's where I got told to put the package since it's more "advanced" I guess?
09:21:00 <j`ey> weird
09:22:00 <j`ey> anyway, I've been playing with rEFInd as a bootloader, I wonder if it could use that instead of the other random ext4 driver it uses
09:22:00 <heat> i'm fine with it, the only issue is that OvmfPkg and ArmVirtPkg can't depend on it
09:22:00 <j`ey> yeah
09:23:00 <heat> j`ey: you can totally use it
09:24:00 <heat> It's seeing usage by nvidia and folks in OpenCorePkg that I know of
09:24:00 <j`ey> cool
09:24:00 <heat> only quirk right now is that it doesn't support symlinks
09:24:00 <j`ey> read only, read write?
09:24:00 <heat> and it can be a bit slow on mechanical hard drives since I dont have caching just yet
09:25:00 <heat> read only
09:25:00 <j`ey> cool
09:41:00 <heat> i think I'm finally going to invest in an simple sata ssd for my laptop
09:41:00 <heat> using a computer is becoming increasingly frustrating
09:43:00 <heat> either that or new laptop, but a laptop is way more expensive, no 1TB drive and you only get integrated graphics
10:41:00 <klange> https://www.youtube.com/watch?v=I9GKrv9WRek
11:22:00 <vai> hi dudes
19:29:00 <geist> 'lo
19:43:00 <sortie> 'hi geist
19:43:00 <geist> a sortie appears!
19:43:00 <geist> quick, catch it
19:43:00 <sortie> It's a good one!
19:44:00 * geist lures it out with nanab berries
19:50:00 <sortie> What's up?
19:56:00 <sortie> geist, just had a fun bug where recvmsg(2) fails with EFAULT if it's called twice with the same msghdr. You see it's supposed to overwrite the struct msghdr in user-space to update msg_flags and msg_controllen. But the kernel temporarily replaced msg_iov pointer with a pointer to the kernel's copy of the array and didn't restore it.
19:56:00 <sortie> => Kernel pointer leaked to user-space and user-space fed it back to the kernel with refused to access that bad pointer.
19:57:00 <geist> Oooh yeah that's not good
19:57:00 <sortie> I was working on my Unix socket file descriptor passing and thought my diff was bad because I had a hard time getting the unit tests to pass, but nope, unrelated kernel bug
19:57:00 <geist> Kernel shouldn't ever put kernel internal stuff in user space
19:57:00 <sortie> That wasn't what was happening
19:58:00 <geist> Ah
19:58:00 <sortie> The kernel made its own copy of the msghdr. It modified it with its own safe pointers. Then it copied it back to user-space, such that the msg_flags and msg_controllen fields got updated there.
19:59:00 <sortie> Basically this whole thing was safe and then at some point I probably realized I needed to update those fields and tacked a copy-to-user-space onto it without realizing it accidentally changed unrelated fields too
20:01:00 <geist> ah makes sense
20:02:00 <sortie> Honestly I do not like the API design of control data.
20:03:00 <sortie> It's kinda tacked onto sendmsg/recvmsg as an out of band thing. It means it's not e.g. counted in the return value how much control data got processed.
20:04:00 <sortie> That means that sendmsg is not able to say just how much control data it actually sent. I made my implementation be essentially an all-or-nothing approach, either it all goes through atomically, or none went through.
20:05:00 <sortie> Honestly it's difficult to implement correctly and also give some safeties like that to user-space. It could maybe just have been done with a flag rather than a whole new set of buffer parameters.
20:31:00 <dormito> bah. someon updated the "Global Descriptor Table" page... but they got some of it very wrong (entires are 8 bytes in i386 mode, IIRC long entries are two 8-byte entries... so sort of 16 bytes)... and I didn't get any further than that.
20:33:00 <gog> segment descriptors are 8 bytes in long mode
20:33:00 <gog> except TSS
20:33:00 <gog> system descriptors are 16
20:33:00 <gog> it's fucked up imo
20:33:00 <dormito> and that is why I didn't fix the edit :p.
20:34:00 <gog> 286 was a mistake we're still paying for
20:34:00 <dormito> x86's segmentation is... a horrible mess. I'm pretty sure every little bit made sense at the time... but it was not designed to be extensible until much later in the game
20:44:00 <Oli> Are we talking about FAT filesystems? Individual entries are 32-byte long, and those with long filenames occupy additional one or more 32-byte length entries.
20:45:00 <j`ey> Oli: GDT
20:45:00 <Oli> Perhaps it is off-topic, my apologies if so.
20:46:00 <Oli> Thank you, j`ey.
20:46:00 <j`ey> Oli: not off topic, just wrong topic :P
20:46:00 <Oli> lol
23:04:00 <junon[m]> Connecting from Matrix for the first time, is this working? lol
23:04:00 <junon[m]> I'm super afraid of accidentally sending garbage or like 10 lines or something.
23:05:00 <clever> junon[m]: if you try to send more then 1 line, matrix will automatically send a link to a .txt file instead
23:05:00 <junon[m]> woah no way, neat
23:06:00 <clever> but there will be no context on why people should click the link and read it
23:06:00 <clever> so your more likely to get ignored
23:06:00 <junon[m]> Oh :|
23:06:00 <clever> so you need to take care to say why they should click the link, in its own 1 line message
23:06:00 <junon_> makes sense I guess.
23:07:00 <clever> it also helps to keep an old irc client connected for the first week, and see how things get mangled on the other end
23:07:00 <junon_> yep that's what I'm doing now
23:07:00 <clever> i still prefer real irc, and i only use matrix from my phone, or when i need to upload images to irc
23:08:00 <junon> yeah I'm still not 100% sold on matrix personally. The UX of it all still needs polish.
23:08:00 <junon> but I've got it all set up now which is good. :)
23:10:00 <junon> I'm not even 30 yet and some of this stuff makes me feel like a grandpa. I was on first on irc when I was 8.