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
gog has joined #osdev
gog has quit [Ping timeout: 244 seconds]
lg has quit [Remote host closed the connection]
knusbaum has quit [Ping timeout: 252 seconds]
knusbaum has joined #osdev
<mrvn> heat: dump the addres son the stack and retq?
<mrvn> .oO(What's the point of a 32bit jump if you only have 1MB of memory?)
<heat> because I'm at 0xfffffff0
<heat> anyway I struggled to get the GDT loaded sooo
<heat> lgdt should use the ds segment right?
<heat> the issue is that I can't get the ds base to be the same as the CS base (which works automagically)
<heat> maybe I was doing something wrong
<heat> honestly, I'm not sure
<heat> i haven't dabbled too much with 16-bit before, literally the only 16-bit code that I've written is my SMP trampoline
<heat> ah wait I can use %cs as a segment override for data?
<zid> should be able to override with any selector, but what's stopping you doing mov ax, cs; mov ds, ax exactly?
<clever> zid: i think that would be fine with the original segmentation, but with the segment descriptor stuff that came around, the same value can have a different meaning in both cs and ds
<clever> and would rely on the os to configure both the same
<zid> he was talking aboot 16bit though
<zid> Unless he's un unreal mode
<heat> i cant do it
<heat> the cs segment at the reset vector is segment cache magic
<zid> so sorta unreal mode then
<heat> CS =f000 ffff0000 0000ffff 00009b00 and it's specified as such in the intel SDM
<zid> and why do you need to preserve things and not just shit on them?
<heat> preserve what?
<zid> you're worried about what's in cs and stuff, but you know where eip is
<zid> and you know you just came out of a reset
Bonstra has quit [Ping timeout: 240 seconds]
<zid> so what is there to care about? go wipe memory with zeros and laugh to the bank
<heat> i can't touch 0xfffffff0 in 16-bit mode without %cs
<heat> that's the problem
<zid> hmm? it's at ffff:0000
<zid> the reset vector
<heat> no
<heat> it's at 0xfffffff0
<heat> EIP=0000fff0, cs base 0xffff0000
<Mutabah> zid: CS might be 0xFFFF, but the descriptor cache has set the base to 0xFFFF_0000 (instead of 0x000F_FFF0)
<zid> that's the 32bit version yea
<zid> reload cs and it'll be 16bit again no?
<heat> yes
<heat> i'm also lacking appropriate tooling to generate a firmware image
<heat> turns out it's not easy to reliably stick a reset vector at the end of the image
<zid> oh apparently this is a hack to make the 286 and 386 boot different firmware?
<clever> heat: what if you do . = 0xfff0; or similar in a linker script, to force a .text.start section to start at the right addr?
<zid> yea that seems like a really normal 'building a ROM' linker script
<clever> and then let the linker pad out the gap between the real .text and the .text.start
<heat> one thing I've found out is that there's no such thing as a "building a ROM" linker script for x86 FW
<zid> right but.. who cares that it's x86 fw
<heat> edk2 has custom tooling, seabios has custom tooling
<zid> well you'd want it on a big project, that's the nature of big projects
<clever> coreboot i think has custom tooling, so you can change the rom size without re-running the linker
<zid> but you can surely just make a really boring . = blah; series of nonsense linker scripts with some imported section contents and make whatever image you like
<zid> same as.. normal
<clever> yeah
<zid> .blah : {} > ram AT > rom
<heat> anyway, that's not the point
<zid> or whatever method you fancy
<heat> i wanted to do this as POC for running simple firmware on top of qemu for the tianocore project I'm mentoring
<heat> but I got sidetracked building a fucking reset vector
<zid> .reset eip_value_at_runtime : AT(firmware_end_address - 16) { reset.o (.text); } if you don't wanna do sections I guess also
bliminse has quit [Ping timeout: 260 seconds]
<heat> right
<heat> theoretically, that would work but I kept running into issues
<bslsk05> ​github.com: rpi-open-firmware/linker.ld at master · librerpi/rpi-open-firmware · GitHub
<clever> i think if you just move lines 12/13 before 9, and fix the addr on 2&9, youll be done
bliminse has joined #osdev
<clever> maybe move 9/11 to be after the other sections
<heat> well, no
<heat> the reset vector is just a tiny 16 byte area of instructions
<clever> yeah, so you need a 16 byte .text.start section in a start.S file
<clever> and then lines 9&11 will set the addr it lives at
<heat> I need it to be base = 0xffffffff - ALIGN_TO(kernel_size, 0x10000)
<heat> s/kernel_size/fw_size/g
<clever> i'm assuming that you have a fixed load address, a fixed size, and can enter both of those on line 2
<heat> force of habit :)
sebonirc has quit [Read error: Connection reset by peer]
<clever> and then the linker will compute the difference between load-addr and reset-vector automatically
sebonirc has joined #osdev
toluene has quit [Ping timeout: 246 seconds]
toluene has joined #osdev
Bonstra has joined #osdev
<zid> I was fiddling with ld a bit, it gets *really* upset if you tell it to accidentally make a 4GB file.
<heat> yeah haha
<heat> tip: .org in GNU assembly also doesn't work
skipwich has quit [Quit: DISCONNECT]
<heat> i accidentally made a 4GB object file
<heat> it's was suuuuper slow doing it too
<heat> for someone reason people don't do that
<zid> my fill value is 6690 apparently by default
<zid> WIDE NOP
skipwich has joined #osdev
<clever> nop-sled!
<zid> Yea the test image I made works fine
<zid> I told it the VMA was 0xBEEF0000 and that I had a 64kB ROM there
<zid> and put a 'mov eax, .; ret' into the rom 16 bytes from the end
<zid> .text BEEF0000 : { . = 0xFFF0; reset.o (.text);
<zid> I'm not as it turns out, an op in binutils for nothing
nyah has quit [Ping timeout: 260 seconds]
<mrvn> try it in 64bit mode making a few exabytes
<mrvn> .text.boot at 0x100000, .text at higher half, lets just fill that in with zeroes.....
smeso has quit [Quit: smeso]
smeso has joined #osdev
troseman has quit [Read error: Connection reset by peer]
Raito_Bezarius has joined #osdev
<zid> anyone aware that gas is absolutely insane wrt intel syntax and that 'byte [rdi]' and 'byte ptr [rdi]' do different things, with the former assembling to [rdi+.]
<zid> +$ whatever your 'current addr' symbol is
<bslsk05> ​godbolt.org: Compiler Explorer
Burgundy has joined #osdev
<bslsk05> ​gist.github.com: ResetVector.S · GitHub
<heat> any idea why this can not work?
<heat> it works in TCG but fails under KVM
<heat> particularly in the ljmpl $0x8,...
<zid> fails?
<heat> it just hangs
<zid> okay someone had a good guess for my paste at least
<zid> it parses it as mov al, 1[rdi] where BYTE EQU 1 somewhere internally
<heat> the only difference is that if i info registers a few times under KVM the resume flag is toggled
<heat> ...
<bslsk05> ​godbolt.org: Compiler Explorer
<moon-child> whaat
<zid> gas intel syntax is always the pinnacle of usability
<moon-child> hmm so does this mean that with att syntax I can 'movw %al', and it's the same as 'movb $2,%al'?
<zid> doubt it, I think it's just a parser hack
<zid> to make the 'byte ptr' crap work
<zid> and it's leaking its abstractions all over my pasta
* moon-child snatches an olive
heat has quit [Ping timeout: 272 seconds]
<stephe> hey
scoobydoob has joined #osdev
scoobydoo has quit [Ping timeout: 244 seconds]
scoobydoob is now known as scoobydoo
k8yun has joined #osdev
k8yun has quit [Remote host closed the connection]
Burgundy has quit [Ping timeout: 255 seconds]
No_File has joined #osdev
Likorn has quit [Quit: WeeChat 3.4.1]
No_File has left #osdev [#osdev]
PapaFrog has quit [Ping timeout: 256 seconds]
PapaFrog has joined #osdev
Jari-- has quit [Ping timeout: 258 seconds]
<geist> zid: oh wild
* mrvn recommend The Timertravelers Wife
<mrvn> +s
<mrvn> "I had a plan, I had such a perfect plan."
pretty_dumm_guy has joined #osdev
archenoth has joined #osdev
archenoth has quit [Client Quit]
Burgundy has joined #osdev
archenoth has joined #osdev
gildasio1 has quit [Ping timeout: 240 seconds]
gildasio1 has joined #osdev
Burgundy has quit [Ping timeout: 255 seconds]
haliucinas has joined #osdev
GeDaMo has joined #osdev
zaquest has quit [Remote host closed the connection]
pg12 has quit [Ping timeout: 248 seconds]
pg12 has joined #osdev
zaquest has joined #osdev
gog has joined #osdev
SGautam has joined #osdev
nyah has joined #osdev
dennis95 has joined #osdev
Burgundy has joined #osdev
ngc0202 has joined #osdev
Matt|home has joined #osdev
gildasio1 has quit [Remote host closed the connection]
gildasio1 has joined #osdev
dude12312414 has joined #osdev
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
hyenasky has joined #osdev
<hyenasky> joined to mention i just got page table swapping working because it sounded delightfully lovecraftian
<hyenasky> i feel like a 70s VMS engineer
<zid> as in, swapping page tables, or as in swap memory, or something else I'm not thinking of
<zid> cus the former is just 'processes' :P
<hyenasky> swapping page table pages to disk
<hyenasky> and back
<hyenasky> on demand
<zid> swap swap memory :D
<hyenasky> im not smart enough to do that on my own i read a VMS book and it sounded simple enough to taunt me into doing it
<hyenasky> if u have swapping already then its not hard to swap the page tables, thing is VMS and NT only do it when all of the tracked pages have been reclaimed
<hyenasky> you cant just free them because they still hold the location in swap of private memory that was swapped to disk
<hyenasky> so youd lose that information
<zid> swapswapmemory
<hyenasky> swapping is cool
<hyenasky> underused feature in hobby OSes
jafarlihi has joined #osdev
<jafarlihi> Is my OS considered halal if every module is copy-pasted from other OSes and tutorials?
<sbalmos> w...t...f...
<sbalmos> hyenasky: btw, go for single-level storage and memory persistence next.
<hyenasky> i think i have single-level storage because i have virtual memory w/o overcommit which seems synonymous
<hyenasky> i only support one swapfile though which seems like a deficiency considering every swapping VMM ive looked at supports multiple
<sbalmos> hyenasky: I meant more like the next level, where memory persists without necessarily needing an explicit filename, "save", etc
jafarlihi has quit [Ping timeout: 255 seconds]
hyenasky has quit [Quit: Client closed]
heat has joined #osdev
<zid> heya teeth
jafarlihi has joined #osdev
<heat> jafarlihi it's 100% haram
<zid> I mean heath
<heat> sup zidders
<zid> wanna play factorio?
<heat> no i have a big important meeting in 25 minutes
<heat> important(tm)
<zid> You shall be first against the wall when the revolution comes
<sbalmos> zid: down with the bloated bourgeoisie OSs!
<heat> down with the people who write unix clones
<sbalmos> I would continue with something about POSIX, but I'm doing Real Work [tm] on my other 2 screens
<heat> so? you have a screen for osdev
<heat> ez
<sbalmos> heat: I have yet to purchase the dual-core brain upgrade
<heat> just use hyperthreading doofus
<sbalmos> heat: Yeah I heard with enough coffee that's unlocked. but that makes the whole computer case shake, and the power supply makes some really weird noises then
jafarlihi has quit [Quit: WeeChat 3.5]
jafarlihi has joined #osdev
gildasio1 has quit [Remote host closed the connection]
ZipCPU_ has joined #osdev
gildasio1 has joined #osdev
ZipCPU has quit [Ping timeout: 240 seconds]
ZipCPU_ is now known as ZipCPU
SGautam has quit [Quit: Connection closed for inactivity]
Likorn has joined #osdev
<mrvn> i kind of think swapping is obsolete. If you run out of physical memory it's usualy by so much the swapping will stop your apps dead.
<mrvn> And then you are so far into swap you need to swap page tables? They take up ~0.2% of virtual memory. How much swap do you have to have for that to make a significant difference?
<dormito> that and the diff between cpu perf, and disk access times is so large that any real swap uages (on a modern system) would need to be with amaybe a PCIe 4 NVME drive
<zid> does vms have nvme
<mrvn> And there I'm afraid it will just destroy the NVME drive. Manufactorers specs say I can break my drive in under 3 days.
sonny has joined #osdev
<mrvn> It might be different for mobiles where you don't close apps but swap them out for long times. Maybe that's his target.
bauen1 has quit [Ping timeout: 272 seconds]
<jafarlihi> Are most people here just backend devs in real life?
<heat> mrvn, windows does a lot of swapping
<zid> We're not real people
<heat> and it doesn't stop our apps dead :/
<heat> ^^fax
<heat> we're all geist's personas
<mrvn> heat: windows is also the one that thought a system never needs more than 64MB for programs and anything above will be just disk cache.
<heat> right
<heat> what does that matter?
<zid> irc is just multiplayer notepad anyway
<heat> windows (most used desktop OS) swaps successfully without stopping anything dead
<heat> it's not swapping, it's how you swap
<mrvn> N. It's how much you have to swap in.
<heat> i have 3GB of swap used right now
<heat> in Linux
<heat> everything's nice and fast
<mrvn> heat: and how much swapping are you doing?
<zid> did you ever use windows xp
<zid> on a mech drive it would just hard-lock if you clicked a task bar entry for a window that was minimized more than 7 seconds ago :P
<mrvn> It's the throughput, not the amount.
dennis95 has quit [Quit: Leaving]
<mrvn> heat: try something: close firefox. How much swap remains in use? More than your usable memory?
<heat> i've got a whole clangd swapped
<heat> firefox is using *most* of my memory since I'm actively using it
<mrvn> heat: that's where I see time should be spend. Not on implementing swap. Give me a decent browser please.
<heat> you want kernel devs to write a browser?
<mrvn> can't be worse than the people doing it now. :)
<heat> except the people doing it now have been doing it for decades
<heat> i would guess they know what they're doing
<heat> why don't you write a browser, a program that needs to interpret code (fast!), accelerate everything with GPUs, support every broken web page, and ultimately make sure everything is correct and doesn't crash and doesn't kill your battery
<mrvn> with firefox getting a timeout on start because opening the tabs from last time (not loading the pages, just showing the tabs) takes too long and the js engine times out.
<mrvn> ? doubtfull
<heat> fix it then
<heat> beauty of open source
<jafarlihi> Does having an OS in your GitHub make it easier to get backend or embedded jobs?
<heat> if its good, probably
<mrvn> jafarlihi: I've got offers due to it
<heat> but getting into osdev for the career isn't exactly the point (or feasible anyway)
<jafarlihi> mrvn: Can I see your OS?
<mrvn> you can look nat what's on github
<dormito> it'd probably be more practicle to submit real/useful fixes to the linux kernel (I've seen posting that basically want people with linux commits)
<jafarlihi> dormito: Issue is the low-hanging bugs are fixed pretty quickly, no?
sonny has quit [Ping timeout: 252 seconds]
<heat> jafarlihi, github.com/heatd/Onyx is mine
<bslsk05> ​heatd/Onyx - UNIX-like operating system written in C and C++ (2 forks/48 stargazers/MIT)
<mrvn> jafarlihi: so be quicker or moretorrough
<heat> i've also gotten offers because of it
<heat> but yet again, don't get into osdev for the career, you'll get worn out very quickly
<heat> if you want to build one, get into osdev. if you just want a nice career, do something else
<jafarlihi> I don't have anything else to live for other than osdev
<jafarlihi> heat: Did someone just find your GitHub on their own and email you an offer?
<heat> yes
<jafarlihi> wow
<heat> well, not an offer but some recruiters have reached out to me
<heat> and I did impress recruiters with my OS (which probably helped me get actual offers)
<heat> they'll never reach out from nowhere with an offer, that's just not how companies work ;)
<j`ey> and yet you ended up working on websites!
<heat> im not working on websites lol
<j`ey> I know, just teasing :P
<heat> x86 > arm
<heat> how bout that
<j`ey> no comment
<heat> j`ey when do you get me a referral for ARM
<heat> i'll shill ARM64 if you do
<j`ey> when you want to apply
<heat> maybe this october or something
<heat> might genuinely do it
<heat> I tried intel last time but no dice
<heat> poland was a bit too far anyway
dude12312414 has joined #osdev
<jafarlihi> heat: What kind of salary did you expect to get from Intel or ARM?
<heat> fuck do I know
<heat> depends on the company and the location (and the cost of living there)
<jafarlihi> Is it more for people doing lowlevel shit or about same range as run of the mill backend or frontend developer?
<heat> 1000 euro is good pay for ukraine but you'll starve in London
<heat> so you might get paid 1000 euro in Ukraine and in London you'll get 6000
<heat> do I agree with the fact that your worth to the employer depends on where you live and work? no, but that's life
<mrvn> heat: and then you are piss poor in london
<heat> (particularly, because although the cost of living in London may be higher than in Ukraine, the price of lots of stuff doesn't actually scale (computers for instance))
<heat> 6000 euro isn't piss poor in London
<mrvn> You should live in the ukrain and work from home for a firm in london.
<heat> the average salary in London is like 3000 pounds
<heat> right. but they scale your pay regardless
<jafarlihi> Computers are actually cheaper in first world
<heat> i know
<heat> even poorer first world countries(i.e ukraine, moldova, etc) have more expensive electronics than 1st class first world countries like the US, EU
<heat> and they get paid significantly less. the whole system's broken
<zid> 6000 euro is the rent in london also
<heat> even in the greater london?
<heat> i know shit in the core london areas is ridiculously expensive but that's reserved for russian oligarchs
Likorn has quit [Quit: WeeChat 3.4.1]
<mrvn> But hey, someone has to pay for the cameras in the city with the most cameras.
<Bitweasil> I don't think you could pay me enough to live in London.
<j`ey> Bitweasil: 100 hundred million dollars a day?
<mrvn> I take it.
<heat> jeez why do you hate london so much
<mrvn> I think I can last a week at least.
<j`ey> too many people :P
<bslsk05> ​'Northerner terrifies Londoners by saying "Hello"' by Content Without Context (00:01:39)
<mrvn> j`ey: better delivery services
<Bitweasil> Oh, it's not London. I feel that way about all cities now.
<Bitweasil> j`ey, if someone was willing to pay me that, I probably wouldn't want to do it.
<Bitweasil> As it would probably involve things I very much oppose. :)
<j`ey> yes probably
<Bitweasil> But $1M/yr to live in somewhere like London, which is quite in excess of my current income, wouldn't do it.
<heat> 100M a day and you couldn't do it?
<j`ey> $1M is a lot, but a year is a long time
<heat> you could work a day and retire
<heat> boom
<Bitweasil> I suppose I should say, "Any *reasonable* offer, even to 10-20x my current salary, wouldn't be sufficient to get me to move."
<j`ey> I would do 10x my salary for a year.. but I dont live too far from London already :P
<mrvn> first day you are only setting up your desk anyway.
<Bitweasil> I like my dirt, my hill, my birds, my quiet, etc.
<Bitweasil> And not having to deal with the sort of people who pile on top of each other in a city. :)
<Bitweasil> I mean, where do you even *park* the tractor in a city? ;)
<mrvn> for 100M you just buy a new tractor after
<heat> you can probably live in rural england and work a remote position
<Bitweasil> I could live in the rural US and work a remote position too, which is exactly what I do. ;)
<Bitweasil> My tractor's like 80 years old though.
<heat> but the US is cringe, big up the UK bruv
<Bitweasil> *shrug* It may be, but it's also what I'm familiar with, and able to navigate. And where family is.
<Bitweasil> My wife and I considered it a decade and a half ago, I had a serious enough offer to work in Norway.
<Bitweasil> But our family is out here, and we know how to navigate things, so... happy enough to stick with somewhere we know people and aren't perpetual foreigners.
<heat> norway would be fun but it would probably be very different
sonny has joined #osdev
<stephe> mmm lutefisk
wootehfoot has joined #osdev
<zid> please leave
<zid> we don't support war criminals and weapons such as that are banned under the geneva convention
<Bitweasil> lutefisk: An experience you'll never forget!
<sbalmos> zid: what is vegemite classified as?
<mrvn> we don't support vegemite :)
<sbalmos> heh
<sbalmos> never had it, but those I know who have would classify it as a plastic explosive
<Bitweasil> "I can neither confirm nor deny the existence of vegemite."
<zid> It's just.. malty
<zid> most people who 'tried' it but don't like it really fucked it up and used it like butter
<heat> iraq didn't have nuclear weapons but it did have vegemite
<sbalmos> biological weapons, different category
vdamewood has joined #osdev
<zid> comparing it to lutefisk is hilarious
<zid> accidentally eating vegemite is like "oh, that's very strong and salty, blech"
<zid> accidentally being in the same ROOM as lutefisk "Oh no, my insides are now my outsides, I need to clean up this vomit"
<Bitweasil> zid, but what do you *really* think about it? :p
ripmalware_ is now known as ripmalware
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<bslsk05> ​swarm.ptsecurity.com: A Kernel Hacker Meets Fuchsia OS – PT SWARM
<stephe> last time i had lutefisk it was covered in bacon and mustard sauce so you barely taste the lutefisk, of course there is still the gooey-fish texture
<heat> j`ey, kool!
<heat> "For some reason, GDB was unable to chew symbols from the 110MB Zircon binary within a reasonable time."
<heat> how tf is the kernel 110MB
<j`ey> lul
<j`ey> """micro-kernel"""
<heat> mine is 7.6MB and has drivers, filesystems in it
<heat> linux is a good chunk larger than mine but it's also freaking linux
<j`ey> my linux build is 15-16M
<heat> with debug symbols?
<j`ey> I have KALLSYMS
<j`ey> if thats what you mean?
<zid> 5.3MB
<heat> i was thinking more about -g
<heat> like symbols, debug info
<zid> but I do manual .config
<j`ey> I dunno if this has -g or not
<j`ey> zid: with MODULES=n?
<zid> no I has modules
<zid> but ext4 is baked into the kernel
<zid> because I cbf to make a ramfs
<j`ey> oh ok, mines 16M with all stuff builtin
<heat> "ffffffff803d7680 fffffffffffff800 r _isr_table"
<heat> what the fuck?
<zid> I only have like.. e1000, i2c, vmware graphics as modules
<j`ey> lol
<heat> i was trying to run bloaty on zircon but it can't because what the fuck is going on here
<j`ey> zid: what's i2c for?
wootehfoot has quit [Read error: Connection reset by peer]
Likorn has joined #osdev
<zid> talking to things over i2c ofc
<heat> smbus?
<zid> probably required for thermal sensors
<zid> lmsensors best program
<j`ey> zid: I thought you ran linux in a vm only
<zid> for the most part yea
<zid> it'll still boot on my desktop if I want it to though
<heat> zid runs linux inside a windows vm inside native solaris
<zid> correct
<zid> and inside that linux I run qemu with boros inside it
<heat> and boros runs qemu with windows ME inside it
<heat> the true daily driver OS
<jafarlihi> Can someone please tell me if this NASM to GAS translation correct? https://pastebin.com/qJvZe4By
<bslsk05> ​pastebin.com: NASM:[GLOBAL copy_page_physical]copy_page_physical: push ebx - Pastebin.com
<heat> don't do that
<heat> it smells like jamesm's tutorial from here
<jafarlihi> Is there any other tutorial that gets you up to the user mode?
sonny has quit [Quit: Client closed]
<heat> you can just ask
<heat> and don't follow tutorials
<jafarlihi> heat: You mean I should just read the processor manual and figure it all out myself?
<heat> yes
<heat> you can also, you know, just ask questions
pretty_dumm_guy has quit [Ping timeout: 255 seconds]
sonny has joined #osdev
Burgundy has quit [Ping timeout: 276 seconds]
<heat> j`ey, I stripped my local 77MB zircon.elf and I got a 3MB image
<heat> still large but wtf is that debug info
<heat> late stage C++ back at it again
<j`ey> damn
<mrvn> jafarlihi: Is your kernel all asm or C or c++?
<mrvn> line 7 should be line 4.
<heat> no it shouldn't
<heat> that will actually break the function
<mrvn> You want an interrupt to fire during the 2 pushes?
<heat> why not?
<geist> oh wow, dropping paging to copy a page?
<mrvn> same reason you don't want it to fire any point after line 7.
<geist> theobvious issue being that the code had better be identity mapped at that point
<bslsk05> ​www.jamesmolloy.co.uk: 9.-Multitasking
<heat> paging is enabled before line 7
<heat> you don't want it to fire when paging is disabled
<mrvn> then it could be as low as line 14.
<heat> sure
sonny has quit [Ping timeout: 252 seconds]
<mrvn> and we should complain that STI is missing
<heat> no
<heat> popf takes care of that
<mrvn> oh, right.
<heat> jamesm's tutorials aren't that bad!
<mrvn> sorry, you are right, cli must be after pushf
<heat> the idea is totally wrong but the execution is fine
<mrvn> yeah. bashit crazy idea.
<jafarlihi> shit man, will i ever figure out how to osdev
<geist> right, that's the problem: it has a lot of bad ideas but is very slick and well executed
<mrvn> jafarlihi: why would you want to copy a physical page?
<jafarlihi> mrvn: no idea, just following the tut
<geist> jafarlihi: ah no no worries. just wean yourself off tutorials at some point. they help up to a point. but then they start to hurt
pretty_dumm_guy has joined #osdev
<geist> but in particular the jamesm tutorial is bad.
<geist> there's even a pageon the osdev wiki that talks about all the problems it has
<geist> but we can't get jamesm to remove it, so it continues to lead people astray
<mrvn> jafarlihi: I would suggest writing almost all your code in C, C++, Rust or something high level. Realy minimize the amount of asm you use.
<mrvn> jafarlihi: write code you can understand and forget about speed for the first 10 years.
<mrvn> I like how things come together when you optimize code a bit: https://godbolt.org/z/fo7jWscdq
<heat> you're not writing fast assembly code
<bslsk05> ​godbolt.org: Compiler Explorer
<heat> particularly, you do need to use assembly on that
<mrvn> s/to use assembly on/not/
<heat> yes you do
<heat> write a function that disables paging, copies a page, and enables paging again in C
<mrvn> and then have fun when you do a higher half kernel :)
<heat> and make sure it *never* touches the stack and disables every sanitizer and stack protection
jafarlihi has quit [Quit: WeeChat 3.5]
jafarlihi has joined #osdev
<mrvn> Someone motivate me to cook dinner please.
<Bitweasil> sudo cook me dinner.
<heat> if you do not cook dinner you will starve to death
<heat> therefore, cook dinner or starve
<heat> your choice mister
<Bitweasil> Nah, that's a long term consequence.
<Bitweasil> You can go a month or so water fasting before it's a problem.
<Bitweasil> Some of us, longer. :/
<zid> you need to be careful about that, it can technically release a bunch of crap that's stored in your fat you built up over long exposure
<zid> and give it to you as a much more accute dose
<zid> acute
<mrvn> or order in
<Bitweasil> Yes, though it's not ideal to have that crap stored in the first place. In general, the first time water fasting sucks, and it gets easier each time after that.
<Bitweasil> Your body sort of goes, "Oh, this again, OK."
<bslsk05> ​en.wikipedia.org: Angus Barbieri's fast - Wikipedia
<Bitweasil> Weight loss #s check out for that duration.
<zid> well yea
<zid> who needs to be TOLD not to have toxic exposure
<zid> "stop huffing lead" "Omg but it's so tasty"
Patater has quit [Quit: Explodes into a thousand pieces]
Patater has joined #osdev
<jafarlihi> heat: How long have you been doing osdev?
<heat> since 2015
gamozo has quit [Quit: Lost terminal]
<geist> mmmm mercury
<heat> eating mercury is poisonous geist
<geist> but but mat hatters!
<geist> mad
* geist goes and makes some
sonny has joined #osdev
<geist> oh interesting wikipedia says the general symptoms of mercury poisoning are not what i expected (and not what the Mad Hatter exhibited)
<geist> "However, the Hatter does not exhibit the symptoms of mercury poisoning, which include excessive timidity, diffidence, increasing shyness, loss of self-confidence, anxiety, and a desire to remain unobserved and unobtrusive."
<geist> okay, so maybe i *am* exposed to mercury
<heat> :D
<GeDaMo> Yeah, me too :|
<zid> furtiveness is a diagnosis now? o h no
<geist> well, this is from the Mad Hatter page, not a medical guide
* zid goes back to being a furtive pygmy
sonny has quit [Client Quit]
<heat> here's a fun fact
<heat> qemu's PIIX4 emulation only emulates 2 registers
<zid> Oh I thought it was going to be about the first flame
<heat> the shutdown one and the PIRQ registers
<zid> or the scaleless dragons
<heat> no dark souls mr zid
<heat> this is not the time to watch a 1 hour video about dark souls lore
<zid> but zuuli's got a cool dress though
<heat> >who
<heat> >googles
<heat> >dark souls 2
<heat> nah
<zid> zullie*
<zid> She makes lore vids on youtube
<zid> for ds/er etc
<zid> elden ring, the other dark meat
<mrvn> Don't blink, don't even blink. Oh, and duck.
<heat> vaatividya is a classic
<zid> yea I couldn't remember how his name was spelled so I spelled zullie wrong instead
<heat> my favourite type of dark souls vids are the ones where some guy just goes haywire and skips half the game to get some items
<heat> and honestly that's my favourite way to play the game
<heat> get the master key and fuck off, the bosses are just suggestions
<zid> The bosses in ds1 are infact, just suggestions
<zid> I saw a reverse boss order vid that was funny
<zid> gwyn first, immediately puts you into NG+1 for every remaining boss too
<heat> how?
<heat> mod?
<zid> no
<zid> there are wrong warps and stuff
<heat> right but in the asylum where do you warp to?
<zid> what do you mean
<heat> if you wrong warp there
<heat> where tf do you go to? the end?
<zid> gwyn is not in the asylum though
<heat> i know but you need to skip the asylum (and not kill the 1st boss)
<zid> there's a weird trick for that
<zid> to do with opening the side gate shortcut then looping back around to the beginning
<zid> because there's a complicated script to do with the fact there's two asylum demons, one for if you fight it with only your starting broken sword
<zid> and a different one for after you fight it 'properly' through the fog gate at the top
<zid> you can kill the first one and get him to drop the big key and escape, but returning to the boss room will mean he's actually still alive
<heat> what haha
<zid> death cam glitch lets you into sen's fortress from there
<zid> iron golem's grab attack + a well timed quit-out has a stupidly low chance of spawning you in anor londo when you reload
<bslsk05> ​www.youtube.com <no title>
<heat> the most interesting thing is that he does it without the master key
<mrvn> Now you need to use what they did in minecraft: Build out a few chunk in such a way that every tick the random number generator resets to a known state that is most advantageous for you.
<mrvn> RNG? There is no RNG here, nothing to see, go away.
<zid> master key is overrated if you're willing to do skips
<zid> I usually go MK just because I'm fighting spider waifu from behind, huehue
<heat> wtf he just death cam glitches into the lower undead burg
<zid> I guess it's quicker and/or easier? you don't need to
<zid> you can just do some jumperonis
<heat> it is needed
<heat> he got to the depths from there
<zid> oh to skip kapra
<heat> cuz of the large ember
<zid> the depths with no kapra would need it yea
<zid> capra? I forget how to name
<heat> capra yes
<zid> kappa demon
<zid> we playing krastorio 2 now?
pretty_dumm_guy has quit [Quit: WeeChat 3.5]
GeDaMo has quit [Quit: There is as yet insufficient data for a meaningful answer.]
sonny has joined #osdev
<jjuran> Whoa, where am I? I was looking for #osdev; how did I get here?
<jjuran> I must have wrong-warped
<mrvn> we finished our OSes and went on to gaming.
<heat> exactly
<heat> we did it guys
<heat> we finished osdev
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<zid> pfft I finished it ages ago on hard
sympt2 has joined #osdev
sympt has quit [Ping timeout: 248 seconds]
sympt2 is now known as sympt
<moon-child> tried ng+?
<jafarlihi> My keyboard stops outputting stuff to the framebuffer when I fork(). Any idea why?
<zid> your framebuffer is racist and only cares about parents
bauen1 has joined #osdev
<heat> jafarlihi, see if crashed, hanged or if interrupts are still disabled
<heat> your keyboard doesn't output stuff to the framebuffer
<zid> I mean, I'd just.. debug it
<zid> does the syscall really happen, does the syscall add it to the buffers
<zid> do the buffers get checked
<moon-child> ^^ goes for both input and output
<heat> it's not a syscall
<heat> it's jamesm's fork
<zid> a.. what
<zid> who
<moon-child> jamesm?
<heat> james molloy's tutorials
<moon-child> oh
<bslsk05> ​www.jamesmolloy.co.uk: JamesM's kernel development tutorials
<heat> notoriously crap tutorial
<heat> jafarlihi, again, you should ditch the tutorials
<heat> you seem to be a bit out of your depth so my advice is that you should start over
<mrvn> zid: That's not racism, that aehm, what's the opposite of ageism?
<mrvn> youthism?
jafarlihi has quit [Ping timeout: 258 seconds]
<zid> Can't tell if he took it well or badly
<zid> no shouting, but also left
<heat> it do be like that sometimes
mrlemke has joined #osdev
ZipCPU has quit [Remote host closed the connection]
sonny has quit [Quit: Ping timeout (120 seconds)]
sonny has joined #osdev
ZipCPU has joined #osdev
<geist> it was a ping timeout, so maybe just connection issues
ZipCPU has quit [Ping timeout: 258 seconds]
ZipCPU has joined #osdev
* mrvn fragt sich ob C++ lectures will ever start with teaching `std:array` and `std::vector` over `int arr[size];` which isn't even c++.
* mrvn wonders if C++ lectures will ever start with teaching `std:array` and `std::vector` over `int arr[size];` which isn't even c++.
<heat> languages are leaking
<heat> std::array is bad
<mrvn> heat: ehy?
<heat> std::array is clunky as hell
<heat> also needing a header to use arrays is so late stage C++ it's not even funny
<mrvn> it's a C-style array without the decay to pointer
<mrvn> heat: you already have to teach "#include <iostream>"
<bslsk05> ​godbolt.org: Compiler Explorer
<heat> using std::array teaches students how to count, good point
<mrvn> heat: std::array a{1, 2, 3};;
<mrvn> and no need to tech them about sizeof(x) / sizeof(x[0])
elastic_dog has quit [Killed (lead.libera.chat (Nickname regained by services))]
<heat> so you can either specify nothing or you specify everything
elastic_dog has joined #osdev
<mrvn> heat: yep. unfortunately there isn't a deduction guide for just the size missing
<heat> and that makes it brooookennnnnnn
<heat> std::array is very much a half baked feature in my eyes
<mrvn> yeah, bugs me too. But still worlds better than `int a[] = {1, 2, 3};`
<zid> A C++ feature that isn't well integrated and has some issues!?
<heat> int a[] = {1,2,3} works fine
<heat> it even decays automatically to an iterator! nice!
<mrvn> that part isn't the problem. It's the 1000 bugs you get from new users trying to use a and pass it to functions.
<zid> You know what works even better, int a[7] = { [0] = 1, [1] = 2, [2] = 3};
hyenasky has joined #osdev
<zid> and then you can pass it to a function that takes an array of 4 int and get a warning
<clever> another syntax ive seen is:
<zid> or maybe I dreamed this
<heat> mrvn, new users should understand pointers and argument passing
hyenasky has quit [Client Quit]
<mrvn> zid: except you don't get a warning because new users don't know how to turn on warnings
<clever> struct foo symbol[] = { [INDEX0] = { .name = "foo", }, }
<heat> !!! BAD TOOLING ALERT !!!
<bslsk05> ​github.com: lk-overlay/pll_control.c at master · librerpi/lk-overlay · GitHub
<mrvn> heat: I strongly disagree. New users shouldn't know about pointers at all.
<clever> this lets you define a value at each inde
<heat> what
<clever> x
<clever> and skip indexes
<heat> ...C++ may not be the language for you
<zid> I do that to sparse init a LUT
<bslsk05> ​github.com: lk-overlay/pll_read.c at master · librerpi/lk-overlay · GitHub
<zid> in a couple of places in some code
<mrvn> heat: they need references but not pointers.
<heat> you're taking C, improving it (creating C++) and then 20 years later you want to take out C?
<clever> zid: what about a table like this second one?
<heat> so now it's just ++?
hyenasky has joined #osdev
<heat> pointers are still *part of the language*
<mrvn> heat: yes. Don't teach C++ by teaching all the C cruft.
<zid> someone has to use em
<heat> malloc is still *a function*
<hyenasky> mrvn: i disagree that swapping is obsolete, the alternative is just dying when your programs use more than available RAM which lots of programs do regularly
<mrvn> hyenasky: so fix your programs
<heat> in fact isn't the recommended practice to pass raw pointers when you want to give out non-owning pointers?
<hyenasky> mrvn: some data sets are pretty huge
<heat> "hey professor, what's this weird '*'?"
<mrvn> heat: how would you give out non-owning pointers if you don't have pointers at all?
<mrvn> hyenasky: then mmap them
<clever> isnt `this` a pointer?
<heat> the & operator or unique_ptr or shared_ptr or this
<heat> or weak_ptr if you're a weirdo
<mrvn> clever: unfortunately yes, comes form a time before refrences. Luckily beginers don't need this.
<hyenasky> people regularly get deep into swap just running photoshop with high res images and that works fine
<heat> they don't need this?
<kazinsal> adobe has its own separate pseudo-swap implementation as well
<heat> does c++23 introduce self?
<mrvn> heat: where would they need this?
<heat> to pass a pointer to this class to something
<hyenasky> i always felt like hobby osdevs saying "swap is obsolete in 2022" just didnt feel like implementing it lol
<heat> or
<hyenasky> no harm in having it around
<mrvn> heat: no pointer so not a problem.
<bslsk05> ​github.com: Onyx/bitmap.h at master · heatd/Onyx · GitHub
<heat> tadaaaaaaaaa
<heat> that doesn't work without this->!
<hyenasky> also this web client disconnects at the drop of a hat its kind of annoying
<mrvn> heat: you don't need to compute fibonacci numbers. Or test a number for primt. Or sort an array.
<mrvn> heat: why do you use "this->" there`Just use bitmap directly.
<mrvn> s,`,?,
<heat> you can't
<heat> standard C++-ify it and try it out in godbolt
<heat> I actually asked this in here and Griwes helped me out
<heat> anyway, as I was saying
<zid> how are you supposed to implement all these lovely things without a way to access memory
<heat> if you want to take out pointers you're better off creating a new language
<heat> fortunately, there's rust
<mrvn> heat: That's a pretty adcanced template calss with inheritance optimized for different use cases. Really not something beginners would run across.
<hyenasky> also as for the idea of "theres no swapping at runtime, then you run out of physical memory and the OS starts dumping pages to disk and everything locks up", swapping isnt supposed to work like that
<mrvn> heat: that's your std::bitset, right?
<heat> yes
<heat> well
<heat> yes and no
<mrvn> heat: see, problem solved.
<heat> std::bitset doesn't grow dynamically
<heat> it's my bitset AND vector<bool>
<heat> see, problem not solved
<hyenasky> (cont) it worked like that in unixlikes for a long time but what NT does is passively "clean" dirty anonymous pages at all times by writing them to swap when theyve been trimmed from a working set and are on the modified page list longer than something like 30 seconds, this allows it to rebalance memory continuously instead of all at once
<hyenasky> so it tends to lock up less
<mrvn> I would rather let students taste the sausages instead of starting with showing them how they are made. No need to start with the ugly bits.
<heat> and that's your opinion
<mrvn> heat: not just mine
<heat> it's a weird opinion for C++ (why not java?) but hey, you do you
<heat> Java pretends there's no such thing as pointers by having everything as a pointers except base types
<mrvn> heat: you think it's weird that people should learn about the STL before you have them write their own?
<heat> I think people should learn about the STL last
<heat> lots of environments can't use the STL
<heat> noexcept code for instance
<heat> kernel, firmware, game engines
<mrvn> all advanced topics
<heat> if you only show students the STL you'll never teach them about the base language
<heat> or base problems that the STL helps solve
<zid> This reminds me of russian nuclear reactor technicians
<heat> what are unique_ptr's for? what's malloc?
<mrvn> nobody said "only"
<heat> you want to hide pointers from them
<heat> freaking pointers
<heat> that's like half the language
<mrvn> yes, to start with. Nobody needs to learn about `malloc` on the first day.
<heat> I disagree
<kazinsal> pointers themselves are probably a solid few lessons on their own just because of all the trouble you can get into with them
<heat> bottom-up is easier to learn
<mrvn> kazinsal: nod
<zid> pointers just happens to touch deeply on a bunch of language features
<zid> because half the language is about them
<zid> Typing, punning, aliasing, etc
<mrvn> pointers should be pretty much the last solution for a c++ problem.
<zid> arrays, decay, the three pointery operators
<zid> it's also a good point to introduce objects vs values as a concrete concept
<zid> That last one is the thing I see amateurs struggle most with in C, they follow crappy tutorials instead of learning the difference
<zid> so they can't reason well about that &a is a pointer value and can be assigned to pointer types, and the * operator gives you the object it refers to etc
<heat> yeah
<mrvn> zid: and why should they? Just use a reference.
<zid> which tends to lead to 'failing to allocate an (int *)[16] for their array of pointers' and stuff
<heat> mrvn, make a vector of references
<moon-child> part of the issue is that the rules about arrays decaying into pointers are tuned for the convenience of experts in specific program patterns
<moon-child> they're not tuned for convenience
<zid> They're tuned so you don't have to write two of every function, one for arrays and one for pointers
<mrvn> or *arr[10][20];, take arr, skip 10 matrixes ahead, take row 20, return first item. Yeah, that's what the user wanted.
<moon-child> err, not tuned for intuitiveness
<zid> strlen(a) just works in both cases
* moon-child accidentally a word
<zid> everything else is an accident more or less
<moon-child> yeah
<moon-child> as I said, tuned for the convenience of experts in specific program patterns
<zid> I mean.. I'd hardly call strlen an expert strategy :P
<heat> oh nice reference! make it reference another object
<moon-child> you _could_ write strlen(&a[0]), but who wants to do that?
<moon-child> zid: well...
<mrvn> C strings is another thing you don't have to teach. just use std::string
<heat> how do I get an optional reference?
<mrvn> (on the first day=
<moon-child> zid: mantra goes 'they did the best they could with the tools they had available to them'. Whether this is true or not, I won't take a position on :)
<zid> That's basically all of computering
<mrvn> heat: that's second or thrid year stuff
<zid> I once had to smack down an otherwise smart friend because he was shitting all over x87 for being awkward
<zid> I was like bro, that chip was absolutely cutting edge at the time, making it a stack machine made it possible for /compilers/ to actually generate code for it.
<zid> etc
<moon-child> there's an interesting post from djb to the effect that x87 might actually be optimal
<heat> mrvn: the issue is that all these "amazing" C++ features require advanced syntax compared to other hello worlds
<moon-child> but yeah, given the context of fpus as standalone chips x87 is fine
<moon-child> and 80-bit floats are a good idea, just didn't catch on
<zid> but my main point is basically, everything is a product of its environment
<heat> std::cout << std::string("Hello World!\n"); <-- what the fuck does this do
<zid> there were very few bad products entirely that you've actually heard of
<zid> it's all just compromised by reality
<mrvn> heat: I would say std::array, std::vector, std::string need less syntax than the C equivalents.
<heat> meanwhile, rust: println!("Hello World");
<zid> people thought risc was fast because it was, because ram was faster than clocks and transistors were expensive, etc
<moon-child> I still think they coulda done better with c
<moon-child> 'worse is better' &c
<zid> absolutely should have done something inbetween C99 and C22
<moon-child> no I mean originally
<heat> C11 was nice
<zid> I'm not sure what the env was like at the time
<mrvn> zid: punch cards?
<zid> I don't know bcpl and stuff
<zid> which I'd need to know to have relevant thoughts on the design of C in-context
<mrvn> AmigaOS uses that
<mrvn> They bought parts of the OS as bcpl code and interfaced it with C.
<zid> re x87: We're just now barely getting to the point where compilers can auto-vectorize sse, woo :P
<mrvn> re x87: having to store values in ram so the fpu can read them back is horrible nowadays.
<zid> Imagine dumping avx in 1987, it'd cost a million dollars a die and there'd be 0 compilers capable of emitting it for the next 10 years
<zid> wait this sounds like itanium...
<kazinsal> bcpl is not a pleasant programming language but that's on account of it being older than dirt
<moon-child> nah it sounds like cray
<moon-child> which was massively successful
<moon-child> but also not _remotely_ close to a microcomputer you could put under your desk
<mrvn> zid: at a million dollars a die you only need to sell 10
<zid> yea it really failed as a workstation other than the fact they added a bench
<kazinsal> itanium is one of my favourite examples of an utter mess of an architecture
<zid> the bench was a VERY nice touch
<kazinsal> partially because it wasn't intel's first hilariously over-complicated flop
<moon-child> (fun fact: cray _still_ has more vector register-age than a fully kitted out avx512. Might still even be true after amx)
<zid> AMX is advanced microdevices XTREME VECTORS?
<zid> new to me
<moon-child> there's an apple amx and an intel amx
<mrvn> If I have AVX512 with 512 bit registers then why no int512 type?
<moon-child> which are slightly similar, but not really
<clever> moon-child: how exactly do cray and avx512 compare in what they can do?
<moon-child> it's all very confusing
<heat> advanced matrix extensions?
<moon-child> heat: yeah
<heat> ok fun fact
<heat> clang has matrix types
<moon-child> clever: they don't particularly, but they both have a tonne of vector register-age, which is why I make the comparison
<bslsk05> ​clang.llvm.org: Matrix Types — Clang 15.0.0git documentation
<clever> moon-child: register-age?
<zid> 'idge'
<zid> not 'oldness'
<moon-child> ^
<zid> registerality
<mrvn> clever: I think the cray had a ripple carry adder but you can add a number every cycle and only have to wait for the ripple carry at the very end. Summing up an array of numbers is fast.
<moon-child> mrvn: cute
<zid> I *think* he's trying to say the dsign philosophy was similar in that they both aim to pack a fuck load of vectors into regs and do wide ops on them?
<clever> ah
<mrvn> clever: all things that went away with add and mul taking single cycles.
<clever> mrvn: sounds like the add was pipelined, and doing back2back adds can hide that latency and make it 1 cycle effectively?
<mrvn> clever: yes, pipelining is the modern solution.
<clever> the rpi has a 48bit 16 lane accumulator, but ive not closely inspected it to see what the cycle costs are
<clever> basically, you can take a uint32_t[16] and add it to the uint48_t[16], in addition to an existing opcode
<mrvn> But that's SIMD
<clever> all vector opcodes have an "add to accumulator" flag, and the option to store the result to /dev/null
<mrvn> different kind of vector.
<clever> i assume it has low to no clock cycle overhead
<clever> so you can do back2back adds to the accumulator, but your also doing 16 at once
<mrvn> The old vector unit would be uint32_t[16] -> uint48_t
<mrvn> "sum" instead of "add", "prod" instead of "mul"
<clever> there is also a set of fixed functions, like sum, that can be applied to the entire accumulator
<clever> so you can reduce your 16 sums of each lane down to a single sum
<mrvn> Is there a sum(double[4] * doubl[4])?
<clever> close
<mrvn> or even better 4 of those in parallel please.
<clever> typing it out
<clever> uint48_t[16] accumulator; uint16_t a[16], b[16]; are the types involved
<clever> foreach: accumulator += a*b; is a single opcode
<clever> and result = sum(accumulator); is a second opcode
<bslsk05> ​github.com: lk-overlay/pink.S at master · librerpi/lk-overlay · GitHub
<mrvn> But for a 4x4 matrix you only want to sum up 4 each.
<clever> line 13 will load an array of 16*r0 16bit ints
<clever> mrvn: there are per-lane conditional execution flags, so you can nop out some lanes
<clever> or just array so the [16] has 0 in 12 of the slots, so *0 == 0, and +=0 is a no-op
<clever> arrange*
<mrvn> sum(0-3) sum(4-7) sum(8-11) sum(12-15) in one opcode would be nice.
<clever> line 14 loads a second array of 16*r0 16bit ints
<clever> line 15 will then do accumulator[i%16] += a[i] * b[i]; where i goes from 0 to (16*r0)-1
<clever> and line 16 will then sum the 16 accumulator lanes, and >>15 the result
<clever> i think this is a dot product?
<clever> and if you want it on something that isnt a multiple of 16 inputs, just pad the end of the array with 0's
<mrvn> maybe 4 dot products in parallel.
<clever> i'm not sure you could do the sums in vector mode
<mrvn> My example was for a dot product. Mat4x4 * Vec4 = Vec4
<clever> so it might be simpler to do 16 in parallel
<clever> i still need to figure out matrix math
<mrvn> yeah, I'm thinking too small. JUst do a million dot products 16 at a time.
<clever> its kinda hard to write vectorized asm, when you dont even know the algo your trying to implement
<clever> the biggest limitations i can see on the VPU, is that mult only accepts 16bit inputs max
<clever> and its int only
<clever> all other opcodes work up to 32bits
<mrvn> clever: You need quite a bit of math and drawing things out for it. Especially the 4x4 Matrix stuff for 3D graphics.
<clever> and the accumulator is 48bit, so it can overflow a decent amount, when adding a ton of 32bit ints
<clever> do you mean the 3d->2d transform?
<clever> or the rendering parts?
<mrvn> clever: the 4x4 matrix is a rotation + translation + projection + scaling.
<clever> yeah, thats one thing i still need to learn
<bslsk05> ​github.com: 3D/3D.BAS at master · cleverca22/3D · GitHub
<mrvn> And then you just say: Here a a million triangles, multiply them by this 4x4 Matrix and then paint the x,y coords if z>0.
<clever> i think this is how i did projection back in the 2003?
<clever> projection and translation
<clever> but i never figured out rotation
<geist> noice
<geist> i wish i had my old pascal program i wrote in high school that did some 3d stuff
<clever> i found it on a floppy one day, and archived it to github
<mrvn> And that 4x4 matrix multiply is basically an opcode in the GPU, or a very fast sequence of opcodes to do 16 of them in parallel.
<clever> i'm surprised i'm even seeing struct like features in qbasic
<mrvn> I had to do x[1000], y[1000], z[1000] in C64 basic.
<clever> mrvn: for the v3d on the rpi, ive not seen any signs of a 4x4 matrix mult, but it is a 16 lane vector core, claiming to be 16 scalar cores
<clever> for most opcodes, you can just think of it as a scalar core
<clever> and only for loading the vertex data, and some conditional execution, does the vector nature leak out
<mrvn> modern chips do parallel stuff instead of a massive matrix opcode.
<clever> yeah
<mrvn> SIMD vs. CISC
<clever> that fits v3d perfectly
<mrvn> With SIMD you can do 2x2 matrix for 2D graohics, 3x3 matrix for 3D rotations, 4x4 matrix for the whole shebang, 1000x1000 matrix for numeric algorithms. It's relly the most flexible.
<clever> mrvn: https://imgur.com/a/8gQXjc8 the raw vertex attribute data (inputs to your 4x4 matrix mult) get loaded into the VPM in one of these modes, i think 32bit mode (the one at the bottom)
<bslsk05> ​imgur.com: Imgur: The magic of the Internet
<clever> you can then use any of those modes to pull out slices of it (8bit laned and 16bit laned seem the best for this)
<clever> (or 32bit)
<clever> and then you can forget that its vectorized, and just do the math as-if it was a scalar only core
<clever> so basically, you can load row 10 of the VPM, in 16bit laned mode, upper half, into R0
<clever> and all 16 lanes will go into the 16 lanes of the QPU core
<clever> so you could use that to load the xyz of a vertex, and then use uniforms to load the 4x4 matrix, mult them together, and write the final xyz back to the VPM
<clever> and boom, thats your vertex shader
<zid> Imaging shading vertices
xenos1984 has quit [Read error: Connection reset by peer]
<zid> Like we live in some kind of graph problem
<zid> hurr durr I'm a graphy theory textbook, I colour vertices
<clever> the v3d is like a lot of mobile 3d cores, and its tile based
<clever> so you also need a coordinate shader
<zid> to be fair, everything is tiled based, but a proper desktop gpu just does it automagically
<clever> the coordinate shader only produces xyz, while the vertex shader produces xyz + vary[]
<clever> maybe a desktop gpu has enough ram to keep those extra vary[] around the whole frame?
<clever> while the v3d doesnt, and needs to re-compute them later
<clever> and saves time, by just skipping them the first time
<zid> or maybe not automagically and the firmware is doing it using proprietary algs, who knwos
<clever> yeah
<clever> much more of a blackbox on most GPU's
<clever> in the v3d case, the output of the coordinate/vertex shader only lives in the limited VPM memory (a uint32_t[64][16])
<clever> the binner will run a coodinate shader, and generate an array of polygon's in each tile
<clever> and then the xyz is lost
<clever> the renderer will then take a single tile worth of polygons, run the vertex shader to re-create the xyz, and create the vary[] for the first time
<clever> and then it uses that as inputs to raserize the polygon and run the fragment shader
<clever> but, the fragment shader can reserve some VPM space, so the hardware has to balance keeping some VPM space free, vs running the vertex shader ahead of time so the rasterizer doesnt starve
<mrvn> And all I really want is a simple interface where I give it a triangle, a texture, a brightness and an alpha and have it draw it on a framebuffer.
<geist> re: cray iirc off eh top of my head it had something like 3072 A and B registers
<clever> all shaders also co-exist on the same set of cores (usually without context switching)
<geist> and the operatins were generally to repeat the thing N things across all the regs
<geist> and lots of move into/out of registers
<clever> ah
<mrvn> Hell, I feel nostalgic, skip the texture. Give me flat of phong shading.
<clever> mrvn: 3D.BAS above had just 1 solid color per poly, lol
<clever> it was just using the 2d flood-fill function
<clever> i didnt even try rasterizing back then
<clever> i just drew the outline of the polygon in a magic color, then did flood fill to that color
<clever> then re-drew the outline in the poly color, so it wouldnt interfere
<mrvn> My AMiga had hardware for the flood fill
<mrvn> Just draw the lines with bresenham, 1 pixel per scanline, and the blit fill the area.
<clever> the blitter in the amiga is still magic to me
<clever> its somehow even involved in decoding the floppy encoding
<mrvn> the copper is even better
<clever> maybe it was the copper
<mrvn> The copper is programmed and reacts to the x,y coords of the gfx output. You can wait for specific pixel positions and then do something.
<geist> hmm no my 3072 thing was bogus, but there was a large set of internal registers. re-reading it now
<mrvn> e.g. reprogram the sprite hardware to display a second set of sprites in the lower half of the screen. Or change the resolution of the gfx output.
<mrvn> clever: ever used a light pen?
<geist> ah i see had either V registers (V0-V7) which each had 64 64bit elements
<mrvn> or one of those arcade games where you shoot at the screen and it knows where you aimed?
<geist> so they were some seriously wide-ass vector registers