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
rwxr-xr-x has joined #osdev
Burgundy has quit [Ping timeout: 272 seconds]
spikeheron has quit [Quit: WeeChat 3.7]
spikeheron has joined #osdev
atlas1 has quit [Ping timeout: 272 seconds]
lkurusa has quit [Quit: I probably fell asleep (or went out). Who will ever know.]
heat has quit [Read error: Connection reset by peer]
heat_ has joined #osdev
smach has joined #osdev
heat_ is now known as heat
rwxr-xr-x has quit [Remote host closed the connection]
heat has quit [Remote host closed the connection]
heat has joined #osdev
<heat> yo
<heat> is there a way to use /* */ inside a C comment (/* */)?
<klange> get some alternative asterisks /❋ ❋/
<moon-child> no
<moon-child> but you can use #if 0 inside of #if 0
<kof123> ^^^ #if 0 my little preprocessor, pragma is magic
<heat> you know, is it really osdev if you're not fixing Intel's FW code mess?
<Mutabah> heat: <rustacean> Use a better language :) - Rust's lexer handles nested block comments
<heat> lol
<heat> RUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUSUTUSRUSRUSUTSURURUSRUSURSUTURUST
gorgonical has quit [Ping timeout: 265 seconds]
<bnchs> rust rust rust
<bnchs> RUUUUUUUUsT RUST RUST RUST RUST RUUUUUUUUUUUUUST RUUUUUUUUUUUUUUST
<bnchs> RUUUUUUUUUUUUUUUUUUUST RUST RUST... RUST RUST RUST!!!!!!
<kaichiuchi> template <class Type,
<kaichiuchi> class = typename std::enable_if<std::is_integral<Type>::value>::type>
<kaichiuchi> I think that's how you say "I want this template to only accept integrals"
<bnchs> that looks like shit
<kaichiuchi> welcome to C++
smach has quit []
<kaichiuchi> C++20 does make this much nicer
<kaichiuchi> std::integral
<bnchs> no different than RUUUUUUUUUUUUUUUUST
<kaichiuchi> where I can just say
<kaichiuchi> void f(std::integral auto x)
<bnchs> ohhhh intel god
<bnchs> please give us more registers!!!
<bnchs> NO
<heat> concepts mate
<heat> just use them
FreeFull has quit []
<kaichiuchi> fun fact
<kaichiuchi> when I worked in the semiconductor industry, no surprise but Intel was by far our largest customer
<kaichiuchi> they're kinda nutty.
<bnchs> bro x86 was meant for graphing calculators
<bnchs> not actual computer
<bnchs> it was a mistake to choose them
<heat> kaichiuchi, intel is fucking massive
<kaichiuchi> yes
<kaichiuchi> there's a lot I still cannot say
<kaichiuchi> but I can say some of the brightest people I've ever seen came from Intel
<heat> top contributors in kernel stuff, firmware stuff, graphics stuff, etc
<kaichiuchi> I am but a little cockroach
<heat> i mean, i've seen plenty of shit intel code
<kaichiuchi> of course
<heat> just github.com/tianocore/edk2 and pick your favourite line
<bslsk05> ​tianocore/edk2 - EDK II (1951 forks/3329 stargazers/NOASSERTION)
vdamewood has joined #osdev
<kaichiuchi> I'm not at all saying they're godly
<kaichiuchi> heh
<kaichiuchi> just that some of the people I talked to there are a step above
<bnchs> i would say IBM should have chosen m68k
<bnchs> it seemed much more powerful compared to the still-16-bit intel 8088
smach has joined #osdev
<zid> what about price
<zid> availability
<bnchs> i guess you could look at amiga
<bnchs> and mac
<epony> and then donate your eyes
<epony> it's not should, it's never in a frozen hell never
smach has quit []
<epony> the mistake is to believe CISC and X86 are a coincidende and a "choice of one person that was mostly in disagreement with you"
<geist> heat: oh hey, forgot to mention
<bnchs> epony: you proved me wrong congrats
<bnchs> i shall now give you my eyes
<bnchs> i didn't even need them anyway
<epony> the point is, there is some brain-damage virus affecting people into false alternate history beliefs
<epony> so they talk without knowledge and understanding of the spectacular qualities of some failed architectures and commercial disasters and terminated product lines as the "forgone computer second coming"
<geist> bnchs: re: 68k and IBM. it wasn't ready when the PC was getting designed. too early
<geist> supposedly missed the window by like 6 months
<geist> amiga and mac both came out years later
<heat> geist, you forgot to mention?
<geist> heat: oh yeah. RUUUUUUUUUSSSSSSSSST
<geist> and CAAAARRRRGGGGOOO
<heat> RUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUST
<epony> with no idea about quantities, prices and times and compatibility vs efficiency and production competition between chip producing and computer selling companies
<bnchs> geist: ooooooh
<bnchs> OOOOOOH
<kazinsal> per-unit price in 1980 of a 68000 was also something like four times that of an 8088
<kazinsal> the 68k was a pretty pricey chip when it came out
smach has joined #osdev
smach has quit [Client Quit]
<bnchs> yes i get it
<bslsk05> ​github.com: llvm-project/start.cpp at main · llvm/llvm-project · GitHub
<bnchs> that's why sega genesis was mostly expensive
<heat> find the bugs
<bnchs> most of the budget got taken by the m68k cpu
<heat> you can also look at that brilliant _start() for peak llvm libc
[itchyjunk] has joined #osdev
<kaichiuchi> holy christ
<kaichiuchi> I forgot what it's like to use the STL
<bslsk05> ​en.wikipedia.org: Instructions per second - Wikipedia
<bslsk05> ​en.wikipedia.org: Transistor count - Wikipedia
<epony> the price per unit and units produced is for homework
<zid> They wrote the compiler, they're using compiler builtins to 'fix the frame' etc.. surely they could have just made a builtin for 'do sysvabi _start entry'..?
<bnchs> bro all i want for christmas
<bnchs> is more CPU registers
<heat> zid, llvm libc is the lowest effort libc I've seen
<epony> get them from Knuth, his MMIX has 256
<heat> that whole file is lifted from musl but sneaky-relicensed
<zid> ah
<moon-child> they use rlibm at least
<moon-child> instead of msun like all the other libcs
<moon-child> which is kinda cool
<heat> anyway find the bug in set_thread_ptr
<heat> and the genius ?: expression too
<moon-child> yeah I noticed that :P
<klange> `?:` is one of those things I keep thinking I'd find useful but then never do.
<zid> what's the bug?
<moon-child> I find it very useful, but here ... ... ...
<heat> linux system calls don't return -1, they return negative errnos
<klange> oh this isn't a ?: this is just a normal ternary with a silly expression pair
<zid> ?: is a ternary though?
<moon-child> klange meant x ?: y
<moon-child> the gnu ext
<zid> oh never heard of it
<moon-child> it means x ? x : y (but without double-eval of x)
<epony> that's non-standard (negative return error codes)
<moon-child> so idea is if you have a potentially null pointer you can provide a default value
<klange> "?:" literally with no expression between the two symbols is a GCC extension which returns the original value if it is truthy
<heat> syscall(2) and other system calls return -1 because they do return errno = -retval, -1;
<zid> can I have a ?: extension that has different types on each side
<heat> that syscall thing cannot fill errno because you have no errno before TLS
<moon-child> (I misunderstood at first)
<zid> so I can actually use it with tagged unions
<zid> #define GET_VAL(x) (x->type == INT ? x->intv : x->floatv)
<zid> is illegals
<moon-child> wtf
<moon-child> why do you want that
<moon-child> what do you want that to do
<zid> >tagged enum
<zid> union
<moon-child> yeah but like
<moon-child> should the result be an int or a float?
<moon-child> or do you want to automatically convert the int to a float? cus then you lose bits
<zid> It should be whatever the type of the expression is
<moon-child> dynamic typing? In _my_ c?
<zid> also the format checker gets *really* confused if you use ?
<moon-child> I could really use some execute-only memory rn
<moon-child> :\
* zid sets bit 63
<moon-child> that _N_X
<moon-child> I want only X
<moon-child> no read or write
<zid> https://godbolt.org/z/Ys5cx6Kr9 Basically I want this to not be several warnings :p
<bslsk05> ​godbolt.org: Compiler Explorer
<heat> moon-child, which arch?
<moon-child> amd64
<zid> so [cs:n] only?
<geist> heat: ITAAAAAAANIUM
<zid> I could fuck your ds/es/ss/fs/gs if you want?
<heat> you can have it with that new pkey thing
<zid> That'll make all of memory execute only
<heat> if you have hardware for that ofc
<moon-child> heat: oh interesting
<heat> yes
<zid> weirdly this is kind of easy on 32bit, with some limitations
<moon-child> zid: basically the idea is to be able to hide cookies, so that an attacker with a read primitive can't find them out
heat has quit [Remote host closed the connection]
<zid> you want to.. execute cookies? :o
<moon-child> I mean like
heat has joined #osdev
<moon-child> mov rax, cookie
xenos1984 has quit [Read error: Connection reset by peer]
xenos1984 has joined #osdev
Andrew has quit [Quit: Leaving]
MuonNeutrino has quit [Quit: Leaving]
<geist> heh hanging out at this brewery and the wifi has suuuucked until this family with a bunch of kids just left. i guess they were all streaming vids
<kazinsal> you get much snow down there?
<heat> shark dududududu baby shark dududududu baby shark dudududu baby shark
<geist> proibably 3 or 4 inches. now it's generally sitting at or below freezing, so probably will turn to ice over the next few days
<heat> ok i figured out how to get nicer looking acpica's
<bslsk05> ​github.com: acpica: Update to the latest acpica · heatd/Onyx@b065a15 · GitHub
Andrew has joined #osdev
MuonNeutrino has joined #osdev
<geist> by updating it?
<geist> or the problem was updating it?
<kazinsal> geist: nice. it hit us real hard, almost a foot. currently -10C, supposed to be -14C with wind chill of -21C tomorrow morning. not lookin forward to it
<geist> yeah it's going to be colder here the next few days but not really suggesting any more snow, guess the moisture isn't here
* geist curses the Fraiser River Valley
* geist raises fist
<geist> Fraser even
<kazinsal> mmyep, curse the Mighty Muddy Fraser
<zid> It's nearly boiling here after a week of sub-zero, 6C
<heat> geist, you need to run acpisrc -ldqy <acpica-src-dir> <new-acpica-src-dir>
<zid> ah yes the classic ldqy fix
<heat> you get something like how linux's acpica is formatted (with the underscore_names) and all
<heat> if you REALLY want to you could run something like clang-format on top for the extra crispyness
<heat> but to get this done I needed to patch acpisrc itself (https://github.com/heatd/acpica/tree/acpisrc-linux-fix)
<bslsk05> ​github.com: GitHub - heatd/acpica at acpisrc-linux-fix
<heat> because of course, fixing up STATIC VOID code is my life goal
[itchyjunk] has quit [Remote host closed the connection]
dude12312414 has joined #osdev
<heat> i guess this is not useful for Fuchsia's coding style but it should be for lk if you want to take a stab at a c p i sometime
dude12312414 has quit [Client Quit]
terrorjack has quit [Ping timeout: 252 seconds]
terrorjack has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
gog has quit [Ping timeout: 272 seconds]
<geist> oh interesting, what does the acpisrc do?
<geist> reformat it to what you want?
<geist> ah interesting. didn't know this
<geist> usually i've just used it stock
<heat> yes acpisrc does various transformations to the acpica source
<geist> in general porting to fuchsia either in the kernel (at first) and later in user space wasn't too hard
<geist> mostly just filling in some routines you needed to provide
<heat> yeah acpica is super portable but also very yucky
Burgundy has joined #osdev
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
heat has quit [Ping timeout: 256 seconds]
invalidopcode has joined #osdev
bgs has joined #osdev
vdamewood has quit [Read error: Connection reset by peer]
vdamewood has joined #osdev
vai has joined #osdev
<vai> dear #osdev still looking for a standard dynamic loader in pure C code ?
<vai> I know osdev.org has an example, but though someone else might have done this already by now in C + kmalloc
<klange> I find the way you phrased your inquiry a bit peculiar so I'd like to ask a few questions about what exactly you're looking for.
<klange> You say 'kmalloc', which suggests you want to load things in a kernel, but I would caution that most implementations of dynamic loading happen in userspace and employ interfaces like mmap to achieve their goals.
<klange> You call out "pure C" but I'll also note there's not really anything I can think of that you'd want to do in a dynamic loader that wouldn't be 'pure C' by my interpretation, so some clarity on what you consider 'pure C' might be helpful.
invalidopcode has quit [Remote host closed the connection]
<klange> Knowing what you want to load would also be helpful. ELF? DLL? Mach-o? Dynamic binaries for userspace, or do you want to dynamically load modules for a kernel?
invalidopcode has joined #osdev
* geist seconds what klange said
Burgundy has quit [Ping timeout: 255 seconds]
invalidopcode has quit [Remote host closed the connection]
invalidopcode has joined #osdev
<Mutabah> vai: Any response? There are many things we could link you to... but that may not be the right decision
gog has joined #osdev
gog has quit [Client Quit]
<mrvn> A (32bit) stub to load and start the kernel in (64bit) higher half?
gog has joined #osdev
smach has joined #osdev
merry has quit [Quit: ZNC - https://znc.in]
GeDaMo has joined #osdev
jjuran has quit [Ping timeout: 248 seconds]
jjuran has joined #osdev
fel has joined #osdev
bnchs has quit [Ping timeout: 260 seconds]
bnchs has joined #osdev
Irvise_ has quit [Ping timeout: 246 seconds]
<immibis_> apparently a reason to require identification is to not get spammed with quit messages when a matrix bridge crashes
smach has quit [Ping timeout: 252 seconds]
sakasama has quit [Ping timeout: 256 seconds]
smach has joined #osdev
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sakasama has joined #osdev
mcf has quit [Ping timeout: 260 seconds]
Irvise_ has joined #osdev
smach has quit [Ping timeout: 246 seconds]
bnchs has quit [Quit: Lost terminal]
ggherdov has joined #osdev
bauen1 has quit [Ping timeout: 268 seconds]
smach has joined #osdev
ephemer0l has quit [Ping timeout: 260 seconds]
bnchs has joined #osdev
<bnchs> hiii
Burgundy has joined #osdev
spikeheron has quit [Quit: WeeChat 3.7]
spikeheron has joined #osdev
<j`ey> the circle of life
<epony> you mean most hobby operating systems look like the african housing variety
<epony> must have a goat or a wife or something like a shade
<epony> but not all three at any time
<ddevault> erp, I have the dumb
<ddevault> 10 points to the first person to spot the dumb in that screenshot
<zid> dumlife
smach has quit []
<zid> a .so file isn't the right file?
<ddevault> aye
<zid> I've never used efi before, so maybe.. I am a genius?
<j`ey> I saw the .so but assumed you just named it wrong
<ddevault> .so is an intermediate file before I violently rearrange it into a PE/COFF executable with objcopy
<j`ey> so does .efi work?
<ddevault> let's find out
<ddevault> :D
<ddevault> dunno if the kernel actually comes up because I don't have a working serial cable atm so once EFI goes away I can't log
<ddevault> but the bootloader works :D
<j`ey> ah, i though you were using uefi print services
<ddevault> I am, until I exit EFI services, of course
<ddevault> the bootloader kills EFI before jumping to the kernel
<zid> have you considered using a PC instead, then you can use text mode
<ddevault> nothing wrong with serial my friend
<zid> except requiring a cable :P
<ddevault> anyway my kernel already runs on x86_64
<zid> oh so you're done, phew
<zid> this is just for show, documenting how awful it is to do non x86
<ddevault> I'm doing an aarch64 port for stupid reasons
<ddevault> like, yes, eventually I want aarch64 support
<ddevault> the reason I want it /now/ is because I'm giving a talk in february and it will be easier to port to aarch64 and write a driver for the rpi gpu than to get an external projector working on my x86_64 laptop
<j`ey> ddevault: oh that text is yours already, duh
<ddevault> heh, yeah
<ddevault> there's more text after "Booting kernel" but it's written to serial, not EFI
<zid> Yea that's both a very dumb, and a very understandable reason
<zid> It'd be easier to get remote X working over the network than actually get display cloning going to enable the vga port, I imagine :p
Turn_Left has joined #osdev
rwxr-xr-x has joined #osdev
Left_Turn has quit [Ping timeout: 252 seconds]
bauen1 has joined #osdev
[itchyjunk] has joined #osdev
lkurusa has joined #osdev
<Mutabah> ddevault: Does UEFI on that machine provide a framebuffer?
<ddevault> dunno
<ddevault> it's edk2
<Mutabah> probably will
<Mutabah> hack up a simple bitmap font renderer, and you can get text without the serial port :)
<ddevault> rigging up a framebuffer from scratch is easy enough
<ddevault> I don't intend to make much use of EFI post boot
<ddevault> it looks like it does support GOP though
<Mutabah> GOP to get a flat framebuffer set up, then blit to that after exiting boot services
<ddevault> I mean you really don't need it on this platform
<ddevault> you can set up a framebuffer on this GPU in like 50 lines of code
<ddevault> VideoCore is the simplest GPU I've ever seen
lkurusa has quit [Ping timeout: 246 seconds]
<zid> 82810 for life
<ddevault> although
<ddevault> anyone know how to get a vblank interrupt out of it?
<zid> haha imagine
<ddevault> found it
<clever> ddevault: there are 2 ways to get a vblank irq out of the rpi, and several ipc ways
rwxr-xr-x has quit [Remote host closed the connection]
dude12312414 has joined #osdev
<ddevault> so how does device memory work on arm anyway
<ddevault> EFI gives me an MMIO range on qemu of 4000000-8000000
<ddevault> but the uart is at 9000000?
<ddevault> am confusion
Starfoxxes has quit [Ping timeout: 265 seconds]
heat has joined #osdev
<ddevault> also, seems that on the rpi4 the UART is supposed to be at 0xFE201000, but the device tree has it at 0x7E201000
<heat> >EFI gives me an MMIO range
<heat> what is that?
<ddevault> MEMORY_TYPE::MEMORY_MAPPED_IO in a MEMORY_DESCRIPTOR
<heat> ah ok
<heat> you don't need to fully describe the system memory in the EFI memory map
<heat> and many don't
<heat> basically you can't go off of MEMORY_MAPPED_IO
<ddevault> ack
<heat> you need to read the device tree OR the ACPI tables for that
<ddevault> aye
<heat> also on that address thing, I think it's a quirk on the rpi where they have multiple modes and one of them is to put peripherials lower down for compat? something like that, but don't quote me
<heat> in any case for the EFI memory map you can assume things are correct but there may be gaps in the memory map and those gaps may have things in them
<heat> soo when are you writing the AML interpreter? :v
<ddevault> ah I was misreading this device tree
<ddevault> the parent specifies an address range which corrects the serial port address to the expected value
<ddevault> every time
<ddevault> for MMIO is it... reasonable to identity map physical memory with the device MAIR attribute
<ddevault> at least for a start
Starfoxxes has joined #osdev
Turn_Left has quit [Ping timeout: 264 seconds]
<ddevault> well, maybe, but after more reading I understand the trade-offs well enough to find out for myself
k0valski18891 has joined #osdev
<kaichiuchi> hi kids
Burgundy has quit [Ping timeout: 246 seconds]
<Ermine> Would be cool to see helios on m1/m2
<heat> ddevault, ah yes
<heat> you need to go up the tree to find out what the addresses really mean
<heat> you also need to do that for DMA btw
gildasio has quit [Ping timeout: 255 seconds]
gildasio has joined #osdev
<ddevault> aye
<heat> it's another one of the Great Device Tree Moves
<Ermine> heat: s/Great/Outstanding/
<Ermine> (to fit meme template)
<heat> you know what I hate? my life, which is why I'm standing here and implementing C23
<Ermine> uhh
<heat> c = c<<6 | *s++-0x80; n--;
<heat> loop:
<heat> outstanding
<ddevault> spaces around operators bro
<ddevault> infix operators*
<heat> this is taken straight from musl
<Ermine> this wouldn't help
<ddevault> yeah musl can be questionable in some places
<ddevault> but at least it's not fucking glibc
<Ermine> heat: where did you find this?
heat_ has joined #osdev
<heat_> <heat> mbrtowc
<heat_> <heat> src/multibyte/...
<heat_> i would appreciate 1) comments 2) less HACKERMAN code
heat has quit [Read error: Connection reset by peer]
heat_ is now known as heat
<kaichiuchi> hopefully we get to go home early
<heat> mbstate_t is a fully undocumented struct that has two opaque uints in its definition
<zid> Looks like utf conversion code
<heat> musl touches this structure by casting to an unsigned int * and touching that
<heat> ???
<Ermine> return !!(*wc = *s);
<bnchs> hi osdevelopers
<zid> grep "\!\!" cpu.c | wc -l
<zid> 36
<zid> I am a big fan of !!
<Ermine> It's 2011 code, didn't dalias stop do like this?
<Ermine> s/do/doing/
<heat> no
<Ermine> :(
<heat> mallocng is full of smartass code like this
<heat> ((unsigned char *)p)[-3] = 255;
<clever> 2022-12-21 12:03:51 < ddevault> also, seems that on the rpi4 the UART is supposed to be at 0xFE201000, but the device tree has it at 0x7E201000
<clever> ddevault: you forgot to look at the ranges property
<clever> ranges tells you to map 7e to fe
<heat> clever, yeah he got that after
<clever> ah
ephemer0l has joined #osdev
<Ermine> At this point I regret that I failed to clear January from exams
invalidopcode has quit [Remote host closed the connection]
invalidopcode has joined #osdev
<kaichiuchi> C++ streams get worse every time I look at them
<bnchs> why are you using it
<kaichiuchi> i’m not
<kaichiuchi> work is
<heat> int bs = "\0\1\2\4\7\3\6\5"[(0x17*base)>>5&7];
<heat> ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
<heat> what the fuck
<kaichiuchi> but they don’t want to use libfmt for some reason
<kaichiuchi> and it’s like a multi line stream manipulation because they don’t want to use printf either.
<heat> C++20 has <format> if you're lucky
<Ermine> heat: variable name represents this code
<kaichiuchi> yes
<kaichiuchi> and we are not
<kaichiuchi> <format> as far as I know isn’t even supported on anywhere other than microsoft’s STL
<heat> gcc and/or clang do
<Ermine> heat are you going to refactor this?
<heat> Ermine, depends. if it were just for my OS, probably. if not, probably not
<heat> I don't want to deal with the fierce resistence of "omg this is so minimal and so much better than glibc"
<bnchs> heat: bro wtf
gog` has joined #osdev
gog has quit [Read error: Connection reset by peer]
<heat> C23 mallocs now explicitly say that allocations can have lower alignments if the size is smaller than alignof(max_align_t)
knusbaum has quit [Ping timeout: 268 seconds]
<kaichiuchi> oh std::format works now
<kaichiuchi> very nice
<heat> inb4 you realize you need to do std::cout << std::format(...);
<kaichiuchi> that’s still better than before
<heat> disagree
<heat> you get a std::string from std::format and THEN copy it into cout's buffers AND ONLY THEN do you output
<heat> it's silly
<heat> also, dynamic memory when printing yay!
<kaichiuchi> if you wanted efficiency
<clever> i had trouble with qPrintable on QT a few weeks ago, to my surprise, its not returning a pointer to the data backing a QString, but rather, a shared buffer
<kaichiuchi> the STL isn’t it.
<clever> so if you use qPrintable twice in the same statement, it breaks horribly
<heat> kaichiuchi, plenty of STL algos are efficient
<kaichiuchi> and I really think C++‘s STL just likes to allocate all over the place
<heat> std::string itself is as efficient as possible within the constraints
<kaichiuchi> that’s all well and good
<kaichiuchi> but that doesn’t change “there’s a metric fuckton of dynamic memory allocation”
<kaichiuchi> and for many applications it’s not efficient to have it shit out a malloc call every 2 seconds
knusbaum has joined #osdev
xenos1984 has quit [Ping timeout: 252 seconds]
xenos1984 has joined #osdev
sortie has joined #osdev
<epony> the important part is that it's metric, the other details are, why are you doing it and not the operating system
<epony> now ask that question to the big applications that believe they are "opearating environments" themselves
<bnchs> kaichiuchi: have a memory pool?
<kaichiuchi> yes, memory pools are cool
<epony> as lard
<epony> get you pretty heated quickly
<epony> and slow
<epony> in UNIX, large memory and large process is the most common fault making everything defective that relies on such a model
<epony> that's the WINDOS model
<epony> has the same effects as scattering storage over large portions of the disk
<epony> cache operations take 1-3 clock cycles
<bnchs> in this OS i'm reimplementating, the required memory size is stored in the program, so that the OS can allocate the required memory when it's loading the executable
<epony> memory operations take 20-200 cycles
<bnchs> and not after
<bnchs> is stored in the executable file*
<bnchs> the OS stores the pointer to the allocated space in one of the program's CPU registers
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
<bnchs> in that way, it seems efficient if you're using a memory pool in your program
<kaichiuchi> epony: honestly i have no idea if you’re for or against memory pools based on that
epony has quit [Quit: QUIT]
<kaichiuchi> I do everything I can to avoid dynamic memory allocation unless there is quite literally no way to know “x” beforehand or if “x” is too large to be stored on the stack
<kaichiuchi> if reasonable upper bounds can be set, that is ideal
<kaichiuchi> consider an IRC server, I don’t know how many users are on one server (one) these days, but let’s say an average 2,500 users on one server and I’m really just pulling a number out of my ass
<kaichiuchi> it is better to allocate 2500 User structs or something, rather than allocate in the critical path
<kaichiuchi> (allocate a chunk of memory with malloc up front, and then grab slices of that)
wootehfoot has joined #osdev
elastic_dog has quit [Ping timeout: 260 seconds]
elastic_dog has joined #osdev
gog` is now known as gog
heat_ is now known as heat
xenos1984 has quit [Ping timeout: 256 seconds]
bauen1 has quit [Ping timeout: 272 seconds]
<heat> kaichiuchi, tiny little allocations is a horrible C++ anti-pattern
<kaichiuchi> why?
<heat> because you malloc a lot more
<heat> more internal fragmentation, more malloc overhead, a good probability malloc starts showing up in your profile a lot more
<kaichiuchi> i don’t understand unless I’m missing something here
<kaichiuchi> you use malloc once
<kaichiuchi> that’s it
<heat> I said tiny little allocations
<heat> you use malloc 20 times for 10 objects
<kaichiuchi> oh, yes
xenos1984 has joined #osdev
_73 has joined #osdev
<heat> i find it most annoying that C++ doesn't have a realloc equivalent
<zid> renew[]
<heat> std::vector when expanding needs to keep the old buffer and the new buffer just so it can move objects from the old to the new
<heat> realloc literally doesn't work because if it grows in-place, great, if not you can't move your objects anymore
<kaichiuchi> i am so tired and i want to go home and sleep(INT_MAX);
gildasio has quit [Ping timeout: 255 seconds]
gildasio has joined #osdev
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
Vercas has quit [Remote host closed the connection]
_73 has quit [Remote host closed the connection]
Vercas has joined #osdev
Bonstra has quit [Quit: Pouf c'est tout !]
TkTech has quit [Ping timeout: 272 seconds]
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
<geist> yeah i guess now with move constructors or whatnot you could hypothetically do some sort of renew[] style thing
Burgundy has joined #osdev
SGautam has joined #osdev
bauen1 has joined #osdev
spikeheron has quit [Quit: WeeChat 3.7]
spikeheron has joined #osdev
terminalpusher has joined #osdev
epony has joined #osdev
Bonstra has joined #osdev
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
wootehfoot has quit [Quit: Leaving]
dude12312414 has joined #osdev
wootehfoot has joined #osdev
terminalpusher has quit [Remote host closed the connection]
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
_73 has joined #osdev
heat_ has quit [Ping timeout: 246 seconds]
<kaichiuchi> so
<kaichiuchi> i'm getting a bonus, which I was not expecting since I just started
<kaichiuchi> how am I going to stop myself from buying another packard bell
heat has joined #osdev
bgs has quit [Remote host closed the connection]
<zid> by buying me one, ofc
SGautam has quit [Quit: Connection closed for inactivity]
Beato has quit [Remote host closed the connection]
Beato has joined #osdev
<kaichiuchi> ok
<kaichiuchi> but you're paying the likely $200-$350 shipping
<zid> can't you just buy a local one
<kaichiuchi> a packard bell?
<zid> and direct ship
<kaichiuchi> i mean, I just use ebay
<kaichiuchi> because I've tried to find older shit to buy on craigslist but no one cares enough to keep it
<zid> what kinda packard bells are you into
<zid> I take it not this i5 4460
<kaichiuchi> the ones that say “America grew up listening to us. It still does.” on the POST self test
<kaichiuchi> the lovely ones from early 2000s-mid 90s
<zid> There's two 'club desk top' here for £41 and £55 respectively
<heat> geist, move constructors can't work though, they need 2 valid memory locations
<geist> well inside the renew[] compiler implementation basically
<geist> ie seems like it'd be possible to have some sort of realloc style builtin implementation thingy in the compiler now that move constructors are a thing
<heat> something cool would be like a relocate() or whatever you could implement to relocate your object elsewhere
xenos1984 has quit [Read error: Connection reset by peer]
<heat> cuz i don't see how move constructors could help you out here
<geist> but yeah it'd be highly integrated with the heap to work
<geist> since it's bsiclaly conditional code
<zid> https://www.ebay.co.uk/itm/155287419225 What about a lovely cheap pvm
<bslsk05> ​www.ebay.co.uk: Sony Trinitron PVM-2053MD Video Colour Monitor in near mint condition. | eBay
<geist> ie, renew[](ptr) { if can extend { construct new objects off the end } else if cant extent { move construct old bits in new space; construct new ones } free old addr; }
<zid> It even has bad convergence judging from the picture
<geist> or whatever
<heat> oh yeah totally
<geist> but yeah temporarily it needs both pointers
<heat> the annoying bit is that realloc just can't work as-is
<zid> ah no I think that's just fringing on the camera
<heat> you need to have the two buffers allocated at once
<heat> in any case it's probably not a big deal considering vectors grow with amortized O(1)
<geist> those are weasel words!
<heat> they only keep 2^n in capacity so you're (probably?) unlikely to be able expand
<heat> oh yeah did you see my malloc comment thing? In C23 malloc has been clarified to not need max_align_t alignment
<heat> you do not need to return 16-byte aligned objects
<heat> in fact, several implementations already did so
<heat> basically AIUI it allows smaller alignment if your object is < 16 bytes
<bslsk05> ​open-std.org: N2293: Alignment requirements for memory management functions
<geist> zid: even if it was good and cheap, i'm basically afraid to ever order a CRT on ebay
<geist> so many horror stories of broken shit showing up everywhere
<geist> really even old computers too, but at least metal PCs usually are sturdy enough to survive without too many bumps
<geist> it's happening a lot to 8 bit machines and whatnot where c64s and amigas and whatnot show up completely destroyed, old macintoshes too
<geist> folsk just toss them in cardboard boxes without any real padding
<geist> you're almost doing the world a disservice by getting old hardware like that shipped, since the's a fairly high chance it'll get destroyed and thus taken out of the global pool of it
<zid> service*
<zid> geist: it's not bad if it stays in the UK, and tbh.. they got here from japan fine at one point!
<zid> people actually over-pack CRTs a lot
<zid> "it's glass, ergo fragile"
<zid> when actually it's 20kg of leaded reinforced glass, more like shipping a bowling ball
<zid> They used to come in cardboard boxes with 1cm of polystyrene
<geist> possible delivery here is even more destructive to boxes then there
<zid> wouldn't be surprised
<zid> it's a big place with lots of terrain and air-freight
<geist> i think the problem, at least in some cases, is some of the collectables have turned into a real industry
<geist> ie, lots of old retro computers are getting really expensive
<zid> pvms certainly have
<geist> because jackasses just grab and resell at markup, have no idea what they're dealing with
xenos1984 has joined #osdev
<geist> and thus use the absolute minimum amount of effort to get it done
<zid> There's random 'VINTAGE PACKARD BELL' £350 listings here
<geist> yah
<zid> it has £18 of hardware in it if you buy it in parts
<zid> so it's £330 for the case, effectively
<zid> type-x is the only case I care about, I'd pay £20 for one
<geist> yeah i have zero good memories of packard bells. in high school folks figured out that i knew how to 'fix' computers
<geist> so i'd end up debugging broken windows 3.1 installs on their shitty packard bell
<heat> was it windows 3.11?
<heat> because those only work for workgroups
<zid> we never used to fix installs
<zid> Your option was a full format and reinstall or nothing
<heat> it blows up if you work but are not in a group
<geist> heh, actually good question, though *i* had 3.11 i'm not sure actual real computers came with them
<geist> probably though after some point
<zid> I only use linux 3.11 for workgroups
<heat> that's a classic