channel logs for 2004 - 2010 are archived at http://tunes.org/~nef/logs/old/ ·· can't be searched
#osdev2 = #osdev @ Libera from 23may2021 to present
#osdev @ OPN/FreeNode from 3apr2001 to 23may2021
all other channels are on OPN/FreeNode from 2004 to present
http://bespin.org/~qz/search/?view=1&c=osdev2&y=24&m=7&d=23
00:21:00 <heat_> sorry i've been away for a bit
00:23:00 <heat_> i don't really recall many of these details but this should help: https://github.com/heatd/hsd/blob/master/usr/sys/stand/trap.c#L7-L35
00:23:00 <bslsk05> github.com: hsd/usr/sys/stand/trap.c at master · heatd/hsd · GitHub
00:48:00 <bessieTheBoy> heat_ thanks this worked.
00:49:00 <heat_> you were supposed to see whats wrong with your code
00:49:00 <heat_> but whatever
01:28:00 <adder> I iterate over Limine's memory maps, and for each address in a range marked as USABLE, I make a struct page (which contains the address and the size, mostly), and insert it into a linked list of free pages, which I later use to allocate pages from. I also have a kernel heap of fixed size in one of those usable ranges located at the beginning of one of those ranges. My question is, should I make pages out of the heap region (and add them to the free list)? If
01:28:00 <adder> I do, I'll be overwriting memory when I later init the heap (struct block) and begin kmalloc-ing. I should also mention that during the process of recreating Limine's memory maps, I have mapped addresses in 0-4GB to address + hhdm_offset, so the heap happens to be mapped.
01:30:00 <heat_> no idea about limine, but struct page is *not* that
01:30:00 <heat_> struct page is a one-per-page kind of thing, generally contiguous so you don't need to store the address (neither the size)
01:31:00 <adder> hmmm
01:32:00 <adder> btw. nothing special about Limine, it just provides memory maps
01:32:00 <adder> wanna see some code?
01:33:00 <heat_> not really
01:33:00 <heat_> :D
01:33:00 <adder> np :)
01:33:00 <heat_> so, if your question is: what do i do to existing stuff when setting up the memory map and page allocator
01:33:00 <heat_> the answer is: you careful reserve those things if need be, and don't add them to the page allocator
01:34:00 <adder> so let's say I call palloc() (to alloc a page), do I keep the next free page in an uint64_t or so?
01:34:00 <adder> palloc() needs to return the physical address
01:35:00 <adder> at least that's how my current code is set up
01:35:00 <adder> I guess the question is, how do I keep track of free pages
01:36:00 <heat_> ok i'll explain my design. note that this is not the only idea, but the generally the common one
01:37:00 * adder 's ears perk up
01:37:00 <heat_> so i have a struct page with a bunch of per-page data crammed into it. flags, reference counts, whatever, not really super important atm. when initializing memory i take the max page address and allocate those many struct pages *contiguously*, so going from struct page * -> physical address is fast and straightforward.
01:38:00 <heat_> it so happens that my page allocator has a bunch of linked lists of pages, and the struct page itself is "owned" by the page allocator when free so... you can use those for the linked list, then going struct page * -> physical address is, again, fast and straightforward
01:39:00 <heat_> this is the said struct page: https://github.com/heatd/Onyx/blob/c4cb5f0ea936de98a3f5c26f0c09a7f8cdb6bcff/kernel/include/onyx/page.h#L83-L115
01:39:00 <bslsk05> github.com: Onyx/kernel/include/onyx/page.h at c4cb5f0ea936de98a3f5c26f0c09a7f8cdb6bcff · heatd/Onyx · GitHub
01:40:00 <heat_> you'll notice a bunch of fields overlap each other with unions, it's gnarly but space-optimal
01:40:00 <heat_> idea being that e.g lru_node cannot be in use (a page cannot be in an LRU list) when freed in the page allocator (page_allocator_node.list_node is in use)
01:41:00 <heat_> you can skip the union terribleness for now ofc, it's far too complex if you're just starting out. a simple linked list node in your struct page is okay
01:41:00 <heat_> just trying to give you some fuller context :)
01:41:00 <adder> yeah, yeah, no problemos
01:41:00 <adder> I just don't understand what that linked list is doing in the struct?
01:42:00 <heat_> uhh this is a C linux-like list_head thing, that can be a linked list *node* as well as a linked list itself
01:42:00 <heat_> in this case these are all nodes
01:43:00 <adder> ok, let's just please take a step back: you are given ranges of physical memory, you do what with struct page with those?
01:44:00 <adder> do you (struct page *)(addr + offset), and then do something with that?
01:44:00 <heat_> a naive allocator that only allocates single pages would take the struct page for each page in that range, then add that
01:45:00 <heat_> note that (struct page *)(addr + offset) is *not* the math, because the struct page is not stored on the page it itself represents
01:45:00 <adder> ok
01:46:00 <adder> ..."add that", add where? to some linked list or so?
01:47:00 <heat_> yes, that would be the naive page allocator and will do for now
01:47:00 <heat_> and it's actually not completely terrible for all intents and purposes
01:48:00 <adder> just making sure we're on the same page (hehe), then when I go about allocating a page, I take a page off of the list?
01:48:00 <heat_> yes
01:48:00 <adder> great
01:48:00 <adder> thanks heaten
01:49:00 <heat_> wrt struct page, i have a struct page *page_map = array_of_pages_up_to_max_phys_addr; then basically the struct page for a given phys address is page_map[PFN], and the PFN for a given struct page is given by page - page_map
01:49:00 <heat_> PFN being physical addr / PAGE_SIZE (or >> PAGE_SHIFT)
01:51:00 <adder> ah that's great, thank you
01:52:00 <heat_> you're welcome :)
10:35:00 <adder> heat, is your base_pfn the start of the lowest usable entry?
10:36:00 <adder> and why do you have it? to reduce the overhead?
10:36:00 <adder> my math seems to check out without it, so idk if I need it
10:41:00 <mcrod> hi
10:41:00 <sham1> hi
10:41:00 <nikolar> oi
10:42:00 <adder> hello
10:45:00 <nikolar> Are we kernaling today
10:47:00 <adder> yes been kernaling since 3am or so
10:48:00 <adder> idk if it's this h_e_a_t, but I'm having huge issues with my sleep
12:31:00 <netbsduser> i have been thinking of setting up virtually contiguous page structs
12:32:00 <netbsduser> i don't want to allocate as many contiguous as highest page lest i run on a system with particularly sparse memory
13:22:00 <GeDaMo> https://www.brendangregg.com/blog/2024-07-22/no-more-blue-fridays.html
13:22:00 <bslsk05> www.brendangregg.com: No More Blue Fridays
13:23:00 <GeDaMo> "Once Microsoft's eBPF support for Windows becomes production-ready, Windows security software can be ported to eBPF as well."
13:28:00 <netbsduser> gregg still on the eBPF train
13:28:00 <netbsduser> he needs to get with the times
13:29:00 <netbsduser> turning linux into a microkernel with everything put into ebpf proglets was yesterday's thing
13:29:00 <netbsduser> today's thing is the wholesale rustication of linux, without delay
13:35:00 <GeDaMo> Why not just compile Rust to eBPF? :P
13:36:00 <mjg> can you unwrap in ebpf? :thinkingface:
13:37:00 <sham1> ebpf proglets of course aren't mutually exclusive with rust
13:38:00 <sham1> Although for rust, webassembly would be more natural
13:41:00 <GeDaMo> https://eunomia.dev/blogs/introduce-to-wasm-bpf-bpf-community/
13:41:00 <bslsk05> eunomia.dev: Wasm-bpf: Bridging WebAssembly and eBPF for Kernel Programmability - eunomia
13:43:00 <nikolar> No way
13:44:00 <sham1> please, I was joking ._.
13:45:00 <nikolar> YOU'LL HAVE WEB TECHNOLOGIES IN THE KERNEL AND YOU'LL LIKE IT
13:48:00 <GeDaMo> You misspelt KERNAL! :P
13:50:00 <nikolar> KERNAL!
13:51:00 <zid> It's spelled coronet
14:14:00 <sham1> I don't want a web kernal
14:14:00 <mjg> too late
14:14:00 <mjg> crashes are going to continue until morale improves
15:33:00 <heat> <netbsduser> i don't want to allocate as many contiguous as highest page lest i run on a system with particularly sparse memory
15:33:00 <heat> here's the trick: you can use VIRTUAL MEMORY to that effect
16:02:00 <netbsduser> heat: i have been considering just that
16:05:00 <heat> make sure you hugepage the fucker
19:29:00 <gorgonical> how are we today, javascript webdevs?
19:29:00 * mjg feels excluded
19:31:00 <nikolar> uh javascript
19:31:00 <nikolar> why did you remind me
19:31:00 <nikolar> that it existed
19:31:00 <gorgonical> debugging kernel bugs is painful, but it could always be worse
19:31:00 <gorgonical> its a memento mori
19:32:00 <nikolar> lel
19:32:00 <sham1> I'm fine. Webdev is pain as always
19:33:00 <heat> i'm feeling terrible
19:35:00 <kof673> http://www.brackeen.com/vga/source/djgpp20/modes.c.html https://web.archive.org/web/20030520053535/http://www.geocities.com/siliconvalley/Horizon/6933/vesa.html alexfru-SmallerC-b120a9c/v0100/tests/vesalfb.c
19:35:00 <bslsk05> www.brackeen.com: 256-Color VGA Programming in C - modes.c
19:35:00 <bslsk05> web.archive.org: Fractal Programs
19:35:00 <kof673> "it could always be worse"
19:56:00 <Ermine> > brackeen -- reminded me of that evil senator from Castle
19:57:00 <kof673> lots of bracks lol House of the Dragon: The Bracken Brak is a cat-like alien (space ghost)
20:01:00 <heat> https://social.kernel.org/notice/AkDuGHsn0WuA1g1uD2
20:01:00 <bslsk05> <arnd> I had a feeling that kernel compilation got slower recently and tried to find the slowest file across randconfig builds. It turned out to be arch/x86/xen/setup.c, which takes 15 seconds to preprocess on a reasonably fast Apple M1 Ultra.  This all comes from one line "extra_pages = min3(EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)), extra_pages, max_pages - max_pfn);" that expands to 47MB of preprocessor output after commit[…]
20:01:00 <heat> 15s of compile time FOR A FUCKING MIN
20:01:00 <heat> even the biggest SFINAE appreciator would be horrified
20:04:00 <netbsduser> substitution failure not an error, the catechism of C++ programmers, but do they understand it?
20:04:00 <netbsduser> a study was carried out lately, they couldn't find 10 C++ programmers so they asked 20 C programmers what it meant
20:04:00 <netbsduser> not one of them had even heard of it
20:05:00 <nikolar> lol
20:05:00 <heat> the unrealistic bit was that they could find 20 C programmers
20:06:00 <Ermine> first time I've heard of sfinae
20:06:00 <sortie> heat: It is a bit cold to program at but it's so weird when silicon valley offices are so chill, it's like the set the temperature so you can work in a suit but people are wearing shorts
20:06:00 <nikolar> heat: said a so called c programmer :P
20:08:00 <heat> sortie, 20C is cold?
20:08:00 <heat> arent you supposed to be, uh, nordic?
20:08:00 <sortie> heat: As an interior temperature, yeah a bit
20:08:00 <sortie> Outside, yeah warm
20:08:00 <sortie> warm-ish at least yeah
20:08:00 <Ermine> warm, but not enough
20:08:00 <heat> you're supposed to start melting with 15C, literal death at 25C
20:09:00 <mjg> that's russian
20:09:00 <sortie> heat: You're confusing me with my friends in Finland
20:13:00 <Ermine> There's a region in Africa that is claimed by nobody because it's too hot there, and it sounds like suitable place for me
20:13:00 <gorgonical> holy shit 48MB of output
20:14:00 <nikolar> But silly innit
20:14:00 <nikolar> Couldn't they have just split it up into several statements to avoid exponential growth
20:15:00 <nikolar> statementen
20:15:00 <gorgonical> I think this is why we need compile-time programming in a general way that isn't realized with the eldritch horrow that is c++ templates
20:15:00 <Ermine> I guess some stuff in min3 gets expanded more than once?
20:15:00 <gorgonical> s/horrow/horror/
20:15:00 <bslsk05> <gorgonical*> I think this is why we need compile-time programming in a general way that isn't realized with the eldritch horror that is c++ templates
20:15:00 <netbsduser> say what you will about C++ templates but you can do all kinds of useful and fun things with them
20:15:00 <nikolar> Everything gets expanded more than once
20:16:00 <Ermine> oh no, let's not holywar over languages today
20:16:00 <nikolar> I agree
20:16:00 <gorgonical> they are amazingly powerful but I really hated using them
20:16:00 <gorgonical> the boost library multicontainer was like wizardry I thought
20:16:00 <heat> >boost
20:17:00 <heat> yeah checks out
20:17:00 <gorgonical> I haven't used boost in many years and I really only used it in an academic setting. I was under the impression then that boost was like the batteries included with C++
20:17:00 <gorgonical> does it have a reputation?
20:17:00 <Ermine> my friend talked about boost asio all the time
20:18:00 <nikolar> As a non c++ guy, yeah it definitely has a reputation
20:18:00 <heat> boost is lovely if you love C++, boost is horrible if you have a particular set of C++ that intersects a lot more with C
20:18:00 <heat> but boost is also widely recognized to be veeeeeeery slow to compile, and complex
20:18:00 <nikolar> Also compile times, yada yada
20:19:00 <gorgonical> our entire project essentially was predicated on the boost asio event system
20:19:00 <gorgonical> I hate event-based programming
20:19:00 <nikolar> What do you prefer
20:20:00 <gorgonical> The main gripe I have with event-based programming is that most of the time tasks don't neatly decompose across async boundaries
20:20:00 <gorgonical> and the boost model forces you to have either lambda closures (ugly) or discrete functions (end up with func_part1 and func_part2)
20:20:00 <gorgonical> so I would prefer something like a continuation syntax to express this
20:20:00 <Ermine> looping around poll() is also event-based programming
20:21:00 <nikolar> Indeed
20:21:00 <gorgonical> It's more about the depth of the async stackk
20:21:00 <gorgonical> If it's just poll->event handler that's okay
20:22:00 <heat> poll being event-based programming is like saying linux is written in OOP
20:22:00 <heat> technically true, but a little far off from the actual thing
20:22:00 <nikolar> poll is definitely event-based programming
20:23:00 <gorgonical> and the linux kernel is definitely oop
20:23:00 <nikolar> Debatable
20:23:00 <heat> nope, not debatable
20:23:00 <gorgonical> I don't really agree. When you have context and methods that's oop
20:23:00 <Ermine> Since debate have ensued, it's clearly debatable
20:23:00 <nikolar> Lol there we go
20:23:00 <gorgonical> lol
20:23:00 <nikolar> qed
20:24:00 <heat> my point was that a poll loop is as far from Actual Event Based Programming as OOP-ish C is from actual OOP
20:25:00 <kof673> eh, subjective, objective, the two may agree, or may not.
20:25:00 <nikolar> There is not a single Actual Event Based Programming(tm) is my point
20:26:00 <heat> there's no single idea of it, but there's also no single idea of OOP
20:26:00 <heat> they all kind of converge and are also slightly different
20:26:00 <Ermine> Btw that vulkan triangle program from vulkan-tutorial (and, I guess, Khronos tutorial too) is more C-ish than C++-ish, but it takes some time to compile. But maybe because it uses vectors
20:26:00 <nikolar> Completely missing the point but sure let's go with that
20:26:00 <heat> yeah including C++ stdlib will kill your compile time
20:26:00 <gorgonical> I have played a little with zig's compile-time programming and I think that's a nice way of expressing it
20:26:00 <nikolar> So poll is as much Actual Event Based Programming(tm) as oop stuff is
20:28:00 <gorgonical> though I think for event-based programming what I've heard of erlang it seems pretty much indisputably the most suited for it
20:28:00 <nikolar> It was specifically designed for it, no?
20:28:00 <gorgonical> yeah
20:28:00 <Ermine> oh, another reason to rewrite it without glfw and c++ stdlib. Glfw is C though
20:29:00 <nikolar> What's wrong with glfw in this context
20:29:00 <Ermine> nothing, I just want to take a deeper look
20:30:00 <nikolar> Lol ok
20:43:00 <gorgonical> unrelated, but how many languages is everyone here proficient in? I take it for granted that english is the internet language but am aware that most of you aren't l1 english speakers I don't think
20:44:00 <heat> define proficient
20:44:00 <nikolar> what was l1 again
20:44:00 <gorgonical> l1 = mother tongue
20:44:00 <nikolar> oh yeah
20:44:00 <gorgonical> by proficient i mean you could probably get by in the country doing ordinary things. ordering food, interacting with businesses, stuff like that. No need to conduct business meetings or scientific lectures
20:45:00 <nikolar> i am fluent in 2 but learning one more
20:45:00 <gog> gorgonical: spanish and icelandic at that level
20:45:00 <nikolar> And studied another in school but couldn't tell you a thing in it
20:45:00 <gog> but i'm english native
20:46:00 <gorgonical> nikolar: do you count that your l1 masquerades as many languages
20:46:00 <nikolar> no, there's only one true south slavic language: serbian :P
20:46:00 <gorgonical> bosno-croato-serbo-montenegro-kosovan
20:46:00 <heat> i'm fluent in english and portuguese, and i can get by with spanish so.... 2.5? 2.7?
20:47:00 <nikolar> if you want to make a joke about kosovo, at least get your facts straight
20:47:00 <nikolar> heat: oh fractional languages, nice
20:47:00 <gorgonical> I assumed kosovan was a reasonable dialect name for it but the wikipedia page says they just call it serbian
20:47:00 <heat> floating point profiency mon
20:47:00 <gorgonical> my mistake
20:47:00 <gog> when my portugese coworker speaks spanish i understand her better than my boss and another coworker
20:47:00 <gog> but i'm psure they're speaking catalan together
20:47:00 <Ermine> from cv pov I need to take IETLS or TOEFL exam (and I think I can have C2 certificate if I approach it seriously), but................
20:48:00 <nikolar> gorgonical: well if there is going to an official language in kosovo other than serbian, it would be albanian
20:48:00 <heat> gog, spanish people fucking speedrun talking
20:48:00 <nikolar> that's what i was referring to lol
20:48:00 <gorgonical> indeed both are listed as official
20:48:00 <nikolar> what languages do you speak anyway gorgonical
20:48:00 <nikolar> since you started this
20:48:00 <Ermine> Also I'll learn Latin, Chinese and Japanese one day
20:49:00 <gorgonical> english native, german, and I have passing understanding of many others because it's a hobby of mine. I used to speak Japanese to a B2 level
20:49:00 <nikolar> Ermine: oh i want to learn latin too
20:49:00 <kof673> i am against "plain language law" so i get what is meant, but the premise is faulty IMO
20:49:00 <nikolar> gorgonical: serbian and english, studied german but can't really speak it, learning greek now
20:49:00 <Ermine> I've studied German in school
20:50:00 <gorgonical> To try and push my vocabulary up I've started reading novels in German recently (something I never managed well in Japanese) and it's quite comfortable
20:50:00 <nikolar> honestly, just never cared for german much
20:50:00 <gorgonical> Reading hemingway in german now lol
20:50:00 <nikolar> lol
20:51:00 <gorgonical> I read half the first volume of honzuki in Japanese and became deeply demoralized about the whole thing
20:51:00 <nikolar> why's that
20:51:00 <nikolar> you got to the half way point
20:52:00 <gorgonical> I had been studying for a long time and my interest waned somewhat after I learned all the 2000 "standard" kanji. But like you need to know many more than that to read any real fiction. The best I could do was slice of life mangas and I realized I just don't really like manga/anime enough to justify it as a long-term language
20:53:00 <nikolar> that's fair
20:53:00 <gorgonical> slice of life mangas and the news, actually
20:53:00 <gorgonical> yotsuba is very enjoyable in japanese though
20:53:00 <nikolar> do news get limited to the "standard" 2000 or something
20:54:00 <gorgonical> uh not necessarily limited but there is a definite style of speech in the news that means the vocabulary is pretty limited. by law (?) or at least by convention any kanji that's not in the standard 2000 has to have readings printed over top
20:54:00 <nikolar> so like using katakana/hiragana for it
20:55:00 <gorgonical> I feel like it's always hiragana but can't be entirely sure. I don't think I've ever seen katakana used as furiggana
20:55:00 <gorgonical> damn keyboard double-typing
20:55:00 <kof673> Ignoratis terminis ignoratur et ars. - Co. Litt. 2 a. Je sais que chaque science et chaque art a ses termes propres, inconnu au commun des hommes. - Fleury With References to the Civil and Other Systems of Foreign Law lol
20:56:00 <nikolar> gorgonical: honestly, no clue what's the difference in usage between hiragana and katakana
20:56:00 <nikolar> i assumed that they were pretty equal
20:56:00 <gorgonical> they are phonetically equal but have different contextual use. katakana is used for emphasis or on foreign words
20:57:00 <nikolar> (i know that they are equal phonetically, but that's where my knowledge stops)
22:27:00 <heat> how many kernals do i really have in stock
22:27:00 <heat> 1 2 3 4 5 plus 5