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
lainon has quit [Quit: Textual IRC Client: www.textualapp.com]
Vercas has quit [Quit: Ping timeout (120 seconds)]
Vercas has joined #osdev
srjek|home has joined #osdev
Vercas has quit [Remote host closed the connection]
Vercas has joined #osdev
srjek|home has quit [Ping timeout: 272 seconds]
gxt_ has quit [Remote host closed the connection]
opal has quit [Remote host closed the connection]
gxt_ has joined #osdev
opal has joined #osdev
nyah has quit [Quit: leaving]
Vercas has quit [Quit: Ping timeout (120 seconds)]
Vercas has joined #osdev
zaquest has quit [Remote host closed the connection]
zaquest has joined #osdev
jack_rabbit has joined #osdev
knusbaum has quit [Ping timeout: 240 seconds]
tsraoien has quit [Ping timeout: 246 seconds]
gog has quit [Ping timeout: 276 seconds]
SpikeHeron has quit [Quit: WeeChat 3.5]
nullndvoid has joined #osdev
nullndvoid has left #osdev [#osdev]
nullndvoid has joined #osdev
papaya has joined #osdev
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
vai has joined #osdev
<vai> Hi all. Are you guys implementing, borrowing drivers/source code from Linux kernels? If so which version do you prefer, e.g. 2.2. or so or what? And is it worth the deal to support the Linux kernel drivers in your own embedded pet project?
vai is now known as Jari--
<Jari--> I am just coming to conclusion Linux is too overly bloated to beautify your small agile compact pet embedded kernel...
<Jari--> And the earlier simpler kernel implementations are absolutely deprecated like 1.2 or so which might still fit in a small kernel spce.
<Jari--> Space.
<Jari--> So I what I am doing I am borrowing parts from other LGPL/GPL kernels from OSDEV projects.
<Jari--> Of course, even by borrowing code, you might end up with broken source code. But I am really careful.
<Jari--> I borrowed my mm from one project, forgot now what it was :) Actually 50% rewritten it.
<Jari--> I am implementing a scanmem, classic memory scanner for amount of RAM available. Well, what I am doing now is just pass the PCI memory map to it, and skip those areas, later when paging is coming up, I just map the areas as reserved in the physical memory map.
<Jari--> E.g. you might have 1 gig of RAM according to scanmem, but the mm gets real PCI memory map, and the bitmap tells the full story of available RAM.
<kingoffrance> what hw/platform do you target Jari--? x86-32 ? 64?
<Jari--> kingoffrance: minimum 32-bit 486sx - some OPcodes might be Pentium
<Jari--> no amd64 support yet
<Jari--> kingoffrance: I once implemeneted a chain linked memory management, but if you broke one chain of the memory map, it broke down.. so its now better
<Jari--> I mean whole OS crashed on one memory chain corruption.
<Jari--> Flat memory especially, with paging it is easier.
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
MiningMarsh has quit [Quit: ZNC 1.8.2 - https://znc.in]
MiningMarsh has joined #osdev
GeDaMo has joined #osdev
mzxtuelkl has joined #osdev
bauen1 has quit [Ping timeout: 240 seconds]
elastic_dog has quit [Ping timeout: 264 seconds]
elastic_dog has joined #osdev
bauen1 has joined #osdev
vdamewood has joined #osdev
pretty_dumm_guy has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
vinleod has joined #osdev
vdamewood has quit [Ping timeout: 268 seconds]
heat has quit [Remote host closed the connection]
heat has joined #osdev
Jari-- has quit [Ping timeout: 256 seconds]
SpikeHeron has joined #osdev
bauen1 has quit [Ping timeout: 272 seconds]
bauen1 has joined #osdev
bauen1 has quit [Ping timeout: 246 seconds]
the_lanetly_052 has joined #osdev
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
kpel has joined #osdev
Vercas has quit [Quit: Ping timeout (120 seconds)]
Vercas has joined #osdev
the_lanetly_052_ has joined #osdev
heat has joined #osdev
heat_ has quit [Read error: Connection reset by peer]
the_lanetly_052 has quit [Ping timeout: 268 seconds]
the_lanetly_052_ has quit [Quit: Leaving]
heat has quit [Remote host closed the connection]
heat has joined #osdev
sympt has quit [Ping timeout: 255 seconds]
sympt has joined #osdev
vinleod is now known as vdamewood
jafarlihi has joined #osdev
<jafarlihi> How do you convert int to string if you don't have itoa or printf funcs?
<j`ey> implement itoa
<mrvn> you write itoa or printf
<j`ey> lol weird question
<mrvn> Did you want to ask how to implement itoa?
* mrvn always starts with i-to-hex
<jafarlihi> How to implement itoa?
<zid> divide by 10
<zid> add 48
<zid> repeat until golden brown
<jafarlihi> ok ty
<zid> as in, the number 1234 is the string '1', '2', '3', '4', meaning 1 thousand, 2 hundreds, 3 tens, and 4 units
<zid> 1234/1000 = 1
<zid> (1234-1000)/100 = 2
<zid> (1234-1000-200)/10 = 3
<zid> easier if you do it backwards though, 1234/10 = 123 remainder 4, 123/10 = 12 remainder 3, 12 / 10 = 1 remainder 2, 1 / 10 = 0 remainder 1
<zid> read the remainders backwards and you get 4, 3, 2, 1
<zid> err 1, 2, 3,4 if backwards*
<zid> divide by whatever you want for whatever base, 16 for hex, 2 for binary, etc
<mrvn> You make a output buffer `char buf[21]; buf[20] = 0; buf[19] = '0';` and set a pointer to the end `p = &buf[19];`. And then: while (i > 0) { *p-- = '0' + (i % 10); i /= 10; }
<mrvn> Going LSB to MSB works out nicer
<GeDaMo> If you want to convert multiple bases, instead of adding 48 you can index into a string "0123456789ABCDEF"
<bslsk05> ​github.com: boros/print.c at master · zid/boros · GitHub
the_lanetly_052 has joined #osdev
the_lanetly_052 is now known as eminghuliev
<zid> That one does digit extraction with shift instead of divide cus hex is a power of two, but there's that index into a string :p
<mrvn> zid: your longs are 32bit?
<mrvn> bonus points for using `index[array]`
<mrvn> zid: you should use (n >> shift) & 0xF;
<mrvn> eliminate the `mask`
elastic_dog has quit [Ping timeout: 260 seconds]
gxt_ has quit [Remote host closed the connection]
gxt_ has joined #osdev
elastic_dog has joined #osdev
<mrvn> Is there any non-legacy reason why a struct with a raw pointer should have a default copy constructor?
gog has joined #osdev
eroux has joined #osdev
gxt_ has quit [Remote host closed the connection]
gxt_ has joined #osdev
gxt_ has quit [Remote host closed the connection]
gxt_ has joined #osdev
wand has quit [Remote host closed the connection]
nyah has joined #osdev
wand has joined #osdev
foudfou has joined #osdev
kkd has quit [Quit: Connection closed for inactivity]
<foudfou> const uint64_t frames_total = /* uint64_t */extmem->len / /* #define */PAGE_SIZE;
<foudfou> gets translated by gcc to `shld` ?! what's wrong ?
jafarlihi has quit [Quit: WeeChat 3.5]
<Mutabah> umm... what architecture, and how are you seeing that?
<Mutabah> Wait... `shld` = shift left dword? That's perfectly normal
blockhead has quit [Remote host closed the connection]
<Mutabah> No, wait, shr is what you'd want for a division
<foudfou> x86 32-bit gcc, objdump -D kernel/pmem.o
<foudfou> yeah it results in a multiplication. With `extmem->len >> PAGE_SIZE_SHIFT` I get a shr (!) and a correct result
<zid> is it a multiply.. by a big integer
<mrvn> maye your PAGE_SIZE is wrong, like `#define PAGE_SIZE 1 << PAGE_SIZE_SHIFT`
<mrvn> extmem->len / 1 << PAGE_SIZE_SHIFT == extmem->len << 12
<j`ey> lol C
<mrvn> #define is evil. use enum in C
<j`ey> (well cpp, whatever)
<zid> lol optimizing compilers
<mrvn> zid: where is there any optimizing?
<foudfou> mrvn: spot on! forgot the parens around the definition. thx!!
<mrvn> << >> have a rdiculous low precedence
Vercas has quit [Quit: Ping timeout (120 seconds)]
FatAlbert has joined #osdev
<FatAlbert> came ot rub shoulders with the professionals of osde
<FatAlbert> v
<FatAlbert> so how are you people
Vercas has joined #osdev
kingoffrance has quit [Ping timeout: 265 seconds]
srjek|home has joined #osdev
dennis95 has joined #osdev
srjek|home has quit [Ping timeout: 268 seconds]
eminghuliev has quit [Remote host closed the connection]
tsraoien has joined #osdev
<heat> we are the profesional osdevers
<heat> that last problem wouldn't have existed in
<heat> r u s t
<heat> cargo install pagesize
<Mutabah> heat: You had me up to adding a package :) </oldschool>
<Mutabah> (I tend to avoid pulling in deps for my rust OS project, because it takes part of the fun out ... and I like my assembly)
<heat> if you dont import 100 crates is it really rust?
<Mutabah> well... do compile-time modules count?
<heat> or are you just writing gen Z C
<heat> no
SpikeHeron has quit [Quit: WeeChat 3.5]
<FatAlbert> it's above me why rust is even being used .. but im not an authority here '
<FatAlbert> im just an osdevy
<FatAlbert> but i know
<FatAlbert> one day i will be here giving design adviecs
<FatAlbert> advices
<FatAlbert> i know it
<FatAlbert> mark my words
<FatAlbert> but up until then .. im following your lead
<FatAlbert> so you can use rust ... but that's at least -1 hax0r points
<FatAlbert> ok i admit that's sounds a bit wierd ..
<Mutabah> I'm getting towards osdev oldguard, and there's a reason why I use rust nowadays
<FatAlbert> then all i left is comply
<Mutabah> It makes so many errors I used to make, and still see people making, much less common
<FatAlbert> for me if it's not C, Python or Java .. its' a clutter lanaguage
<heat> lol
<FatAlbert> ruling out specific purpose languages like JavaScript
<FatAlbert> heat: why am i wrong pal ?
<FatAlbert> ok im putting assembly to the my list
<FatAlbert> heat but that's it
<FatAlbert> even Java is Skeptical
<FatAlbert> heat: if you not agree with me i want to know why
<FatAlbert> im here ot learn
<Mutabah> I think it's becuase that's a quite close-minded attitude
<heat> why would you restrict yourself to 3 languages
<heat> also, why those 3?
<heat> makes no sense
<Mutabah> Languges exist to solve problems, some are better than others for given problems.
<FatAlbert> ok ill explain
<Mutabah> C is (nowadays) best as a high-level assembly - you want minimal abstractions between you and the operations performed.
<Mutabah> For larger projects, where abstractions are desired - it's better to use a higher-level language (C++, rust, swift, go, ...)
<FatAlbert> C for the obvious system level stuff, and contorl. Python well .. you want to get thing done quickly ( you can alwayas find someone write something about your given problem) and Assembly because it's needed in specific situations
<heat> in what language would you write a video game?
<FatAlbert> │17:25:53 FatAlbert | ruling out specific purpose languages like JavaScript
<heat> you'd write it in javascript?
<FatAlbert> no, in C++
<heat> ok, how is that not a general purpose language
<FatAlbert> it is .. it's because once you decided that you want to program with C take the courage to do some a bit more additional work and do it with C
<FatAlbert> C++ take the courage ..
<Mutabah> C++ is a different language to C
<FatAlbert> you can gain some performance
<Mutabah> Very similar syntax, but VERY differnent idioms
<heat> no you can't gain some performance
<heat> C is not inherently faster than C++
<FatAlbert> C++ = C with OOP known by the language, and other minor things
<heat> not true
<heat> true "modern" C++ is quite different from C
<FatAlbert> it adds additional abstraction which you have no control of ... in SOME case it would not be optimal
<heat> where?
<heat> please be specific
<FatAlbert> i don't know where ... but it's like using merge sort for arrays of 10's
<FatAlbert> it works .. but it's NOT optimal
<heat> you know C also has sort() right
<FatAlbert> and this is just one tiny example why you DON'T want premade solutions that you ahve no control of
<heat> you don't microptimize stuff because it makes no sense
<heat> sorry, not sort, qsort
<FatAlbert> heat: indeed but you choose wheter to use it or not
<heat> and in C++ I also choose whether I use it or not
<heat> no one calls std::sort() for me
<FatAlbert> no.. it's ingrainer in the design
<heat> no it's not
<FatAlbert> im talking about the OOP stuff and other things build to support it
<heat> in fact, plenty of projects don't use the STL
<FatAlbert> ingrained
<FatAlbert> plus, once you get used too that sugar C++ offer you might sometimes forget how things work internally
<FatAlbert> which is a dangerous buisness here in osdev
<heat> amnesia?
<heat> I've written my OS in C++
<heat> it works fine
<heat> better than it would've if written in C
<FatAlbert> it's a fact .. when something is premade for you .. you are taking it as the optimal way for any given problem which is wrong by principle
<heat> better start writing microcode then
<FatAlbert> in C nothing is enforced by the language itself ( as far as it can be )
<heat> hit me up in 2122 when your optimal solution to "osdev hello world" is finished
<FatAlbert> i didn't say write microcode .. i just don't see the reason why to use abstractions when you can optimize your own for your given project (game)
<FatAlbert> not something offer you as a general way
SpikeHeron has joined #osdev
<heat> instructions are an abstract
<FatAlbert> offer to you
<heat> abstraction*
<heat> C is an abstraction
<heat> C++ is an abstraction
<FatAlbert> i did said ( as far as i can be )
<heat> you don't actually gain performance by switching to C, unless your C++ is in fact horrible
<FatAlbert> heat: yeah and that's the bridge you dont want to cross ...
<heat> what bridge?
<FatAlbert> the abstractions from C to C++, because it's unnecessary
<heat> it's not unnecessary
<heat> I highly encourage you to write a piece of complex software
<heat> it would do wonders for you
<FatAlbert> GeDaMo: what camp are you on ?
<GeDaMo> Camp?
<heat> you seem to not know what C and C++ are and are spitting out really hot takes on languages
<FatAlbert> heat: ok you might not agreeing with me, and yes im not an expert but nothing suggested that i don't know what C or C++ are
<FatAlbert> i think i laid out what there are pertty good
<FatAlbert> they
<heat> you're telling me that C++ is useless and C is better
<heat> it suggests you haven't written anything in those two languages
<heat> C++ does not force much "on you"
<heat> you choose whether you want to use it, you choose what features you want to use, and where
<FatAlbert> im telling you C++ has the potential of saving you coding time, but as far as performance goe's it has some pitfalls by the very fact that it offers functionality that you have no control of
<heat> which is why I was able to write a whole kernel in C++
<FatAlbert> i never said you coudldn't
<Mutabah> Every language has pitfalls
<heat> I suggest you give me a good example of functionality I have no control of and how my life would be better if I had control over it, in C
<Mutabah> e.g. see the `sscanf` loop issue with GTA5
<Griwes> There's barely any things that you don't have control over, and you disable basically all of them in kernel land anyway
opal has quit [Ping timeout: 268 seconds]
<FatAlbert> heat: i alreayd told you, C++ is implementing OOP support and other few things by the language ... you can't control how they are implemented. yes this might save you coding time ... but this abstractions might generate not optimal code for some use cases .. because they static implementations, in C you can can make your own abstractiosn ( and in C++ also but what's the point ? )
<FatAlbert> heat: im not expert but i gave oyu an example with the merge sort algorithm
<FatAlbert> yes it works ... but is it the optimal way in ALL cases ? no.
<FatAlbert> heat: honestly .. im if wrong i would be happy to be corrected but it's very logical ( at least as i see it )
<j`ey> and the C code would be optimal in all cases?
<FatAlbert> j`ey: you can optimize your own abstractions, to the given use case
<j`ey> can you do that in C++?
<FatAlbert> yes .. buut what's the point ? if you are writing pretty much the same code why to learn another language ?
<FatAlbert> this is how it started
<j`ey> because you dont need to optimise every single use case
<Griwes> You can't control how what are implemented
<j`ey> OOP
<FatAlbert> j`ey: interesting ..
<Griwes> People have done numerous different implementations of polymorphism in C++
<Griwes> Virtual functions? They are implemented in precisely the way virtual functions are implemented idiomatically - with vtables and vptrs
<FatAlbert> j`ey: what you saying is that the time of the coding earned by using C++ mechanisms are worth much of the time earning let's say for clarity 0.0001 runtiem ?
<FatAlbert> in using C optimized
<Griwes> I really don't get what the heck you're talking about, FatAlbert
<j`ey> FatAlbert: sure
<FatAlbert> j`ey: i convinced
<FatAlbert> j`ey: thank oyu
<FatAlbert> you
<FatAlbert> and more importantly i also learned that there might be actual concrete benefits of learning more than few languages ... finding the language that would provide the right balance of development time, and readability would be much preferable for earning few unimportant run speed.
opal has joined #osdev
the_lanetly_052 has joined #osdev
<heat> and... that compilers are smart enough to generate fast code
arch-angel has quit [Ping timeout: 264 seconds]
<bslsk05> ​godbolt.org: Compiler Explorer
<heat> oh look, its the exact same code
<heat> who would've known
<Griwes> And one of those the compiler actually understands on a semantic level even before lowering it down into its middleware
rtypo_bot has joined #osdev
rtypo_bot has left #osdev [#osdev]
foudfou has quit [Remote host closed the connection]
opal has quit [Remote host closed the connection]
Vercas has quit [Remote host closed the connection]
wand has quit [Remote host closed the connection]
foudfou has joined #osdev
opal has joined #osdev
<FatAlbert> are you lubing your switches ?
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
heat_ is now known as heat
dennis95 has quit [Quit: Leaving]
<mrvn> FatAlbert: C++ sort uses linear insertion sort for arrays < 6 (expensive objects in c++), 16 (msvc, gcc) or 32 (cheap obejcts in clang).
<mrvn> FatAlbert: also every C program is also a C++ program with the exception of VLA and some variable names being keywoards now and similar. You only need to change some variable names or your comments style and C source will compile with C++ to identical output.
bauen1 has joined #osdev
<mrvn> In recent years I have come to the conclusion that knowing C is more of a hindrance to leraning modern C++.
qeeg__ has joined #osdev
<geist> interesting theory and maybe pretty valid
papaya has quit [Quit: leaving]
<mrvn> If you know C you are going to use `a[10]` and raw pointers far to easily instead of learning the newer abstractions. You already know how to solve problems one way so you aren't goign to search for different ways modern c++ might provide.
<geist> and you might be like me, constantly annoyed at how less efficient C++ abstractions are for the same thing
<mrvn> Similar if you know older c++ and now have to write C++20/23. You skip a lot because you simply don't know it.
<mrvn> geist: a) a lot of C++ abstractions aim at 0 cost (they do miss a lot too but not by much usually), b) does it matter for code that isn't the inner loop?
<\Test_User> mrvn: "if it's code that's run it will effect performance" >:)
<mrvn> \Test_User: 5 cycles per call isn't relevant if it's only called once.
<\Test_User> and if isn't then you should consider outright removing it
<zid> actually it will probably do the opposite of effecting performance, it might affect it though :P
<mrvn> 30 minutes spend wiriting it 5 cylces faster you never get back
<mrvn> zid: std::vector<int> v; v.reserver(1000000); greatly effects performance for the remaining code :)
<\Test_User> mrvn: meh, if it's run once in a while it doesn't matter much, but if you start adding those inefficiencies together you end up much slower
<gog> not writing code is way faster
<gog> nothing to write, nothing to execute
<GeDaMo> No bugs! :P
<geist> mrvn: well usual argument. it doesn't unless it does
<geist> and sometimes it does so that means if you're a good programmer, you have to know these things
<geist> and since there are far more abstractions in C++ than in C its much more stuff to learn, etc
<geist> so you have to see the value in the whole thing, which may be harder hump for a C programmer to get over
<geist> a *bad* programmer in my opinion is one that does not care about what the abstractions do, and simply blindly use them
<geist> that's how you get really inefficient things sometimes. though most of the time it may not matter
<mrvn> geist: true. A big problemn is people not knowing the limit of abstractions. For example people call `std::vector<Foo> v; ... v.emplace_back(Foo(13));` and then wonder why it does a horribly slow copy construct.
<geist> yah
<mrvn> Don't use `make_*` or `emplace_*` on objects, only on the constructor arguments.
<geist> or be at least naturally curious about it. so sometimes i struggle with my desire to know *everything* about how the abstractions work, and just getting it working
<geist> so feels like sometimes i get stuck in the loop of trying to deeply learn some thing vs just letting it go
<mrvn> I wish the C++ standard would declare the copy/move constructors and assignment open to optimization like with (N)RVO.
<geist> and 4/5 times that's fine. but my eperience is, especially in embedded and kernel contexts, that 1/5 times actually really matters
<geist> and you really should know the details of the implementation
<mrvn> geist: Having to write your own STL for your kernel helps a lot with knowing what those abstractions do.
<mrvn> Plus you won't write any of the monster constructs the compiler can never get rid off. Too much work.
<geist> right. which comes back to the original point: i fyou're coming at it from a C programmers point of view, you have to see enough value in all that work building your own TL to actually want to do it
<zid> no no you should write it in python then worry 18 months in why it's so slow and what you can do to fix it
<FatAlbert> i still the topic of #osdev i see
<geist> whereas if you're already a c++ programmer and you come to the 'gotta write my own TL for my kernel' then there may simply be no other option
<FatAlbert> im gaining popularity and you guys haven't seen my code yet
<mrvn> Even in C you are going to write your own List and Tree and Slab and such. It just won't be as typesafe.
* geist nods
<mrvn> What I hat about C++ is that you don't know what the optimizter will actually make out of the abstraction. You can look at the asm output to see if the optimizing works but maybe next week you change a line and it stops removing the abstraction.
<geist> side note: in all my years of using non typesafe lists/trees/slabs, i've never once had a type safety issue. my experience is you have trees and lists of One Type Of Thing, and it's simply known what type of thing goes in this list
<FatAlbert> mrvn: insteresting thanks
<geist> and thus really doesn't end up being a problem
<FatAlbert> i wasn't here just reading your output
<geist> however, i've had that argument about type safety and containers with folks that simply cannt comprehend not using a type safe container. in their mind it's ludicrous not to
<geist> which i find a bit closed minded, to be honest
<mrvn> geist: For kernels that's probably true. Bounds checks on the other hand I feel you do have.
<geist> like, everything doesn't need to have handrails on absolutely everything
<geist> yah i think std::array kinda things are pretty useful
<geist> or string buffer whatever you call them.
<FatAlbert> mrvn i know that you can compile C code is also C++ code except the things you mention .. the things is .. if you need to implement your own OOP concepts in C while you using the one's provided by the C++ language, then they will NOT compile to the same code
<FatAlbert> not always atleast
<mrvn> Does std:array do anything other than remove the "arry decays to pointer" for you?
<mrvn> string_view?
<geist> std::array at least has the length baked into the type so it also does bounds checking for you
<FatAlbert> in these simplistic cases maybe no
<geist> but it's limited to things that are compile time fixed, since thelenght is part of the template
<FatAlbert> however implement inheritance and aggregation in C, and od the equivalent in C++ using the provided syntax
<FatAlbert> and you will see difference
<mrvn> FatAlbert: you can design your own OOP concpects in c++ if you think you can do it better.
<FatAlbert> ss
<geist> useful for 'this thing returns 8 of that' or whatnot
<FatAlbert> mrvn: but in that case you defeat the purpose of using C++ in the first place
<mrvn> geist: only is you use arr.at(x) instead of arr[x]
* geist nods
<geist> anyway just an example of a low calorie abstraction
<mrvn> FatAlbert: you realize that most people use C++ without exception and without rtti for kernels, right?
<geist> and generally without most of STL, since it generally isn't suitable for kernel work
<mrvn> geist: for (auto & x : arr), I just love that sometimes.
<geist> mrvn: totally
<FatAlbert> it's like j`ey said, it's boils down to sacrifice small ( often very small giving today compilers ) performance for faster development time and readability
<mrvn> I do miss a ranged-for with index though.
<FatAlbert> and these abstract benefits are not bound only to C and C++ ofcourse
<mrvn> FatAlbert: there are lot of things in C++ that give you 0 overhead abstractions.
<mrvn> like std::array
<clever> ive written templated constexpr inlined functions, that compile down to a single opcode
<FatAlbert> mrvn: yes in these cases it's not different than #DEFINE in C
<geist> not true at all
<clever> FatAlbert: but can the pre-processor act on the sizeof() an object?
<geist> but much of the value there stems from how much value one puts into type safety
<FatAlbert> mrvn and geist now you got me on deep water ...
<FatAlbert> im not expert system programmer ( obviously )
<bslsk05> ​'CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”' by CppCon (01:19:52)
<clever> dang!
<mrvn> "And what this means is the entire game, including sprite resources, compiles to 1005 bytes"
<clever> i rarely see gcc targeting the c64, even in c
<FatAlbert> i bet all of you are CS graduates
<clever> FatAlbert: i'm not even an HS graduate :P
<FatAlbert> yeah you are also not that `clever` :)
<FatAlbert> i wan to learn in Uni
<mrvn> geist: when I say type safety I also count not havign to cast stuff around all the time to get the right type even if there is no danger of getting it wrong. Or having no risk of shadoing due to namespaces or enum class and lots of other minor niceties.
<FatAlbert> mrvn you are CS graduate right ?
<mrvn> I'm a CS non-graduate
<FatAlbert> you still student ?
<mrvn> no. Just had to leave to get a job due to money problems and never got back
<gog> same
<FatAlbert> i also have money problems
<FatAlbert> but i can do some courses
<FatAlbert> it doesn't have ot be the full degre
<FatAlbert> degree
<FatAlbert> in Your Uni's cs degree also include math that you will never use ? :)
<mrvn> If you want some arguments against C++ look at the "C++ Best Practices": https://www.youtube.com/watch?v=zBkNBP00wJE&t=3693s
<mrvn> You can probably define lisp in 748 words.
<gog> math that youll never use in a direct way, but i think learning maths is extremely important
<geist> fun thing i watched a vid last night about: VTL. Very Tiny Language. interpreter fit in 768 bytes on a 6800
<geist> basically a simpler but pretty powerful BASIC
seer has quit [Quit: quit]
<bslsk05> ​gist.github.com: VTL - A Very Tiny Language for Arduino · GitHub
seer has joined #osdev
<GeDaMo> There seem to be VTLs for many small systems
wand has joined #osdev
<mrvn> geist: You have to love ARM64. https://godbolt.org/z/Yrfhjf4oa Try understanding the clang x86_64 output and then the ARM64.
<bslsk05> ​godbolt.org: Compiler Explorer
<GeDaMo> I don't see 6800 but there's this https://www.youtube.com/watch?v=GJ02QLHRVOw
<bslsk05> ​'Altair 680 - VTL (Very Tiny Language)' by deramp5113 (00:23:11)
Vercas has joined #osdev
<mrvn> (if you remove line 6 the x86_64 gcc output gets worse too)
<FatAlbert> mrvn: your money problems might have been a good luck .. sense you spared the money and you still kick ass in CS :)
<FatAlbert> which means doin only the courses you interested in without graduating could prove not a bad tactic also from a financial point of view
<mrvn> FatAlbert: You study CS for the degree and background. You don't really learn to program at university. And barebones basically not at all.
jafarlihi has joined #osdev
<jafarlihi> Hey peeps. I use this code to check my IDT table: https://github.com/jafarlihi/ksec/blob/62811b3cf71b11ac4a607fd4860471201568e819/ksec.c#L247 Now the issue is all my entries seem to be outside main kernel text, is this normal?
<bslsk05> ​github.com: ksec/ksec.c at 62811b3cf71b11ac4a607fd4860471201568e819 · jafarlihi/ksec · GitHub
<FatAlbert> mrvn: right programming you learn by practicing .. but i need to get some solid foundations .. sometimes you guys talk about topics that i don't even know what they are
<gog> jafarlihi: the table itself will be in data, not text
<FatAlbert> for example RTTI .. the first time heared this word is today by you
<mrvn> FatAlbert: It's all stuff you can get from a good book. But you when you apply for a job they look at your lack of degree.
<mrvn> FatAlbert: run time type information
<gog> you'll have to decode the entry to get the pointer to the isr
<gog> and then check that the isr is inside text
<mrvn> FatAlbert: raii - resource allocation is initialization
<j`ey> you spend lots of paper to get a degree, which is a piece of paper you can use to make more pieces of paper from an employer
<mrvn> FatAlbert: and it's important restruction is resource deallocation :)
<mrvn> s/restruction/destruction/
<jafarlihi> I quit my degree when I had 6 classes left to take because I hacked Calculus 1 grade and couldn't do shit about Calculus 2 lol
<mrvn> FatAlbert: raii is what make lock guard possible
<FatAlbert> mrvn: you speak chinease to me :)
<jafarlihi> mrvn: It's "acquisition"
<mrvn> jafarlihi: I stand corrected
Vercas has quit [Remote host closed the connection]
Vercas has joined #osdev
<mrvn> FatAlbert: wathcing some cppcon videos on youtube can also help. I recommend some Back To Basics talks and then go and buy a good book
<jafarlihi> gog: Thanks
<jafarlihi> FatAlbert: I do computing 10 hours a day every day and still feel like a noob, if you are going into it then you have to dedicate your whole life
terminalpusher has joined #osdev
vdamewood has quit [Read error: Connection reset by peer]
vdamewood has joined #osdev
<jafarlihi> gog: I tried "core_kernel_data" instead, still reports them outside kernel
<jafarlihi> This chiense code does the same but it is completely useless because it laters skips over the loop with continue when it can't find the address in a module: https://github.com/bytedance/Elkeid/blob/8b11178c35bf8287e30c02300493dac9b3b4d84a/driver/LKM/src/anti_rootkit.c#L140
<bslsk05> ​github.com: Elkeid/anti_rootkit.c at 8b11178c35bf8287e30c02300493dac9b3b4d84a · bytedance/Elkeid · GitHub
<jafarlihi> Funny it has 1.2k stars
<jafarlihi> BS security product
<zid> what on earth is a core_kernel_data
wand has quit [Remote host closed the connection]
<jafarlihi> zid: Supposed to tell you if given addr is in kernel .data
wand has joined #osdev
<zid> it's a program?
<jafarlihi> It's a macro in linux
<jafarlihi> or rather function
<zid> * Returns true if @addr passed in is from the core kernel data
<zid> * section.
<zid> whatever one of this is, heh
<mrvn> How do I make a unique_ptr with placement new?
<zid> it just checks if it's >= _sdata but _edata anyway, which are presumably exported symbols from the linker script
<zid> but < _edata*
Vercas has quit [Quit: Ping timeout (120 seconds)]
Vercas has joined #osdev
<jafarlihi> Does this look correct?: return offset_0_15 | (offset_16_31 << 16) | (offset_32_63 << 32);
<mrvn> if that is what you intend to do
<mrvn> it will compile if it's part of a function and the variables exist
qeeg__ has left #osdev [Leaving]
<jafarlihi> mrvn: Is it correct amount of shifts for building IDT entry offset addr though?
<mrvn> building? Would have thought that's for reading the IDT entry.
<jafarlihi> Yes, reading
<mrvn> why don't you test it?
<jafarlihi> I don't want to crash the kernel or bring up VM lol
<mrvn> reading the IDT won't crash anything
<heat> mrvn, std::unique_ptr<T, custom_deleter> p{new (&buf) T{...}};
<heat> where that custom deleter calls placement delete
<mrvn> heat: hmm, now it works. Couldn't get it to compile before though I thought I wrote exactly that.
<mrvn> void *mem = aligned_alloc(alignof(int), sizeof(int));
<mrvn> return std::unique_ptr<int>{new(mem) int(x)};
<mrvn> return std::unique_ptr<int>{std::construct_at((int*)mem, x)};
<heat> you still need a custom deleter right?
<mrvn> for aligned_alloc?
<heat> oh right
<heat> well... possibly?
<heat> it's not exactly defined per the standard
<mrvn> aligned_alloc needs a simple delete, right?
<heat> but yes it should be fine to pair aligned_alloc with delete
<heat> technically pairing anything that's not new with delete is undefined afaik
<mrvn> To avoid a memory leak, the returned pointer must be deallocated with std::free() or std::realloc().
<mrvn> Ups, no "delete".
<mrvn> So, yes, it needs a custom deleted that calls free.
<mrvn> Isn't there an aligned_new C++ thing?
<merry> e.g. return new (std::align_val_t(16)) int[40]; for a 128-byte aligned thingy
<jafarlihi> In both of my laptops interrupts 3, 4, and 128 are outside kernel text and not within any module text either. Any idea why?
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<mrvn> merry: 128? Shouldn't that be 16 byte aligned?
<merry> bit*, brain did a derp
<merry> I would recommend against doing such a thing because calling the correct aligned delete[] is a pain
<merry> in c++ i would just alignas() the type appropriately
<heat> i say mrvn's solution is the better one
<mrvn> merry: something like using aligned_int = alignas(16) int;?
kpel has quit [Ping timeout: 260 seconds]
<merry> that should work afaik
jafarlihi has quit [Quit: WeeChat 3.5]
<mrvn> void(*)(D*
<mrvn> return std::unique_ptr<int, void(*)(void*)>{
<mrvn> std::construct_at((int*)mem, x),
<mrvn> std::free
<mrvn> };
<mrvn> It's kind of ugly.
Vercas has quit [Remote host closed the connection]
Vercas has joined #osdev
Vercas has quit [Remote host closed the connection]
<mrvn> It sucks that you have function pointers, operator(), lambdas and std::function to support there as deleted.
<mrvn> deleter
Vercas has joined #osdev
<mrvn> Or rather that they are all different things.
wand has quit [Remote host closed the connection]
wand has joined #osdev
wand has quit [Remote host closed the connection]
wand has joined #osdev
the_lanetly_052 has quit [Ping timeout: 246 seconds]
pretty_dumm_guy has quit [Ping timeout: 246 seconds]
GeDaMo has quit [Quit: There is as yet insufficient data for a meaningful answer.]
pretty_dumm_guy has joined #osdev
terminalpusher has quit [Remote host closed the connection]
FatAlbert has quit [Ping timeout: 268 seconds]
<MA-SA-YU-KI> Hello again, professional systems programmers.
<MA-SA-YU-KI> Can I do one last participant recruitment post for my CoPilot study so I can say I really did my best to recruit professional systems programmers?
<heat> how much time do you need and what exactly do you need
<MA-SA-YU-KI> heat Thank you so much for responding.
<MA-SA-YU-KI> I need about 14 professional systems programmers to participate in a study that wants to investigate the quality of code developers produce when assisted by Github CoPilot. The procedure involves solving a C++ programming problem within 30 minutes with CoPilot then solving another C++ programming problem within 30 minutes without CoPilot. In total, it would take about 75 minutes to 90 minutes. If you're interested in the study, I
<MA-SA-YU-KI> can work around giving you Github CoPilot access for the duration of the session.
<MA-SA-YU-KI> Affiliation - I am a CS Master's student at the University of Waterloo supervised by Meiyappan Nagappan and Samer Al-Kiswany. Email is - derhabor@uwaterloo.ca
<MA-SA-YU-KI> Thank you all for your time.
Vercas has quit [Remote host closed the connection]
mzxtuelkl has quit [Quit: Leaving]
nyah has quit [Quit: leaving]
Vercas has joined #osdev
kingoffrance has joined #osdev