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
epony has quit [Remote host closed the connection]
heat has quit [Ping timeout: 265 seconds]
linearcannon_ has quit [Remote host closed the connection]
ZombieChicken has joined #osdev
dutch has quit [Quit: WeeChat 3.8]
dutch has joined #osdev
JudgeChicken has joined #osdev
ZombieChicken has quit [Ping timeout: 255 seconds]
JudgeChicken is now known as ZombieChicken
<geist> gog: oh no your programming page is 404!
ZombieChicken has quit [Remote host closed the connection]
ZombieChicken has joined #osdev
ZombieChicken has quit [Ping timeout: 255 seconds]
<gog> i don't do any of that
<gog> i'm a web designer now
ZombieChicken has joined #osdev
<geist> but dont web designers have terrible nightmares of 404?
<geist> it's the dreaded 404!
rurtty has quit [Quit: Leaving]
lg has quit [Ping timeout: 246 seconds]
wlemuel has quit [Ping timeout: 255 seconds]
wlemuel has joined #osdev
<moon-child> if 404 is so good how come they haven't made a 405
<geist> moon-child: because it's not allowed
lg has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
gog has quit [Ping timeout: 256 seconds]
ZombieChicken has quit [Remote host closed the connection]
ZombieChicken has joined #osdev
ZombieChicken has quit [Remote host closed the connection]
ZombieChicken has joined #osdev
ZombieChicken has quit [Ping timeout: 255 seconds]
bradd has joined #osdev
ZombieChicken has joined #osdev
Arthuria has joined #osdev
kfv has joined #osdev
bgs has joined #osdev
ZombieChicken has quit [Ping timeout: 255 seconds]
epony has joined #osdev
Arthuria has quit [Remote host closed the connection]
slidercrank has joined #osdev
kfv has quit [Remote host closed the connection]
m5zs7k has quit [Ping timeout: 265 seconds]
m5zs7k has joined #osdev
kfv has joined #osdev
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bgs has quit [Remote host closed the connection]
epony has quit [Remote host closed the connection]
danilogondolfo has joined #osdev
vdamewood has joined #osdev
epony has joined #osdev
xenos1984 has quit [Read error: Connection reset by peer]
remexre has quit [Ping timeout: 250 seconds]
remexre has joined #osdev
xenos1984 has joined #osdev
zxrom_ has joined #osdev
zxrom has quit [Ping timeout: 240 seconds]
nyah has joined #osdev
zxrom_ is now known as zxrom
GeDaMo has joined #osdev
zxrom has quit [Quit: Leaving]
gog has joined #osdev
sakasama has quit [Read error: Connection reset by peer]
kivikakk has quit [Read error: Connection reset by peer]
sham1 has quit [Read error: Connection reset by peer]
jcmdln has quit [Read error: Connection reset by peer]
Irvise_ has quit [Write error: Connection reset by peer]
selfsigned has quit [Read error: Connection reset by peer]
chibill has quit [Read error: Connection reset by peer]
raggi has quit [Read error: Connection reset by peer]
sham1 has joined #osdev
<sham1> Also to do a "Something went wrong :(" screen
<sham1> The dreaded 404 is an opportunity to show cute quotes
pounce has quit [Ping timeout: 246 seconds]
sakasama has joined #osdev
pounce has joined #osdev
sakasama has quit [Remote host closed the connection]
sham1 has quit [Remote host closed the connection]
<zid`> nobody serves 404s anymore
<zid`> they just redirect you to a sales page :P
sakasama has joined #osdev
<gog> i have 4 tonnes of quality copper to sell
Irvise_ has joined #osdev
sham1 has joined #osdev
chibill has joined #osdev
kivikakk has joined #osdev
selfsigned has joined #osdev
raggi has joined #osdev
jcmdln has joined #osdev
<zid`> gog: does your name start with an e?
<gog> eeeeeeeeeeeeeeeeyesssss
<Ermine> gog: may I pet you
<zid`> bloody irc scammers
bauen1 has quit [Ping timeout: 250 seconds]
<gog> Ermine: only if you buy some copper
<zid`> gog the type of person to put the best copper on top where people will test it, and crap underneath
Vercas696 has joined #osdev
Vercas69 has quit [Ping timeout: 255 seconds]
Vercas696 is now known as Vercas69
<Ermine> gog: i prefer fibre
<zid`> gog'nasir
Irvise_ has quit [Ping timeout: 240 seconds]
sakasama has quit [Ping timeout: 252 seconds]
jcmdln has quit [Ping timeout: 248 seconds]
sham1 has quit [Ping timeout: 246 seconds]
raggi has quit [Ping timeout: 260 seconds]
chibill has quit [Ping timeout: 264 seconds]
selfsigned has quit [Ping timeout: 264 seconds]
kivikakk has quit [Ping timeout: 256 seconds]
wlemuel has quit [Ping timeout: 252 seconds]
wlemuel has joined #osdev
raggi has joined #osdev
jcmdln has joined #osdev
sham1 has joined #osdev
kivikakk has joined #osdev
Irvise_ has joined #osdev
sakasama has joined #osdev
bnchs has joined #osdev
selfsigned has joined #osdev
chibill has joined #osdev
chibill has quit [Remote host closed the connection]
sham1 has quit [Write error: Connection reset by peer]
jcmdln has quit [Read error: Connection reset by peer]
selfsigned has quit [Remote host closed the connection]
raggi has quit [Read error: Connection reset by peer]
Irvise_ has quit [Write error: Connection reset by peer]
sakasama has quit [Read error: Connection reset by peer]
kivikakk has quit [Write error: Connection reset by peer]
sakasama has joined #osdev
wlemuel has quit [Ping timeout: 240 seconds]
vdamewood has quit [Quit: Life beckons]
sham1 has joined #osdev
Irvise_ has joined #osdev
raggi has joined #osdev
jcmdln has joined #osdev
kivikakk has joined #osdev
chibill has joined #osdev
selfsigned has joined #osdev
wlemuel has joined #osdev
bnchs has quit [Remote host closed the connection]
bradd has quit [Ping timeout: 255 seconds]
DynamiteDan has quit [Excess Flood]
DynamiteDan has joined #osdev
Halofreak1990 has joined #osdev
Halofreak1990 has quit [Ping timeout: 240 seconds]
joe9 has joined #osdev
bauen1 has joined #osdev
Halofreak1990 has joined #osdev
<zid`> Man, coming up with non-contrived examples to teach beginners pointers is difficult
<zid`> I keep ending up with code that could just be replaced by n = f(n) where n isn't a pointer to begin with too
bauen1 has quit [Ping timeout: 250 seconds]
<zid`> "what about errors?" "I could just put the { printf("invalid banan"); abort(1); } prt inside the function though?"
<nortti> are you teaching them before or after teaching about arrays?
<zid`> arrays needing pointers in C is actually just a weird artefact of the type system, but I feel I will have to do it that way next
<zid`> a[b] being implemented as *(a+b) rather than arrays being full types
<nortti> oh, was asking because you can't return arrays
<zid`> yea exactly why arrays *will* be useful here
<zid`> f(a1, a2, a3, a4, ..) vs strings
<zid`> and can't return arrays, etc
Halofreak1990 has quit [Ping timeout: 248 seconds]
<zid`> I would like to think of a real example for what pointers are actually useful for though, making programs "dynamic"
bauen1 has joined #osdev
bauen1 has quit [Ping timeout: 240 seconds]
bauen1 has joined #osdev
sjs has quit [Ping timeout: 276 seconds]
sjs has joined #osdev
bauen1 has quit [Ping timeout: 276 seconds]
bauen1 has joined #osdev
<epony> you mean position independent
<epony> time to find out about address modes
<Mutabah> zid`: strings?
<Mutabah> being pointers to the text data
<zid`> yea strings is arrays
bauen1 has quit [Ping timeout: 276 seconds]
<sham1> The reason why C arrays feel fake is because they don't really know their own sizes. And how could they? The language was designed at a time when memory was a luxury. No need to store the size of an array, are you mad‽
<sham1> And as for now, can't change it since it might just break just about everything
<Mutabah> zid`: strings are dynamically sized arrays
<Mutabah> another option, you could use multiple outputs? using output pointers
<Mutabah> maybe a division function? takes numerator and denominator, and stores the quotient and remainder in the output... and returns a boolean that is false if the division failed (i.e. zero denominator)
<zid`> You can use a struct
<zid`> structs are lvalues
<zid`> but maybe this is just a thing in general
<zid`> we're all addicted to using explicit pointers when a lot of the time we could just write x = f(x) instead
<zid`> I wouldn't want to, for complicated reasons, but it's hard to briefly explain that to an amateur
<sham1> If you know how many things you need to return, yes. C does have stuff like div_t for this
<Mutabah> zid`: returning a struct is the better higher-level approach, but at the CPU level anything larger than two registers will most likely end up as a pointer
<zid`> >amateur
<Mutabah> Strings/lists are the best option really
<Mutabah> handling a runtime-determined number of items
Jari-- has joined #osdev
<sham1> "I don't want this to move, so I allocated it manually and now to effectively make use of it, I need to use the pointer to it"
<zid`> yea it not needing to move is the sort of example I need
<zid`> but I need it to be simple as possible
<sham1> Since C ofc is pass-by-value
<zid`> not in the bowels of a program
<Mutabah> A massive struct?
<Mutabah> it's not efficient (or even convinent) to do `mystate = foo(mystate)`, so you do `foo(&mystate)`
<sham1> "I need a reference to this object from elsewhere, and the reference has to stay valid and the object needs to update, so I need this pointer so it doesn't move, while allowing me to manipulate it"
<zid`> Mutabah: detail I'd have to eplain
<zid`> and, compilers will optimize it to a pointer internally
<zid`> like, they can't not, it's per the abi
elastic_dog has quit [Ping timeout: 246 seconds]
<sham1> Do the beginners you're talking to know any other languages?
elastic_dog has joined #osdev
<Mutabah> zid`: I'm more thinking ergonomics... `foo` is just editing `mystate`
<Mutabah> why should it have to take it and return it, it could just "walk over there and fiddle with it"
slidercrank has quit [Ping timeout: 255 seconds]
<sham1> Well mystate = foo(mystate) makes more sense and is probably easier to reason about, since it just returns a fresh state, like how you'd do it in functional programming. That it gets optimised to the pointer version is an implementation detail
<Mutabah> Meanwhile, the `foo(&mystate)` way is the "OOP" way
<sham1> Well imperative, but yes
<Mutabah> *shrug*
<Mutabah> zid`: strings or other dynamic-sized arrays
<Mutabah> You could avoid the NUL termination challenges of C strings and just use an explicit length in the example
<GeDaMo> zid`: maybe trees as an example for pointers?
<gog> what's a tree
<GeDaMo> A recursive data structure :P
<gog> oh
<GeDaMo> On the other hand, that might involve explaining recursion :|
<gog> i thought it was a graph with no cycles
<Mutabah> Trees are strictly diverging graphs
<gog> me too
<Ermine> gog: I turned out to lack any stuff supporting fiber cabels, so I agree for some copper
<gog> great! you may pet me and buy my copper
* Ermine buys copper from gog and pets her
<zid`> don't trust gog'nasir
<zid`> noo Ermine
* Ermine enters copper age
<zid`> you wish
<gog> wooo
<gog> idk why that meme kills me
<gog> there's another one about a guy who watched a donkey eating figs and he thought it was so funny after he said "maybe we should get him some wine too" and he laughed so hard he died
<gog> idk if this is a real story from history
<nortti> chrysippus of soli?
<nortti> "Diogenes Laërtius gives two different accounts of his death.[18] In the first account, Chrysippus was seized with dizziness having drunk undiluted wine at a feast, and died soon after. In the second account, he was watching a donkey eat some figs and cried out: "Now give the donkey a drink of pure wine to wash down the figs", whereupon he died in a fit of laughter."
<gog> yes
<zid`> You are standing in my light go away.
<GeDaMo> "The episode is infamous for the documented example of a man laughing to death. Fifty-year-old Alex Mitchell could not stop laughing for a continuous 25-minute period—almost the entire length of the show—and suffered a fatal heart attack as a result of the strain placed on his heart. Alex's widow later sent the Goodies a letter thanking them for making his final moments so pleasant." https://en.wikipedia.org/wiki/Kung_Fu_Kapers
bauen1 has joined #osdev
<sakasama> zid` Basic data structures are great for teaching pointers: linked lists, spaghetti stack and trees. They're also good examples of why iteration might need more than array offsets.
<zid`> mmm sorta
<zid`> people tend to get bogged down in the actual details, I will get there
<zid`> once pointers are slightly more comfortable
<gog> what's a spaghetti stack
<Ermine> Tfw your joke is too good
<zid`> The other weird death thing I remember is tycho brhaehaeh dying from needing a piss
<zid`> cus he refused to have to excuse himself at a fancy dinner
bauen1 has quit [Ping timeout: 240 seconds]
<zid`> the astronomer guy
<zid`> with the nose?
bauen1 has joined #osdev
<Ermine> zid`: it's one of the versions
<zid`> w're baktracking into initialization vs assignment atm
<zid`> because I brought up arrays not being lvalues
<zid`> slow and steady :D
<zid`> he's thinking it all through at least
* sakasama stacks spaghetti over gog.
<gog> i've died from needing a piss
* gog eats spaghetti
<zid`> I've died from pissing too much
<zid`> Old age.
<sakasama> The mortality rates here are terrible.
<zid`> It's the air quality I think
<sakasama> Too much cheap copper dust.
<zid`> if it's even really copper
<zid`> who knows with gog'nasir roaming around
<gog> it's mostly fired clay with copper plating
<zid`> shh
<zid`> The correct answer is "It was fine when I sold it"
<zid`> "I'd be asking questions to the courier, not me"
<zid`> Where my E2th element of E1 bitches at
Matt|home has joined #osdev
<Ermine> Do people die from being pissed off?
<zid`> yes
<zid`> it's called blowing a head gasket
joe9 has quit [Quit: leaving]
joe9 has joined #osdev
<gog> ok i'm just starting now to work with EF.Core
<gog> and it's so freakin nice
<gog> omg
<gog> we don't have to run a big fragile program to generate shitloads of bad code for us anymore
<gog> i love it
<gog> microsoft makes decent products sometimes
<gog> not windows
<gog> the NT kernel yes
<gog> windows, no
<zid`> I actually really like win32
<gog> i've never coded with it really
<zid`> Just pick what you wanna do, write that sentence and end it with ()
<zid`> that function exists and has a sane interface (usually)
<zid`> I want to create a window..? Sure, CreateWindow()
<zid`> I want to.. enumerate.. the .. monitors?
<zid`> Sure, EnumMonitors()
<zid`> I want to .. create a file? SUre. OpenFile.
<zid`> (wait what)
<gog> MapViewOfFile
<Ermine> gog: is EF.Core js framework?
<gog> c#
<gog> dotnet
gildasio has quit [Remote host closed the connection]
<zid`> Fun fact, my stack explodes at f(64908) if I write recursive return f(x+1)
<zid`> so I assume windows has.. 128k stacks?
<zid`> err 256k
gildasio has joined #osdev
<zid`> err even bigger cus return address and alignment..
<zid`> 1MB!?
Left_Turn has joined #osdev
<geist> that seems reasonable, yes
<geist> actually 1MB may be a little small for the default stack
<zid`> 1MB is beyond reasonable
<geist> mkay
<geist> i've seen much larger than that. pretty sre linux defaults to something somehwat bigger than even that
<geist> for the first stack at least
xenos1984 has quit [Ping timeout: 240 seconds]
<zid`> mine's 8kB or 8MB I can't tell
<zid`> it jsut says 'size 8192'
<geist> yah 8MB
<geist> lots of code just assumes you can use fairly large amount of stack in main() in a single threaded app
<geist> makes sense, create a few objects on the stack, call into a pile of code that performs a task with it
<geist> no heap, gets it done
<zid`> I assume "lots of C++ programs in their constructors", more than anything
<zid`> is what caused beeg stack
<zid`> to be historicallyt rue
<geist> possibly, but i'd also histrically say a lot of C code can do that
<geist> though i guess historicially C code would probably make a lot of globals
<geist> but in a single threaded, classic enviroment, the stack would be The Stack and it'd grow down from the top of the address space, and you'd have basically as much stack as you have memory in the system
slidercrank has joined #osdev
<geist> actually linux has this pretty grody scheme where it can dynamically grow the stack mapping automatically in the kernel
<gog> dynamic stacks!
<geist> it's pretty nasty. someone was asking about something equivalent in zircon and it was like ugh no way
<nortti> is it the stack probe thing, or something else?
heat has joined #osdev
<gog> heat
<gog> heat heat heat
<heat> hi
heat has quit [Remote host closed the connection]
<gog> :<
heat has joined #osdev
<heat> oh yes good ol ping timeout
<zid`> I accidntally just tail call optimized my example use of a software stack
<zid`> so it never goes deeper than 1 element
<zid`> I'm TOO GOOD AT PROGRAMMING
<heat> i'm having easily the worst weeks of my life
<heat> checkmate atheist
<geist> nortti: i think it's stack probe? something like if you fault within some certain distance of the bottom of a stack mapping, it'll just expand the stack mapping
<zid`> heat have you tried staring at some footballers' legs, that usually cheers you up
<heat> i'm afraid that doesn't help atm
<gog> what's the matter, buddY?
zxrom has joined #osdev
<zid`> gog'nasir has some copper to gift you
xenos1984 has joined #osdev
gog has quit [Quit: Konversation terminated!]
qubasa has quit [Remote host closed the connection]
xenos1984 has quit [Ping timeout: 248 seconds]
<heat> geist, musl has historically had issues with its small thread stacks (80k, then bumped to 128k)
<heat> while glibc uses RLIMIT_STACK so you get a multi-megabyte stack
<geist> yeah and also i remember hearing about some sort of feature/extension where an ELF section declares the size of the initial stack, if you want to override it
<geist> i dunno what loaders honor it though
<heat> yes, they sometimes use GNU_STACK for it
<heat> program header
xvmt has quit [Remote host closed the connection]
<geist> yah gues you’d use that if you had exceptional needs
<heat> linux does not seem to honor the size, although it does honor the perms (for the executable bit)
<geist> glibc doesn’t?
<geist> or you’re using something otherthan glibc?
<heat> i'm looking at the codez. saying that the kernel's elf loader does not look at the size in PT_GNU_STACK
<geist> ah but seems like the ld.so loader could probably honor it and then switch to the newer stack
<geist> since doesn’t the kernel loader just load ld.so?
<heat> yes
xenos1984 has joined #osdev
<heat> ldso does re-mprotect the stack if the perms don't match up
<heat> actually no, they do not seem to use any GNU_STACK stuff for sizing. huh.
<heat> i could've sworn this was true
<heat> aha. this is true only in musl
<bslsk05> ​git.musl-libc.org: musl - musl - an implementation of the standard library for Linux-based systems
<geist> yah that’s probably where i heard about it, because fuchsia uses a fork of musl, we probably also picked up the feature
<geist> makes sense, look like it finds the max of the main program and all the dynamic libs that it knows about
FreeFull has joined #osdev
qubasa has joined #osdev
<heat> i'm seriously surprised you didn't just take another much larger stack size for threads
dude12312414 has joined #osdev
<heat> i don't see much reasoning for small thread stacks in fuchsia. you can only make the case for address space exhaustion (on 32-bit) and systems without overcommit
<ChadGPT> how small is small
Halofreak1990 has joined #osdev
<heat> musl used 80k and bumped them up to 128
<ChadGPT> huh
bauen1 has quit [Ping timeout: 265 seconds]
<heat> zircon uses 256KB by default but does respect PT_GNU_STACK
<bslsk05> ​cs.opensource.google <no title>
<heat> even then, seems silly small
Halofreak1990 has quit [Ping timeout: 240 seconds]
Halofreak1990 has joined #osdev
danilogondolfo has quit [Remote host closed the connection]
bauen1 has joined #osdev
dutch has quit [Quit: WeeChat 3.8]
wlemuel has quit [Quit: Ping timeout (120 seconds)]
wlemuel has joined #osdev
Burgundy has joined #osdev
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
_xor has joined #osdev
dutch has joined #osdev
Halofreak1990 has quit [Ping timeout: 246 seconds]
Halofreak1990 has joined #osdev
ThinkT510 has quit [Quit: WeeChat 3.8]
ThinkT510 has joined #osdev
slidercrank has quit [Ping timeout: 240 seconds]
wlemuel has quit [Quit: Ping timeout (120 seconds)]
gildasio1 has joined #osdev
wlemuel has joined #osdev
gildasio has quit [Ping timeout: 255 seconds]
alturmann1729 has joined #osdev
Halofreak1990 has quit [Quit: Konversation terminated!]
joe9 has quit [Quit: leaving]
gog has joined #osdev
deflated8837 has quit [Ping timeout: 255 seconds]
deflated8837 has joined #osdev
gildasio1 has quit [Remote host closed the connection]
gildasio1 has joined #osdev
Jari-- has quit [Ping timeout: 240 seconds]
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
Matt|home has quit [Ping timeout: 250 seconds]
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
Left_Turn has quit [Read error: Connection reset by peer]
terrorjack has joined #osdev
[itchyjunk] has joined #osdev
morgan has quit [Read error: Connection reset by peer]
morgan has joined #osdev
FreeFull has quit []
Reinhilde is now known as Ellenor
sprock has quit [Quit: brb]
sprock has joined #osdev