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> not yet
Left_Turn has joined #osdev
<mrvn> a true dependency graph for IO requests qould be nice so a flush could reorder requests would be nice. But it's hard to update that as each request is added or removed.
<mrvn> -be nice.
bradd has joined #osdev
Turn_Left has quit [Ping timeout: 246 seconds]
nyah has quit [Quit: leaving]
sympt has joined #osdev
arminweigl has quit [Ping timeout: 260 seconds]
arminweigl has joined #osdev
c2a2 has joined #osdev
arminweigl has quit [Ping timeout: 255 seconds]
SpikeHeron has joined #osdev
arminweigl has joined #osdev
<mrvn> "You're playing chess when everybody else is playing checkers."
<gog> mew
gog has quit [Quit: byee]
<Ermine> bye gog
<kof123> what is story of mel? <pauses> ok...let's see....i'll take "write once, run everywhere" for 700
craigo has quit [Ping timeout: 252 seconds]
<moon-child> 'write once, run away'
<heat> javaaaaaaaaaaaaaaaaaaaaaaaaaaaa
heat has quit [Remote host closed the connection]
kaichiuchi has quit []
[itchyjunk] has joined #osdev
fedorafansuper has quit [Ping timeout: 248 seconds]
fedorafan has joined #osdev
bradd has quit [Ping timeout: 248 seconds]
clever has quit [Ping timeout: 252 seconds]
clever has joined #osdev
robem has quit [Ping timeout: 255 seconds]
tommybomb has joined #osdev
fedorafan has quit [Ping timeout: 246 seconds]
fedorafan has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
fedorafan has quit [Quit: Textual IRC Client: www.textualapp.com]
Arthuria has quit [Killed (NickServ (GHOST command used by Guest684531))]
Arthuria has joined #osdev
Arthuria has quit [Killed (NickServ (GHOST command used by Guest684531))]
Arthuria has joined #osdev
smeso has quit [Quit: smeso]
Vercas has quit [Quit: buh bye]
Vercas has joined #osdev
smeso has joined #osdev
SGautam has joined #osdev
c2a2 has quit [Quit: Lost terminal]
gxt has quit [Ping timeout: 255 seconds]
gxt has joined #osdev
bradd has joined #osdev
Arthuria has quit [Remote host closed the connection]
slidercrank has joined #osdev
bgs has joined #osdev
gxt has quit [Remote host closed the connection]
gxt has joined #osdev
riverdc_ has quit [Ping timeout: 268 seconds]
riverdc has joined #osdev
eschaton_ has quit [Excess Flood]
eschaton has joined #osdev
MelMalik is now known as Ellenor
SGautam has quit [Quit: Connection closed for inactivity]
bgs has quit [Remote host closed the connection]
warlock has joined #osdev
<sham1> "Write once, run into platform-specific quirks"
<sham1> It's fun and games while it manages to abstract things away, but it doesn't always manage that
<zid> Write once, debug anywhere
<Ermine> write once, do not work anywhere but your computer
bitterlollipop has joined #osdev
<sham1> Well that's why you put it inside a container after all, sort of defeating the point of the VM, but still
danilogondolfo has joined #osdev
<Ellenor> I like Tcl
<dinkelhacker> Today is my last day at my current job... going back to software development..yay!
bitterlollipop has quit [Quit: system sleep - ZZZzzz...]
riverdc has quit [Quit: quitting]
riverdc has joined #osdev
<mrvn> The only good VM ist ScummVM.
<dinkelhacker> Hah! Indeed! "Look behind you, a three headed monkey!"
<dinkelhacker> Allthough, I have to say I actually also enjoyed the most recent Monkey Island. So there is still hope for the genre.
<zid> dinkelhacker: Don't forget to steal as many pens and dram modules and stuff as you can fit about your person
<zid> quitting perks
bnchs has quit [Read error: Connection reset by peer]
bauen1 has quit [Ping timeout: 255 seconds]
<dinkelhacker> zid: Technically, I'm staying in the same group of companies. Just moving to a subsidiary. So I'll leave the pens and dram modules where they are :P Don't want to burn any bridges.
<kof123> "write once" it was meant as a "how many times has this been claimed" is why i chose it as a category :D
nyah has joined #osdev
mctpyt has joined #osdev
nyah has quit [Ping timeout: 255 seconds]
fedorafan has joined #osdev
xenos1984 has quit [Ping timeout: 248 seconds]
_xor has joined #osdev
xenos1984 has joined #osdev
nyah has joined #osdev
mctpyt has quit [Ping timeout: 265 seconds]
<zid> dinkelhacker: You could at least hack a few dinkels on the way out surely
<Ellenor> hehe
<dinkelhacker> zid: I don't think that I get the joke^^. Actually the name is just a pun, because there is a local brewery named dinkelAcker (dinkel field)... I like code and beer sooo....
<dinkelhacker> I guess it's only funny when you live in my area.
GeDaMo has joined #osdev
<zid> dinkelhacker: dinkel sounds like a very childish way to refer to a penis
<zid> so a dinkelhacker is a sort of very small guillotine
<dinkelhacker> ...omfg
<zid> English is a wonderful language
<dinkelhacker> Ok.. so either I will have to change my name or have a "pun intended notice" that explains the name everywhere I go..
<zid> I doubt many would notice it
<zid> Only pheasant pluckers
<dinkelhacker> I hope so. But thanks for letting me know. So I'll understand when the native speakers laugh behind my back.
<dinkelhacker> Now I have to google what a pheasant pluckers is
<zid> Someone who removes the feathers from birds, obviously
<dinkelhacker> ..apparently a band
<zid> and totally isn't a spoonerism
<dinkelhacker> xD I see
<zid> We'll have to ask richard cranium if he noticed
<bslsk05> ​www.urbandictionary.com: Urban Dictionary: Richard Cranium
<zid> yep
<dinkelhacker> I think he should know if he doesn't want to get accidentially beheaded
<zid> I wonder if richard cranium suffers from nomintive determinism
<dinkelhacker> We shouldn't judge him just because of his name
<zid> That's why I never see my dentist at 2:30
<dinkelhacker> What's his name?
<zid> you'll have to google that one too
<dinkelhacker> lol
<dinkelhacker> It's like the "How do you call a deer with no eyes?" joke
<zid> The correct reponse is *groan*
<zid> doctor?
<zid> oh wait that's a deer with no Es
<zid> What do you call a fish with no eyes? A fsh.
<dinkelhacker> "No idea! (eye deer)"
<zid> What do you get if you cross an elephant and a rhino?
<zid> 'ell if I know
<dinkelhacker> tell me
<klange> What do you call a medical student who graduates bottom of his class?
<zid> Doctor!
<zid> Spoken in the same tone of voice as: The aristocrats!
<zid> Yours isn't really a joke, more a crushing outlook on reality
<klange> What's the difference?
<zid> Nothing if you're german, they can't tell
ifreund has left #osdev [WeeChat 3.8]
<zid> dinkelhacker: is your last name McKraken?
<dinkelhacker> I'm german and I can't tell so you're right
<dinkelhacker> zid: not quite
<zid> oh so those lads just do it without you asking, I see
<dinkelhacker> do what?
<zid> fill your crack in
<dinkelhacker> I'm giving up. My english is not good enough to compete with you in a joke competition. Also I need to cook lunch.
craigo has joined #osdev
<zid> ooh what we you making me?
<zid> Please make the deliver to Mike Hawk
<dinkelhacker> whatever is in the fridge
<dinkelhacker> so probably nothing
<zid> I have a task for germany
<zid> english doesn't make its own words, we just steal them
<klange> Just need to translate the whole sentence into German and remove the spaces.
<zid> good point
craigo has quit [Client Quit]
<zid> could probably also try it via latin stacking, some kind of full kitchen starvation
craigo has joined #osdev
<zid> plenaculinafame or something
zxrom has quit [Quit: Leaving]
zxrom has joined #osdev
<dinkelhacker> Maybe somethin like 'Verweigerunsbedingterhungertod'
<zid> 'refusal starvation'
<zid> nice character count, german
<klange> Needs more specific mention of a fridge.
<zid> tbh you'd probably just end up shortening it to kitchen hunger
<dinkelhacker> klange: getting the fridge in might be tricky
<zid> lift with your knees
<dinkelhacker> lol
_xor has quit [Ping timeout: 252 seconds]
<dinkelhacker> s/getting the fridge in/mentioning the fridge/
_xor has joined #osdev
<zid> GeDaMo: hard square today
<GeDaMo> zid: I finished and I'm trying one of the special puzzles
<zid> Half the words I've found are bonuses :(
<zid> 8 + 7
<zid> canid, rhymer, tyre, etc
<GeDaMo> The special called Time has 206 words :|
<zid> okay done, was quick but hard
<zid> GeDaMo: ah I started time but lost my progress to the great ssd crash of 2023
<mrvn> Why did the chicken cross the road?
gildasio1 has quit [Ping timeout: 255 seconds]
gildasio1 has joined #osdev
<zid> so close to being able to spell platypus
jafarlihi has joined #osdev
<jafarlihi> Henlo. I got new laptop today and installed Arch, I noticed there's `xenbus_probe` process running. Any idea why that runs when I have nothing to do with Xen?
CryptoDavid has joined #osdev
heat has joined #osdev
jafarlihi has quit [Quit: WeeChat 3.5]
bradd has quit [Ping timeout: 255 seconds]
craigo has quit [Ping timeout: 260 seconds]
fedorafan has quit [Ping timeout: 246 seconds]
craigo has joined #osdev
ilovethinking has joined #osdev
<ilovethinking> hi
fedorafan has joined #osdev
ilovethinking has quit [Remote host closed the connection]
<nikolar> Hello
<dinkelhacker> Good afternoon one and all.
gildasio1 has quit [Remote host closed the connection]
gildasio1 has joined #osdev
fedorafan has quit [Ping timeout: 248 seconds]
_xor has quit [Ping timeout: 255 seconds]
fedorafan has joined #osdev
_xor has joined #osdev
fedorafansuper has joined #osdev
fedorafan has quit [Read error: Connection reset by peer]
_xor has quit [Quit: WeeChat 3.8]
gildasio1 has quit [Remote host closed the connection]
gildasio1 has joined #osdev
slidercrank has quit [Quit: Why not ask me about Sevastopol's safety protocols?]
slidercrank has joined #osdev
gog has joined #osdev
gog is now known as pog
vdamewood has joined #osdev
gabi-250_ has joined #osdev
gabi-250_ has quit [Client Quit]
SpikeHeron has quit [Quit: WeeChat 3.8]
fedorafan has joined #osdev
fedorafansuper has quit [Ping timeout: 252 seconds]
fedorafan has quit [Ping timeout: 252 seconds]
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
bgs has joined #osdev
fedorafan has joined #osdev
chmeller has joined #osdev
<chmeller> Dears #osdev, I have a question. my question is: I have wrote an ELF Shared Library loader to provide loadable modules to my kernel. It is operational. Now I would like know how I will tell the linker GNU Ld, "Do not call this an 'undefined reference', because it is implemented in my kernel executable, and this SHLIB depends on it."
<pog> you'll need to patch the PLT
<pog> or rather
<pog> hang on
<bslsk05> ​github.com: sophia/defaults.mk at main · adachristine/sophia · GitHub
<pog> -Bsymbolic -shared -pic
<pog> and then
<pog> you'll need to patch the PLT to point to the procedure that resolves symbolic references
<pog> and that procedure will patch the GOTPLT with the address of the symbol
<chmeller> I have the dynamic linking operational already. I can call the kernel functions from my shared library as I desire and I can access the kernel global variables. But I must insert in the GNU Ld commandments for the module, "-Wl,--allow-shlib-undefined" else GNU Ld complain the symbol is undefined
<pog> then you're further along than i am with that
<pog> i can't advise
<chmeller> Thank you anyway. I did not find dynamic linker difficult to write. It just iterate the Elf64_Rela's and adjust appropriately
<heat> 1) shared libraries make for bad kernel modules
<heat> 2) that's it, you found the option
<chmeller> Now I want to remove this gross stain GNU Ld commandment and allow the GNU Ld to know that the symbols defined by my kernel are accessible to the shared library. So that I will get an error at GNU Ld invocation time if I try to reference anything, which is not actually going be defined by Kernel (or by other module)
<heat> in theory if your kernel was also a shared lib you could link with it
<heat> but dude stop
<heat> kernel modules are not shared libraries
<chmeller> There is no alternative to a shared library for a kernel module, because the static library is unsuited, neither is an executable
<heat> yes there is, relocatable files
<heat> just how linux does it
<chmeller> Relocatable files are for the GNU Ld. Not for my kernel. They are not meant for modules or plugins
<heat> wrong
<heat> as I said, kernels regularly load them as modules
<heat> ld -r bunch-of-objs -o module.ko and load it
<heat> in fact the internal FreeBSD loader calls itself a linker :)
<marshmallow> when a userspace application attempts to access an illegal memory address, we say the "hardware" generates a trap. what's exactly the hardware here? the CPU itself? in which stage of the pipeline? or the MMU?
<chmeller> I call it "An inelegance." But they are welcome to do as they will. But this would not solve the problem, and especially if I emit a relocatable, then there is now no way in heaven or earth to get GNU Ld to error if the module try to access what it cannot
<heat> it's not "an intelegance"
<chmeller> marshmallow: It is the MMU that will raise the trap
<heat> having a fucking GOT and PLT and 20 different workaround to not relocate into .text is an inelegance
<marshmallow> chmeller: why? why not the CPU itself?
<heat> marshmallow, the MMU is in the CPU, it's part of the CPU
<heat> what I would logically expect to happen is that translation fails and some bit of the CPU raises the page fault
<heat> in reality the difference between "MMU" and "rest of the CPU" is probably murky as all hell
<marshmallow> heat: what happens in the meantime to all the out-of-order executed instructions?
<marshmallow> by the time the CPU has raised the page fault?
<heat> they're not actually committed so no harm done
<heat> except for all the side channels :)
<chmeller> heat: On the MS Windows, where my experience is, this is totally foreign approach. And surely the GNU Link Editor can be made to understand my simple request, to admit symbols which are defined in my kernel executable or in other shared libraries with which is the module explicitly linked
<marshmallow> heat: when you say the translation failed, is that because within the page tables of the user process, a specific virtual address is not mapped to a physical address (e.g.: 0x12345678 has no direct mapping with any physical addresses)?
<heat> but this is not windows, so it's not a foreign approach. and no, ld cannot link with your executable if its not a shared library
<heat> so either make it a shared library or cry yourself to sleep
<heat> or do your own post-link checking
<chmeller> On Windows not either. There is the concept of export and import libraries which allow you to do it
<heat> marshmallow, that's one of the possible reasons yes
bauen1 has joined #osdev
<marshmallow> heat: do per-process page tables live in software or hardware? like, when we say that CR3 points to the top-level base address translation tables, are we implying that it is pointing to some data structures that exist in software?
<marshmallow> not sure if I haven't expressed myself correctly
<heat> it's in memory
<heat> they are all in memory, RAM
<marshmallow> OK but are those pages tables implemented only in HW or there's some structures that map VA -> PA in the kernel?
<heat> i'm telling you, they are in memory
<sham1> That's kind of the whole point of the paging structure
<heat> HW defines the format
<heat> you lay it out like it wants to
<marshmallow> so what's linux kernel mm_struct about sorry?
<heat> other stuff
<marshmallow> wait, I swear there's a lot of confusion over this
<marshmallow> what are we referring to exactly when we say "kernel page tables"?
<nikolar> Doesn't arm raise an interrupt so you can handle address translation in software
<heat> no
<heat> marshmallow, we refer to page tables
<heat> there's literally not much more I can tell you lol
<marshmallow> heat: so if you read CR3, you're reading a physical address?
<chmeller> You are right Marshmallow
<heat> yes
<chmeller> For if it was a virtual address, then how will the CPU know it? It will be the "cat that tries to catch his own tail"
<marshmallow> heat: I think my confusion stems from kernel virtual memory vs kernel space page tables
CryptoDavid has quit [Quit: Connection closed for inactivity]
<marshmallow> heat: do also TTBR0_EL1 and TTRB1_EL1 point to physical addresses?
<heat> yes
SpikeHeron has joined #osdev
ilovethinking has joined #osdev
<marshmallow> when a page fault is raised, how does the OS figure if we need to retrieve the page tables from disk or if we're simply accessing an address that is not mapped to our address space?
<pog> i will never relocate into .text
<pog> don't @me
<ilovethinking> "retrieve the page tables"
<ilovethinking> wdym
<ilovethinking> at which point does the os retrieve the page tables when a pf is raised
<sham1> I think the idea is to ask about how the OS knows that it needs to get pages from swap
<marshmallow> I mean the OS signaling the hardware for an I/O operation from disk?
pog has quit [Quit: Konversation terminated!]
chmeller has quit [Quit: CGI:IRC (EOF)]
<ilovethinking> how do i apply the x86 barebones to x86-64? the part im especially confused aboout is grub
PapaFrog has quit [Read error: Connection reset by peer]
LostFrog has joined #osdev
<heat> marshmallow, so, the mm_struct bit comes into play on that end
gog has joined #osdev
<gog> hiiiiiiiii
<gog> there's a cat in my house and it's not me
<netbsduser`> marshmallow: the os does not necessarily deal with page tables beyond a small component that creates them, it can be the least part of the vmm
<netbsduser`> at least not the page tables that the hardware defines. some oses (windows nt) do run with them as far as they can
<FireFly> gog: cute
<netbsduser`> i don't; i mostly followed the pattern of UVM (which itself followed the pattern of Mach's VMM) which maintains hardware-independent structures to define how address space is laid out
<ilovethinking> did any of you try the apple pie from lidl?
<netbsduser`> so the answer is, "however you want to do it." i added swapping support to my kernel two weeks ago or so. a struct called `vm_anon` defines a virtual page of anonymous memory, and it has a `resident` bit determining whether it contains a swap-address or a physical page address. then the page fault handler can act accordingly
<ilovethinking> not sure if it exists in the us but here in the uk it's 1 quid
<ilovethinking> so delicious
<netbsduser`> ilovethinking: i haven't, i've quite taken to the one the co-op sells
<ilovethinking> ahh okay
<ilovethinking> i'm now anti limine >:(
<netbsduser`> why? i like it
<netbsduser`> it's why i've implemented swapping instead of faffing around with uefi, prekernels, whatever
zxrom has quit [Ping timeout: 252 seconds]
<ilovethinking> because it made me who i am today
<ilovethinking> a douchebag who doesn't know why evryhing works
<ilovethinking> limine did everyting fo rme
<ilovethinking> now i want to actually start osdev
<netbsduser`> that's farcical
<gog> being hard on yourself isn't going to help you
<ilovethinking> yes i know
<netbsduser`> it does tedious junk that has no bearing on your OS except for the few seconds maximum when it's being loaded
<ilovethinking> but i realized i don't know the stuff i need to know
<ilovethinking> netbsduser`: no, not becauase of that
<ilovethinking> it's just that im a beginner
<ilovethinking> and i think i need to learn how everything works
<ilovethinking> before using shortcuts
<gog> you can still use limine
<ilovethinking> after i learn everything
<ilovethinking> yes
<gog> well, no, you don't need to write a bootloader
<netbsduser`> ilovethinking: you will only be learning things that you don't need to learn, trifles that have no actual bearing on your OS's operation
<gog> you can use limine to get your next project loaded
<netbsduser`> if you really want to learn the basics then Tanenbaum's textbook is a better place to start
<ilovethinking> i want to use limine after i make a simple kernel with all the painful methods
<gog> instead of forking somebody else's project and trying to do stuff with it and not really understanding what it does
<gog> you'll still need a bootloader
<ilovethinking> grub?
<gog> grub is fine
<netbsduser`> but that's just the thing, these painful methods aren't what make you a well-knowledgeable osdever or not
<gog> limine also implemeents multiboot
<gog> so you can absolutely still use limine, just write a multiboot kernel instead
<gog> of the limine protocol
<ilovethinking> oh really?
<ilovethinking> the thing is
<ilovethinking> i want to actually do stuff my myself
<ilovethinking> limine gives me a gdt, enables paging etc etc and bumps me into long mode
lukflug has joined #osdev
<gog> EFI gives me all of those things too
<gog> but they're useless to the kernel
<gog> you'll need to provide your own anyway
<netbsduser`> doing stuff yourself - that's fine - you might have to start by tearing out the eeprom or whatever your bios is stored on and smashing it so you can write your own
<gog> GDT, IDT, page tables
<ilovethinking> cmon you know what i mean
<netbsduser`> because (unless you are truly masochistic) you would be in reliance on either the bios or uefi to handle many of the pain points of bootloading
<gog> i have a UEFI bare bones that actually works somewhere
<gog> it's out of sync with what i've done lately though
<ilovethinking> how do i make a multiboot kernel with limine? is it documented somewhere?
<pitust> PROTOCOL=multiboot
<ilovethinking> hi pitust
<pitust> instead of PROTOCOL=limine
wootehfoot has joined #osdev
<ilovethinking> im thinkorsink
<pitust> it /is/ documented, in the CONFIG.md file
<gog> ok time to cook diner
<ilovethinking> what are you cooking
<lukflug> doesn't one need to replace the GDT Limine provides anyways?
<pitust> if you want to do userspace yes
<ilovethinking> hi lukflug
<pitust> else, no
<ilovethinking> hmm, i wonder how to use the multiboot tho
<pitust> first two posts of https://os.phil-opp.com/edition-1/ cover multiboot2
<bslsk05> ​os.phil-opp.com: Writing an OS in Rust (First Edition)
xenos1984 has quit [Read error: Connection reset by peer]
<ilovethinking> wait does multiboot work with x86-64
<ilovethinking> yeah it does
<ilovethinking> sorry
<netbsduser`> it does but doesn't put you in long mode
<ilovethinking> ydah
<ilovethinking> ydzh
<ilovethinking> yeah
<heat> multiboot2 also sucks ass
dude12312414 has joined #osdev
<Ermine> gog: may I pet you
<ilovethinking> can i load the kernel at higher half? because phill opp uses 4M
<pitust> you need a prekernel
<ilovethinking> sorry 1m
<pitust> multiboot and multiboot2 are horendous
<heat> pitust, multiboot2 is buggy af
<heat> i have hit many bugs on grub2's mb2 implementation by simply being one of the like 5 projects that have ever used it
<bslsk05> ​www.gnu.org: Multiboot Specification version 0.6.96
<ilovethinking> first time seeing a good specsheet
<ilovethinking> for old projects
smach has joined #osdev
CryptoDavid has joined #osdev
xenos1984 has joined #osdev
ilovethinking has quit [Quit: i probably locked my mac and i got disconnected]
smach has quit []
bnchs has joined #osdev
<gog> Ermine: yes
* Ermine pets gog
<heat> colon three
<gog> :3
lukflug has left #osdev [Leaving]
ilovethinking has joined #osdev
<ilovethinking> hello, shall i use MB2 or MB
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<sham1> MB2 is probably better
dude12312414 has joined #osdev
dude12312414 has quit [Remote host closed the connection]
<ilovethinking> i was reading the phil opp tutorial (need to set up the image itself cuz idk how) and saw that the mb header fields were different
<ilovethinking> turns out he was using mb2
<ilovethinking> so i should probably use it too (if it's better?)
<gog> ilovethinking: penne marinara with chorizo
<ilovethinking> idk why ur saying this to me but fuck i love penne]
<gog> you asked what i was cooking :P
<ilovethinking> better than spaghetti
<ilovethinking> oh yeah i did
<ilovethinking> sorry i disconnected so no history :P
<gog> yes, i like a robust pasta because i put it in the sauce when the sauce is about 2/3 reduced
<gog> keeps it from overcooking
<ilovethinking> ah
<ilovethinking> you a chef fr
<gog> nah i just know a thing or two about cooking
<ilovethinking> ah
<ilovethinking> well yeah
<ilovethinking> idk if it's childish but i love making myself pancakes with bananas inside
<ilovethinking> sliced bananas
<ilovethinking> a dessert but also a snack
<ilovethinking> simply perfect
<gog> my wife makes good banana pancakes
<gog> she blends the banana into the batter tho
<ilovethinking> yeah that's good too
<ilovethinking> but i'm still a fan of sliced bananas
<gog> ah shoot that reminds me i forgot to get skyr for my dessert
<vin> Hi, I am trying to trace all the memory accesses made by an application at page granularity. So one way I am thinking of doing this is by looking at page table access bits
<gog> the other thing you can do is mark all the pages as not present for that application and trap page faults
<vin> Is there any other well known way to identify all memory accessed by an application?
<gog> the pages you're concerned about
<vin> gog: but that will only give me a one time page fault information. I want to know which pages were referenced how many times
<gog> ah hm
<vin> On linux I think I can parse /rpoc/kpageflags for this
<vin> */proc
wootehfoot has quit [Quit: Leaving]
zxrom has joined #osdev
<heat> vin, the A flag won't work
<heat> it will only set itself if its clear, no counter there
<heat> and you don't know when exactly it is set
<heat> the page fault thing is exactly the way to do it
<heat> some processors may also have some tracing info for that (intel PT maybe?)
<bnchs> :3
bnchs has quit [Remote host closed the connection]
Vercas has quit [Write error: Connection reset by peer]
Vercas has joined #osdev
<ilovethinking> phil opp does this to set the multiboot header checksum: dd 0x100000000 - (0xe85250d6 + 0 + (header_end - header_start))
<ilovethinking> where does the 0x100000000 come from? mb2 spec only says to add the values
<ilovethinking> although it doesn't make sense to get a 0 value when adding positive numbers
<heat> no
<heat> The field ‘checksum’ is a 32-bit unsigned value which, when added to the other magic fields (i.e. ‘magic’, ‘architecture’ and ‘header_length’), must have a 32-bit unsigned sum of zero.
<heat> whatever that sum is, you must find the complement, in order to overflow to 0
<heat> so 0x100000000 - sum
bitterlollipop has joined #osdev
<gog> heat: colonthreezinga
SpikeHeron has quit [Quit: WeeChat 3.8]
<heat> i love me some colon
<ilovethinking> heat: thank you very much :)
<heat> np
<heat> simply negating it would also work I think?
<gog> the code i've seen negates it
<gog> that was for 32 bit specifically since you can't really represent 0x100000000 in
<gog> that width
<heat> I also have 0x100000000
<gog> the last tiem i used multiboot was ca 2013 so
<heat> i guess I took this off the wiki so
<gog> i think the negation way is in the grub docs
<gog> iirc
<gog> which i probably don't
<heat> you're right
<gog> !!
<gog> first time for everything
<heat> pog
gog is now known as pog
<heat> pog
<heat> gog
ilovethinking has quit [Remote host closed the connection]
ilovethinking has joined #osdev
<ilovethinking> it's so fucking annoying that whenever i lock my mac i get disconnected
<netbsduser`> vin: i abuse kasan to do that in my kernel, you might be able to do it for user apps too
bnchs has joined #osdev
ilovethinking has quit [Remote host closed the connection]
<vin> Thanks netbsduser` I will check it out, do you have source I can follow?
ilovethinking has joined #osdev
danilogondolfo has quit [Remote host closed the connection]
dza has quit [Ping timeout: 255 seconds]
bitterlollipop has quit [Quit: system sleep - ZZZzzz...]
acidx has quit [Quit: leaving]
acidx has joined #osdev
bitterlollipop has joined #osdev
ilovethinking has quit [Remote host closed the connection]
bitterlollipop has quit [Client Quit]
<vin> netbsduser`: do you mean you changed kasan to track addresses accessed overtime?
<Piraty> is anyone aware if serenity os founder has presence on irc?
<acidx> Piraty: serenity used to have an IRC channel but AFAIK it all moved to discord a while back
<netbsduser`> vin: i just made kasan_check_ or whatever they're called functions to do what i want
<netbsduser`> and often that would be, if the access is to some address i care about, print out the access
<heat> netbsduser`, do not that it doesn't work if the compiler inlines the checks
<Piraty> acidx: thanks,
* Piraty pukes at discord
<pog> yeah he's on discord but mentions nothing about irc
<netbsduser`> heat: this is why i don't support LLVM/Clang
<heat> gcc also inlines checks mate
<netbsduser`> they do some crazy stuff with this region of memory they expect to be a bitmap or something like that
<netbsduser`> well, if GCC does it, then i've yet to have any problem as a result
<heat> this is all disableable but you obviously want it enabled because it's much faster
<pog> meow?
<heat> i guess pog, i guess
<pog> weird, i've got a timer interrupt that never gets acknowledged
<pog> after sysret it just hangs there
<heat> did you enable irqs
<pog> yeh RFLAGS are 0x202
<pog> pic shows ISR=0x1 and IRR=0x13
<pog> idk why irq 7 fired probably spurious
<pog> which doens't make sense
<pog> but i've got a timer and keyboard interrupt waiting which also doesn't really make sense
<pog> because i didn't input anything
<pog> idk i'll figure it out ig
dza has joined #osdev
<heat> hmm
<heat> does -d int say anything interesting?
<pog> not that i can tell
<zid> did you check at startup
<zid> maybe it's pre-wedged from bios
<pog> pic is totally reset
<pog> gonna step through
<heat> i'm trying to remember if there's anything interesting there that can catch you
<zid> GeDaMo: did you finish TIME
<heat> what idt flags are you using?
<GeDaMo> No, 195 / 206 +90
<zid> +90? fuck me
<GeDaMo> Although I've been cheating a bit :P
<GeDaMo> Thank goodness for grep :|
<heat> pog, how is your tss looking?
<zid> I jus found the long words at least
<GeDaMo> Yeah, I only have 4s 5s and 6s to go
<pog> access byte is 8e
<pog> tss might be wrong
<GeDaMo> Larynx!
<bslsk05> ​github.com: Onyx/tss.cpp at master · heatd/Onyx · GitHub
<zid> k I cheated for 1 word then so far
<pog> DPL might be wrong
<pog> but if that's the case why doesn't it GP
<heat> fuck do I know
<heat> have you tried a regular trap or int syscall?
<heat> int3
<pog> i have not
<pog> i'll get to it thanks
<pog> :)
airplanemodes has joined #osdev
<zid> ex**** impossible
<zid> oh got it haha
<vin> netbsduser`: do you have ASLR disabled?
<pog> the syscall comes in during the middle of the timer ISR. funky
<pog> idek why i'm uniprocessor rn
<pog> i have a spaghetti problem
wootehfoot has joined #osdev
airplanemodes has quit [Quit: WeeChat 3.8]
<pog> i guess i need to actually understand this task code now heh
Left_Turn has quit [Ping timeout: 246 seconds]
<heat> wht
<netbsduser`> vin: i do if i'm debugging anything, all it does is make it more annoying
<pog> heat: i said i need to understand this code that i didn't write ok
<pog> i didn't write it
<pog> i modified it until it worked
<heat> i'm reacting to
<heat> <pog> the syscall comes in during the middle of the timer ISR. funky
<pog> oh
<heat> truly confusing
<pog> it's definitely something i did wrong
bitterlollipop has joined #osdev
<pog> i want oatmeal tho
<zid> you scheduled out of the timer interrupt without acking the pic?
<pog> i'm guessing that's what's happening here
<pog> i have a sort of idea rn and i don't really know how to fix it yet
<zid> ack it on entry? :P
<pog> you can do that?
<zid> as long as interrupts stay disabled until sysretq
<zid> it'll just pend
<pog> duh
<zid> even if it refires
<pog> smart zid :>
Left_Turn has joined #osdev
<netbsduser`> i have a guard against such an eventuality
<netbsduser`> the timer is handled at ipl 'clock' which is incompatible with any scheduler operation
<heat> do not run interrupts with irq on
<heat> simple
<netbsduser`> the scheduling functions try to raise ipl to 'sched' and this panics when the ipl is already higher than that
<netbsduser`> heat: i find it a bit goofy to just keep interrupts altogether disabled in an interrupt handler (at least if it's a lower-priority handler)
<pog> at some point i think nested interrupts would be a good thing to have
<pog> but i lack the technical knolwedge of how to do that right at this time
<heat> netbsduser`, why?
<netbsduser`> heat: the timer interrupt gets cruelly and unnecessarily blocked
<heat> irqs are fast to run, if you keep irqs on when handling them you're just inviting latency
<heat> doing cli; 200 insns; sti is pretty free
<heat> any post processing gets moved to softirq land, with irqs on but preempt off
<heat> if even that is too much, get some threaded DPC
<heat> s/much/little/
<pog> neat it worked
<netbsduser`> i implemented (non-threaded) dpcs a little time ago but actually only use one atm (preemption)
<pog> for older systems where the timer was also keeping track of the passage of actual time and any blocking can cause clock drift i can see that being useful
<heat> i use them for networking and timers
<pog> but modern systems eh
<zid> It'd be nice to do fast softirqs and stuff on systems really getting hammered
<netbsduser`> now that i am working on a profoundly-async i/o model i will need to make more active use of them
<zid> but I don't intend to do 100 million packets a core
bauen1 has quit [Ping timeout: 268 seconds]
<netbsduser`> profoundly-async sounds a bit insulting, come to think of it
bitterlollipop has quit [Quit: system sleep - ZZZzzz...]
<netbsduser`> "oh, i wouldn't pay much heed to what HE has to say - he's profoundly asynchronous, you know"
<kof123> altitude, latitude, profundity - -some alchemy text
Left_Turn has quit [Ping timeout: 252 seconds]
bitterlollipop has joined #osdev
bitterlollipop has quit [Client Quit]
wootehfoot has quit [Read error: Connection reset by peer]
bitterlollipop has joined #osdev
bitterlollipop has quit [Client Quit]
bitterlollipop has joined #osdev
<GeDaMo> zid: finished
<heat> gedamo finishes quickly
<GeDaMo> It took most of the day actually :P
<zid> heh
<zid> I am on 63/206 +17
<zid> missing a 8, and a billion of everythig below
<GeDaMo> What's the 8?
<zid> err missing a 9 level*
<zid> even*
bitterlollipop has quit [Ping timeout: 255 seconds]
<zid> 69/206, nice
Left_Turn has joined #osdev
<pog> zid: it worked :)
<zid> neato
<heat> wha t work
<vin> netbsduser`: what has been the overhead of using kasan?
<netbsduser`> vin: i haven't measured, it's clearly noticeable when it's enabled, i would guess at least halving performance, but i have not tried to implement it in an even remotely efficient way
<netbsduser`> (since i only use it as a debug tool)
<heat> way more than half
<heat> particularly the call variants
<vin> Hmm then I am thinking a simple kernel module that scans the /proc/kpageflags to track page access will be more efficient
<heat> but you can't do that
<heat> as I told you
<vin> heat: oh I missed your text
<vin> Can you send it again?
<vin> I can't scroll up, sorry :/
<heat> lol
<heat> <heat> vin, the A flag won't work
<heat> <heat> and you don't know when exactly it is set
<heat> <heat> it will only set itself if its clear, no counter there
<heat> <heat> the page fault thing is exactly the way to do it
<heat> <heat> some processors may also have some tracing info for that (intel PT maybe?)
<heat> kpageflags's IDLE will only be as accurate as the kernel's perception of it
<vin> Hmm I thought about Intel PT and Intel Pintool but they orovide cache line level access information and not at the page level
<heat> so your "best bet" would be to keep looping and reading (https://www.kernel.org/doc/html/latest/admin-guide/mm/idle_page_tracking.html) but this will obviously have large overhead
<bslsk05> ​www.kernel.org: Idle Page Tracking — The Linux Kernel documentation
<vin> I am curious if it can be done at a page level, because memory is accessed a page at a time anyway
<heat> so you would get a best-effort sampling attempt
<heat> cache line won't help you out?
<heat> cache lines are smaller than pages. you even get more info, more precise, for way cheaper!
<vin> It will! So I am building a heatmap of virtual address space, trying to understand which regions of memory is accessed more than others. I was wondering if I can reduce the overhead of tracing by measuing at page level rather than per cacheline
<heat> i don't think so
<heat> like, intel PT is probably the accurest most precise data you'll get
<vin> The problem with intel PT is it will hide many nuances, for example I won't know the p99 latencies in certain cases at all
<heat> latencies of what?
<vin> memory access
<heat> you won't get better data elsewhere
<vin> Yea looks like it, what about kasan?
<heat> large overhead, way more expensive
<heat> also definitely not what its designed for
<heat> you would need to develop your own custom solution
<heat> and recompile what you want to profile
<heat> intel PT is the best solution here, really. anything the processor gives you
<pog> heat: my deadllock was solved my moving irq acks to the start of the isr
<vin> Makes sense, yea I wouldn't want to recompile apps.
<heat> pog, that sounds like the wrong solution
<pog> why
<vin> Intel PT + Intel Pin you mean heat PT does not capture memory accesses
<pog> interrupts are masked until the isr exits anyway
<heat> pog, because you're randomly scheduling out in your IRQs?
<pog> it's not random
<heat> you should get your task switching in order
<pog> probably
<pog> its not very good
<pog> it's a reflection of me
<pog> :<
<heat> oh boy its from that tutorial
<heat> yeah that sucks
<heat> don't use it
<pog> yeah i told you
<pog> i had to fafo until it worked
<heat> like, the easy simple and consistent way to handle this is to use exactly what you use for isr ret
<heat> because it's literally that
<pog> yessssss
<heat> isr entry and ret do full context save and ret, your switch_task should do exactly that
<heat> then creating a thread is as easy as laying out the stack
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
<bslsk05> ​github.com: Onyx/exit.S at master · heatd/Onyx · GitHub
<heat> it literally uses x86_interrupt_ret
<heat> i just have a small indirection if the previous thread should get deaded
<sham1> I like that parameter comment
<heat> what comment?
<bslsk05> ​github.com: Onyx/exit.S at master · heatd/Onyx · GitHub
<heat> oh yeah lol
<heat> it's useful
<heat> it's nice to be doubly careful when writing assembly
<bslsk05> ​github.com: Onyx/interrupts.S at master · heatd/Onyx · GitHub
<heat> forgot to adjust the comment lol
fedorafan has quit [Ping timeout: 252 seconds]
fedorafan has joined #osdev
<pog> heat: hmm hmm yes i see
<zid> don't forget to PUT THE THREAD
<pog> what if i'm le tired
<lav> eepy gril,
<pog> i don't wanna tonight and i have to be up at early tomorrow
foudfou has quit [Remote host closed the connection]
gildasio1 has quit [Remote host closed the connection]
foudfou has joined #osdev
SpikeHeron has joined #osdev
bgs has quit [Remote host closed the connection]
craigo has quit [Ping timeout: 246 seconds]
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 252 seconds]
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
demindiro has joined #osdev
CalimeroTeknik has joined #osdev
<netbsduser`> "a layered i/o system"
<netbsduser`> who conceived this
<pog> layered?
<heat> are we talking about STREAMS
<heat> i feel like we're talking about STREAMS
<netbsduser`> pog: drivers are arranged in a stack and you send a message and it descends the stack
<pog> neat
<netbsduser`> except sometimes it goes up again from time to time
dh` has joined #osdev
<pog> i like stacks
<netbsduser`> heat: that's the one
<heat> yesssssssssss this is STREAMS
<heat> STREAMS is goated
* pog streams
<heat> pog, *STREAMS
<netbsduser`> i'm reading the svr4 book
<zid> netbsduser`: commiserations
<heat> what's the svr4 book?
<netbsduser`> it's called "the magic garden" of all things
<heat> ooooooooh
<heat> cool
<dh`> someone should make a STREAMS compat layer for sane systems and call it TWITCH
<dh`> but they'd probably get sued
slidercrank has quit [Quit: Why not ask me about Sevastopol's safety protocols?]
* kof123 points at freebsd geom
<kof123> i think it uses terms producer/consumer
<netbsduser`> this thing is either genius (and needs weeks of thought to understand its genius) or a convoluted monstrosity and i haven't decided which yet
* kof123 points at geom grave as zfs takes over j/k
<netbsduser`> kof123: geom also looks potentially genius and it's on my list to study
<dh`> all you really need to know about STREAMS is Dennis Ritchie's famous quote: "I designed streams, they build sewers"
<dh`> s/build/built/
<heat> wasn't the sunos network stack originally super slow because they had built it on STREAMS?
<dh`> don't remember
<netbsduser`> i believe it still is STREAMS-based even in modern Illumos
<heat> the same applies for some early windows network stack. they had it on top of STREAMS
<netbsduser`> at least i saw all kinds of STREAMS mentions in the codebase last i looked
<heat> mjg: solaris STREAMS best
<netbsduser`> the windows driver stack is also apparently a layered I/O model so perhaps they thought STREAMS was a good fit
<heat> i mean, lots of things are still layered
<heat> the linux block IO stack is also layered
<heat> (and so are network stacks, etc)
<netbsduser`> i have layers but there is no explicit stack of devices
<kof123> +heat it actually seems to me like a ...i dont want to say "higher" ...like xth order.
<netbsduser`> the C stack is my only stack
<kof123> like a generic concept for "objects" or whatever you want to call them
<kof123> interceptor pattern!
<kof123> the ability to arbitrarily stack things
<netbsduser`> but i am thinking whether i might want some kind of explicit stack for this use case: async read()/write() in filesystems
<klange> I think you want a queue for that ;)
<heat> yeah I'm in the middle of refactoring my block IO for async IO queue operation
<netbsduser`> klange: i definitely need a queue, i ran into the limit of my current approach when i wanted to handle large read()/write() in my virtio-disk driver
<heat> should provide a much better abstraction for future async endeavours
<netbsduser`> i was using a semaphore before to gate access to it according to how many descriptors were available on the vring or whatever they call it - but for async large read/write() i might consume a lot of them and then need to continue the i/o, which i can't currently since the virtio disk interrupt handler certainly can't wait on the semaphore till it can resubmit for the next set of blocks
<heat> "The first several (currently 64) read(2) calls on such a disconnected streams return 0; sub-sequent calls generate SIGPIPE signals
<heat> hahaha what
<netbsduser`> klange: great work
<netbsduser`> now i can not know how to play minesweeper on toaruos just as well as i don't know how to play it on windows
<heat> no, you're not playing minesweeper
<heat> you're playing mines
<heat> it's the "We're on TV so we can't mention brands" special
<demindiro> I'm convinced efficiently & concurrently resizing on-disk trees with a cache is one of the hardest problems there is.
<demindiro> Turns out most of my tests were just to check if changing the depth of a tree actually worked
<demindiro> 59 files changed, 2791 insertions(+), 5794 deletions(-) and I'm not even done yet
<demindiro> I appreciate the design of ext2 a bit more now too
<heat> ext2 has a great design
<heat> tried and true from the anals of UNIX
<heat> ext4 takes that design and makes it modern
<heat> it's like, the perfect filesystem
<zid> ext5 deletes it all and replaes it with an atomic byteswap only.
<kof123> *annals or was that deliberate
joe9 has joined #osdev
<heat> typo but also somehow it works better this way
<kof123> yes, plausible deniability
<kof123> secure