<heat>
i'm gonna make a microcode version of rust and call it ʳᵘˢᵗ
<bnchs__>
i'm gonna make rust and call it shit version of iron
<heat>
you mean micro$hit rustblows
<moon-child>
I'm gonna make an italian version of rust and call it 𝑟𝑢𝑠𝑡
<jjuran>
bnchs__: Will it run on an SGI O2 machine?
<geist>
oh that's true, i think MSFT is into rust now too. doesn't that put some of the micro$loth stank on it?
<bnchs__>
jjuran: it just rusts your SGI machine
<heat>
even NSA is into rust
<heat>
<cue all seeing eye>
<geist>
oh no! if they use rust they'll actually be competant at domestic surveillance
* geist
waves to friends in domestic surveillance
<heat>
ladies and gents, we have defeated terrorism with rust
* geist
gestures subtly towards heat
<bnchs__>
i'm gonna make rust, and call it C++ with even shitter syntax
<sortie>
jet fuel can't melt rust
<heat>
GEORGE BUSH DID RUST LANG
<geist>
to get meta for a minute, joking about rust is like joking about kids these days. you rip on them but you're really just feeling obsolete and a little jealous.
* geist
sighs
<geist>
but will continue my tirade against rust! we must hold strong
<bnchs__>
i was wondering why retroarch froze, and firefox refused to play videos
<bnchs__>
apparently audacity was still taking control of my speakers
<heat>
i will never be obsolete
<geist>
hmm, i kinda thought al gore invented rust along with the intenret
<heat>
i am inevitable
epony has joined #osdev
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
<heat>
you can hold your unique_ptrs and your Boxes but I will arrive with my strong opinions about everything and a very intense NIH syndrome
<epony>
Reinhilde, at which grade were you discarded from school ;-)
<epony>
(landing on your head)
<epony>
your Niebellung masculinity is showing
<epony>
you'll have to e-mule-ate self-castration jokes too
<epony>
dating back to Kronos times, you know harversting the monads
<Reinhilde>
accursèd
<epony>
now work some more on your Lisping
<Reinhilde>
yeah no that'd just be while what i wrote
<epony>
cause it sounds a bit snakeish
<epony>
imagine if that initial socialist test-sickle was the first closing bracee of your old testamentality Lisparsersperger
<epony>
quite islamic when you figure out it's the crescent and star after all
<epony>
don't you think, Hilda?
<mrvn>
moon-child: now build switch/case
<moon-child>
hmmm
<moon-child>
do I get to use setjmp/longjmp?
isaacwoods has quit [Quit: WeeChat 3.7.1]
<epony>
no, just register shifts and forward-reverse control but you get 256 registers to play with and not a single memory instruction
<bnchs__>
use raw opcodes to jump
<bnchs__>
epony: 256 registers
<bnchs__>
alot than intel's 8 registers
<epony>
yep, for all your 256 miffle fingers
<epony>
"meddle"
xenos1984 has quit [Read error: Connection reset by peer]
<bnchs__>
no i still not gonna forget about intel's shit registers
<epony>
they were 6
<bnchs__>
no they were 2
<epony>
that's another Intel
<epony>
from MOStek
<heat>
what's a shit register?
<heat>
I didn't see those in the SDM
JerryXiao has quit [Ping timeout: 260 seconds]
<epony>
a shit register is what you use on SONET-SDH
<kaichiuchi>
god
<kaichiuchi>
recursion is annoying
<mats2>
is it?
<mrvn>
bnchs__: number 1 and number 2?
<kaichiuchi>
i do not write recursive code and this is nice
<kaichiuchi>
change my mind
<mats2>
is it?
<moon-child>
recursion is nice
<epony>
a-ha
<kaichiuchi>
:(
<moon-child>
I recently wrote a concurrent ring buffer as a (tail-recursive) function. Was much easier to reason about the state involved than it would have been with an explicit loop
<epony>
for when you want to make longjumps from the top of the jumping tray in a waterless pool
<epony>
the computer does not have a problem with it
<epony>
it's the premise of computing to do all kinds of iterative bit flipping
<epony>
you get the effects of that pre and post usage (if you have time to wait)
<epony>
maybe you would know why it was invented at least?
<zid>
i starts as 0, then you increment i by 2, then test the parity of i
<zid>
= 0 and += 2 cannot change the parity of i to odd
<zid>
it looks like it was meant to be i++
<zid>
so that you alternate betwen two code paths
<bnchs>
oh yeah, i added that i += 2 during some early point in development
<bnchs>
must have forgotten to change it
<zid>
but that's the dumb way to write it, the i += 2 way is correct, you just have no if() inside and do thing[i+0] = 0; thing[i+1] = 0xD; or whatever op you're doing
<zid>
same issue as before on 109, 113 is wrong wrt aliasing but at least correct wrt it being an endian issue at least
<zid>
repeat until end
<bnchs>
alright
<zid>
the correct primitive is memcpy, not casting to u32 *
<zid>
or just writing a WRITE_U32 macro
<zid>
that does p[0] = high_byte; p[1] = ..;
<zid>
personal style thing: spaces after the sizeof keyword, it's an operator not a function
<heat>
you could just cast to u32 * if -fno-strict-aliasing
<zid>
potential bug source that probably needs a documentary comment; You do pid++ on entry to process_new, even if the syscall fails, idk if that's correct behavior wrt the original
<heat>
actually good q
<heat>
what's the behavior on that for fork()?
<bnchs>
no that's a mistake
<heat>
if you create a new process in fork and then ENOMEM somewhere what should be the next pid?
<zid>
six
<heat>
ah POSIX doesn't require sequence in pids apparently
<zid>
that's the best part about emulation
<zid>
spec doesn't matter, what anyone can write a test-rom to have happen does
<zid>
"I wrote a test rom that relies on pid sequencing staying sequential even if it fails 3/4 of the way through fork, glhf"
<bnchs>
the OS api calls are implemented in trap_handlers, if you wanna see that
<zid>
we should watch non non biyori clips on youtube now I think
<heat>
i'm 0/3 on "teams I want to win" world cup edition
<heat>
fml
<zid>
who won?
<zid>
Was it me?
<heat>
no not the ingerland
<zid>
I meant me personally
<heat>
also not zid no
<heat>
it was the anti-ingerland, the argentinians
xenos1984 has joined #osdev
<zid>
who did they murder
<epony>
the turkey
<jimbzy>
Le Blue
<zid>
les bleux
wootehfoot has joined #osdev
<epony>
there is a long arrow in this chicken
Raito_Bezarius has quit [Ping timeout: 268 seconds]
<epony>
pooq poq poq poq france lost poq coq pooq poq poq 1 week of Xmessi celebrations now #10
terminalpusher has joined #osdev
danilogondolfo has quit [Remote host closed the connection]
<kaichiuchi>
hi
<heat>
hello
dennis95 has joined #osdev
andreas303 has joined #osdev
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
Raito_Bezarius has joined #osdev
ZombieChicken has joined #osdev
wootehfoot has quit [Read error: Connection reset by peer]
<kaichiuchi>
you know
<kaichiuchi>
I wonder how logging on embedded systems goes
<zid>
serial
<kaichiuchi>
yes
<kaichiuchi>
that's all well and good
<kaichiuchi>
that part I know
<kaichiuchi>
but sometimes you can't do that
<heat>
LEDs
<kaichiuchi>
heat: hey by the way
<kaichiuchi>
I have another task for you
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
<kaichiuchi>
i have a heap, right? and this heap accepts structs which contain functions to call
<kaichiuchi>
and these structs are in an array
<kaichiuchi>
how can I possibly do the lambda magic now
<kaichiuchi>
with templates
genpaku has quit [Read error: Connection reset by peer]
genpaku has joined #osdev
<kaichiuchi>
(i don't think you can)
terminalpusher has quit [Remote host closed the connection]
<bnchs>
kaichiuchi: isn't that called the stack
<kaichiuchi>
no
<kaichiuchi>
I literally mean a heap data structure
<bnchs>
oh
heat__ has joined #osdev
<heat__>
kaichiuchi, pointer
heat_ has quit [Read error: Connection reset by peer]
heat__ is now known as heat
<heat>
actually
<heat>
hrm
<kaichiuchi>
pointers are a candidate
<heat>
you'll need a pure virtual class invokeable or something that has an operator(), then a subclass of that that encapsulates a lambda and has an operator() that invokes the lambda's operator()
<kaichiuchi>
i hate this.
<heat>
that's the only way here
<heat>
you need to do type erasure
<kaichiuchi>
what a horrible fucking language
<kaichiuchi>
okay
<heat>
void * doesn't work because lambdas don't subclass anything (i.e you can't just operator() them out of the blue)
<heat>
you'd have this exact same problem in C sweetheart
<kaichiuchi>
no I wouldn't
<kaichiuchi>
I would just do `event_handler func;` and be done
<heat>
and have a void *ctx?
<kaichiuchi>
rather that than this monstrocity
<heat>
you store 2 pointers instead of one
<kaichiuchi>
unless this can all be better abstracted later
<heat>
you're like literally implementing std::function bit by bit
<kaichiuchi>
and it's awful :)
<heat>
this is the part that needs dynamic memory allocation (you don't know the size of the lambda beforehand)
<kaichiuchi>
I can't do that
<heat>
i guess you can skip that in this case
<kaichiuchi>
skipping what?
<heat>
dynamic memory allocation
UncleBen has joined #osdev
<heat>
yeah totes
<heat>
you would only need malloc if you're doing this lambda shizzle with std::function
<heat>
because you can't reliably know how large your lambda is, so you can't just store a static buffer in std::function
<heat>
pure function calls are ez, just a function ptr (8 bytes), member functions are ez, just a fptr and a pointer to this(16 bytes)
<heat>
lambdas are hard, no way to know how much shit you're capturing
<heat>
at least 8 bytes for the fptr, plus whatever state you have going on
<zid>
I like it when C++ programmers remember pointers exist
<kaichiuchi>
I just hope this can be better abstracted later
<zid>
they spend all day doing std::max<std::max<std::vector<T>,std::span<T>>,std::container<T>> termplates
<zid>
then remember arrays exist
<kaichiuchi>
because this is just... a gargantuan nightmare
<kaichiuchi>
if I wanted to fight with the language this much I'd write Rust
heat has quit [Remote host closed the connection]
heat_ has joined #osdev
<heat_>
kaichiuchi, welcome to the C++ standard library
<heat_>
thou ist reimplementing it
heat_ is now known as heat
<kaichiuchi>
I couldn't give two shits
<kaichiuchi>
this is absolute bullshit
<heat>
wait until you see type_traits
<zid>
did you implement all 17 variants of = yet
<heat>
SFINAE if you're lucky, else compiler magic
<heat>
gcc and clang have a shit ton of __builtin_ magic for type_traits
<kaichiuchi>
yeah I've seen that
<heat>
also, again, you can't complain that people dont give a crap about the hardware while desiring a language that abstracts everything for you
<zid>
I was talking to a C++ dude about something and he was genuinly having to do something like that?
<zid>
oh it was new
<heat>
this is actual C++, the language, no nice abstractions
<zid>
new had 17 variants he had to implement, there was a big table
<heat>
if you override operator new on a type T, new T will use that
UncleBen has quit [Quit: salvia]
<mrvn>
heat: if you don't know how large the lambda is then how would you specify the size to malloc? Makes no sense. you have to know the size and the type and then you can have your buffer.
<heat>
yes it does make sense
<heat>
new invokeable_lambda<T>(<lambda>)
<heat>
you don't know how large a lambda you can get, that's the point
UncleBen has joined #osdev
<heat>
so doing char small_buffer[sizeof(void *) * 2]; and using that as a storage for type erasure is hard, although possible and maybe more efficient in many circumstances
<mrvn>
heat: You do know how large that one lambda is. The problem is that each lambda is a unqiue type so you can't make a heap of different lambdas. You do need the type erasure and then you can make a heap of pointers of the type erased type. Or more likely a heap of type erased lambdas that contain a pointer to the actual lambdasd.
<bslsk05>
stackoverflow.com: pointers - std::function/bind like type-erasure without Standard C++ library - Stack Overflow
<kaichiuchi>
“isn’t hard to write”
<kaichiuchi>
my ass.
dennis95 has joined #osdev
<epony>
on tv
<kaichiuchi>
my ass is on tv?
nyah has quit [Quit: leaving]
ZombieChicken has quit [Quit: WeeChat 3.7.1]
ZombieChicken has joined #osdev
andreas303 has joined #osdev
<bnchs>
what if you do
<zid>
six
<bnchs>
a function pointer, and you execute it
<zid>
it'll never work
<kaichiuchi>
I'm already too deep in this
<bnchs>
no like, this isn't related to kaichiuchi's question but
<kaichiuchi>
the fact that I have a folder called "gbstl" with replacements for std::array, and maybe soon to be std::function is *astounding*
<zid>
"C++ programmer remembers pointers exist" is my favourite
<kaichiuchi>
the major challenges so far have not been solving the problem, but getting things to work with the language as efficient as they can possibly can get
<kaichiuchi>
-extraneous can
<bnchs>
tbh at this point, i would be doing dynarec
<bnchs>
but i forgot this is meant for shit machines
<kaichiuchi>
well I plan to
<kaichiuchi>
I mean, this is supposed to run on just about anything
<kaichiuchi>
it's an exercise in target portability and getting something performant on shit hardware
<kaichiuchi>
but of course, if it's running on a desktop, yes a JIT would be nice
<kaichiuchi>
note: I did not say it was an exercise in *language/compiler portability*
<kaichiuchi>
this is C++17 abusing the ever living fuck out of gcc/clang specifics
<bnchs>
what are you trying to do in your emulator
<bnchs>
events?
<kaichiuchi>
yes
<kaichiuchi>
if I had std::function this would've been over by now
<kaichiuchi>
and honestly, this "event scheduler" is not as efficient as it could be
<bnchs>
what does your emulator do with your event scheduler
<kaichiuchi>
otherwise we're doing this in lock-step and that's not particularly efficient
<kaichiuchi>
the drawback of how I'm doing this now, although it can be changed later, is the fact I'm just firing events even if the guest program doesn't actually give two shits about the result
<bnchs>
but i don't understand what you're trying to do with std::function