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
<geist> i kinda like the 'hey beter' one
<geist> that whole class of meta jokes is pretty absurd
<geist> as far as absurd i'm much more into tim & eric, or eric andre or something like that
<bslsk05> ​i.redd.it: Reddit - Dive into anything
<geist> meguca is suffering is pretty good too
<mjg> 8/
<mjg> heat: have you been on 4chan by any chance
<heat> yes
<mjg> utter nonsense seemed to be their thing (one of them anyway)
<heat> no, 4chan is offensive humor (sometimes with air quotes around humor)
<mcrod> i have it blackholed
<milesrout> as Richard Stallman once said of /g/ "I tried to look at that page but saw only inane comments."
<mjg> if stallman says that it may go either way man
<immibis> mcrod: great, now i have to change the combination on my luggage
<mjg> what is /g/ about
<heat> linux i think?
<mjg> aptly named
<mjg> after GNU
<heat> ah no, technology
<mjg> technoloGy
<milesrout> technology
<mjg> i get it
<milesrout> they probably just ran out of letters
<mjg> some unix vibes
<milesrout> when they creat'd it
<mjg> i wonder how many syscalls got misnamed because the teletype malfunctioned
<mjg> "well fuck it"
<mjg> "who cares"
<milesrout> there's a thread on /g/ right now about templeos
<mjg> the really funny bit here is that the binary is named umount
<milesrout> well about whether the CIA killed Terry actually
<mjg> but syscall is unmount
<mjg> like wtf man
<mcrod> immibis: what
<heat> milesrout, did you see the pinned post? rms, ballmer and terry + an anime girl
<mjg> wait, are you active 4chan users?
* mjg hands out some bans
<heat> no, but i have a web browser
<milesrout> very occasionally browse it but it's very low quality these days
<milesrout> half the threads on /g/ are just about muh ai
<heat> mjg, also it's umount on linux
<milesrout> desperate nerds hoping for an AI chatbot girlfriend
<heat> pog
<immibis> mcrod: 8675309, that's the combination on my luggage
<mcrod> you're kidding me
<mcrod> you do realize that's also a well known song
<immibis> mcrod: you do realize that's also a well known meme
<mcrod> yes
<immibis> oh hey, my cellphone internet is down. do you think they finally banned me for using multiple terabytes per month for the last several months? probably not at 2am
<immibis> although that's midnight utc so who knows
<bslsk05> ​'Spaceballs 12345' by bvontob (00:01:05)
<immibis> oddly enough the apartment wi-fi which I am now connected to is both slower and less reliable than my cellphone
<immibis> i don't know what it is beyond the wi-fi. probably something fast. wi-fi is usually affected a lot by interference in apartment buildings
<milesrout> i guess the transmitters for wifi are a lot weaker than the ones for cellphone networks
<heat> my 5g is miles faster than my wifi (2.4GHz and 5GHz)
<zid> My 5GHz wifi is like 2.1x faster than my 2.4GHz wifi
<milesrout> my wifi works for my phone in bed, but my laptop only connects if it's at the foot of my bed
<milesrout> so i sftp a couple of tv show episodes with it at the foot of my bed while i brush my teeth :D
<gog> hi
<heat> gog
<gog> heat
<heat> geist
slidercrank has quit [Ping timeout: 245 seconds]
<immibis> milesrout: they are, but it's more to do with the amount of traffic
<immibis> cellphone networks are centrally managed; wi-fi is a free-for-all
<immibis> transmitter strength is relative to distance, anyway
<milesrout> my wifi network is ~nowhere near any other wifi network, and is 5GHz, and still barely reaches one of the TVs or my bed.
<milesrout> maybe i could boost the transmission power idk
<milesrout> it's set to 100% on the router *shrug*
<immibis> obstructions?
<immibis> consider moving the router; also consider using wired connections wherever possible. Wi-fi to a TV is a crime of laziness
<milesrout> just walls, really. can't touch the walls, or change where the fibre comes in, sadly.
<milesrout> it's life i'm afraid. will be moving to a new place next year, hopefully will be better
<immibis> wi-fi is also designed so a network can have more than one transmitter.
<immibis> they are called access points
<bl4ckb0ne> the quality on /g is abysmal
<bl4ckb0ne> the real deal is on /x with autistic larpers trying to summon a succibus
<geist> hmm, is that why reddit starts with /r?
<geist> to fit in with the trend at the time?
<milesrout> immibis: if i could wire an access point in that would be ideal, i guess
jimbzy has quit [Ping timeout: 264 seconds]
jimbzy has joined #osdev
<Griwes> https://www.oracle.com/news/announcement/blog/keep-linux-open-and-free-2023-07-10/ we live in the wildest timeline, oracle is throwing shade on ibm in the year of our lord 2023 and it is somewhat newsworthy
<bslsk05> ​www.oracle.com: Keep Linux Open and Free—We Can’t Afford Not To
nyah has quit [Quit: leaving]
valshaped742 has quit [Quit: Gone]
MiningMarsh has quit [Ping timeout: 240 seconds]
lainon has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
valshaped742 has joined #osdev
lucartc has quit [Remote host closed the connection]
[itchyjunk] has quit [Ping timeout: 240 seconds]
frkazoid333 has joined #osdev
[itchyjunk] has joined #osdev
bnchs has joined #osdev
eddof13 has joined #osdev
eddof13 has quit [Client Quit]
[itchyjunk] has quit [Remote host closed the connection]
guideX has quit [Ping timeout: 258 seconds]
Vercas has quit [Quit: Ping timeout (120 seconds)]
Vercas has joined #osdev
smeso has quit [Quit: smeso]
smeso has joined #osdev
eddof13 has joined #osdev
eddof13 has quit [Client Quit]
<sham1> You know you have screwed up when Oracle is the company that's the voice of reason
Vercas has quit [Quit: buh bye]
Vercas has joined #osdev
Andrew has quit [Killed (zinc.libera.chat (Nickname regained by services))]
<immibis> no
<immibis> they're the voice of profits. Sometimes profits and reason align, fleetingly
<[Reinhilde]> Oracle is a lawnmower. It will do the right thing if that helps them mow more lawn.
<immibis> zuck gained a whole lot more bootlickers this week
<immibis> and last
frkazoid333 has quit [Ping timeout: 240 seconds]
GeDaMo has joined #osdev
<heat> kernal
<heat> ok so random question
<heat> if((ip->i_mode&(IFCHR&IFBLK)) == 0)
<heat> the fuck is this supposed to mean?
<heat> ip->i_mode & (IFCHR|IFBLK) would make sense, but this always looks to be false? considering IFCHR and IFBLK are separate flags
<heat> (this is straight from v7 source code)
<Griwes> what's the bit patterns of the flag things? because I found a source file in which they have a common set bit
<heat> oh, that may be it
<heat> bizarre
<heat> #defineIFCHR0020000/* character special */
<heat> #defineIFBLK0060000/* block special */
<heat> yep
<Griwes> indeed
<Griwes> (I'm unreasonably angry at those constants being octal)
<heat> you should read old unix
<heat> every constant was octal
<heat> hex was not really a thing
<Griwes> (also unreasonably angry that octal is even a thing that was ever available in C)
<bslsk05> ​github.com: Onyx/kernel/include/uapi/stat.h at master · heatd/Onyx · GitHub
<Griwes> minimizing the amount of unix code I read is one of my goals in life
<heat> too late
<heat> #defineILOCK01/* inode is locked */
<heat> #defineIACC04/* inode access time to be updated */
<heat> #defineIMOUNT010/* inode is mounted on */
<heat> #defineIUPD02/* file has been modified */
<heat> #defineIWANT020/* some process waiting on lock */
<heat> #defineITEXT040/* inode is pure text prototype */
<heat> #defineICHG0100/* inode has been changed */
<klange> it was the style of the time
<heat> blessed_octal.gif
<sham1> Octal made sense for PDP-11s
<GeDaMo> 18-bit?
<GeDaMo> Nope, 16-bit
<sham1> Err, was it PDP-8
<sham1> Anyway, one of them had a funky word size like 36 bits
<GeDaMo> 12-bit
<sham1> PDP-10 was apparently a 36-bit machine
<sham1> Octal makes sense there
<Griwes> that makes me have *less* sympathy for octal, what a series of awful decisions
<kazinsal> octal was just a thing that DEC liked
<sham1> 35 bits is the minimum one needs to represent decimal numbers up to 10 digits, both positive and negative. And with 36 being a multiple of 2…
<klange> "we just think it's nifty"
<kazinsal> most of the 11's instruction set breaks down really cleanly into octal categories
<bslsk05> ​gist.github.com: x86 is an octal machine · GitHub
<kazinsal> also since all eight of the PDP-11's registers are all addressible using all addressing modes (iirc) there's three bits of addressing mode selection and three bits of register selection
<sham1> I've played around with Z80 (well technically the Sharp CPU that's a stripped down Z80, found in GameBoys) and there the instructions also group neatly by octal
<kof123> i'll just... <points at https://github.com/PDP-10/kcc/ > "PDP-10 was apparently" you mean IS!
<bslsk05> ​PDP-10/kcc - Kok Chen's C compiler for PDP-10 (0 forks/7 stargazers)
<kof123> IIRC k&r only. nevertheless IS!
<kof123> scratch that, it has some ansi-ish stuff
<sham1> I don't like the indentation in the code there
goliath has joined #osdev
<milesrout> ew whitesmiths style
slidercrank has joined #osdev
danilogondolfo has joined #osdev
nyah has joined #osdev
gog has quit [Ping timeout: 245 seconds]
sprock has quit [Ping timeout: 246 seconds]
sprock has joined #osdev
gog has joined #osdev
<gog> mew
* kazinsal pets gog
* gog prr
vdamewood has joined #osdev
<Ermine> gog: may I pet you
<gog> Ermine: yes
* Ermine pets gog
* gog prr
zxrom_ has joined #osdev
zxrom has quit [Ping timeout: 245 seconds]
* vdamewood gives gog a fishy
MiningMarsh has joined #osdev
zxrom__ has joined #osdev
zxrom_ has quit [Ping timeout: 246 seconds]
zxrom_ has joined #osdev
zxrom__ has quit [Ping timeout: 240 seconds]
m5zs7k has quit [Ping timeout: 245 seconds]
m5zs7k has joined #osdev
gareppa has joined #osdev
zxrom_ has quit [Ping timeout: 245 seconds]
lucartc has joined #osdev
gxt__ has quit [Remote host closed the connection]
foudfou has quit [Remote host closed the connection]
lucartc has quit [Remote host closed the connection]
gxt__ has joined #osdev
foudfou has joined #osdev
lucartc has joined #osdev
lucartc has quit [Client Quit]
lucartc has joined #osdev
lucartc has quit [Remote host closed the connection]
lucartc has joined #osdev
Left_Turn has joined #osdev
bliminse has joined #osdev
mhall has joined #osdev
valshaped742 has quit [Read error: Connection reset by peer]
* gog chomp fishy
valshaped742 has joined #osdev
zhiayang has quit [Quit: oof.]
frkzoid has joined #osdev
zhiayang has joined #osdev
zxrom_ has joined #osdev
zhiayang has quit [Client Quit]
zhiayang has joined #osdev
dude12312414 has joined #osdev
goliath has quit [Quit: SIGSEGV]
zxrom_ is now known as zxrom
zxrom is now known as zxrom512
zxrom512 is now known as zxrom
<heat> gog
<heat> hi!
<heat> gog!!!
<heat> give me immediate attention i am a baby
<zid> did someone hear something
<zid> Must have been doggers outside my window
<gog> heat
<gog> heat
<gog> hi
<gog> you are baby
<gog> doggers
lucartc has quit [Ping timeout: 260 seconds]
<zid> Is that your new catchphrase
<mjg> i just came up with a genz joke
<mjg> anti-nuke grey collar
<mjg> get it? no sense whatsoever
<bl4ckb0ne> E.
<heat> mjg it's not funny just because you said it
<heat> gog hi gog hi gog hi can we got for a car ride
<heat> go*
<mjg> you mean because i pointed out it does not make sense
<mjg> or me not being a genz to begin with
<heat> yes
<zid> heat wants to go dogging
<gog> i don't onw a car
<gog> so no
<gog> we'll go for a walk
<gog> bl4ckb0ne: E
<gog> E E E e e e e e
<heat> did u get a stroller for me
<gog> yes
<heat> i dont want to walk
slidercrank has quit [Ping timeout: 252 seconds]
<heat> nicee!
<GeDaMo> Ǝ
<mjg> ∀
<gog> wow that for-all looks really weird in this font
<bl4ckb0ne> gog my bootloader works without kvm
<gog> bl4ckb0ne: yeah i don't use kvm while i'm testing
<heat> bl4ckb0ne, ok so either your kvm is absurdly borked or your bootloader is subtly borked
<gog> more likely the bootlaoder
<bl4ckb0ne> i dont trust kvm
<heat> does it boot normal stuff? if so, bootloader borked
<bl4ckb0ne> my code is flawless
<gog> lmao
<gog> lol
<gog> my code is flawless too
<gog> except for all the flaws
<bl4ckb0ne> but we dont talk about that
<mjg> heat: i'm sorry i provoked this
<bl4ckb0ne> ill dig deeper soon
<heat> my code is unlikely to have been used in the yugoslav wars
<heat> linux, windows and BSD though? :v
<bl4ckb0ne> the sam code runs fine with kvm on intel
<bl4ckb0ne> definetly ayymd issue
<heat> show code
<heat> how does it fuck itself?
<bl4ckb0ne> same code as before, the silent triple fault
<heat> i dont know what code was before
<bslsk05> ​git.sr.ht: ~bl4ckb0ne/hboot: src/mmu.c - sourcehut git
<heat> ok so, issues: 1) you have G set but you don't know if G is enabled
<heat> you don't zero the tables so reserved bits can get set magically
<heat> well, not in this case, but iirc you mentioned AllocatePages yeah?
<heat> // Additionally map the first 1GiB physical to the last 1GiB virtual
<heat> this means nothing
<heat> wait, no, sorry, am stupid
<bl4ckb0ne> i wanted to move to allocatepages but havent finished the patch
<bl4ckb0ne> im not the author of that code fwiw
<heat> also IIRC AMD KVM stuff added a window up in the high TBs (physical), that may be it
<bl4ckb0ne> wdym
<heat> AMD KVM qemu stuff adds a region really high up in TBs
<heat> that's literally what I mean
<bl4ckb0ne> oh
<bl4ckb0ne> i see
<gog> i feel like that recently broke something for me
<bl4ckb0ne> ty for the tips, ill poke around soon
<gog> maybe i am using kvm
<heat> is all of that running under EFI BS?
<heat> (BS meaning bullshit)
<bl4ckb0ne> yep
<heat> no
<heat> systab->BootServices->ExitBootServices(image, map_key);
<heat> init_mmu();
<heat> so fwiw you can't AllocatePages there, since you're out of bs
<bl4ckb0ne> oh after not under
<bl4ckb0ne> yeah that why i stick with static arrays
<zid> I don't understand this array of arrays
<heat> ok so you don't need to map any magical stuff like that AMD window
<heat> the rest looks ok? it may be the G thing
<zid> heat what is the array of arrays for
<heat> 64 page tables as separate symbols would not work very well, would it
<zid> only pd_ident[0] is used though
<zid> oh no it's upside down, FOUND IT
<zid> the addresses get taken, *then* the arrays get filled out
<heat> im not a fan of for (size_t i = 0; i < IDENT_PDS; i++)
<heat> for (size_t j = 0; j < 512; j++) {
<heat> this literally takes me back to tricky early UNIX code
<zid> I'd have just made a static function to do the mapping, with a nice vaddr and paddr variable
<zid> to make it easier to grok
<bslsk05> ​github.com: unix-history-repo/usr/src/sys/sys/nami.c at BSD-4-Snapshot-Development · dspinellis/unix-history-repo · GitHub
<zid> and a struct pagetable { uintptr_t vaddr[512]; } or something
<zid> now everything has nice names
<bslsk05> ​github.com: bootstrap/boot/main.c at master · zid/bootstrap · GitHub
<heat> mjg: you go on about "PESSIMAL" shit but tricky weird code is much much worse
<zid> then an identity map looks like map_page(addr, addr, PF_X, 1); and a virtual mapping looks like map_page(vaddr, paddr, ..)
<zid> and you loop doing map_page
<zid> for(page = start; page < start + len; page += 0x1000)
<zid> map_page(VIRT_TO_PHYS + page, page, PF_W, 0);
<zid> much easier to read imo
<heat> i find bl4ckb0ne's approach better here
<heat> no need for fancy routines
<zid> fancy?
<zid> It's the same code but inside a static function so you get two local names
<zid> also there are tab characters inbetween the defines, gross
<bslsk05> ​gist.github.com: gist:3c68a18db30bc8d56699b1e6f10ed23c · GitHub
<zid> There's also this
<zid> oh was it 2M pages? line 25 needs changing, same shit
<zid> oh I can edit gists, right
eddof13 has joined #osdev
goliath has joined #osdev
gog has quit [Quit: Konversation terminated!]
lainon has joined #osdev
gog has joined #osdev
<gog> :3
slidercrank has joined #osdev
lainon has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 246 seconds]
<sham1> :3
<zid> :4
<sortie> :4
<kazinsal> :V
<GeDaMo> :∞
<sortie> :^
<kazinsal> :>
<sham1> Interesting faces
<gog> :°
<FireFly> c:
<gog> d:
<FireFly> Ɛ:
<gog> :b
<gog> :p :b :q :d
<sortie> ^[
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #osdev
<gog> hi
<sham1> hi
<kazinsal> ih
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<gog> :3
goliath has quit [Quit: SIGSEGV]
<Ermine> hi gog, may I pet you
lainon has joined #osdev
linear_cannon has quit [Ping timeout: 252 seconds]
linear_cannon has joined #osdev
<gog> Ermine: yes
eck has quit [Ping timeout: 246 seconds]
zxrom_ has joined #osdev
zxrom has quit [Read error: Connection reset by peer]
eck has joined #osdev
dude12312414 has joined #osdev
* Ermine pets gog
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
<bslsk05> ​preview.redd.it: Reddit - Dive into anything
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #osdev
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<heat> gog my fucked up knee is back
<heat> do you think i should go to an orthopedist? probably a good idea right?
<zid> You should go to the vet to be put down
<heat> cheers
<heat> but seriously fucking hell why is my body breaking down
<heat> im fucking 20 not 67 and balding like mjg
<mjg> maybe the shit jokes are catching up with you
<mjg> taking a tool
<mjg> toll
<sbalmos> heat: a sledgehammer will take care of that
<sham1> Could also be a tool
<Griwes> bodies are shit in general
<sham1> But can't really dispose of them
<mjg> heat's idea of exercise: getting up from the couch to take a piss
<mjg> also heat "why is my body falling apart wtf im genz"
<heat> i go to the gym and play tennis almost every day u doofus
<sham1> But is that exercise
<heat> i literally stopped tennis for 1 week cuz i was kinda sick, and my fucky knee came back
<heat> hmm, good point, is gym exercise? can't tell
<Griwes> that amount of playing tennis may be why your knee is not satisfied :P
<heat> nope, i literally just stopped
<Griwes> yeah, and it felt that you are capable of stopping and made you do it again
<gog> i feel like shit when i don't exercise tbh
<heat> amen brotha
<gog> and i don't think is psychosomatic
<heat> or sista
<gog> the latter pls
<gog> :P
gareppa has quit [Quit: WeeChat 3.8]
<heat> :p
<heat> but srsly i should probably get this checked out by a non-GP
<sham1> Probably ought to
deflated8837 has quit [Read error: Connection reset by peer]
<mjg> heat: playing tennis on wii is not exercise idiot
<mjg> go outside once in a while
<heat> excuse me
<heat> im on the xbox 360 kinect
<heat> im not a wii
<heat> fanboy
<mjg> hmm i don't knowabout that one
<mjg> will have to get back to you
<heat> my mom says you can come to our place and play kinect star wars all afternoon
<mjg> funny story
<mjg> back in the day i had a friend who was doing extramural studies, classes about every other week
<mjg> on weekends + friday evening
<mjg> and he would sleep at my place since he was from out of town
<mjg> first year he mostly attended classes
<mjg> but then he would show up on the friday, immediately change into pyjamas
<mjg> he would stay in them till sunday evening
<mjg> he would consume pizza, energy drinks and pepsi the entire time while playing some MMO
<heat> >pepsi
<heat> murderer alert
<mjg> i believe he still managed to pass all the way to the end
<mjg> cause this is a typical scam higher uni
<bslsk05> ​lwn.net: [PATCH v2 0/2] Lock and Pointer guards [LWN.net]
<heat> this is hilarious
<heat> they're doing budget RAII now
<heat> i can barely wait for [PATCH 0/2] Exceptions - a new way to propagate errors through the kernel
<sham1> First they add Rust support and now this. Linus is getting soft
<heat> yup, linus is SOFT and OLD
<heat> what's next, userspace drivers? lol
<bslsk05> ​docs.kernel.org: Userspace block device driver (ublk driver) — The Linux Kernel documentation
<heat> o wait
<mjg> looks a shite proposal, very rust-style
<Griwes> lol reinventing raii, just badly
<heat> wdym very rust style?
<mjg> i'm negatively surprised this is getting traction in this form
<mjg> FEARLESS CONCURRENCY while performance being openbsd-esque, all while using locks, requires reducing their f-ing scope
<mjg> the thing to do would be to require annotations that intentionally pass the lock up to the caller instead of unlocking yourself
<mjg> and othewrise unlock yourself
<heat> what
<mjg> what
deflated8837 has joined #osdev
<heat> lock guards have nothing to do with scope
<heat> spin_lock(&lock); ... spin_unlock(&lock); vs scoped_lock g{lock}; ...
<heat> literally the same thing
<bslsk05> ​lwn.net: Re: [PATCH v2 0/2] Lock and Pointer guards [LWN.net]
<mjg> they want automagic unlock
<heat> in fact, you can return the scoped_lock in C++, no idea about the C hilarity here
<mjg> i'm saying that's bad
<heat> why?
<Griwes> ...automatic unlock on scope exit is good
<mjg> instead, if one is concerned with locks leaking when they should not, add annotations of intended behavior
<Griwes> it's how you avoid forgetting to unlock on some or all branches
<heat> have you considered that scoped locks effectively clean up exit and error paths?
<mjg> see above
<sham1> I suppose the pessimal part about this is that locking probably shouldn't correlate with scope necessarily
<heat> btw clang at least does not support conditional locking mate
<Griwes> even people writing real world C have realized that and started making sure they get automatic cleanup with compiler attributes
<mjg> by real world c you must mean systemd here
<sham1> This is why I enforce one-place return religiously
<Griwes> systemd is actually doing this right vOv
<heat> mjg, qemu, glib
<sham1> Well, not really. But reducing the amount of return paths is useful for this. Esp if you goto to an error path
<Griwes> one-place return is silly
<mjg> by relying on automagic unlock you are mostl iekly extending hold time
<Griwes> just have automatic cleanup and then you don't need to deal with bullshit of goto error;
<Griwes> mjg, have you heard... about braces
<Griwes> I routinely introduce scopes just to limit resource lifetime, I'm sure the C extensions for this also support that (because anything else would be insanity)
<sham1> Well the C extensions exist because the compilers are also C++ compilers, so they follow that semsntic
<sham1> Semantic
<sham1> I almost typo'd that twice in the same manner
<sham1> Phones are terrible
<heat> why are you on IRC on your phone? bad move
<sham1> Because I'm going to bed, very, very slowly
<heat> IRC is best used on 90s hardware or a shitty libreboot thinkpad with an FSF sticker
<sham1> > FSF
<sham1> I'd rather not
<heat> also that said thinkpad does not run any conventional distribution due to BLOBS
<sham1> *Maybe* FSFE but yeah
<sham1> And yes, of course you'd run Parabola BTW
<mjg> Griwes: are you for real mate
<Griwes> Yes, and it's been working for me perfectly for years
<gog> hi
<sham1> hi
<heat> you should try out java's synchronized
<heat> that can lock ANYTHING
<heat> int a; synchronized (a) {System.out.println("mjg <3 Sun Microsystems");}
<sham1> It's old-fashioned to just have an Object around you can synchronize with
* gog locks and pops
<heat> synchronized(this)!!
<sham1> Of course modern Java can use a try-with-resources and a real lock type
<sham1> Even works with the virtual threads
<mcrod> hi
<sham1> Didn't think I'd have the opportunity to rant about Java and some of the strange decisions by Sun
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<sham1> So, you can use synchronized on any instance of Object, i.e. any non-primitive type. You can also use any Object as a condition variable, wait on said object until another thread somewhere calls either notify or notifyAll. But this means that you have to put all this condvar stuff into every. Single. Object header
<sham1> I suppose it's neat that you can technically lock on the resource itself instead of needing to lock on an external mutex or something, but it's still a strange choice, which can't even be removed anymore
zxrom__ has joined #osdev
zxrom_ has quit [Ping timeout: 245 seconds]
danilogondolfo has quit [Quit: Leaving]
eddof13 has joined #osdev
dutch has quit [Ping timeout: 246 seconds]
<heat> sham1, doesn't mean that
<heat> you could have a large futex-like hashtable
eddof13 has quit [Client Quit]
<heat> for all of this stuff
dutch has joined #osdev
heat has quit [Remote host closed the connection]
[itchyjunk] has joined #osdev
vdamewood has joined #osdev
Turn_Left has quit [Read error: Connection reset by peer]
<mcrod> tell me something people
<mcrod> and bear with me
<mcrod> there is a reason I am asking
<mcrod> (i am not this silly)
<mcrod> if you set your stack size to `unlimited`, does that mean you never have to use malloc()?
<mcrod> i am waiting for the response that I expect
<mcrod> i am being intentionally cryptic for a reason
<kof123> ram is ram. barring cpu instructions for "stack" stuff... "it's all the same to me." but this of course is going to depend on what a language and "program" does to a stack/how it defines a stack. i mean, you could "simulate" either with either, write/recreate language x inside of language y, etc.
<gog> no
<gog> depending on the language
<gog> presuming a c-like where you mean a call stack that local variables with automatic storate duration live
<kof123> ^ there's "stack" and then there's "Stack"
<gog> but
<vdamewood> Anyone want to exchange stacks?
<gog> if we're talking abouta hypothetical language
<mcrod> this is C/C++
<gog> ok
<gog> then no, the stack is volatile
<mcrod> so if something stupid occurs
<vdamewood> I'd rather program in Hypothetical.
<mcrod> e.g., double gog[2048][2048][200]
<mcrod> first off, under normal circumstances *duh*, yes, this will cause a stack overflow
<kof123> that makes more sense, just make one giant global variable lol
<mcrod> but the stack is not infinite
<gog> yes
<gog> your stack is limited by address space
<vdamewood> Isn' hat how Quake 2 worked?
<vdamewood> that*
<gog> i think a lot of games still work this way
<mcrod> vdamewood: you're getting closer
<mcrod> much closer to why I'm asking
heat has joined #osdev
<vdamewood> One reason you still can't use the stack only, though, is that you may need to allocate memory in one stack frame, and release that stack frame before you dispose of the allocated memory.
<heat> sorry, had to pop back in just to say something
<kof123> sounds like AOS versus SOA maybe
<heat> mcrod: what's up with the socratic questioning you doofus
<mcrod> gog: so, limited by address space, and on x86-64 we have 48 bits that matter only (as far as I know, I am not an x86-64 wizard)
<gog> 57 if you have 5-level paging
<mcrod> heat: i am trying to understand if `ulimit -s unlimited` is actually somehow unlimited, which I doubted in the first place
<mcrod> and goggers over here appears to have answered my question
<heat> obviously not unlimited
<mcrod> yes
<heat> but you just don't have a limit
<heat> as in rlimit
<gog> it's unlimited in the sense that the kernel will do no enforcement
<gog> but you can still OOM
<heat> what's likely to happen is that the stack will colide with an mmap and SEGV your ass
<gog> yes
<mcrod> right
<heat> or obviously exhaust mem
<mcrod> the reason I ask
<gog> which is more likely to happen first on most computers
<mcrod> in more deeper terms
<mcrod> I am investigating memory allocation schemes, and there's a bunch that basically just eat the shit out of the stack
<mcrod> note: not for OS stuff
<vdamewood> Sounds like fun on systems where the stack only holds 356 bytes.
<vdamewood> 256*
<gog> i decided i'm going to learn fortran
<heat> are u stopid
<gog> i am in the named audience
<heat> of stopid ppl?
<gog> for tran
<vdamewood> gog: Yay-ish.
<heat> hahahahaha
<heat> ha
<heat> hahaha
<heat> haha
<heat> ha
<mcrod> i'm just looking through game code
<heat> are u tran?
<heat> a single tran?
<gog> yes
<mcrod> and even for some playstation games malloc() is never called
<heat> mcrod bw what allocation schemes
* vdamewood assigns gog a fishy at birth
<mcrod> read: my understanding is most games will call malloc() once to allocate a shit ton of 'x', then sell off slices to the application to "allocate"
<gog> blub
<heat> yes
<vdamewood> mcrod: Naw, they use .bss
<vdamewood> or the equivalent
<heat> same shit, really
<mcrod> i am trying to understand why this seems to not be being done by any playstation game I've looked at
<vdamewood> but muh details!
<gog> historically there are programs that implement their own malloc because the available one sucks
<mcrod> first off the playstation BIOS was garbage
<mcrod> so that's probably a good reason
<gog> so they either just sbrk() and use that, mmap() and use that or malloc() a large chunk and use that
<gog> so yeah
<gog> definitely the reason for the playstation
<heat> AIUI the cutting edge idea is to have a per-frame pool and allocate on that, then when the frame ends every allocation is implicitly fucked-off'd and you start from a clean slate
<gog> also because a lot of games ovewrote the firmware shadow to get a little extra memory
<mcrod> dammit. they stole my idea.
<gog> at least the areas that were safe to do
<mcrod> this is what I was thinking about on my way home from work
<vdamewood> heat: That sounds like how I implemented my first command interpreter.
<gog> yeah crash bandicoot pioneered this technique iirc
<vdamewood> You run a command, it allocates things, then when the command finishes, the allocator or reset and all the memory is implicitly free'd.
<mcrod> so, my understanding is correct now: `ulimit -s unlimited` means "the kernel will not enforce any bullshit, but you are at risk of being killed at any time, and you're limited by address space"
<gog> yes
<heat> yes
<mcrod> now
<heat> $address_space being limited by x86 mm layout and aslr
<mcrod> each process has its own virtual address space
<mcrod> however, this virtual address space is "shared" with the rest of the system implicitly, seeing as how you can still go OOM if you decided to allocate the entirety of it all
<mcrod> or close to it, whatever, at some point you get canned, you get the idea
<heat> btw, just checked, x86 linux gives you 128MiB of stack
<mcrod> the fuck?
<mcrod> it's not 8MB anymore?
<heat> that's the ulimit
<mcrod> hm, I see
<vdamewood> No one will ever need more than 640k.
<heat> i was just looking at the mmap base placement code
<mcrod> terminology check: ulimit == soft limit
<mcrod> and then the stack is just... the stack, the hard stack maximum
* gog stacks
<mcrod> gog: may I tuck you in and give you a plushie
<kof123> i thought ulimit stuff had soft and hard limits, but maybe that is bsd
<kof123> which is not to deny that, but those terms might already be in use
<heat> did you pick the wrong terms? xD
<gog> mcrod: yes actually it's almost bedtime
* mcrod tucks gog in and gives her a plushie
<mcrod> heat: the fuck you say
* gog prr and snuggle plushie
<kof123> posix me harder. just call the other one harder limit
<gog> i do have a plushie, it's a unicorn
<heat> soft limit and hard limit are rlimit and ulimit terms already
<mcrod> ok
<mcrod> so ulimit is the soft limit which is 8MB on Linux
<heat> no
<gog> POSIX_ME_HARDER_DADDY
<mcrod> ok I see
<heat> ulimit -H looks at hard limits
<mcrod> "Each call to either getrlimit() or setrlimit() identifies a specific resource to be operated upon as well as a resource limit. A resource limit is represented by an rlimit structure. The rlim_cur member specifies the current or soft limit and the rlim_max member specifies the maximum or hard limit. Soft limits may be changed by a process to any value that is less than or equal to the hard limit. A process may (irreversibly) lower its hard limit to any value that
<mcrod> is greater than or equal to the soft limit. Only a process with appropriate privileges can raise a hard limit. Both hard and soft limits can be changed in a single call to setrlimit() subject to the constraints described above."
<bslsk05> ​github.com: Onyx/kernel/kernel/rlimit.cpp at master · heatd/Onyx · GitHub
<mcrod> ok this makes more senes
<mcrod> sense
<mcrod> fuck
<gog> sens
<heat> anyway the stack ulimit being unlimited makes little difference as you will inevitably hit something somewhere that prevents stack expansion
lainon has quit [Quit: Textual IRC Client: www.textualapp.com]
<heat> that being another mmap region or OOM exhaustion
<mcrod> right
<mcrod> so what I'm hearing is
<heat> and mmap can be as close as 128MiB from the stack
<mcrod> using a stack based allocator for a game (example, and of course it depends on the game) may go sideways
<heat> depends on how much memory you're allocating lol
<mcrod> well that's why i said it may go sideways :(
<mcrod> basically, imagine allocating I don't know, 30MB
<mcrod> that I would imagine would _not_ shit the bed
gog has quit [Quit: byee]
<heat> at this point we're speculating on architectural and kernel details
<mcrod> so it's safer to use malloc()
<mcrod> until proven otherwise
<heat> sure
<heat> malloc a whole pool if you'd like, and allocate like that
<mcrod> this is my questioning of you because I am but a wee fly in the land of memory allocations at a die hard implementation level
<heat> anyway, why do you care?
<mcrod> i just said why
<heat> no you didn't
<heat> are you writing a game?
<mcrod> no
<mcrod> this is "i want to understand more about this"
<heat> oh ok
<heat> so yeah we've been discussing the stack but memory allocators are different
<mcrod> but there _are_ stack based memory allocators
<mcrod> yknow', alloca()
<heat> those are just pool based memory allocators with "char buf[0x2000000]; pool_alloc a{buf}"
<heat> alloca() is not a memory allocator
<mcrod> well, it _allocates_ space in the stack frame of the caller
<heat> (in fact, the C++ standard library has the pmr allocators that can do exactly this, point them at a buf and a size and they alloc from that)
<heat> sure, but it's not /really/ memory allocation
<heat> like, you can't return, ever
<heat> if alloca is memory allocation, int a; is memory allocation
<mcrod> ok fair point
<heat> do you want a brain dump about memory?
<mcrod> yes
<heat> ok so UNIXes traditionally layed out memory like "program .text - .data - brk (right after .data) - large gap - stack - top of the addr space"
<heat> then mmap got retrofitted in somewhere in the middle of brk and stack
<heat> linux's modern x86 addr space layout kind of doesn't do this and just makes mmap allocate downwards, mmap base being really high up with some distance to the top of the stack to allow it to grow
<heat> and things like the brk and stack and mmap base are all ASLR'd
<heat> also they randomly picked the ELF PIE executable base to like 2/3 of the address space's size because whatever
<heat> so on a typical distro you can look at your default PIE /bin/bash with pmap $$ and see "0x5500.....(64-bit number) - program .text - .data - some random offset to brk ... mmaps - stack (with random offset to the top)" with mmaps being in reverse-ish order
eck has quit [Ping timeout: 240 seconds]
<heat> also no one really uses the brk anymore so that's not really important anymore
<heat> but, you know, the stack grows downwards on page faults, brk goes upwards on brk(2), whatever, it's pretty standard shit
eck has joined #osdev
linearcannon has joined #osdev
<heat> anyway you have multiple allocation schemes, they're all decently documented in their own respective allocator docs
<heat> power-of-2 allocators are not very good due to lots of internal fragmentation
<heat> so that makes buddy allocation for the heap kinda cringe
<heat> slab allocators are good tho, press 1 for more on that
<mcrod> uh
<mcrod> ok speak about slab allocators
linear_cannon has quit [Ping timeout: 252 seconds]
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<heat> ok so the geniuses up at Sun microsystems thought of a way to allocate objects in such a way that you could easily cache em or whatever, with minimal fragmentation, in a fast way. so slab uses caches which are essentially a struct slab_cache {size_t obj_size; list partial_slabs; list free_slabs; list used_slabs;}. what's a slab? more or less a
<heat> page, where you allocate from
linear_cannon has joined #osdev
<heat> turns out this object allocation thing can be fit pretty easily into a standard malloc implementation
<heat> (use caches of various sizes as bins, and you'll be able to get the slab from the pointer on free() anyway)
<heat> and this is all pretty great as allocating from a slab is dumb-easy, allocating from a cache is dumb-easy (allocate from partials first (to try to fill them up and reduce fragmentation), allocate from free next, else allocate a new slab)
linearcannon has quit [Ping timeout: 246 seconds]
<heat> and you reduce lock contention cuz each cache has its own locking
<heat> then the VMEM paper from ~the same guys came out a few years later, going on about percpu magazines and how you should have a per-cpu cache of objects as that makes it effectively scale on many CPUs
<heat> so you end up allocating batches of objects and putting them on your percpu cache, so the allocation fast path doesn't need to lock
<heat> and yeah, that's pretty much it. some userspace allocators do things kind of differently but the per-cpu/per-thread cache thing is common
<heat> also worth noting that kernel allocators tend to be a lot more greedy with unused memory as page reclamation can reclaim them pretty effortlessly
<heat> whereas userspace could get swapped to death or OOM-kill'd
nyah has quit [Quit: leaving]
<mcrod> i see
<mcrod> this clarifies a few things