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
* heat reads the scrollback
<heat> wtf
<heat> for the hardware weirdos out here: why does so much stuff do "register stores the value - 1"
<moon-child> huh?
nyah has quit [Quit: leaving]
<heat> easiest example I can think of from the top of my head is the GDTR's limit
<zid`> huh?
<zid`> register doesn't store the value -1
<heat> i mean "value - 1" not "-1"
<zid`> it doesn't
<heat> it does
<zid`> it stores the value you gave it
<heat> ... which is the size of the thing - 1
<zid`> do you mean, why is the gdt limit specified as the final valid byte, and not the first invalid byte? because comparisons.
<zid`> >final_valid is easier than >=first_invalid
<heat> but this is relatively widespread on a bunch of crap when you program hw registers or whatever
<heat> for Reasons
<zid`> because >final_valid is easier than >=first_invalid
<heat> ok
<heat> why could that not be internal?
<zid`> because why waste silicon
<heat> i.e internal_gdtr.limit = given_gdtr.limit - 1;
<zid`> doing something completely trivial for the software
<zid`> The limit is also the limit then, and not the limit plus one
<zid`> aka the size
<Mutabah> I think because it shares logic with segmentation, and that needs to specify a limit that covers the full range
<zid`> you also see the exact thing with rare beasts known as 'arrays
<zid`> where [8] is the size, but [7] is the limit
<zid`> char a[8]; <-- very legal, a[8] = 0; <-- where the cops at
<sakasama> zid` What happens if the final valid byte is the maximum representable value for the address width?
<moon-child> no one stores the 'limit' of an array though
<zid`> they do, constantly
<moon-child> everyone stores the length
<zid`> for(i = 0; i <= 7; i++)
<zid`> repeatedly
<moon-child> I have never seen anyone do that
<moon-child> for (i = 0; i < 8; i++)
<bslsk05> ​www.cs.utexas.edu: E.W. Dijkstra Archive: Why numbering should start at zero (EWD 831)
<sakasama> moon-child: That article is complete garbage.
<zid`> sakasama: Then you're in better shape than if you tried to specify it by size
<zid`> cus then the size would be 0
<moon-child> sakasama: oh?
<sakasama> moon-child: He chooses his conclusion in advance and then selects and discards possibilities in order to suit it, rather than objectively analysing them.
<heat> dijkstra? more like stupijdkstra
<heat> am i right fellas
<zid`> My favourite part of djikstra is like, people trying to apply things he said about 70s programs to modern stuff
<zid`> I've seen *lots* of people say "gotos are evil", because they have no concept of "interprocedural goto" because.. languages don't even allow them anymore
<heat> oh yeah totally
<heat> the gotos are evil shit is stupid
<zid`> Don't tell them that cpus exclusively use goto :(
<moon-child> goto <3
<sakasama> zid` The point is that only an inclusive interval can represent the entire range without kludges for the final value. They have slightly simpler logic in hardware.
<zid`> sakasama: hence size overflowing
<zid`> and you're in a better position by using a limit instead
<zid`> because.. a size would overflow
<moon-child> sakasama: if you want to store the final address, then you need kludges; but not if you store the length
<moon-child> sakasama: unless you want to have a single array which spans the _entire_ address space, which is clearly unreasonable
gog has quit [Ping timeout: 248 seconds]
<heat> something i find stupid: gotos as loops
<zid`> size is just limit+1 and gives you no extra info except shifting everything along by 1 and causing max-1 to be unrepresentable instead of 0
<sakasama> moon-child: Yes, but an inclusive interval handles that fine too.
<heat> like, erm, maybe you should've created another function entirely, if you need a goto as a loop
<zid`> heat: goto as a loop is fairly mandatory in printf sadly
<heat> there are so many examples of this in LE UNIKS
<zid`> unless you want a shit load of 'bypass' flags
<heat> yeah
<zid`> to make the outer while(1) short-circuit
<zid`> tristates are annoying, basically
<zid`> where you have yes, no, and continue
<zid`> goto loops stops you needing to bother with them sometimes
<sakasama> moon-child: Perhaps more importantly, it doesn't require an adder: you can get away with just the subtraction for the comparison op.
FreeFull has quit []
<moon-child> eh
<moon-child> subtract is not more efficient than add (and indeed, x - y may be implemented as x + -y, though I don't know if modern chips do this)
<moon-child> you can implement a compare circuit more efficiently than an add or subtract
<moon-child> (because it is simply a reduce, not a scan)
<moon-child> but I don't see why one of < and <= would be more efficient than the other then
<sakasama> moon-child: If you store size, then testing against the end is X < start + size, or some transmutation involving the extra addition in some form, whereas with an interval you can just do X <= limit.
<moon-child> heat's question was why we store size-1 rather than size
<zid`> cus it's a limit not a size, was the answer :P
<zid`> and limits have some obscure very minor technical advantanges, so why not
<zid`> when limitof operator for C
<heat> thank you
<heat> also
<heat> nerdz lmao
* sakasama snorts a mysterious powder.
<zid`> (it's ground mummies)
goliath has quit [Quit: SIGSEGV]
linear_cannon has quit [Remote host closed the connection]
linear_cannon has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
bnchs has joined #osdev
<mrvn> moon-child: all modern CPUs use two's-complement integers and those you have x - y = x + ~y + 1, which they do by setting the carry-in signal on the addition.
<mrvn> zid`: with a limit how do you represent a size of 0?
<moon-child> yes, that is what I was talking about
<mrvn> sakasama: the size of an object is basically limited to half the representable value because ptrdiff_t needs 1 bit for signedness.
<mrvn> and the address space on 64bit cpus is way smaller still. So you really aren't going to overflow a size.
<mrvn> moon-child: Even one's-complement / sign+magnitude math would just have an adder with an inverter on the input. There really is no call to have an adder and a subtractor. The one extra gate isn't going to slow down additions.
wgrant has quit [Quit: WeeChat 3.5]
wgrant has joined #osdev
bradd has joined #osdev
pmaz has quit [Quit: Konversation terminated!]
_xor has quit [Quit: bbiab]
bradd has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
bradd has joined #osdev
napcat is now known as lav
heat has quit [Ping timeout: 248 seconds]
Starfoxxes has quit [Ping timeout: 276 seconds]
GeDaMo has joined #osdev
<sakasama> mrvn: The statement isn't about the cost of addition vs subtraction, but that it requires an extra operation to add in the size.
<zid`> sakasama: who is you
<sakasama> No one, really. I don't actually exist.
<zid`> oh did I accidentally open multiplayer notepad again
stefanct has quit [Ping timeout: 256 seconds]
stefanct has joined #osdev
<sakasama> Sir, this is a Wendy's.
<zid`> back at it again at krispy kreme
* zid` backflips into #osdev and breaks something
Burgundy has joined #osdev
stefanct has quit [Ping timeout: 255 seconds]
<sham1> Stop breaking things
<zid`> It was just the one thing actually
stefanct has joined #osdev
<sakasama> That was my brain.
<sakasama> Oh; wait, it was already broken.
* sakasama can't remember.
Jari--- has quit [Ping timeout: 276 seconds]
xenos1984 has quit [Ping timeout: 248 seconds]
xenos1984 has joined #osdev
theboringkid has joined #osdev
antranigv_ is now known as antranigv
antranigv is now known as antranigv_
theboringkid has quit [Ping timeout: 255 seconds]
andreas303 has joined #osdev
antranigv_ is now known as antranigv
antranigv is now known as antranigv_
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #osdev
Burgundy has quit [Ping timeout: 276 seconds]
elastic_dog has quit [Quit: elastic_dog]
elastic_dog has joined #osdev
pmaz has joined #osdev
zxrom has quit [Quit: Leaving]
slidercrank has joined #osdev
bliminse has quit [Ping timeout: 260 seconds]
zxrom has joined #osdev
antranigv_ is now known as antranigv
antranigv is now known as antranigv_
bliminse has joined #osdev
antranigv_ is now known as antranigv
<sortie> https://new.mta.info/document/6856 ← The x64 bus (don't forget to nominate for an Apple award)
k0valski18891 has joined #osdev
antranigv is now known as antranigv_
pmaz has quit [Ping timeout: 248 seconds]
goliath has joined #osdev
Vercas6 has quit [Quit: Ping timeout (120 seconds)]
Starfoxxes has joined #osdev
Starfoxxes has quit [Max SendQ exceeded]
Starfoxxes has joined #osdev
Starfoxxes has quit [Max SendQ exceeded]
crankslider has joined #osdev
pmaz has joined #osdev
crankslider has quit [Remote host closed the connection]
Starfoxxes has joined #osdev
IRChatter has quit [Read error: Connection reset by peer]
IRChatter has joined #osdev
IRChatter has quit [Read error: Connection reset by peer]
IRChatter has joined #osdev
heat has joined #osdev
<heat> lonix
<heat> sortie, amd64 bus where??
<sortie> heat, sure just take the PCI line downtown (recommend the express line)
<heat> i sure hope you have 33 buses per second on that PCI line
pmaz has quit [Ping timeout: 260 seconds]
gog has joined #osdev
nyah has joined #osdev
bradd has quit [Ping timeout: 250 seconds]
mjg is now known as chadgpt
chadgpt is now known as ChadGPT
sortiecat has joined #osdev
sortiecat has quit [Quit: Leaving]
Left_Turn has joined #osdev
sinvet has quit [Ping timeout: 255 seconds]
bauen1 has quit [Ping timeout: 252 seconds]
heat has quit [Read error: Connection reset by peer]
heat_ has joined #osdev
[itchyjunk] has joined #osdev
heat_ is now known as heat
antranigv_ is now known as antranigv
Gooberpatrol_66 has quit [Remote host closed the connection]
Gooberpatrol66 has joined #osdev
troseman has joined #osdev
troseman has quit [Quit: troseman]
Jari--- has joined #osdev
Burgundy has joined #osdev
xenos1984 has quit [Ping timeout: 248 seconds]
xenos1984 has joined #osdev
xenos1984 has quit [Ping timeout: 248 seconds]
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
inegatives has joined #osdev
<inegatives> Is your OS somehow "crippled" if you use Limine, since it boots you into long mode with higher half kernel?
FreeFull has joined #osdev
<inegatives> Does Serenity only support multiboot?
yyp has quit [Remote host closed the connection]
yyp has joined #osdev
<inegatives> How does Linux boot besides with multiboot?
<nortti> as far as I understand it, linux has its own per-platform boot protocol
xenos1984 has joined #osdev
<bslsk05> ​www.kernel.org: 1. The Linux/x86 Boot Protocol — The Linux Kernel documentation
Arthuria has joined #osdev
bnchs has quit [Remote host closed the connection]
<inegatives> Is there such thing as UEFI bootloader? Or is OS just an UEFI application that the firmware loads?
<nortti> you can have a bootloader be an UEFI application. that's what I would think is being referred to when someone says "UEFI bootloader" at least
<nortti> but it is also possible to have UEFI load the kernel directly
<inegatives> nortti: What's the point of having UEFI bootloader if firmware can directly set you up with long mode and identity paging?
<nortti> you might want to support both UEFI and legacy boot, you might want to present user with a bootloader menu, you might need something else loaded alongside your program
<nortti> *kernel
<inegatives> So I guess the best way for an hobbyist desiring modern kernel is to make it an UEFI application and have firmware load it to long mode? What's the point of using Limine for example, just so that it can set GDT and higher half?
<gog> i have a UEFI loader because i need some things to be set up in a specific way before entering my kernel
<inegatives> gog: Like what? Also could that be done in the kernel instead?
<gog> memory mapping
<gog> specifically
inegatives has quit [Read error: Connection reset by peer]
<gog> it could be done in the kernel but it's dependent on the boot environment so i'm trying to keep that loosely-coupled
<gog> oh
linear_cannon has quit [Remote host closed the connection]
<Ermine> gog: may I pet you
Arthuria has quit [Remote host closed the connection]
<gog> yes
* Ermine pets gog
* gog prrr
<heat> just had a great nap
<heat> this is gog's fault
<gog> yw
Arthuria has joined #osdev
<heat> thank you vincent van gog
<heat> you're like my good sleep fairy
<heat> keep on at it
sinvet has joined #osdev
linear_cannon has joined #osdev
elastic_dog is now known as Guest9292
elastic_dog has joined #osdev
dude12312414 has joined #osdev
inegatives has joined #osdev
<inegatives> Is it possible to connect to WiFi network in UEFI app, are drivers provided?
<gog> that's gonna be vendor-specific
<gog> if the vendor provides a driver for the wifi device, then you can use Simple Network Protocol to implement aribitrary protocols
<gog> if the vendor doesn't provide a driver you'll have to be able to install one somehow which is possible
<gog> neither are something i've played with
inegatives has quit [Read error: Connection reset by peer]
<gog> EFI_SUPPLICA--
<gog> ok
<geist> crippled? my guess is somone on discord or whatnot is getting on their case abou tit
<gog> idk how that could matter, long mode is fine
<Ermine> Wifi.. in uefi...
<gog> Ermine: it does work
<gog> there's a supplicant protocol
* Ermine pukes
<gog> you can do WPA2 PSK and Enterprise from an EFI application
<gog> (provided the chipset drivers are present)
<gog> ofc any vendor can choose not to include that
<gog> and trying to open that protocol on a handle will just return EFI_UNSUPPORTED
<gog> so YMMV
<gog> also early platform yuck can stay in the bootloader
<gog> kernel should know as little as possible about how it got booted
<gog> not relevant once you're up and running in the mode you want
<gog> my osdev hot take is that operating system development is unnecessary so you should do whatever you want
<gog> there's no limit, cmon!
gildasio has quit [Ping timeout: 255 seconds]
<zid`> my osdev hot take is that osdev is dead
<zid`> run dedicated ring0 programs all in a different hypervisor
<zid`> one per core
<gog> yes
<gog> that's a good idea actually
gildasio has joined #osdev
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<heat> gog, yes that's true
<heat> although I suspect that in practice it's not true and almost no one does wifi
<gog> most likely
<gog> i wouldn't
<heat> or that some do and the stack is incredibly broken
<gog> wifi network in a mode where everything is accessible?
<gog> no thanks
<gog> seems like a recipe for haxx
<heat> wait until you figure out your firmware has openssl
<heat> https://github.com/tianocore/edk2/tree/master/NetworkPkg/WifiConnectionManagerDxe <-- this is fairly recent and the only bit of upstream i've seen that has anything to do with wifi
<bslsk05> ​github.com: edk2/NetworkPkg/WifiConnectionManagerDxe at master · tianocore/edk2 · GitHub
<gog> how old of an openssl
<heat> depends on your firmware
<heat> right now they're stuck in 1.1 and are trying to update to 3
<gog> i recently updated my firmware in contravention of my "never update" rule because there were some severe CVEs associated with the one i had
<gog> and i figure since i use my computer for work i should be responsible-ish
<heat> although they did upgrade 1.1 LTS releases BUT who the fuck knows what your firmware vendor does
<heat> probably nothing
<gog> most likely nothing
<heat> also I had to chastise Intel into trying to upgrade to openssl 3 since 1.1 is going EOL and the original plan is "MAKE BOTH OPTIONS AVAILABLE BECAUSE FLASH SPACE IS LIMITED OR WHATEVER"
<heat> being agressive most definitely worked, I said something like "yeah good job intel, maybe in a few months you get One More UEFI CVE or secure boot bypass"
<heat> so linus was right, as he usually is
<heat> gog, genius abort() implementation straight from edk2 crypto code (for OpenSSL) https://godbolt.org/z/rrWhWMvez
<bslsk05> ​godbolt.org: Compiler Explorer
<zid`> I wonder if the new 'wifi' cpus do efi wifi
<zid`> am5 and ..whatever rapid/lake/gem intel are up to
<heat> do those have wireless builtin?
<geist> seems like it's possible, but not sure uefi is really set up to have a wpa supplicant stick around, etc
<geist> wifi is more of an active maintaining of the link than regular ethernet
<heat> i don't know but whatever it does is proprietary
<zid`> yea they have pins for wifi
<heat> because TOP SECRIT WPA CODE
<zid`> like they have pins for pci-e
<zid`> (and displayport for gma, etc)
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
SGautam has joined #osdev
<gog> heat_: uhhh
<gog> this looks bad
<heat_> gog, what does
heat_ is now known as heat
<gog> that abort() impl
<gog> "impl"
<heat> it's high quality stuff gog I don't know what you're on about
<gog> yes
<gog> enterprise quality
<gog> i would ship this ngl
<gog> whoa pink godbolt theme is amazing
<heat> the funniest bit is that I tried the oldest gcc in godbolt and it gens the same shit
bgs has quit [Remote host closed the connection]
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
<zid`> asm("hcf"); equivalent
<zid`> I am a weird nerd so I just watched a video about taking 39 days to crash mario 64 via rng manipulating a float overflow
<gog> this is #osdev, friend, we're all weird nerds here
<heat> i'm a cool jock
<zid`> heat is a football
Jari--- has quit [Ping timeout: 268 seconds]
* gog kick
<zid`> don't, he likes it
<heat> oh yeah fucking kick me
<heat> score a goal with me
<heat> score a hattrick and take me home with you
sortie has quit [Quit: Leaving]
sortie has joined #osdev
linear_cannon has quit [Quit: new gpu just arrived, time to install it]
Matt|home has quit [Quit: Leaving]
goliath has quit [Quit: SIGSEGV]
linear_cannon has joined #osdev
jjuran has quit [Quit: Killing Colloquy first, before it kills me…]
jjuran has joined #osdev
Burgundy has quit [Ping timeout: 248 seconds]
dutch has quit [Quit: WeeChat 3.8]
dutch has joined #osdev
pmaz has joined #osdev
Left_Turn has quit [Read error: Connection reset by peer]
DanDan has quit [Ping timeout: 250 seconds]