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
<bslsk05> ​github.com: Onyx/kunit.cpp at master · heatd/Onyx · GitHub
<bslsk05> ​github.com: Onyx/elf.cpp at master · heatd/Onyx · GitHub
<heat> it's super basic googletestie, you can't really notice a difference
<mrvn> heat: I don't quite get something there. On top of page 10 they show a superblock where the missing chunk is in the middle. But earlier they said they always split superblocks so their blocks are sorted by size.
<mrvn> heat: how do does the sorted superblock devolve into a scrambled one?
potash has quit [Ping timeout: 265 seconds]
heat_ has joined #osdev
heat has quit [Ping timeout: 260 seconds]
potash has joined #osdev
<moon-child> o hai DjanSeriy
<moon-child> when did you get here
invalidopcode has quit [Remote host closed the connection]
invalidopcode has joined #osdev
nyah has quit [Quit: leaving]
sprock has quit [Quit: ...]
terrorjack has quit [Ping timeout: 252 seconds]
terrorjack has joined #osdev
gog has quit [Ping timeout: 265 seconds]
<heat_> mrvn, dunno, I haven't digested it properly
heat_ is now known as heat
kori has left #osdev [Leaving]
<heat> you know, I was thinking way too long about making a DAG for my bpf interpreter when detecting a loop really is trivial
<heat> I can get by using a bitmap executed[N] and if executed[jmp_dst] == 1 this is a loop
sprock has joined #osdev
<heat> akshually, this may not 100% work, I may indeed need a CFG
<heat> yeah my idea goes to poopy with actual conditionals
<heat> not that I'll get a CFG for this since its just cBPF, I can get away with a halfassed approach and cross muh fingers
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #osdev
[itchyjunk] has quit [Read error: Connection reset by peer]
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<heat> is there a good source for x86 opcode basics that isn't the SDM (i.e doesn't assume I know what a ModRM byte is)?
<bslsk05> ​sandpile.org: sandpile.org -- The world's leading source for technical x86 processor information.
<gamozo> Nearly everything on sandpile (eg. in those specific diagram shapes) can be found in the SDM, but sometimes they're tucked in a footnote or something.
<gamozo> sandpile is bae for quick ref
invalidopcode has quit [Read error: Connection reset by peer]
invalidopcode has joined #osdev
Killaship35 has joined #osdev
Killaship35 has quit [Quit: Client closed]
Killaship3460 has joined #osdev
node15 has joined #osdev
Killaship3460 has quit [Client Quit]
<geist> i discovered the other day that the sandpile guy works at google
<geist> i mentioned t to someone and they're like 'oh yeah XXX he's over in YY'
<heat> everyone works at google
<heat> it's a massive conspiracy
<mrvn> heat: what do you need a buddy-allocator for by the way?
<heat> page allocation
<mrvn> as in physical pages?
<heat> yes
<mrvn> Do you have hardware that dynamically needs contigous physical pages?
<heat> yes
<heat> I also need large pages
<heat> and bigger chunks of physical memory is useful for the slab allocator
<geist> woo hoo short 1 minute power out
<mrvn> on the one hand I get large pages, but they are 9 powers of 2 larger so buddies maybe aren't the best way to go about them.
<mrvn> on the other hand they are 9 powers of 2 larger, fragmentation will be hell and eventually you run out and need some other mechanism to get large pages.
<mrvn> Except maybe on ARM where you have sizes between page table levels.
<mrvn> have you considered using recursive slabs? Have a slab for all memory containing 1GB objects. From that you allocate to populate a slab for 2MB objects and from that a slab for pages.
<heat> hm?
<mrvn> or in other words a generalized buddy allocator using a 512-way split.
<heat> ok so you want a buddy allocator?
<geist> just wants a buddy
<heat> that's what the allocator is for geist
<heat> page tinder
<heat> i have realised my jit problem is going to get a lot more complicated
<mrvn> me? not exactly. I would use more the slab data structure handling each level separately. What I don't think is best is the 2-way split of a plain buddy system. A 512k block of memory does you no good.
<mrvn> (unless you have some hardware that needs such blocks)
<heat> BPF programs on packets expect loaded data to be endian-reversed...
<heat> except seccomp ones don't
<mrvn> heat: In your page tinder half the deallocations will swipe right and the other half swipe left. Aeh, I mean merge.
<mrvn> endian-reversed? As not network byte order?
<heat> yup
<mrvn> heat: don't they expect host byte order?
<heat> well, that is reversed
<mrvn> only on some archs
<heat> on most sane archs
<mrvn> not sure I would call m68k, mips, arm, ... insane
<heat> arm is le
<mrvn> arm is biendian: "Modern ARM processors support a big-endian format known architecturally as BE8 that is only applied to the data memory system."
<heat> so optionally LE so you have no reason to use BE
<mrvn> geist: do you know of anyone using ARM in big-endian mode?
<heat> some routers maybe
<geist> i've heard of it mostly in the networking space
<mrvn> For network hardware it makes sense to run in network byte order, makes sense.
<geist> i guess linux kernel has support for it and i guess you could compile a armbe debian or something, but haven't personally seen it
<heat> nitpick: annoying there's no explicit bswapw
<geist> a 16 bit swap you mean? I thought there was
<geist> there's also a bit swap which is pretty neat
<heat> no, there's no 16 bswap
<heat> you need to use xchg %lower, %upper
<geist> sure, i guess a 32bit bswap plus shift is what you need
<bslsk05> ​developer.arm.com: Documentation – Arm Developer
<heat> I'm on x86 mrvn
* geist sits, dumbfounded
<heat> i guess x86 has some rotate somewhere but xchg is probably better in this case
<geist> i... you.. x86? wha...
* geist stares, unsure how to process this information
<mrvn> geist: lets hope he means x86_64 at least
<geist> mrvn: just as i hope you mean arm64
<mrvn> geist: does ARM64 still have a 16bit rotate?
<geist> i think it has a rotate yeah
<geist> in general if some serious hardware is needed to also run arm32, like a barrel shifter, arm64 has it too
<geist> since at least the first 10 years of implementations still n eed to also run arm32
<mrvn> you also need the opcode space for it. And you also need a 64 bit rotate.
<geist> uyou just can't generically do it to the 3rd argument like you can in arm32
<geist> sure but there are already 64bit shifts and whatnot
<mrvn> On x86 they would have replaced one of the smaller sized opcodes to mean the bigger size in long more.
<mrvn> stupid mode specific default size and size prefixes.
<geist> nah what arm32 generally does is all instructions have a 32 and 64bit version (usually just a bit that sets the operand size) and then in the case of shift and rors 6 bits are allocated in the opcode
<geist> s/arm32/arm64
<geist> think of arm64 is mostly a superset of arm32 however the tricky bits like conditional instructions and barrel shifter on the seconmd arg is gone, those bits are used for more opcodes/etc
<geist> also FWIW arm64 does have a 16bit byteswap: REV16
<mrvn> Note that ARM doesn't seem to have a 8bit rotate
<geist> course not. doesn't operate sub register like x86.
<geist> arm64 however does have 32 and 64bit versions of most stuff. that's a conceit to make it a bit easier to run 32bit stuff
<geist> not all risc machines have that sort of consideration
<mrvn> it's not really subregister in x86, they just have a register for every size
<geist> generally arm64 cdoes it because it's condition register based. so you may want a add32 or add64 to set the condition bits based on what is considered the target size
<geist> whereas arches like riscv or mips that dont have condition registers you generally dont need that sort of thing
<mrvn> You also have a lot of code that simply needs just an "int" and it might be faster.
<geist> yah. arm64 is fairly pragmatic in that regard
<mrvn> They could have added CC32/CC64 registers. Just one "add" but on "cmp" you then pick which flags to use.
<geist> that's a good pdf btw, you should save it
<geist> really sums things up well
<mrvn> Oh, that's just 3 pages cheat-sheet. Got to print that next time I'm at a printer.
<geist> huh things i didn't knmow about: EON, ORN: xor and or with negated second arg
<geist> not sure i've ever seen the compiler emit that, or the disassembler tends to replace that with EOR of the negated constant
<mrvn> assuming you have a constant
<geist> yeah with a register i guess i've just never seen the compier usei t
<geist> kinda curious now...
<mrvn> Aren't there lots of constants that couldn't be expressed in the opcode negated? x ^ const should do "x EON !const" when that allows an immediate.
<bslsk05> ​godbolt.org: Compiler Explorer
<geist> yeah in general these sort of negate the second arg things are there to help generate constants
<heat> dear gods of eks eighty six
<bslsk05> ​gist.github.com: gist:641eda5b47b685e370c3ef5f9045274f · GitHub
<mrvn> EON is also known as equality
<geist> arm64 opcode structure has some pretty interesting compressed constant formats, kinda hard to enumerate
<heat> behold my all powerful JITter
<geist> huh the power outage has not returned
<geist> a windy stormy night in the woods always means power lines are down
<geist> i half expected to be plunged into darkness again
<geist> now that i'm not, i kinda dont know what to do with the night
<heat> write a jitter
<heat> 1v1 me
<heat> 1v1 me rust irl RUST RUST RUST RUST SRU TSUT UETURUST RsUT RSUT
<mrvn> When I loose power no amount of backup normaly helps. I might still have power but the next hop upstream will shut down so I'm offline anyway.
<geist> i have a fewbattery backups to ride my computer and the core switches/cable modem over till the backup generator kicks
<geist> but usually i wait about 10 minutes and if the power isn't coming back i start to power everything off
<geist> and then turn off the generator
<geist> and yeah usually after about an hour i've discovered the cable modem network usually goes down. probably some battery backup somewhere upstream in some remote note
<geist> node
<geist> heat: also if the power lines were written in RUST there wouldn't be this problem
<zid> heat: let's have an increment contest, who can write an increment in the fewest characters
<heat> ++
<zid> you have to play rust
<heat> nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
<heat> oooooooooooooooooooooooooooooooooooooooooooooooooooooo
<zid> Heat concedes.
<mrvn> geist: they need to cut down trees more around power lines. https://www.youtube.com/watch?v=KV2ANE3vLfI
<bslsk05> ​'Helicopter with rotating saw blades trims trees in Alabama' by WVTM 13 News (00:00:36)
<zid> You know it's bad when you lose to assembly
<geist> nah we like trees
<geist> and trees grow like crazy
<zid> I loved flying the scout heli in bf2
<geist> so the curse of liking trees here is you sometimes lose power
<geist> so everyone has a generator
<zid> reminds me of all these vids of them logging with helis
<geist> it's the tradeoff for liking trees
<geist> also trees sometime kill you. happens.
<heat> zid, bf4's scout heli is also very fun
<zid> does the game still use incredibly low sky jelly
<zid> that's why I didn't play bf3
<heat> you should've played both
<heat> both fucking masterpieces
<zid> bf3 turned into quake, cus of the spawn beacon nonsense, everybody was always behind you
<bslsk05> ​godbolt.org: Compiler Explorer
<zid> I liked bf2, I wanted bf2++, they made a different game that was probably good idk
<heat> re: the opcodes
<geist> yeah, signed vs unsignwed i guess
<bslsk05> ​godbolt.org: Compiler Explorer
<heat> ah because 83 e0 sign extends?
<geist> yah
<geist> so mean syou can also do negatives there to -127
HumanLove has joined #osdev
chartreuse has quit [Ping timeout: 264 seconds]
<mrvn> Quake, tss, 4.5 degrees of freedom. so lame.
<mrvn> There should be more games with 6 degrees of freedom. How will people be ready to fly space ships?
<heat> x86 instructions are so fucked
HumanLove has quit [Quit: .]
<bslsk05> ​gist.github.com: cursedjit.c · GitHub
<heat> my neverending set of defines whose meaning is clear to me and me only
<heat> also very funny how there's a specific opcode for AND EAX
<geist> yah think of AX as the accumulator
<geist> it's the thing you should be doing work in, the other registers are there to hold temporaries or for other purposes (base register, counter, etc)
heat has quit [Ping timeout: 260 seconds]
<geist> it's of course totally opposite of how you should use registers nowadays, but if you come from a world of 6502 or whatnot where the accumulator is *the* register it makes sense
<zid> we should replace the short encoding for and rax with and rsp
node15 has quit [Quit: Client closed]
xenos1984 has quit [Ping timeout: 260 seconds]
xenos1984 has joined #osdev
xenos1984 has quit [Ping timeout: 256 seconds]
xenos1984 has joined #osdev
genpaku has quit [Remote host closed the connection]
genpaku has joined #osdev
sympt has joined #osdev
janemba has quit [Ping timeout: 260 seconds]
epony has quit [Ping timeout: 268 seconds]
gareppa has joined #osdev
epony has joined #osdev
gareppa has quit [Quit: Leaving]
jjuran has quit [Quit: Killing Colloquy first, before it kills me…]
jjuran has joined #osdev
janemba has joined #osdev
<moon-child> what's cursed about that code? Looks like pretty par for 'ghetto'-style assemblers (as opposed to proper table-based ones)
Burgundy has joined #osdev
GeDaMo has joined #osdev
potash has quit [Ping timeout: 264 seconds]
nyah has joined #osdev
gog has joined #osdev
potash has joined #osdev
potash has quit [Ping timeout: 265 seconds]
potash has joined #osdev
potash has quit [Ping timeout: 268 seconds]
wootehfoot has joined #osdev
<DjanSeriy> moon-child: idk maybe a few weeks back
<gog> hi
<moon-child> sup
<Ermine> hi gog!
<gog> :)
xenos1984 has quit [Read error: Connection reset by peer]
<Ermine> gog: may I pet you?
<gog> yes
* Ermine pets gog
* gog prr
<Ermine> aww
[itchyjunk] has joined #osdev
xenos1984 has joined #osdev
Burgundy has quit [Ping timeout: 260 seconds]
gildasio has quit [Remote host closed the connection]
gildasio has joined #osdev
gildasio has quit [Ping timeout: 255 seconds]
gildasio has joined #osdev
potash has joined #osdev
gildasio has quit [Remote host closed the connection]
gildasio has joined #osdev
Burgundy has joined #osdev
<kaichiuchi> ...i think i need to go back to sleep
<kaichiuchi> god C++ makes life fucking *annoying* sometimes
<kaichiuchi> why is type punning through unions undefined behavior :(
sham1 has quit [Ping timeout: 248 seconds]
isaacwoods has joined #osdev
MiningMarsh has quit [Quit: ZNC 1.8.2 - https://znc.in]
jafarlihi has joined #osdev
<jafarlihi> Someone please do the needful and help. In here: https://stevemorse.org/8086/29.jpg the instruction at the top says it is to DI register, but onlinedisassembler.com says it is to BX register given same bit pattern. Which one is true?
<jafarlihi> Here's the bit pattern by the way: 0xc7070ff0
<jafarlihi> shell-storm.org also says BX
<jafarlihi> Is it wrong in the book?
<kof123> from the middle of the page: figure 2.23 moves 1111 0000 0000 1111 into a word in memory in the data sagment at the offset contained in DI
<kof123> so what do you mean "to DI register" ?
<kof123> note it talks about figure 2.21, which is not at the top of the page, and presumably a page or so back
<kof123> *segment
<GeDaMo> It looks like DI to me
<jafarlihi> I'm talking about Fig 2.23
<GeDaMo> 66 c7 07 0f f0          mov    WORD PTR [edi],0xf00f from https://defuse.ca/online-x86-assembler.htm
<bslsk05> ​defuse.ca: Online x86 and x64 Intel Instruction Assembler
<GeDaMo> The 66 prefix is to force 16 bit mode
<jafarlihi> So without prefix it is to BX register? This fucks up the backwards compat no?
<GeDaMo> Without the prefix, it expects a 32 bit immediate c7 07 0f f0 00 00       mov    DWORD PTR [edi],0xf00f
<gog> if it's not in real mode then backwards compatibility is already moot
<GeDaMo> What did you do to the disassemblers to get then to generate bx? :|
<jafarlihi> Check it yourself onlinedisassembler.com
<jafarlihi> Somethings wrong
<GeDaMo> I have tried it, c7 07 0f f0 on its own is not a valid sequence
MiningMarsh has joined #osdev
<GeDaMo> Not in 32 bit mode anyway
<jafarlihi> Book is for 8086
<jafarlihi> I picked 8086 mode in disassembler
<gog> show us the disassembler you're using please
<bslsk05> ​onlinedisassembler.com: ODA - The Online Disassembler
<GeDaMo> If you select i8086 it does say bx
<gog> hm
<jafarlihi> One more thing, in here: https://stevemorse.org/8086/28.jpg Fig 2.21 says that instruction moves the immediate to the register. In Fig 2.23 however, it says it moves to offset specified by the register. For other instructions, how would I go about knowing whether it is like the former or the latter? Is there some kind of letter associated with differentiating that behavior?
<kof123> C707F00F mov word [bx],0xff0
<kof123> C7050FF0 mov word [di],0xf00f
<kof123> quote ndisasm
<gog> objdump gives me bx, i think that's what onlinedisassembler is using on the backend
<jafarlihi> So objdump bug then?
<gog> no because it's consistent with ndisasm
<gog> maybe the book is wrong
<gog> c705 gives me mov indirect via di
<jafarlihi> What does c7070ff0 get you?
<jafarlihi> That's what's in the book
<gog> bx
<jafarlihi> But ndiasm bx is c707f00f, not c7070ff0
<kof123> if thats from my quote, ignore that, that is just me in a hurry
<gog> the immediate is the lower word
<kof123> ^^
<jafarlihi> Ok, thanks
<gog> the instruction is encoded in c707
<gog> OPCODE 11000111 -> C7
<gog> mod opcode r:M 0000111 -> 07
<gog> 00000111*
<jafarlihi> One more question, if in the same instruction "w" is 0 then immediate will be 8 bits right? But what about the register in modr/m, will it be 8bit too?
<gog> yes
<gog> it does a movb
<jafarlihi> If so then the question is how is segment:offset is calculated with 8 bit register, doesn't it require 16 bit segment and 16 bit offset?
<gog> the register, hwoever
<gog> is still 16 bits because it's an indirection
<gog> the immediate has to be 8 bytes'
<jafarlihi> so sign extended then?
<gog> because its encoding is only 3 bytes
<gog> no it's not sign extended, the immediate has to be only one byte
<gog> the address is already in the register
<gog> you're moving to the memory location at the address in the register
<jafarlihi> But how is effective address calculated? If the register is 8 bits too, doesn't it require 16 bit offset?
<gog> no, teh register is not 8 bites
<GeDaMo> The immediate is 8 bits
<jafarlihi> Oh, okay
<jafarlihi> Thanks
<gog> you have to prepare the address register before an instruction like this
<gog> and without a prefix override it'll be es:(destination op)
<jafarlihi> You mean ds
<GeDaMo> In the Intel manuals, modr/m of 07 is [bx] in 16 bit mode, [edi] is 32 bit mode
<gog> no, writes go to es: iirc
<gog> but i might be wrong i don't play with real mode anymore
<GeDaMo> Volume 2, table 2.1
<jafarlihi> Is Intel manual known to contain many errors?
<gog> it's a huge manual
<gog> it might have been an oversight by the author and editor alike. the author was thinking about protected mode operand encodings and thought it was 1:1 with real mode
<jafarlihi> I'm making 8086 emulator btw: https://github.com/jafarlihi/8086emulate
<bslsk05> ​jafarlihi/8086emulate - [WIP] 8086 emulator (0 forks/0 stargazers/MIT)
dude12312414 has joined #osdev
<jafarlihi> Will try to get 8086 assembler then upgrade it all the way to x64
dude12312414 has quit [Client Quit]
<Arsen> .code64 :^)
jafarlihi has quit [Quit: WeeChat 3.7.1]
GeDaMo has quit [Read error: Connection reset by peer]
GeDaMo has joined #osdev
gildasio has quit [Remote host closed the connection]
gxt has quit [Remote host closed the connection]
gxt has joined #osdev
xenos1984 has quit [Read error: Connection reset by peer]
gildasio has joined #osdev
mahk has joined #osdev
xenos1984 has joined #osdev
gildasio has quit [Read error: Connection reset by peer]
gildasio has joined #osdev
xenos1984 has quit [Ping timeout: 260 seconds]
xenos1984 has joined #osdev
gxt has quit [Remote host closed the connection]
gxt has joined #osdev
xenos1984 has quit [Ping timeout: 260 seconds]
xenos1984 has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
heat has joined #osdev
<heat> sup nerds
<GeDaMo> I got Covid and Flu vaccinations
sprock has quit [Remote host closed the connection]
sprock has joined #osdev
<heat> my last covid vax was a year ago or so
<GeDaMo> Same, this is the latest booster
<heat> moon-child, if you decipher what MOVstli32 means without checking the opcodes I will be most impressed :P
<heat> I could use some generic mov_load() that could take registers and addends and that shit and generate an opcode in a less-specific way
<heat> new idea: what if we created a simple ISA where instructions just operated on registers, fixed size instructions, and then load + store instructions which operate on memory? None of this modrm debauchery with creative addressing
<GeDaMo> It'll never catch on :P
<heat> we could call it HISC for heat's instruction set computer
<GeDaMo> HEAL: Heat's Elegant Assembly Language
<heat> HARM: Heat's advanced resourceful machine
<GeDaMo> HUNT: Heat's Unique New Technology
<heat> HEAT: HEAT
<heat> hearing americans pronounce muller is something else
Matt|home has quit [Quit: Leaving]
<heat> almost as good as how they say tortillas
<gog> tortiyas
<GeDaMo> torTEEah
Vercas6 has joined #osdev
<gog> when i'm making them they're tortiyaaaaas queen
<GeDaMo> (I have no idea :P )
<heat> you mean tortilas
<gog> torTILLas
<heat> or tehcos
Matt|home has joined #osdev
<gog> tAYcos
<gog> yo quiero taco bell
<heat> no señorita, no hay taco bell en IRC
<heat> gog, buy a germany jersey and go to work with it tomorrow
<gog> lmao
<gog> the CEO would be pissed
<gog> i'm gonna do it
<gog> where can i get a germany jersey before 9am tho
<heat> adidas
<heat> the gog gets fired for epic trollage
<DjanSeriy> getting fired Any%
wootehfoot has quit [Ping timeout: 260 seconds]
<GeDaMo> Maybe you could wear a combination of the German colours
<gog> i don't have any yellow
<gog> ooh oooh
<gog> i can do my eyeshadow in geermany's colors
<gog> yaaaaaaaa whooooool Königin
<heat> este equipo no juega una mierda
<heat> at least I got a proper english stream
Vercas6 has quit [Remote host closed the connection]
Vercas6 has joined #osdev
TkTech has joined #osdev
<zid> go belgium
<heat> zid rn
<bslsk05> ​i2-prod.mirror.co.uk <no title>
GeDaMo has quit [Ping timeout: 260 seconds]
<zid> does he think he's going to be born somewhere else all of a sudden
<zid> "better make sure they know I'll be english for a while"
<zid> Breaking news: 42 year old kitchen fitter Mark Harris from Brighton (pictured) has been given birth to by a Dutch mother of 2 (now 3). Mark Harris is said to be "gutted" to no longer be English.
<heat> huh
<heat> confused.jpeg
GeDaMo has joined #osdev
<mjg> look at this long name mofo
<mjg> cnfsd.jpg
furt_box has quit [Ping timeout: 260 seconds]
<mjg> there, dos-frienly
<heat> shut up
<heat> no one cares about dos
<heat> it's all about this "UNIX" these days
potash has quit [Read error: Connection reset by peer]
potash has joined #osdev
<zid> mr mouse snuck out of my room while I was getting a drink, he's scratching the door to be let back in..
<zid> kinda cute seeing his little paws through the crack in the frame
chartreuse has joined #osdev
<heat> what the actual fuck
<gog> aw
<gog> tiny rodent
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
<heat> what's the functional difference between mul and imul?
<zid> imul is signed
<zid> mul is unsigned
<heat> thanks fuckboy
<heat> but what does that functionally mean
<zid> range
<heat> ELI5
<heat> gcc appears to use imul for unsigned int multiplication
<gog> imul is effectively the same in one form
<gog> but the two other forms are not the same
<gog> unsigned multiply has no equivalent encodings
<heat> I know, I just want to know what the actual difference is
<heat> is it just a matter of eflags?
<gog> intermediate product
<gog> idk
<gog> it basically seems to be about the fact that there are more encodings for imul becuause you can specify a destination operand
<heat> the amount of different encodings gcc has for multiplication is insane
<heat> it's pulling lea's with adds and shit
<geist> signed vs unsigned mul/division is not like 2s compliement arithmetic
<geist> the sign bit has to be handled explicitly (though not hard)
<geist> but that's why you always end up with two different opcodes on pretty mcuh all arches, even riscv
<heat> so why is (unsigned int) * (unsigned int) = imul valid?
sham1 has joined #osdev
invalidopcode has quit [Remote host closed the connection]
invalidopcode has joined #osdev
<bslsk05> ​godbolt.org: Compiler Explorer
<zid> change it to long and it has to use imul
<geist> iirc the different muls on x86 have all sorts of odd restrictions on registers and whatnot
<geist> i can see it picking signed over unsigned if it knows it'll still be an unsigned result if it is easier to use, etc
<heat> x86 MUL is shitty, only has one operand and doesn't have imm mult
<zid> 0F AF is not the encoding you wanna use
<heat> why?
<zid> it loves it though
<heat> I can't get gcc to generate mul
<heat> it's either imul or a bunch of ?? encodings like lea/neg/etc
<heat> also shifts ofc
<zid> gcc's got a hardon for imul indeed
<heat> so does clang
<zid> also it likes 0f 1f 84 00 00 00 00 00
<zid> best instruction
<zid> also a big fan of 66 2e 0f 1f 84 00 00 00 00 00
<heat> I'm starting to think there's no problem in doing imul for unsigned mult
<zid> yea there isn't
<heat> maybe the delicate bit is that you can't use unsigned mult for signed mult
<heat> mjg, freebsd's multiplication JIT is p e s s i m a l
<zid> best part about mul is that it just destroys sf/zf/af/pf
<zid> doesn't even set them to known values, I think that's an old 8086 thing
<zid> (and imul)
<heat> that's cool
<heat> classic don't care optimization
<heat> case BPF_ALU|BPF_ADD|BPF_K: ADD_EAXi(ins->k);
<heat> mjg, your jit needs to get itself in order
<zid> oh it makes sense why you're suddenly giving a shit about x86 encoding
<zid> you're doing bpf
<zid> I remember now
<heat> yep
<heat> I'm basically creating a JIT for classic BPF and then probably going to merge it with the kernel
<heat> i'll leave eBPF for after this
<heat> although it's pretty nice that you can't just assign (e)bpf registers to x86 registers all around
<heat> *can
<heat> if I were doing eBPF I would need 8 registers, which means bleeding into r8-r15 and A L T E R N A T I V E F O R M S for instructions
<heat> since classic only has two registers I have accumulator = EAX and index = ECX
<heat> so I only need to concern myself with EAX-specific alternatives
<heat> although I have noticed that the eax-specific stuff seems to be purely an optimization
<zid> reserve eax and ecx in your entire kernel build
<mjg> heat: wait
<mjg> heat: are you trying to say code written by old geezers is crap?
<mjg> heat: wtf man
<heat> * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
<heat> * Copyright (C) 2005-2017 Jung-uk Kim <jkim@FreeBSD.org>
<heat> ain't that old sweet prince
<mjg> hm
<mjg> are you saying that mid-old code is crap?
<mjg> wtf man
<heat> i'm saying f r e e b s d b a d
<heat> and p e s s i m a l
<mjg> onyx does not even have bpf, does it
<heat> that's what I'm adding mang
<mjg> u n u s a b l e
<heat> although I already have an interpreter
<heat> but i want to JIT like the cool kids
<heat> JIT
<mjg> prefix your message with /disco to have it written in colours!
<heat> what kind of irc client are you using
<heat> and why is it fucking awesome
<mjg> irssi + ascii.pl script dawg
<FireFly> lol
<heat> >perl
<heat> nope
<heat> do you know if there have been more efforts on getting eBPF into freebsd?
<zid> /rsay you guys are cool
<mjg> heat: i don't know what's the refernce point
<mjg> i know of a port from few years back, past that -- no clue
<heat> some 2017 slides I found
<heat> yeah likely that
<mjg> https://www.youtube.com/watch?v=tuOOuarA7xA have a listne instead of talking shit
<bslsk05> ​'Need For Speed 4 High Stakes Soundtrack - Callista (HD 1080p)' by NFS2SE3HP4HS8U2 (00:04:20)
<mjg> classic right there
<heat> I want to mention I went to check openbsd's JIT...lmao they have none
<mjg> makes sense if it ony showed up in 2002+
<mjg> what is netbsd doing
Burgundy has quit [Ping timeout: 268 seconds]
<heat> they have it but it's super yucky
<heat> they import sljit and link with it
<mjg> i don't know what it is and i don't want to find out
<heat> SLJIT - Stack Less JIT Compiler
<heat> "Platform independent low-level JIT compiler"
<zid> I like 'stack less'
xenos1984 has quit [Read error: Connection reset by peer]
<zid> it's like a command
<zid> "fucking jit, stack less you piece of shit"
xenos1984 has joined #osdev
<epony> our o-code is into your p-code
Vercas6 has quit [Ping timeout: 255 seconds]
Vercas6 has joined #osdev
heat has quit [Ping timeout: 256 seconds]
nyah has quit [Quit: leaving]