Search logs:

channel logs for 2004 - 2010 are archived at http://tunes.org/~nef/logs/old/ ·· can't be searched

#osdev2 = #osdev @ Libera from 23may2021 to present

#osdev @ OPN/FreeNode from 3apr2001 to 23may2021

all other channels are on OPN/FreeNode from 2004 to present


http://bespin.org/~qz/search/?view=1&c=osdev2&y=22&m=5&d=24

Tuesday, 24 May 2022

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