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
<moon-child> internet service provider HTH.HAND
<mrvn> moon-child: in the context of videos that makes no sense
sham1 has quit [Ping timeout: 265 seconds]
smach has joined #osdev
lkurusa has quit [Quit: I probably fell asleep (or went out). Who will ever know.]
smach has quit [Client Quit]
Gooberpatrol66 has quit [Quit: Leaving]
sham1 has joined #osdev
Gooberpatrol66 has joined #osdev
smach has joined #osdev
<kaichiuchi> I was about to have a stroke, friends
<mjg> then you remembered you are only 30?
nyah has quit [Quit: leaving]
<kaichiuchi> i forgot about signed integer overflow being UB
<kaichiuchi> I spent 2 hours wondering wtf was happening
<moon-child> if you're not compiling with -fwrapv -fno-strict-aliasing -fno-delete-null-pointer-checks, you're asking to get fucked over
Matt|home has joined #osdev
* \Test_User wants a -fno-integer-promotion
<moon-child> in c2x, you can use _ExtInt
<moon-child> but you lose void (*f)(), soooo
epony has quit [Read error: Connection reset by peer]
<kaichiuchi> you see
<kaichiuchi> I was wondering how a linear time loop was taking 0ns time
<kaichiuchi> despite incredibly large inputs
<\Test_User> linear... 0*n? :P
<kaichiuchi> assembly revealed that gcc was optimizing it out, and generating a compile-time constant
<kaichiuchi> in short, I am tired, I am beat, and I just want to sulk in my tent
Lumia has joined #osdev
\Test_User has quit [Quit: \Test_User]
wikan has quit [Quit: Leaving]
\Test_User has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
nvmd has quit [Quit: WeeChat 3.7.1]
rwxr-xr-x has quit [Ping timeout: 260 seconds]
nlocalhost has quit [Remote host closed the connection]
nlocalhost has joined #osdev
Lumia has quit [Quit: ,-]
gildasio1 has quit [Remote host closed the connection]
gildasio1 has joined #osdev
dude12312414 has joined #osdev
rorx has quit [Ping timeout: 265 seconds]
invalidopcode has quit [Remote host closed the connection]
invalidopcode has joined #osdev
Lumia has joined #osdev
epony has joined #osdev
gildasio1 has quit [Remote host closed the connection]
gildasio1 has joined #osdev
rorx has joined #osdev
gildasio1 has quit [Remote host closed the connection]
gildasio1 has joined #osdev
gxt has quit [Remote host closed the connection]
gxt has joined #osdev
dude12312414 has quit [Remote host closed the connection]
dude12312414 has joined #osdev
gog has quit [Ping timeout: 252 seconds]
smach has quit [Ping timeout: 260 seconds]
Lumia has quit [Ping timeout: 256 seconds]
gildasio1 has quit [Remote host closed the connection]
gildasio1 has joined #osdev
nlocalhost has quit [Remote host closed the connection]
gildasio1 has quit [Remote host closed the connection]
gildasio1 has joined #osdev
dude12312414 has quit [Remote host closed the connection]
dude12312414 has joined #osdev
nlocalhost has joined #osdev
nlocalhost has quit [Remote host closed the connection]
nlocalhost has joined #osdev
nlocalhost has quit [Remote host closed the connection]
Lumia has joined #osdev
nlocalhost has joined #osdev
heat has quit [Ping timeout: 260 seconds]
invalidopcode has quit [Remote host closed the connection]
invalidopcode has joined #osdev
nlocalhost has quit [Remote host closed the connection]
nlocalhost has joined #osdev
Lumia has quit [Ping timeout: 256 seconds]
<zid> Heh just had a look at advent, tempted to do it with system()..
Lumia has joined #osdev
Burgundy has joined #osdev
* geist wraps zid with unsafe {}
<klange> finished 101st for the first part :( 57th for the second
<klange> the cutoff for scoring is 100
<zid> That's fasto
<klange> this was a slow one, it took ten minutes
<zid> I can take my time even more now :D
<zid> not sure how I wanna structure ls parsing, because it's going to gobble the next command if I am not careful
<zid> oh I can just ignore it cus ls doesn't take args
Burgundy has quit [Ping timeout: 260 seconds]
Lumia has quit [Ping timeout: 260 seconds]
<zid> okay done
<bslsk05> ​gist.github.com: 2022-day7.c · GitHub
<zid> I even made it print the answers, rather than my usual shit of requiring you to scan a list or | sort -n or something
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
chartreuse has joined #osdev
gildasio1 has quit [Write error: Connection reset by peer]
gildasio1 has joined #osdev
joe9 has quit [Ping timeout: 256 seconds]
bgs has quit [Remote host closed the connection]
gorgonical has quit [Remote host closed the connection]
gog has joined #osdev
gog` has joined #osdev
gog` has quit [Read error: Connection reset by peer]
gog` has joined #osdev
gog` has quit [Client Quit]
<klange> zid: heh, I think that's even cleaner than mine...
GeDaMo has joined #osdev
riverdc has quit [Quit: quitting]
GreaseMonkey has quit [Remote host closed the connection]
Archer has joined #osdev
rein-er has quit [Read error: Connection reset by peer]
riverdc_ has joined #osdev
heat has joined #osdev
<ddevault> have edk2 debug build now
<ddevault> [Security] 3rd party image[0] can be loaded after EndOfDxe
<ddevault> ah, /can/ be loaded, this is probably a red herring
<j`ey> it is
<Ermine> ddevault: do you use edk2?
<ddevault> trying to get UEFI working on aarch64, Ermine, and using edk2 to test it in qemu
<ddevault> unfortunately the debug build does not offer any particularly useful information as to the real cause
<ddevault> how'd you narrow it down to that one branch, j`ey?
nero has joined #osdev
<j`ey> trial and error
<j`ey> (aka liberal use of ASSERT() lol)
<ddevault> aight
<ddevault> haha
<ddevault> so you modified the edk2 code
<j`ey> yeah..
<ddevault> whelp, guess I'll need to improve my setup
<ddevault> but fair enough, that makes sense
<ddevault> are you able to get gdb in here
<j`ey> I already have EDK2 build setup
<ddevault> maybe I should separate my .text and .data sections
<ddevault> that's probably not it, though
<ddevault> this is an intermediate loader, I'm going to load my real kernel with this EFI binary and then tear it down, so it's not too important that the address space is pristine
<j`ey> I didnt try to debug why the read failed
<heat> >are you able to get gdb in here
<heat> it's hard-ish but theoretically possible and you have some helper scripts
<j`ey> but (Size != ReadSize), and ReadSize = 1 and Size = 0
<ddevault> I don't really know what this read is trying to accomplish
<ddevault> make sure the data is in the image region? what?
<j`ey> so maybe some other field is wrong, like image size (if thats evenn a field..)
<zid> heat: did you show day6?
<bslsk05> ​github.com: aoc2022/day6.c at main · heatd/aoc2022 · GitHub
<ddevault> hrm
<heat> ddevault, do you want build instructions?
<ddevault> this is suspect
<ddevault> heat: no, I can work it out, thank you
<heat> no you can't, the build system is depressing
<heat> well, you can, but you'll take a while
<ddevault> I already have a working build because it's packaged for my distro
<ddevault> can adapt the distro build scripts and it's not that bad
<heat> the distros also frequently do it wrong
<zid> oh you used a histogram? clever.
<heat> cd edk2; make -C BaseTools/; . edksetup.sh; GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -p ArmVirtPkg/ArmVirtQemu.dsc -n 0 -a AARCH64 -t GCC5
<zid> The answer is *always* histogram, and yet I didn't do it, damnit
<ddevault> the build works with an ubuntu image, so it passes the sanity check
<heat> make sure you have a aarch64-linux-gnu toolchain
<heat> zid, how did you do it?
<zid> I just did a rolling (n*n-1)/2 comparison matrix
<j`ey> have to find which impl of ImageRead it actually is
<zid> but I did the grep trick, where if you see a match on char 14 and char 7, you fast-forward the buffer by 7
<zid> and I have an optimized case where if the step-size is 1, we only check the new character vs the string
<zid> rather than the full (14*13)/2 comparisons
<zid> idk if it's faster to just always do step size of 1 or not
<zid> too little data to bench it
<ddevault> j`ey: FAT via virtio block device
<heat> hm?
<ddevault> hint for which ImageRead implementation it might be
<zid> heat: when day 7?
<heat> idk
<zid> day7 is nice and easy at least
<zid> filesystem driver
<ddevault> ah, I have a lead
<ddevault> the SizeOfRawData field is larger than the binary
<heat> zid, lol
<zid> you're an osdev nerd it should be ezpz
<j`ey> so yeah, bigger than the 'image size' i guess
<ddevault> not sure why
<ddevault> but this build process I'm working with is pretty dumb so
Burgundy has joined #osdev
<ddevault> j`ey: can you tell me where this binary fails? https://mirror.drewdevault.com/bootaarch64.efi
<ddevault> err, hmm
<ddevault> nevermind
<ddevault> this binary is not right
<ddevault> okay, this binary is right: https://mirror.drewdevault.com/bootaarch64.efi
<j`ey> I can try in a bit
<ddevault> ty, no hurry
<ddevault> this fucking sucks
<heat> ddevault, btw if you want to take a stab at tianocore debugging, using DEBUG ((DEBUG_INFO, <normal printf args> )); and similar
<ddevault> ack, thanks
<heat> or plain old ASSERT()'s
<ddevault> maybe I should just write a proper EFI bootloader in C instead of doing an EFI stub
<kaichiuchi> I'm really starting to hate google benchmark
<heat> why
<heat> it' gr8
<kaichiuchi> it's great until it doesn't allow a loop to be vectorized
spikeheron has quit [Quit: WeeChat 3.7.1]
<kaichiuchi> oh
<kaichiuchi> never mind
dutch has joined #osdev
smach has joined #osdev
<ddevault> well, hrm
<ddevault> now the challenge is to produce a toolchain which can cross compile EFI binaries for arm64
<j`ey> that binary seemed to fail in the same place
<ddevault> okay this sucks
<ddevault> everyone is just doing the same hacks I was trying to get away from
<ddevault> for aarch64 at least
bgs has joined #osdev
<ddevault> back to trying to get my EFI stub to work
isaacwoods has joined #osdev
bauen1 has quit [Ping timeout: 268 seconds]
Burgundy has quit [Ping timeout: 256 seconds]
vdamewood has joined #osdev
HeTo_ has joined #osdev
HeTo has quit [Ping timeout: 260 seconds]
<epony> stump
dutch has quit [Quit: WeeChat 3.7]
elastic_dog has quit [Ping timeout: 246 seconds]
spikeheron has joined #osdev
elastic_dog has joined #osdev
elastic_dog has quit [Ping timeout: 256 seconds]
elastic_dog has joined #osdev
MiningMarsh has quit [Quit: ZNC 1.8.2 - https://znc.in]
bauen1 has joined #osdev
gildasio1 is now known as gildasio
Piraty has quit [Quit: -]
Piraty has joined #osdev
lkurusa has joined #osdev
<mrvn> Was there any new show on TV without a gay/lesbian couple this year? Is someone overcompensating for decades of ignoring the issue?
<heat> welcome to #osdev
<zid> heat day 7
<heat> no, currently beesy with freebsd
<mrvn> zid: another one that will be hard in bash
<mrvn> or rather POSIX sh, bash at least has arrays
[itchyjunk] has joined #osdev
<heat> I feel stupid using vim
<heat> really should've sticked to gnu nano
<mrvn> trust your feelings. But nano? GO EMACS, GO EMACS, GO EMACS. :) Ever tried zile?
<zid> good idea
<zid> I write each line with echo and >> it mainly
<zid> then if I need to edit it I just head it to a new file
<nero> or type it verbatim into the stdin and cat it into a file
<nero> i use this for "file from clipboard" situation
<mrvn> hah, just "gcc -O2 -o foo -
<mrvn> gcc really should have a mode to execute the binary without saving
MiningMarsh has joined #osdev
Burgundy has joined #osdev
HeTo_ is now known as HeTo
arminweigl_ has joined #osdev
arminweigl has quit [Ping timeout: 260 seconds]
arminweigl_ is now known as arminweigl
nyah has joined #osdev
invalidopcode has quit [Remote host closed the connection]
invalidopcode has joined #osdev
<mrvn> heat/zid: Does AoC measure time between loading the page and submitting the solution or simply first 100 submissions by UTC?
nero has quit [K-Lined]
<lkurusa> heat: give a try to https://helix-editor.com/
<bslsk05> ​helix-editor.com: Helix
<lkurusa> I've installed and it's cool but I'll stick to doom-emacs, merges the best of vim and emacs IMO
<zid> but is a terrible version of doom?
elastic_dog has quit [Ping timeout: 255 seconds]
elastic_dog has joined #osdev
<dzwdz> is the osdev.org registration form busted
<dzwdz> or, like, the entire account system? i swear i had an account, i had an entry in my password manager, but it says it doesn't exist
<zid> osdev.org had a feature that at one point worked?
<dzwdz> i'm pretty sure i managed to login like twice
<dzwdz> it worked at two points
<zid> fever dream
k0valski18891 has quit [Quit: Peace out !]
bgs has quit [Remote host closed the connection]
xenos1984 has quit [Ping timeout: 252 seconds]
xenos1984 has joined #osdev
wootehfoot has joined #osdev
SGautam has joined #osdev
gog has quit [Read error: Connection reset by peer]
gog has joined #osdev
teroshan9 has joined #osdev
xenos1984 has quit [Ping timeout: 252 seconds]
lkurusa has quit [Quit: I probably fell asleep (or went out). Who will ever know.]
xenos1984 has joined #osdev
joe9 has joined #osdev
arminweigl has quit [Ping timeout: 248 seconds]
arminweigl has joined #osdev
seer has quit [Quit: quit]
seer has joined #osdev
smach has quit [Ping timeout: 260 seconds]
nyah has quit [Quit: leaving]
aejsmith has quit [Remote host closed the connection]
aejsmith has joined #osdev
bauen1 has quit [Ping timeout: 252 seconds]
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
dude12312414 has joined #osdev
smach has joined #osdev
gog has quit [Quit: byee]
SGautam has quit [Quit: Connection closed for inactivity]
<mrvn> Here is the concept for the perfect editor: The file is a big doom level and each daemon carries a letter. You have to lead them to the right spot and kill them so they drop the letter and that's how you edit the file.
<klange> /kickban mrvn
<mrvn> Advanced mode: When you have "#include" or "import" a portal forms jumping to the respective file.
eck has quit [Quit: PIRCH98:WIN 95/98/WIN NT:1.0 (build 1.0.1.1190)]
eck has joined #osdev
rwxr-xr-x has joined #osdev
wootehfoot has quit [Read error: Connection reset by peer]
gorgonical has joined #osdev
<rwxr-xr-x> guess who's got covid!
<rwxr-xr-x> living has just become painful
<gorgonical> hopefully not you
<rwxr-xr-x> me
<gorgonical> are you feeling okay? hopefully it is a mild case?
<rwxr-xr-x> My mom also got it, and I'm actually pretty okay
<rwxr-xr-x> pretty high fever and aches everywhere, but my body kind of just ignores that and thinks I have a mild cold
<mrvn> that reminds me, I should get vacinated
<rwxr-xr-x> yeah that's the only reason why i'm not dying right now
<gorgonical> I guess it's soup and tea for you huh
<Ermine> get better soon!
<rwxr-xr-x> Doctor said I can eat anything I want actually, but soup and tea is wise
<rwxr-xr-x> thanks!
<gorgonical> I usually take a lot of baths when achey like that
<rwxr-xr-x> me to! helps a lot
<rwxr-xr-x> juicing up on tylenol helps as well
<Ermine> Lemon tea is also a good thing.
<rwxr-xr-x> I haven't tried that
<rwxr-xr-x> sounds good though
<gorgonical> a lot of people like lemon in hot tea. I moved to a place that is very aggressive with lemon in tea
<gorgonical> Horrid
<rwxr-xr-x> haha
<gorgonical> I grew up drinking iced tea in the south and I don't know many who put a lot of lemon in it, so moving somewhere and the tea being so lemony feels somehow wrong lol
GreaseMonkey has joined #osdev
<heat> all my family (in my house) got covid but i didn't
<heat> i'm like, literally immortal
<rwxr-xr-x> I expect nothing less of you heat
<gorgonical> I haven't gotten it but every time I get the shot I'm ill for days
<gorgonical> I have really intense reactions to it. Paying it in a little at a time I guess
<rwxr-xr-x> I feel a small amount worse than when I got the shot for the first time
<rwxr-xr-x> My mom was like that to, if you have intense reactions to the shot, you're in for a bad time with the real thing
<heat> the problem with immortality is that you lose the driving force behind actually doing things (kicking the bucket)
<heat> so that's why I do jack shit
<gorgonical> Probably. I rarely get sick and if I do I am usually very, very ill
<gorgonical> It's either little sniffles or I am in bed for a week unable to eat. Thanks autoimmune diseases lol
<rwxr-xr-x> Oh that's why heat??
<rwxr-xr-x> ah shit
<rwxr-xr-x> i hope you never get it gorgonical
<heat> yup. i'm in no rush to do things, being a literal ethereal being
<rwxr-xr-x> chill
<rwxr-xr-x> how'd you become one?
<heat> bananas
<rwxr-xr-x> that's it??
<rwxr-xr-x> damn
<gorgonical> 25 bananas a day
<rwxr-xr-x> holy shit
Brnocrist has quit [Ping timeout: 260 seconds]
<gorgonical> I knew a guy that became a vegan and actually ate only 20 bananas for like a month
<gorgonical> I tried out of curiosity and couldn't even eat 15 the first day
<rwxr-xr-x> wild
<heat> dude was bananas
<heat> hehehehehehehe
<gorgonical> he tried to convince me it was a good idea -- "I only spend like $200/month on food"
<gorgonical> but at what cost to your joy and happiness?
<rwxr-xr-x> exactly
<heat> i mean, i like bananas
<heat> i think that maybe I could go with 10-15 a day, no need for 20
<rwxr-xr-x> there's a drink that is basically the perfect meal, 3 of those a day, no time spent making meals, but it sucks all the joy of food
<gorgonical> I did that for a week, too
<rwxr-xr-x> yeah
<gorgonical> I had 4 450-calorie shakes a day. The thing that surprised me the most was that my jaw hurt after a few days of not eating anything
<rwxr-xr-x> really?
<rwxr-xr-x> not from sucking out of a straw, or did you just drink it from a cup?
<gorgonical> I drank it out of a blender bottle with those wide openings
<rwxr-xr-x> yeah
<rwxr-xr-x> weird
<mrvn> I'm pretty sure bananas don't have everything you need.
<gorgonical> he discovered that shortly
<gorgonical> started eating an avocado a day, too
<mrvn> I speend a bit more than $200/month on HelloFresh and get a varied diet.
<mrvn> Have to cook it though, so some electricity on top of that.
Burgundy has quit [Ping timeout: 248 seconds]
<gorgonical> a relevant question: I'm writing a device driver for an i2c bus. The bus is broadcast based, so all messages begin with the address of the target and only the target should reply. If I have /dev/i2c0, what should open() do, if anything?
<gorgonical> One option is to just allow writes to send messages directly into the bus, but part of me wants to impose address restrictions
<heat> what should open() do?
<gorgonical> In the permissive case open() I would think gives you a file handle you can write() messages into. The driver handles wrapping them in the correct i2c formats, etc. Or maybe you do that
<gorgonical> But anyway you'd be able to specify address and message yourself
<gorgonical> The file is like a line onto the bus, without muxing or permissions checking
<heat> i mean, you control the i2c0, you can restrict things yourself on write()
<gorgonical> True
<mrvn> If you have an address then it's not broadcasting. It's just a BUS, unlike the universal serial bus, which is point-to-point.
<heat> and if you want the UNIX purist approach, make multiple devices and give each different permissions
<gorgonical> mrvn: I mean yes it is a bus but the bus doesn't send messages based on address
<mrvn> Why not follow standard unix sockets semantic. You can send_to or you can connect/bind
<gorgonical> hmm
<mrvn> gorgonical: that's the nature of a bus. everything goes onb the busd with an address.
<gorgonical> That's probably a better fit. My first thought was ioctl to ask to open a specific address and you get a file handle bound to that address by the driver
<gorgonical> The problem with i2c is that there's no address enumeration, so you either enumerate the entire address space with device files or do something else
<clever> gorgonical: or you just use an ioctl to change the address, and only if you have permission can you change it
<gorgonical> Technically you *can* try to discover devices but it isn't supported by the standard and i2c loudly warns that this might fuck up devices
<gorgonical> clever: kind of reminiscent of a lock
<gorgonical> then you check address -> change address -> open file -> write -> close as the loop
<heat> i think that the only way to do this is by just having an i2c0 with uid 0 and write()
<heat> given that you don't know what are valid addresses, and what they're doing
<gorgonical> but then anyone with access to the bus can access all devices. is the assumption any bus accessors are trusted?
<clever> gorgonical: the other way i see linux handling this, is that a kernel side driver deals with converting something (ioctl, or char device), into accesses for you, to just an approved addr
<clever> and the i2c layer is entirely hidden from userland
<heat> gorgonical, with uid=0 sure
<clever> for example, on the rpi, the camera subsystem is made up of ~3 parts
<clever> 1: the raw CSI input peripheral
<clever> 2: the i2c master
<mrvn> 3; magic
<clever> 3: the camera sensor driver, that uses i2c to talk to the sensor, and the CSI driver to receive raw bayer frames
<clever> so you then get a single /dev/video0 node that gives bayer frames, and ioctl's to change sensor params
<clever> and the i2c is entirely hidden
<gorgonical> yeah I actually am dealing with a camera. I know v4l2 is comprehensive but I'm trying not to re-import the entire infrastructure
<gorgonical> clever: The ultimate idea is to have some camera driver that knows about the underlying pieces, too
<clever> you should look into #libcamera
<clever> on oftc
<clever> libcamera is an open camera stack for many boards, including the rpi
<gorgonical> is libcamera a replacement in the kernel for v4l2?
<clever> it works ontop of v4l
<clever> in the case of the rpi, there is a raw sensor v4l node, that gives you bayer frames and handles sensor parameters
<clever> and there is an ISP v4l node, that does bayer->yuv, computes states, and does software whitebalance and automatic gain stuff
<clever> libcamera is the glue beteween those, and the control loops to set all params based on stats the ISP gives
<clever> computes stats*
<gorgonical> the more I read about modern cameras the more frustrating it is
<gorgonical> So, so much complexity
<clever> the ISP would give an overall brightness to the frame, libcamera will then tell the ISP to adjust the brightness on the next frame (lower latency), but also tell the sensor to adjust the analog gain (higher latency)
<clever> and a few frames later, the sensor reacts and the ISP brightness is adjusted
<clever> modern usb webcams hide a lot of that from you
<clever> one of mine, just spits out h264, fully encoded and tuned
<gorgonical> maybe I am complaining uselessly, but I have been trying to avoid inheriting all these different API frameworks to make a camera work. I usually try to avoid overcomplexifying things when it's just me. Linux obviously has a need for generic mechanisms and frameworks, but I don't necessarily
<clever> if you want your camera to work as a camera in something like chrome/discord, then your better off using v4l
<gorgonical> So the problem with usb is that we don't think we can make it secure enough. The i2c/csi stuff is MMIO and so we can use the MMU to secure that stuff at the hardware level.
<gorgonical> Our goal is something like face recognition on frames to draw bounding boxes
<clever> gorgonical: ah, so you plan to detect extra long cows as well? https://i.imgur.com/KMfFi0L.png
<gorgonical> very long indeed
<gorgonical> much milk capacity
<gorgonical> lol
<gorgonical> are the camera systems on the *bsds mature at all? Or have they mostly adopted the v4l stuff?
<clever> havent looked into bsd at all
<gorgonical> I usually use them as design alternatives at least for reference
<gorgonical> freebsd lifts v4l, openbsd only supports usb video class stuff it seems
<heat> openbsd
<gorgonical> aww man, i was really hoping not to just absorb all the v4l stuff lol
<heat> spongonical
<gorgonical> I don't happen to have years to engineer a replacement
<klange> clever: moo
<heat> I change sysctl.h and it rebuilds the whole kernel or whatever
<heat> this is normal.
MiningMarsh has quit [Ping timeout: 260 seconds]
mavhq has quit [Ping timeout: 268 seconds]
mavhq has joined #osdev
<gorgonical> the linux driver for the camera I have has just arrays of bytes to write to the sensor
<gorgonical> "lifted off the i2c interface" so acquired by sniffing
<gorgonical> my god
<clever> gorgonical: camera sensors often lack datasheets, and you have no idea how to configure them
<clever> sometimes, the datasheet has no actual documentation, just a big array of bytes
<gorgonical> clever: true, but at least sometimes the manufacturer makes a linux driver and vamps, leaving you with some embedded information. in this case maybe nobody knows
<clever> yeah
<clever> the rpi supported sensors have a number of params exposed
<clever> and some of them have proper datasheets, which ive read over
<heat> have you seen the realtek freebsd re(4) driver?
<clever> at least one of them has a test mode, where the sensor is basically disabled, and it just generates test patterns
<gorgonical> i have not
<bslsk05> ​github.com: rere/if_re.c at my · kostikbel/rere · GitHub
<clever> so you can ignore the analog end, and focus on the digital side
<gorgonical> oh my god heat
<heat> i hope you now understand that having an array is not that bad
<gorgonical> man-made horrors beyond comprehension
<klange> > 1.37MB
<klange> oh gods
<klange> this better be autogenerated, but also why not just loop over an array...
<heat> mjg, have you noticed freebsd seems to have a bad header dependency problem
bauen1 has joined #osdev
<bslsk05> ​godbolt.org: Compiler Explorer
<kaichiuchi> interesting that gcc completely bought the farm on this
<heat> riveting code generation
<klange> loop unrolling very much depends on the size of the loop
<heat> waiiiiiiiiit
<mrvn> how does printf clobber memory?
<heat> did clang detect you sorted the thing?
<kaichiuchi> yes
<heat> fucking what
<kaichiuchi> clang did this all at compile time.
<heat> computers are becoming too smart
<klange> very amused by the inlined sort
<heat> fuck this shit
<heat> i'm becoming a doctor
<mrvn> klange: I don't think the loop unrolling is the problem
<mrvn> I'm a bit disapoited by clang. Why does that not optimize into a single 'puts("...");'?
<klange> presumably it does not optimize the printf with a viable format string
<heat> i don't know if merging multiple printfs into one is remotely legal
<mrvn> klange: but it analysed it to check there is no %* in there that would modify memory.
<mrvn> heat: I've seen printf become puts so it (gcc at least) does it even if it's not quite legal.
<klange> what would the format string have to do with that? there are no pointer arguments
<heat> printf("%s", "string") != printf("%d", num); printf("%d", num);
<mrvn> klange: true. a format string with pointer and then int args would be UB
<mrvn> heat: think of it as the compiler inlining the printf till only the 'puts(buf)' remains.
<klange> Since the arguments are locals, the function call can not legally modify anything, and I think "constant format string with line feed and no actual format specifiers" is the only printf case that either gcc or clang optimize anyway
<mrvn> klange: wrong. The %* stores the number of characters written so far in a pointed to thing. And you can have a local pointer there. The compiler has to be smart enough to see that you don't have %* or that you don't have any pointer.
<mrvn> "local" has nothing to do with it
<klange> Any extern symbol can be modified by a function call.
<klange> Since the arguments are 1) not pointers, as we agree, and 2) locals, and thus not extern symbols, there is nothing printf can legally do to modify them.
<mrvn> klange: ok, if you state those TWO then yes.
<klange> yes I already stated the other one
<klange> I'm not going to repeat myself when you can scroll up!
<mrvn> On the other hand printf is a stdlib function and the compiler uses internal knowledge about what printf does internally to do error checking and optimnizing.
<mrvn> printf("%s", str) -> puts(str) is not a legal optimization, unless you use knowledge about printf.
<klange> in this case I think it's largely a matter of "they don't bother to optimize it _that_ far"
<mrvn> And then printf("%d\n", literal) -> puts(string_of_literal) should be just as valid.
<mrvn> and puts + puts + puts --> puts.
<mrvn> klange: I wish they would go that far. It's just so satisfying having people benchmark code and discuss which code is faster and you just throw in a stupid simple solution and end up with puts()
<klange> Is %d fully defined? Some printf specifiers can be locale-dependent.
<mrvn> hmm, because of 1000nd separator and such?
<klange> (actual question, I don't know if locale stuff is allowed to fuck with a bare %d)
<mrvn> 123456 vs. 123_456 vs. 123'456 vs. 123.456 vs. 123,456
<gorgonical> there's not a legal separator in c is there?
<mrvn> klange: it's the LC_NUMERIC category
<mrvn> gorgonical: at least c++ has '
<gorgonical> right
<klange> If the spec allows for such things to happen with just %d, then whammo.
MiningMarsh has joined #osdev
<gorgonical> i have often lamented not being able to write 0x1000'0000 or so
<klange> Bye bye puts() optimization for that case, you have no clue what that numeric format is gonna turn into :)
<mrvn> klange: I think you are right.
<mrvn> There is LC_NUMERIC and if that isn't used for %d then where would it be used?
<mrvn> You could do "printf("%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n", 1,1,1,2,2,4,5,5,5,8);
<mrvn> (on archs with 11 argument registers)
<heat> d,i The int argument is converted to signed decimal in the style [−]dddd
<mrvn> note: 'gcc -Os' creates just slightly more code than "clang -Ofast"
<heat> I don't speak legalese but this seems to disallow locale shit here
<kaichiuchi> i'm still pretty impressed that clang sorted it at compile time
<klange> It's probably not really that it storted it, it just aggressively applied inlining of the static function definition on a constant input.
<kaichiuchi> sure, yes
<kaichiuchi> by the way, do you say your username the same way one would say "clang"
<kaichiuchi> because that would somehow be funny in this case
<kaichiuchi> heh
nanovad has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
<klange> My name may be pronounced as one syllable, in which case, yes, it is the same as the compiler (note that I came first by nearly two decades, so really the compiler is pronounced like one of the options for my name), or the 'k' may be read separately as the letter, or either of those options can be combined with the correct German pronunciation of the trailing e.
<klange> As long as you don't use a soft 'g', it's _probably_ fine.
<mrvn> so no silent e?
<klange> Silent e is implied by 'one syllable'. We lost the pronounced e many generations ago.
<heat> /usr/bin/klange
<klange> Pronunciation of the 'a' is also flexible.
<klange> I have the IPA /keɪ.laŋə/ listed in my Discord profile.
<klange> But the only thing I really care about is that you get the ŋ bit.
<Mutabah> this is where I say that I've mentally been using a soft g all these years
<Mutabah> (i.e. not prounounced like the sound/compiler)