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> i'm doing it
<gog> i'm gonna try to sysret into user mode
<gog> i fully expect this not to work
<geist> yay do it!
<geist> am currently digging through how i'm setting/clearing the floating point enable bits on riscv
<geist> think i was doing it subtly wrong before
<heat> gog, it fun
<gog> hmmm
<gog> linking problem
<gog> my user test code is in a different section
<gog> and to sysret to it i'm doing a rip-relative lea
<gog> but ldd doesn't like that
<gog> presumably because it's cross-section
<gog> i'm gonna have to rethink this
<gog> this little hack isn't going to work i don't think
<gog> i guess i'll just make an actual image to load with its own page tables and shit
<heat> can u giv err
<heat> yesssssssssssssssssss
<heat> doing things properly!
<gog> ld.bfd: task.o: relocation R_X86_64_PC32 against undefined symbol `usertest_entry' can not be used when making a shared object; recompile with -fPIC
<gog> i am compiled with -fPIC is the thing
<heat> yeah
<gog> orrrrr i could put it in its own zone of .text
<gog> yesssss
<gog> keep it a page away from everything else
<gog> this is still a dumb back
<gog> hack
<heat> no
<heat> don't dumb hack
<gog> fine ill do it right
<heat> do it properly
<gog> but it'll have to be tomorrow
<gog> if not tomorrow i don't anticipate being able to work on it again until at least next weekend
<gog> i can barely work under the conditions i'm in rn
<heat> good
<mrvn> gog: don't forget the hardware "bug" with 0x7FFFF...FFFF
<gog> the what
<mrvn> gog: intel and amd behave differently when your stack overflows causing the mode to be wrong
<gog> i see
<mrvn> on sysret
<mrvn> As to your R_X86_64_PC32 problem. Are you putting the user .text segment into lower half with an AT tag in the linker script to set the LMA right?
<gog> no i tacked it on above .text
<heat> no, that's errata
<mrvn> So your user test runs in higher hgalf too? odd.
<gog> told you it was a hack :P
<mrvn> no, odd that you get the error then. Wrong order of .o files?
nyah has quit [Quit: leaving]
<gog> no, i suspect it has to do with the fact that my kernel image is basically a fake PIE
<mrvn> "undefined symbol" usualy means some .o is missing
<gog> wait
<gog> no it's there
<mrvn> does it work when you load the symbols absolute?
<gog> no
<mrvn> error?
<gog> ld.bfd: task.o: relocation R_X86_64_32S against undefined symbol `usertest_entry' can not be used when making a shared object; recompile with -fPIC
<gog> it shouldn't be undefined though
<gog> i wonder if i did something silly like misspelled
<gog> heh
<mrvn> _usertest_entry because C symbols get mangled?
<gog> i didn't declare it global
<heat> lol
fedorafansuper has quit [Quit: Textual IRC Client: www.textualapp.com]
<gog> aaaay
<gog> haha
<gog> blonde moment stikes again
<zid> side note: global being basically opposite to what you mean in nasm is annoying
<zid> it's like, passive vs active verbs or something
<zid> 'be global' vs 'is global'
<zid> fcuking aux verbs
<heat> doesn't nasm work similarly?
<zid> to what
<heat> to GNU AS
<zid> no idea I don't use as
<gog> well
<gog> it doesn't work
<gog> but it compiled
<gog> and linked
<zid> perfek
<moon-child> zid: how is it opposite of what I mean?
<heat> .global foo\nfoo: vs [GLOBAL foo] foo:
<gog> but compiling and linking means i can at least investigate it with a debugger
<zid> moon-child: in C, extern means "this is external" in nasm it means "make this external"
<zid> and opposite for global
<gog> guh
<gog> that's right
<gog> i haven't used nasm in forever
<moon-child> zid: huh? P sure it doesn't
<moon-child> https://0x0.st/HsXv.s this does exactly what I expect it to
<zid> oh extern is the one that makes sense, global is the one that confuses me
<zid> oh I should install a text editor
* moon-child still does not understand what the problem is
<gog> stop installing software
<zid> I should
<gog> move to the forest
<zid> cus I'm going to have to redo it all after I replace ssd
<moon-child> can't copy data over?
<gog> don't copy that floppy
<mrvn> moon-child: .global is the opposide of C's static
heat_ has joined #osdev
<zid> I could try it
<zid> but I don't expect it to actually work
heat has quit [Read error: Connection reset by peer]
heat_ is now known as heat
<zid> I think the strategy would be to copy the files and pray the installer medium's repair tool could give me a working BCD for it, and that I don't miss any files due to perms (easier said than done on windows)
<moon-child> can't you dd over the entire drive contents?
<zid> but it's not the same capacity
<zid> or sector size for that matter
<zid> so the fs would be using the wrong cluster size and shit too
<moon-child> if the disc is bigger, and the sectors are smaller, i think that's ok
<moon-child> otherwise yeah probably want to reformat
<zid> which is why this is a pain
<zid> either you copy the files and you miss shit cus of perms and it breaks
<zid> or you dd shit, have to resize the partition later, and it breaks :P
<moon-child> can't you keep the same perms
<mrvn> dd to a file and loopback mount that in a live CD
<zid> if you do it on windows, all the native file copies silently skip files you can't access
<zid> half of C:\windows is owned by TrustedInstaller
<zid> and not even admin has perms
<zid> etc
<zid> if you do it on linux you have to trust ntfs-3g to make the ACLs identical
<moon-child> this is what you get for using windows
<zid> yep
<zid> samsung must be closed on saturdays anyway, they never emailed back
<moon-child> windows doesn't even have zfs
<zid> so now we wait until.. monday?
gog has quit [Ping timeout: 255 seconds]
gog has joined #osdev
<nikolar> Migrating an installation on zfs is so easy though
<nikolar> Just zfs send/receive
<zid> it's easy on any *nix
<zid> cus cp does what you want already, and has 'root'
<nikolar> Yeah but a bit trickier over network
<CompanionCube> moon-child: well, depends on how much risk you want to take driver-wise
<zid> scp / rsync, very standard
<zid> but it would't be over network
<nikolar> Fair enough
<zid> I'd just be added a drive and cloning he files
<CompanionCube> ooh, apparently that port went from alpha to beta in november
<moon-child> translation: they decided to get more serious about stealing people's data
<moon-child> :)
<gog> meow
<zid> glorgious
<zid> goggicus
* moon-child pets gog
<zid> maxigog
* gog prr
<zid> no, I'm gogacus!
<moon-child> minigog
<heat> the linux ntfs kernel driver seems pretty decent
<heat> as in, didn't tragically corrupt my data and had good performance
<zid> nice
<zid> does it deep copy with cp
<zid> so that you get the acls
<heat> i dunno
<zid> me either
<heat> but that's probably something cp needs to handle itself
<zid> nah I think the fs driver does
<heat> if it copies xattrs or not
<zid> there should be an acl tool to deal with it, like xattrs
<zid> but cp should move it with the file
<zid> I think the way ntfs works is that a lot of it is inherited from the parent
<heat> no, cp is just int fd = open("blah", O_CREAT | O_RDWR); write(fd, read(..));
<zid> it doesn't O_CREAT | O_RDWR though does it
<mrvn> --preserve[=ATTR_LIST]
<mrvn> preserve the specified attributes (default: mode,ownership,time‐
<mrvn> xattr, all
<mrvn> stamps), if possible additional attributes: context, links,
<zid> ?
<zid> I don't recall copying files around suddenly making them all owned by root
<mrvn> zid: because as pasted ownership is default
<heat> sure does
<zid> huh
<zid> I'd test it but.. I'd have to install vmware
<moon-child> wsl?
<heat> he's on 7 lmao
<mrvn> for rsync: --acls, -A preserve ACLs (implies --perms)
<mrvn> --xattrs, -X preserve extended attributes
<moon-child> oh
<moon-child> use 8 at least
<zid> 8 doesn't fit on a usb
* moon-child has windows 8 on old laptop
<zid> and my drives are all MBR
<zid> my usb*
<mrvn> --archive, -a archive mode is -rlptgoD (no -A,-X,-U,-N,-H)
<zid> and windows 8 fucking sucks
<heat> zid, it may adjust metadata, but open(...) and then copy_file_range (on linux) is the gist of it
<zid> other than that, I'll get right on it
<moon-child> what's wrong with it
<zid> what's right about it
<moon-child> it certainly was a lot more tolerable than windows 10
<heat> moon-child is the only windows 8 user out there
<heat> holy fucking shit
<heat> that's a hot take
<zid> think of how much more tolerable w7 must be than w10 then, given how w8 is trash compared to w7
<moon-child> yes but security updates
<heat> windows 10 is far superior to both 8 and 7
* mrvn hates shows that end (final season) in a cliff hanger.
airplanemodes has quit [Ping timeout: 248 seconds]
<heat> deal with it weirdos
<zid> If they hack my browser they've already hacked my browser, the only thing I use my machines for
<moon-child> win10 is slow as fuck bloatware
<zid> so it's already too late at that point :P
<heat> moon-child, NOT
<zid> if anything I might be safer, cus the shellcode won't work
<zid> wrong kernel32dll addresses
<heat> seriously what windows 10 slowness did you experience and why is mechanical hard drive related
<heat> and in that case: i get you, it's pain, but it's also 2023 stop using mechanical hdds
<moon-child> oh so it's not windows's fault for being slow; it's _my_ fault
<moon-child> ty heat, that clears it up
<heat> yes, you just got #archlinux'd
<geist> haha
<geist> blame the victim nice
<heat> moon-child, but seriously, is it hdd related?
<moon-child> I have an ssd in that laptop
<heat> because that's a fair point but I'm also not sure if 8.1 was far better
<moon-child> 8.1 was _miles_ better. Not good, mind you
<moon-child> one thing I will say is that, unlike linux, windows never froze up completely
<moon-child> slowed to a crawl, yes, but always recovered eventually
<zid> There, added my snatched torrents back to my new client so that I don't get in trouble, thank god for my 'unreliably mechanical drives'
<zid> outliving my SSD by a decade
<zid> s/ly/le
<zid> good news btw, I had a backup of my private keys
<heat> how does one safely back up private keys?
<zid> print them on A4 paper
<zid> put in safe
<moon-child> nope
<zid> I unsafely backed them up by which I mean I just put them in C:\zid D:\zid and F:\zid
<moon-child> Big Paper is in uncle sam's pocket
<heat> do you actually have a C:\zid
<zid> ofc
<zid> It used to be D:\zid
<heat> that's such a C:\work moment
<geist> back from the DOS days of the 90s i have traditionally had a c:\util that just has a big pile of com and exe files
<geist> that was back where i used to have pkzip, etc
<zid> I have C:\zid\bin for that
<geist> still do, though most of those dont work anymore
<geist> but been dragging that folder around for 30 years
<geist> every new install gets a copy of it
<heat> lol
<zid> I have cpuz_x64 pageant and putty so far
<geist> yah at some point i make a c:\util\sysinternals folder, which holds the last copy of the sysinternals suite
<zid> It will collect tools over time I'm not going to think them up ahead of time
<heat> are you a toddlers & tiaras contestant?
<zid> does heat not know what pageant is
<zid> is that what we're learning here
<heat> 0 clue
<geist> same
<zid> it's ssh-agent for putty
<geist> ah yeah i dont use putty, so never bumped into it
<zid> lets git and putty and stuff use ssh auth
zaquest has quit [Remote host closed the connection]
<zid> tortoise-git and mingw git can both talk to it
<heat> yeah I use the terminal like a real nerd person
<geist> traditionally i used securecrt and lately i half and half use that and the windows 10 terminal + command line ssh
<geist> there's a MSFT terminal app yo ucan get from the app store that's pretty good
<geist> can replace the default terminal
<heat> yeah w10+ includes ssh
<zid> funniest thing is that mingw now has a "idk we're dropping w7 support at some point?" banner
<zid> like, who the fuck uses mingw except w7 users?
<moon-child> I'm going to cry
<moon-child> all this broken redhat software
<geist> cywgin FTW!
<heat> geist, isn't windows terminal already included by default? maybe just in w11
<moon-child> packages want to pull in pulseaudio and dbus as dependencies
<zid> I never got into cygwin because it was petptually broken
<zid> fork() wasn't implement on 64bit windows
<zid> I've been using 64bit windows for.. 18 y ears
<geist> heat: maybe? i booted iinto linu to do LK work so i cant check the name of whatever it is
<zid> most people didn't switch until vista, or even skipped vista and went straight w7, but I was a POWER USER using xp64, aka server 2003
<geist> but it was something like windows pro term, or whatnot. a real MSFT app, but not part of w10
<geist> wouldn't be surprised if it didn't get pulled into w11
<geist> yeah that looks liek it
<heat> yeah it's the default in windows 11 now
<geist> cool
<zid> I thought were were supposed to powershell now
<geist> yah my main gaming box is still w10. some detail is still blocking an upgrade and i wasn't too excited about it initially
<geist> youc an still powershell, this is the app that runs the gui part of it
<zid> and do command -FromSelectionSource \\?\\Drive0\\Parition0\\windows
<zid> instead of "ls"
<geist> my other w10 box in the living room was installed BIOS so i have to repave it completely and thus haven't upgraded
<zid> should I GPT my new ssd when I finally get it?
<geist> and yes i know there's a way to supposedly in place upgrade a BIOS win10 insteall to UEFI, but i tried and it fails mysteriousy halfway through
<zid> in 2-3 months when samsung get back to me
<geist> you should absolutely GPT it
<zid> Their warranty department appears to be in a locked room in the basement behind a sign saying beware the leopard
<geist> oh oh i know why my main box i hvaen't upgraded to 11: secure boot and not wanting to futz with it given that i dual boot with linux
heat has quit [Read error: Connection reset by peer]
<zid> and only open for 18 minutes on a tuesday
<geist> i ventually will be forced to do so, but holding out for now
heat has joined #osdev
<geist> but really i should use it as an opportunity to clean install w11 since it' about time anyway. this w10 install is easily 5 or 6 years old and has picke dup enough cruft that it's due for a clean install
<zid> windows installs are either "I'm still missing half my usual programs" or "full of programs I'm not using"
<zid> there's no inbetween
<geist> yeah usually i just clean install and then page them back in as i need it
<geist> it's just a weekend project i need to do. also would have to find the original install key
<geist> i *thik* it was a w7 key i paid for, upgraded to w10 with it, so unclear if i can still use that key for a w11 install
<heat> yes
Amanieu has quit [Quit: No Ping reply in 180 seconds.]
Amanieu has joined #osdev
<heat> a funny thing is that windows laptops come with the key in an ACPI table
<zid> I thought that's how everything that was oem licenced worked
<heat> no idea
<zid> and how windows loader by daz works, inserts a fake vlk entry
<zid> into the nvram
<geist> yah i think you dont need the license key anymore, because they just phone home and get the machine id
<geist> oh yeah one of the other things i was super unhappy with w11 about: requiring you log into MSFT account
<geist> i think there's at least one reasonably safe way to bypass that
<geist> but would want to do my homework
<zid> yea I know what to click in the 98/xp/7 installers to get what I want
<zid> w11 seems harder
<zid> like, do you have to leave it not ethernet plugged in so you can create a local account? etc
<zid> do you need to pre hack the iso?
<zid> not a clue
<geist> yah i'd want to know the deets before starting
<geist> or maybe the right strategy is install w10 without MSFT account, then upgrade to 11
<geist> presumably it wont hold you to it then
<zid> I knew how to bypass the TPM requirement
<geist> i dont fundamentally have a problem with a MSFT account, i just dont want to force it on my local install
<geist> that seems too far
<zid> you hit the cmd.exe hotkey and ran regedit then changed the "wantstpm" setting :P
<zid> then hit back/next again
<geist> yah i had another install on a test laptop where i turned on secure boot, installed it, and then just turned off secure boot/TPM and it was ike okay
<zid> I think the TPM 'requirement' is so that they could be a trusted platform for DRM technologies
<geist> the main thing you have to watch out for us the bitkeeper stuff, if you turn it off and it's already storing the encryption keys you get sad
<zid> by making it mandatory
<geist> yah
<zid> as well as user tracking, which is huge money
<geist> a concern i have noticed with the firmware TPM stuff you might get on an AMD machine is if you update bios i think it wipse it out
<geist> so then you're sad again, no boot because bitkeeper
<zid> yea I wipe my nvram constantly
<geist> anyway i'd rather generally avoid it unless i'm doing it myself. but windows.
<zid> It's just step 1 of doing a hw change or adding ram or whatever, it needs to retrain and there's no "only wipe like, the normal bios settings?"
<zid> just "nuke"
<geist> i used to have more energy getting upset about whatever MSFT was forcig on you and whatnot. now that i'm older and have seen how that sausage is made, its really a bunch of project managers pushing their agenda
<zid> but how will I invite stallman over to molest my wife
<zid> if I have a microsoft banner
<klange> Blood pressure's too high to actually get mad at this shit anymore. It's not that I don't care, it's that I want to live through it.
<mrvn> geist: I have to give WhatsApp permissions to all my files on my mobile so I can watch the video my sister send me via WhatsApp.
<mrvn> Aparently you don't need permissions to write the file or to show a preview though.
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #osdev
foudfou has quit [Quit: Bye]
foudfou has joined #osdev
[itchyjunk] has joined #osdev
Arthuria has quit [Remote host closed the connection]
Arthuria has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
heat has quit [Ping timeout: 246 seconds]
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
CryptoDavid has quit [Quit: Connection closed for inactivity]
slidercrank has joined #osdev
bliminse has joined #osdev
bliminse has quit [Client Quit]
bliminse has joined #osdev
mctpyt has joined #osdev
mctpyt has quit [Ping timeout: 248 seconds]
Arthuria has quit [Remote host closed the connection]
GeDaMo has joined #osdev
ilovethinking has joined #osdev
<ilovethinking> hello lads
<Mutabah> o/
demindiro has quit [Ping timeout: 260 seconds]
<Amorphia> there are ladies here too :v smh
<moon-child> he doesn't like you, clearly
<Amorphia> well there's more than just me
<moon-child> 'you' is plural
<Amorphia> oh right
<Amorphia> i forgor :<
* moon-child still can't believe we got rid of 'thee'
<Amorphia> lol
* Amorphia pats moon-child
<zid> one does not simply get rid of thee
* moon-child purrr
* moon-child curls up in Amorphia's lap and goes to sleep
* Amorphia is torn between "catboys these days smh" and "awww cute"
<zid> Englando: "T-V distinctions are for plebs"
<kazinsal> bring back the thorn
<Amorphia> kazinsal: hell yeah
<zid> I want eth and thorn back
<Amorphia> thorn was dope
<Amorphia> eth was also dope
<zid> fuck thorn, eth better
<Amorphia> zid: can you even pronounce it tho
<zid> yes? english still uses both
<zid> we just lost the glyphs
<Amorphia> oh i was thinking of a different eth sound then
<kazinsal> also put me down as pro-catboy, preferably with intersection of femboy
<Amorphia> danish eth is funky
<zid> voiced and unvoiced th
<zid> the vs thanks
<Amorphia> i mean danish doesn't use the character eth except in pronunciation guides for 'soft d' which is a weird eth variant
<zid> danish soft d is cool
* Amorphia can pronounce it
<kazinsal> it's nice that english only has like, a few insane tone-based rules instead of thousands
<zid> I learned how to pronounce it in 15 mins like 15 years ago
<zid> then immediatley forgot cus.. ofc I did
<Amorphia> zid: lol
<zid> it's not like I speak any danish
<Amorphia> so you can't say rødgrød med fløde anymore? :<
<zid> nope
* Amorphia can speak danish
<Amorphia> a bit
<Amorphia> my evil ex was danish
<Amorphia> i also lived there for two semesters
<zid> all danish people are evil
<Amorphia> yeah ok that was a tautology
<zid> But like, secretly
<zid> It's that evil mastermind kind of evil
<kazinsal> as a canadian I have been cursed with the ability to pronounce all sorts of english things both in the queen^H^H^H^H^H king's english and freedomland english manners
<zid> not 'tortures dogs when they're 6' evil
<Amorphia> oh nah i meant like abusive controlling asshole evil
<zid> kazinsal: Not with a disgusting french accent as well?
<Amorphia> probably not even smart enough to be mastermind evil
<kazinsal> wrong side of the country to be able to do medieval french with catholic swearing
<kazinsal> I'm from the part that's indistinguishable from seattle if you just swapped firearms for free healthcare
<Amorphia> lmfao
<zid> kebek is the useful part of canada, it gives us a group to hate
<kazinsal> also they gave us poutine and tourtiere
<zid> Imagine not having anybody nearby to hate
<kazinsal> can't hate them for that tbh
<zid> british psyche would collapse
<Amorphia> zid: true
<zid> I've got towns I hate I've never even seen pictures of
<Amorphia> as a british person i can confirm
<Amorphia> thats why i moved to germany
<Amorphia> im surrounded by germans to hate
<zid> There are some good germans in bielfield
<Amorphia> i met a few good ones here
<kazinsal> quebec's got some solid cuisine but it's not worth dealing with the francophone supremacy
<zid> That's a top quality german meme
<zid> That only real germs will understand
<Amorphia> bielfield doesn't exist does it
<zid> yea, so I'm saying that
<Amorphia> :D
<zid> they're like good samaritans
<Amorphia> lol
<zid> people from sumaria? Total dickheads.
<kazinsal> schrödinger's village
<zid> A good samarian is a legend
<kazinsal> other good quebec foods: the hot chicken sandwich
<zid> I have hot chicken sandwiches all the time though?
<Amorphia> hot chicken sammich :o
<zid> or do you mean they serve an especially good version
<Amorphia> gog: make me a hot chicken sammich
<kazinsal> the quebec hot chicken sandwich is covered in thick gravy
<Amorphia> stat
<zid> I mean, of course it is?
<kazinsal> and topped with fresh peas
<kazinsal> side of thick-cut fries or, if you're feeling particularly hungry, poutine
<Amorphia> that sounds heavy
<zid> bbc has a recipe, it's "add chicken to bread" :D
<kazinsal> it is an incredible comfort food
<Amorphia> i think i would die instantly of heart attack
<zid> I think the bbc food website might be crowdsourced though? not sure
<Amorphia> but then i have an anxiety disorder and think this constantly
<zid> heart attack from chicken?
<kazinsal> it's also a great use for leftovers
<Amorphia> so it probably wouldn't actually happen
<zid> chicken's like the least food food that exists
<zid> It's like all you're allowed on diet plans
<Amorphia> "least food food" lol
<kazinsal> chicken is wonderfully lean but not so much so that you'll end up with protein poisoning
<zid> it's got less calories than just leaving your mouth open and hoping for some dust to settle on your tongue
<Amorphia> lmfao
<kazinsal> if your main protein intake is chicken you're still getting enough fat to sustain yourself
<kazinsal> if your main protein intake is rabbit, you literally can get protein poisoning because your protein to fat ratio is too low
<Amorphia> what about... vegetarian and vegan diets though
<zid> That's why I stick to cake, it's very calorie dense, so if you want fewer calories you can just cut it in half
<zid> and because you cut it in half it's half the calories
<zid> so you can have twice as much
<kazinsal> most vegetarian and vegan diets use a lot of plant-based proteins
<kazinsal> peanuts are really good for that
<Amorphia> kazinsal: :o
<kazinsal> and adequately fatty
<zid> yea I buy chocolate peanuts for calories
<zid> I'm shit at eating
<zid> like I'd rather sit ther hungry than actually cook things, or I forget
<zid> so stuff like that by my desk is vital
<kazinsal> 100g of peanuts are about 600 kcal, 25g of protein, and 48g of fat
<Amorphia> i used to be vegan but i don't know shit about diets and my evil ex was in charge of such things as what groceries to buy etc.
<zid> 600/100 is a very good ratio, and they cheap
<Amorphia> so im not vegan anymore
<Amorphia> and just eat whatever now
<zid> 400/100 is like "normal food"
<zid> 200/100 is "crap food", 100/100 is "dust", 50/100 is "chicken"
<Amorphia> zid: lol
<kazinsal> 100g of rabbit meat is 173 kcal, 33g of protein, and 4g of fat.
<zid> who wants to buy me 72 snickers
<Amorphia> kazinsal: most people don't even need all that much protein
<kazinsal> rabbit is so fuckin lean if you only eat it for protein intake you can literally damage yourself from not taking in enough fatty acids
<Amorphia> even a lot of body builders eat more protein than actually necessary
<zid> yea there's the classic.. legend? of people starving to death eating rabbits
<zid> or at least vitamin deficiencying themselves to death
<kazinsal> yeah
<kazinsal> it's been known for a few thousand years
<zid> hmm I can get snickers for £12/kg on amazon
<Amorphia> don't try to live on rabbit, gotcha
<Amorphia> thanks for the advice
<Amorphia> speaking of food tho im fucking starving
<zid> also don't eat polar bear liver
<zid> you overdose on iron
<kazinsal> iirc some grecoroman historical document about soldiers trying to siege a city with only rabbits for game
<kazinsal> and having to pull out of the siege because otherwise the army was going to starve
<Amorphia> gonna go out and get an ispanak gözleme
<zid> that's more relevent to people who know gog than dying from rabbit poisoning I feel
<Amorphia> i know gog
<Amorphia> i also know she still hasn't made me a hot chicken sammich :|
<Amorphia> gog: hurry up
<zid> nobody wants to buy me snickers? meanies.
* zid continues to accidentally starve
<Amorphia> zid: :C
* Amorphia plays a sad violin song for zid
craigo has joined #osdev
craigo has joined #osdev
<gog> mewe
<ilovethinking> * how do you do this
<ilovethinking> thing
<ilovethinking> > heh
<ilovethinking> bruh
<ilovethinking> - bruh
<kazinsal> prefix a line with /me
* ilovethinking black
<ilovethinking> fair
<ilovethinking> thanks
<kazinsal> `/me pets gog` turns into
* kazinsal pets gog
* gog prr
* ilovethinking loves gog
<lav> nya
<sham1> ^^
* kazinsal also pets lav
<zid> who let gog out of the kitchen
* lav purr
<lav> i spent like 2 days wondering why my code was being weird, having forgotten that C pointer arithmetic isn't in bytes -_-
<ilovethinking> what does it mean if i get a pagefault but e=0000
<zid> lav: arrays is hard
<gog> lav: it is if your pointer is char on systems where char_bits is 8 :)
<zid> doesn't matter what size char_bit is gog
<zid> it's sizeof 1 no matter what
<gog> o
<kazinsal> ilovethinking: kernel mode read from a non-present page
<zid> if your CHAR_BIT is 14, then byte is just 14 bits long, a two char array is still two bytes
<zid> not 28/8.. 3 and a bit
<zid> If you need a mnemonic to help you remember that offseting with pointer arith adds type-sized chunks not byte sized, *(a+b) == a[b]
<gog> all bytes are octets
<zid> if you see *(a+b) just mentally see it as a[b]
<ilovethinking> kazinsal: i explicitly set present to every page i map
<ilovethinking> flags = flags | PAGEFLAG_PRESENT;
<kazinsal> what's the address being accessed?
<zid> have you met our lord and savior, the |= operator
<gog> what is cr2 on your fault
<Ermine> gog: unless you find some ancient machine
<zid> or modern dsp
<ilovethinking> gog: ffff80007fb1efd0
<zid> 16 is fairly normal for a dsp, cus 16bit PCM
<gog> is that a present page?
<gog> check info tlb
<lav> yup, added two casts and it werks ~w~
<ilovethinking> does this mean all of them aren;t present
<zid> sounds like you rpobably butchered a few aliasing rules though :P
<sham1> And of course, because a[b] is *(a + b), it's also *(b + a) which is b[a]
<zid> yup
<zid> "I like to do this"[3] to troll people sometimes
<zid> that's just a very odd way of writing 'i' :P
<sham1> 3["I like to do this"]
<sham1> More like
<zid> err right
<ilovethinking> i set present everywhere
ptrc has quit [Remote host closed the connection]
ptrc has joined #osdev
<gog> the page isn't there
<gog> it's just not mapped
<ilovethinking> yeha
<ilovethinking> yeah
airplanemodes has joined #osdev
<zid> YEHAW
gog` has joined #osdev
gog` is now known as pog
<pog> buy
gog has quit [Quit: byee]
<pog> byee
<lav> byee
<pog> j/nick gog
<zid> buy pog, stonks
pog is now known as gog
<zid> pogs are back baby
<kazinsal> NASDAQ:GOG
<zid> FTSE100: POGS
* lav buys gog
<zid> sales of crisps up 800%, pogs are back
<gog> hodl
* nikolar
<zid> &nbsp;
<kazinsal> reminds me I got some dosh to throw at some stonks, gotta figure out what I'm gonna throw it into
<kazinsal> gonna turn canadian pesos into money
<zid> snickers
<lav> mars bars, even
airplanemodes has quit [Quit: WeeChat 3.8]
zxrom has joined #osdev
ilovethinking has quit [Quit: i probably locked my mac and i got disconnected]
airplanemodes has joined #osdev
* gog snickers
<zid> Better than the time you golden gaytimed everywhere
<gog> :3
<gog> i am not a good programmer
<zid> neat
<zid> make a screenshot so you can laugh at it when you're feeling better about it
<gog> noooo
<zid> laughing at shit old code is fun
<gog> i should quit programming. i should stop living in sin and marry a good christian man and have 3 kids
<GeDaMo> If you're expecting your kids to finish your code that's going to make the project very late :|
<zid> Man, how the christian guilt rules apply to you is a fucking hypercube not a venn diagram isn't it
<gog> XD
<zid> GeDaMo: what was BATTLE WORDLE website
<zid> oh I know, it'll be the only result for osdev in my browser history
<bslsk05> ​wordhoot.com: WordHoot! - Competitive Wordle
<bslsk05> ​wordhoot.com: WordHoot!
ilovethinking has joined #osdev
<ilovethinking> is it normal that info tlb gives different output than the addresses i map to
<ilovethinking> hello btw
<gog> no there's something wrong with your code probably
<gog> are you stepping it with a debugger?
<gog> :think:
<gog> why did clang use sysretl and not sysretq
<gog> this is not going to work clearly
<zid> you got it to emit a sysretl?
<zid> magic
<gog> not magic just __asm__
<gog> but why
<gog> also it's not going to work because the page i'm trying to return to is not user
<lav> doesn't clang have __attribute__((interrupt)) ?
<gog> yes
<gog> it had it for x86 before gcc did
<gog> however, i don't recommend it on x86
<gog> best to use a stub that redirects to a common handler
<lav> mhm
<bslsk05> ​github.com: sophia/exceptions.S at main · adachristine/sophia · GitHub
<lav> >whoever is outside my house yelling "comment your code!" i will never comment my code
* lav giggles
<gog> hehe
<gog> i don't like that chain of conditions in EXCEPTION_DEFINE but i didn't find any cleaner way to do it :(
<gog> in any case it's code i don't really ever have to think about again
<zid> tan guest finished. (598.9, 2, 6.5s)
<zid> I won wordhoot.
<zid> (2 guesses, 6.5 seconds)
janemba has quit [Ping timeout: 246 seconds]
<GeDaMo> I'm penalised for being a slow thinker! :P
<zid> unfair!
ilovethinking has quit [Remote host closed the connection]
<gog> oops
<gog> fixed my page code but not the sysret code
<gog> aaaay it page faulted with CPL=3
<gog> progress!
<zid> how am I missing 7 words starting with F
<GeDaMo> Poor education? :P
<gog> fuck, fucker, fucking, fucked, fucks, fucky, fucko
<zid> ah
<gog> there's 7 words that start with f
<zid> no they have to go FI FN FO, if FI then FID FIN or FIE or FIX or FIA or FIO, if FO then FON FOE FOT FOB FOA FOX
<zid> okay got *one*
<Amorphia> gog: where's my god damn chicken sammich :V
janemba has joined #osdev
<gog> :o
* gog produces a chicken sammich
<gog> here you are miss
<gog> my apologies for making you wait ':D
<zid> it doesn't accept feof
* Amorphia eats the foods
<Amorphia> gog: it's good
<Amorphia> you are forgiven
<gog> i don't accept feof either
<gog> ah.. CS =0213
<gog> i think i set MSR.STAR wrong
* gog thonk
ilovethinking has joined #osdev
<ilovethinking> i love thinking
<gog> i don't
<gog> head empty only meow moew
<lav> mewo
* lav boops gog
* gog boop lav
<ilovethinking> mwoe
<FireFly> nyaa
bgs has joined #osdev
<ilovethinking> info tlb gives me different pages than the ones i map
<ilovethinking> and i think the only reason for that is if i translate the offsets incorrectly
<gog> ok'
<ilovethinking> but i think
<ilovethinking> it's all correct
<ilovethinking> right?
<ilovethinking> pt >> 12
<ilovethinking> and everything else
<ilovethinking> >> 8?
<gog> uh
<gog> no your PD and PDP entries should be >> 9
<ilovethinking> yes sorry
<ilovethinking> >> 9
<gog> 9, 9, 9, 9, 12
<gog> for PML4
<ilovethinking> like this?
<gog> yessss
<gog> i think
airplanemodes has quit [Read error: Connection reset by peer]
<ilovethinking> then i genuinely have no clue why the addresses in tlb dont match the ones i print on map
<gog> are you stepping through with a debugger
<ilovethinking> wdym stepping
<ilovethinking> oh
<ilovethinking> yeah but that doesn't change anuthing because i don't tamper with the address later
<gog> i stil recommend stepping through the code and looking at the entries you're constructing
<gog> and then seeing what's going wrong
<bslsk05> ​github.com: sophia/loader_paging.c at main · adachristine/sophia · GitHub
<gog> feel free to crib from this
<ilovethinking> wait
<ilovethinking> i guess i'm printing the virtual addy wrong
<ilovethinking> cuz the physical is right
<gog> i don't know what you're doing lol
ilovethinking has quit [Quit: i probably locked my mac and i got disconnected]
nyah has joined #osdev
ilovethinking has joined #osdev
<ilovethinking> gog: https://i.imgur.com/Anp4q1S.png
<ilovethinking> some match some dont
<ilovethinking> for example fff80007 doesn't exist in info tlb
<ilovethinking> qemu -s -S <harddrive.img>
airplanemodes has joined #osdev
<ilovethinking> what do i replace the hardrive.img with
<ilovethinking> this is for debugging with lldb btw
<lav> just add "-s -S" to whatever qemu command you're already using
<gog> PT = 2784, PT = 2867
<gog> way wrong
<gog> you can only have 512 entries in a table
<gog> ok back to figuring out why my MSR.STAR is wrong
<ilovethinking> gog: lmfao i didn;t notice
gog` has joined #osdev
<ilovethinking> gog: is it possible that it's a limine problem
<gog> why would it be
<gog> are you calling limine to actually map the pages?
<ilovethinking> because i'm mapping what limine tells me to map
<ilovethinking> no but i get the
<ilovethinking> entries
<gog> no, it's your math
<ilovethinking> that should be mapped
<ilovethinking> ok wait let me see what limine spits out and i will manually shift it
airplanemodes has quit [Ping timeout: 248 seconds]
<bslsk05> ​github.com: sophia/paging.h at main · adachristine/sophia · GitHub
<nikolar> ilovethinking: once you get all of the info you need, you should probably just ditch limine
<ilovethinking> tbh
wootehfoot has joined #osdev
<ilovethinking> i kinda hate it ngl
<ilovethinking> but i dont want to rewrite everything
<gog> i wrote a basic EFI loader
<gog> and then i have a second stage that actually does the thing
<nikolar> Limine screwed me over by just silently dropping stivale2
<nikolar> And replacing it with it's own thing
<ilovethinking> but this entire thing does not make sense
<ilovethinking> why are only 2 entries screwed
<ilovethinking> they come from the same source
<ilovethinking> i do the math the same way for each type
<gog> idk i'm not looking at your math
<lav> step through your code and see what's different :)
<gog> yes
<ilovethinking> no but there's nothing to step through, i take entry->base and add hhdm offset to it
<ilovethinking> and entry->base is what limine gives me
<gog> bit shifting can do strange things
<gog> can you post the code again?
<ilovethinking> for what?
<gog> so i can look and see what i can see
<ilovethinking> no
<ilovethinking> what function
<gog> the one that calculates your page entry offsets
<bslsk05> ​gist.github.com: gist.c · GitHub
<ilovethinking> i just added everything relevant to one file
<ilovethinking> one gist* sorry
<gog> ok here's the problem
<gog> your page offset is & 0xfff
<gog> not pt_offset
<gog> all table offsets are &1ff
<gog> i know it's confusing
<gog> so, as clearly as i can state it
<ilovethinking> what
<gog> offset within the page is unshifted & 0xfff
<gog> page table offset is >> 12 & 0x1ff
<gog> change the 0xfff to 0x1ff
<ilovethinking> but that doesn;t make sense
<ilovethinking> do i remove the first shift?
<gog> no
<gog> those 12 bits are the offset bits
<gog> you don't need those
<ilovethinking> so shift by 12 and & 1ff?
<gog> yes
<ilovethinking> wtf
<gog> the next 36 bits are index bits
<ilovethinking> i had it like that
<ilovethinking> mrvn told me to change it
<gog> mrvn misunderstood what he was looking at
<ilovethinking> okay fair
<gog> i can see why
<gog> this stuff still trips me up
<ilovethinking> ok now there are no bogus entries
<gog> huzzah
<ilovethinking> limine terminal still fails
<ilovethinking> kekw
<gog> osdev is always from one problem to the next
<gog> ¯\_(ツ)_/¯
airplanemodes has joined #osdev
heat has joined #osdev
<ilovethinking> still have bogus entries
<gog> ok
<ilovethinking> data and rodata doesn't match info tlb
<ilovethinking> lmfao
<ilovethinking> ffs
<ilovethinking> in info tlb they are 80004 and 80005
<gog> ok
<ilovethinking> in what i print it's 8000406a and 80005a03
<ilovethinking> looks like perms messed up
<ilovethinking> wait do emojis work on irc
<ilovethinking> 👍
<ilovethinking> holy fuck
<gog> some of them
<ilovethinking> very nice
<lav> depends on the client
<gog> yes
<FireFly> it's just unicode codepoints
<gog> if the client is not using UTF8 and a font that has the right codepoints
<gog> then they'll see a box or two boxes
<gog> or sometimes three
<ilovethinking> yes
<ilovethinking> anyways if the pages look fine and in order in info tlb i dont care enough
<ilovethinking> won't try debugging that bcuz it gotta be correct
<ilovethinking> it makes sense that text, data and rodata pages are all in order right
airplanemodes has quit [Ping timeout: 248 seconds]
<gog> yes but it should be in order of text rodata data bss
<ilovethinking> i dont map bss]
<ilovethinking> but yes it's text rodata data\
<gog> ok good
<ilovethinking> at this point i feel like ill just use the serial monitor
<ilovethinking> fuck the limine terminal
<gog> ok i gotta get ready to go out
<nikolar> ilovethinking: why don't you just get the framebuffer and draw your own terminal
<nikolar> or use serial
<gog> if you want you can use my drawing code too XD
<gog> it's very stupid and slow but it works
<ilovethinking> nikolar: wouldnt making my own terminal take a fuckton of time
<ilovethinking> like
<ilovethinking> getting everything aligned
<ilovethinking> etc etc
<heat> gog, an efi client would maybe use utf-16
<heat> what now
<nikolar> ilovethinking: i did it in like one afternoon
<nikolar> very simple, just draw a bitmap font to the screen
<gog> i did it in several hours' worth of time over a few days
<nikolar> and have it scroll
<bslsk05> ​github.com: sophia/video.c at main · adachristine/sophia · GitHub
<heat> terminals are hard
<gog> most of that time was debugging
<heat> if you don't agree you never actually wrote the vt100 emulator
<nikolar> heat: depends on how complicated you want to make it
<gog> i didn't write a vt100 emulator
<gog> i wrote a simple fbcon
<nikolar> i did write a termnial emulator, just not a vt100
<gog> which is probably full of other bugs
<nikolar> very much simplified
<nikolar> almost good enough to run vim though :)
<heat> getting my vt and tty layers straight and working well, correctly was hard
<lav> i mean all you need for starters is something to put a character at certain coordinates and keep track of where your cursor is
<gog> i do not have that yet
<gog> i will eventually
<gog> i just wanted output for the moment
<gog> but also i'm gonna start stuffing things into user mode as soon as i figure out how
<gog> omgomgomg
* nikolar asks gog: what is it
<gog> oh
<gog> nothing
<gog> i thought my user mode code was working
<gog> but my PL's are still 9
<gog> 0
<gog> false alarm :')
<nikolar> sad
<ilovethinking> is it worth ditching limine
<nikolar> I meant that you should get the memory map and whatever else you need from it and do your own thing afterwards
ilovethinking has quit [Remote host closed the connection]
valshaped has joined #osdev
warlock has quit [Ping timeout: 255 seconds]
heat has quit [Remote host closed the connection]
heat has joined #osdev
gog` has quit [Ping timeout: 255 seconds]
gog` has joined #osdev
CryptoDavid has joined #osdev
SpikeHeron has quit [Quit: WeeChat 3.8]
janemba has quit [Ping timeout: 246 seconds]
janemba has joined #osdev
heat has quit [Ping timeout: 248 seconds]
heat_ has joined #osdev
SpikeHeron has joined #osdev
ilovethinking has joined #osdev
<ilovethinking> hello
<ilovethinking> does anyone have a serial communication implementation with https://github.com/nothings/stb/blob/master/stb_sprintf.h that i could skid
<bslsk05> ​github.com: stb/stb_sprintf.h at master · nothings/stb · GitHub
<ilovethinking> or what are the other ways to have all the printf features with serial com
<lav> If you have snprintf, you could just do that and then send the resulting string over serial as normal, right?
<ilovethinking> oh right kekw
<ilovethinking> sorry
<ilovethinking> im braomdead
<lav> chill
<heat_> you should try and do things yourself
heat_ is now known as heat
<ilovethinking> with the vmm i was truly lost
<ilovethinking> but yeah
<ilovethinking> agree
<heat> ok, so don't ask for things you can steal
<heat> write them yourself
<heat> also that printfs looks... ungood
<ilovethinking> if it works it work
<ilovethinking> s
<heat> no
<heat> wrong attitude
<ilovethinking> but it works
<ilovethinking> idk what might be wrong with it
<ilovethinking> it works as a printf vcery well
<ilovethinking> idk what ur talking about
<heat> for one, you have a 2kloc header full of weird obtuse defines that you stole from someone else that implements *sprintf* only, and not printf
<ilovethinking> i didn't steal it from someone else
<ilovethinking> it's a library
<ilovethinking> that is made to be used by others
<heat> god
<heat> you stole it
<heat> = you took it from someone else
<heat> = you didn't write it
<ilovethinking> am i stealing stdint.h?
<heat> maybe?
<zid> we should ignore heat
<ilovethinking> what the fuck that does not make sense
<heat> yes it does
<ilovethinking> heat do you write your own bootloader
<ilovethinking> because god forbid you stole it from someone
<ilovethinking> "stole"
<heat> the bootloader is not part of the project
<heat> its not part of the kernel
<ilovethinking> okay sure then don't use a bootloader
<ilovethinking> heat do you use stdint from the standard library?
<heat> you took something central (sprintf) with little idea of what it does
<ilovethinking> why would i write something as complicated as a printf
<heat> I can write a stdint.h if I so choose, because I 100% understand how it works
<ilovethinking> but you don't
<heat> do you think printf will be the pinnacle of complexity in your kernel?
<ilovethinking> quoting the repo
<ilovethinking> single-file public domain (or MIT licensed) libraries for C/C++
<heat> good for you
<heat> you seem to be inclined to not be critical and not do things properly, and you clearly can't handle criticism of any kind
<ilovethinking> "*sprintf* only, and not printf"
<ilovethinking> it's made to be plugged into something else
<ilovethinking> i don't have a stdout
<ilovethinking> i don't need one
<heat> yes, you're right, sorry
<heat> my bad
[itchyjunk] has joined #osdev
<ilovethinking> "clearly can't handle criticism of any kind"
<ilovethinking> listen man ill write my own later
<ilovethinking> ok?
<ilovethinking> i need a way to debug
<ilovethinking> it;s just not as important for me to write my own printf
<ilovethinking> right now
<heat> do whatever you like
<heat> i'm trying to give you guidance. you're not going far if you keep trying to take everything from other projects
<heat> does every line of code need to be written by you? obviously not, I have not done that either
<heat> but doing things methodically, slowly is important. particularly at the beginning
<ilovethinking> okay
<ilovethinking> sure
<ilovethinking> i agree
<zid> <pgimeno> is there a way to avoid this warning for function main()? I'm marking it noreturn because it never returns. "warning: function declared 'noreturn' has a 'return' statement"
<heat> i know it can feel overwhelming, but please take it slow. you'll feel so much more lost later if you try to understand everything that's going on
<zid> classic #gcc
<heat> zid, hahahahaha
<heat> but it never returns!
<zid> I don't have any pets, except for these 17 cats
<lav> i mean the return could be dead i guess
<ilovethinking> what else do i need to map after the kernel in order to have a functioning system? i suppose mapping the kernel isn't enough?
<zid> I like to set up contradictory warnings and see which wins
<heat> ilovethinking, whatever you're using
<lav> well you'll need some memory for dynamically allocating things probably
<heat> lav, red card, too far ahead
<zid> I've still not written an allocator for mine
<zid> and it plays gameboy games :P
<lav> damn harsh, ref
<heat> ilovethinking, you probably want the framebuffer mapped
<ilovethinking> i don't use it anymore
<heat> why
<ilovethinking> i use the serial now
<ilovethinking> already implemented it
<heat> but why
<ilovethinking> wdym
<ilovethinking> i have it mappe
<ilovethinking> d
<heat> why are you not using the framebuffer
<ilovethinking> anyways
<lav> i mean it's not illegal to not have an fb
<heat> it is not
<heat> but he's papering over the cracks
<heat> "can't map the fb? fuggit, lets use serial"
<ilovethinking> i mapped it
<ilovethinking> i have it mapped
<ilovethinking> it's mapped
<heat> but it wasn't working yesterday
<heat> what gives?
<ilovethinking> no the thing is
<ilovethinking> nothing works
<ilovethinking> serial doesn't work
<ilovethinking> it pagefaults
<ilovethinking> and im sure outb doesn't need anything else
<heat> ok, so fix it
<ilovethinking> and also limine terminal wasn't working, not the fb
<heat> see where it faults and why
<heat> be *methodical*
<ilovethinking> it faults because it tries accessing a page that does not exist
<heat> thank you
<heat> where it faults and why
<heat> not the "exception error code"
<ilovethinking> that's what iim trying to figure out
<heat> ok, get to it then
<ilovethinking> idk the why
<ilovethinking> i know where
<heat> what's the instruction?
<zid> heat: okay that gcc question wasn't as dumb as it sounded, gcc was infact being dumb
<heat> zid, whot?
<zid> guess how gcc is implementing the C99 requirement that main need not return
<heat> haha
<heat> lmao
<heat> very fucking cool gcc
<heat> ilovethinking, have you figured out what's its crashing on?
<ilovethinking> im trying to figure out which one is the instruction poointer
<ilovethinking> i dont wanna ask
<gog> printf isn't that complicated
<gog> i wrote one
<gog> it's not totally feature complete
<zid> mine has %d and %x
<heat> ilovethinking, it's the one that ends in ip
<zid> all you ever need
<ilovethinking> oh
<zid> except that one time I wanted %s and forgot I didn't have it
<ilovethinking> so it's instruction 0028, line is outb
<heat> instruction what?
<ilovethinking> IP=0028:ffffffff800006a1
<heat> haha
<lav> oh, that's your segment
<ilovethinking> 28 idk
<ilovethinking> bruh
<ilovethinking> wtf
<heat> it's address 0xffffffff800006a1
<ilovethinking> OH YOU MEAN RIP
<lav> the last part is the actual address
<ilovethinking> same ting
<ilovethinking> anyways
<ilovethinking> ueaj
<ilovethinking> the address is the outb
<heat> do, in qemu, x/8i 0xffffffff800006a1
<heat> when it crashes
<ilovethinking> okay sec
* gog outb
<heat> gogb
<heat> gog, we gettin to usr mode or nah?
<gog> breh i just sat down
<gog> i'm v tired
<heat> omg u don't have a sitting desk?
<gog> no i don't
<heat> you sound like a sitting desk kind of person
<gog> i don't have a desk
<heat> then how do you do stuff
<heat> lap?
<gog> i sit on the couch or in my bed there's no ther comfy place to work
<gog> yes
<heat> hmmmmmmmmmmm
<gog> hmmmmmmmmm
* lav microwave noises
<zid> I thought it was toilet noises for you
<zid> I make horrendous grunting noises like a tractor giving birth, typically
<heat> android's build system has a hmm command btw
<heat> and a m, mma, mmma
<heat> also a tapas
<lav> says the one who's literally a kiwi zed
<ilovethinking> heat im sorry for these questions but i dont know many of the tools
<heat> it's very hungry oriented
<ilovethinking> like
<ilovethinking> x/8i
<ilovethinking> id no clue what that did
<heat> wrong address?
<gog> you disassembled instructions
<zid> tapas --chicken-nuggets --chips --potato-waffles --mini-pizza
<ilovethinking> heat: i probably added a line
<ilovethinking> but it's the right one
<ilovethinking> logs say so
<ilovethinking> pc=ffffffff80000716
<gog> chicckie nuggies!
<gog> choccy milk!
<heat> ok so your stack is fucked probably
<heat> what address are you faulting on?
<ilovethinking> ffffffff80000716
<heat> (X) wrong
<heat> what address are you faulting on?
<heat> notice how my questions are all open-ended as to make that big brain of yours think
<ilovethinking> yes
<ilovethinking> no but it;s confusing
<ilovethinking> i guess im faulting on 715 or 71b
<zid> he loves it afteral
<heat> why are you guessing?
<ilovethinking> :what:
<zid> refuse to think, guess
<heat> it's a page fault right
<ilovethinking> indeed
<heat> I asked you for the address you're faulting on
<ilovethinking> oh
<heat> you gave me the IP (fair, could be a communication error), I said "not that"
<heat> what other address do you have?
<ilovethinking> ffff80007ff77fd0
<ilovethinking> cr2
<ilovethinking> ?
<heat> yes
<heat> ok so now figure out what that address means and why it's your stack
<heat> (I don't know because I didn't write your kernel, you did)
<gog> i didn't write my kernel
<gog> i hired thousands of cats to walk across keyboards until it worked
<gog> i paid them in fish
<heat> my cats do not like fish
<heat> they just eat shitty smelly cat food
<gog> fishe
<lav> frogge
<gog> :o
<gog> ribit
nisa is now known as tuxifan
* lav hops at gog
* gog givs lav moth
<lav> gog moth
<lav> goth
* lav noms the gog
<gog> :o
<gog> moth girl
<gog> goth girl
<gog> goth moth girl
<heat> colon three
<lav> [insert cat sound]
<ilovethinking> heat: that address means that the outb tries accessing it
<ilovethinking> so that means outb wants it
<zid> I bet the sound of inserting a cat is pretty loud
<ilovethinking> that means im not mapping something
<ilovethinking> i don't know what that could be
<lav> but wasn't the instruction a popq?
<ilovethinking> oh right
* ilovethinking i love thinking
<lav> zid: depends what you insert it into I think
<ilovethinking> wait so what does the popq mean
<ilovethinking> does it mean that the address lives in my cr2
<ilovethinking> no
<ilovethinking> the address lives in the rbx
<ilovethinking> or what
<lav> no, pop is to take the topmost element off the stack and put it into that register
<ilovethinking> o
<ilovethinking> hmmm
<lav> Probably something wrong with your stack
<heat> lav, shhhhhhhhhhhhhh
<lav> right heat sorry
<lav> I'm too helpful
<heat> let the thinking man think
<ilovethinking> hmm
<heat> 🤔
<ilovethinking> how can a stack me fucked up
<ilovethinking> be
<ilovethinking> i dont manage it manually
<ilovethinking> do i need to map the stack
<heat> what do you think
<ilovethinking> i think i do
<heat> then try it
<ilovethinking> how does tha towkr
<ilovethinking> work
<heat> how does what work
<ilovethinking> mapping the stack
<heat> you just map it
<heat> Normally
<ilovethinking> starting and ending at what
<ilovethinking> starting at the sp ofc
<ilovethinking> but
<ilovethinking> how do i know the length
<heat> hopefully the bootloader told you that, considering it also mapped the stack for you
<heat> you could also just switch to your own
<ilovethinking> ffff80007ff77fd0
<ilovethinking> oops
<bslsk05> ​github.com: limine/PROTOCOL.md at trunk · limine-bootloader/limine · GitHub
<ilovethinking> i guess that;s thje one
<heat> fuck do I know
<ilovethinking> right sorry
<heat> that is not the one
<ilovethinking> that is the one
<ilovethinking> tells me the stack size
<ilovethinking> lol
<gog> i think limine is holding you back here
<gog> tbqh
<heat> yes
<heat> ilovethinking, no, please read
<heat> and the way you're going to do this is by switching to a new stack
<heat> (note: in assembly)
<gog> it tells you the size yes
<ilovethinking> okok i read it
<gog> i mean no it doesn't
<gog> ugh this request/response stuff smacks of REST
<gog> no thanks
<ilovethinking> heat, how big should my stack be
<ilovethinking> i have to find a big neough memory chunk
<heat> lets do 8KiB
<heat> you do not, use .bss
<bslsk05> ​wiki.osdev.org: Bare Bones - OSDev Wiki
<mrvn> ilovethinking: 1) are you mapping and clearing the .bss segment? 2) In 64bit mode the TSS (iirc) has an IO bitmap limiting what IO ports can be accessed. You have to set that up right so all is allowed for the kernel (at least for now).
<mrvn> outb needs something unlike you stated.
<mrvn> For the stack don't forget to align it to 16 bytes.
<ilovethinking> oh for fucks sake
<ilovethinking> tss before debugging
<ilovethinking> wtf
<heat> hm?
<ilovethinking> ok whatever
<ilovethinking> wait i just now realized my pmm lives on the stack
<ilovethinking> funny
<mrvn> Is limine starting you in long mode? if so I would assume it's setup right already. But if you replace anything you can break it.
<ilovethinking> yes it is
<ilovethinking> so then how do i map the limine provided stac
<ilovethinking> k
<gog> don't
<lav> also it might be too small if you have deep nesting
<gog> request a block of memory and map it and use it as your stack
<heat> no
<heat> no no no no no
<heat> do not do that
<gog> what why
<heat> just use a static block of memory in bss
<gog> oh yeah
<gog> do taht
<mrvn> gog: because boot.S has no memory yet
<gog> tru
<ilovethinking> heat: 1. how do i get a static block of memory (i don't map the bss btw, should i?) 2. how do i make the block of memory my stack 3. how do i switch my stack with the new stack
<mrvn> yes you should.
<mrvn> see https://wiki.osdev.org/Bare_Bones for an example
<heat> 1) gave you a link, also the question answers itself 2) assembly 3) assembly
<ilovethinking> thnaks
<ilovethinking> mrvn: the linking section?
<heat> edk2 actually does funny war crimes to live-migrate the stack from CAR to RAM in the middle of C code
<heat> it's disgusting
<ilovethinking> okay i gotta go
<ilovethinking> thanks
<ilovethinking> buh bye
ilovethinking has quit [Quit: i probably locked my mac and i got disconnected]
<heat> what a character eh
<gog> ok heat
<heat> affirmative warmth
<gog> so kcs, kds, u32 cs, u32 ds, u64 cs and u64 ds
<gog> this is the expected arrangement for syscall/sysret
<gog> If
<gog> SYSRET is returning to 64-bit mode, the CS selector is set to this field + 16. SS.Sel is set to
<gog> this field + 8, regardless of the target mode. Because SYSRET always returns to CPL 3, the
<gog> RPL bits 49:48 should be initialized to 11b.
<gog> ope sorry spam
<zid> ope
<heat> yeah and cuz i programmed u32cs it returns to u32cs + 16 = u64 cs
<gog> ok
<gog> that's the key misunderstanding i had
<heat> and u32ds is just a normal ds statement
<heat> s/statement/segment/g
<heat> but you can totally reorder things here and be clever
<gog> ehhhh
<gog> no
<gog> being clever with the GDT seems like a mistake
<heat> *good old fashioned fun
<zid> mine is just kernel kernel user user tss[0] tss[1]
<zid> (and null)
<mrvn> are we playing: My GDT is bigger than yours?
<mrvn> anyone using LDTs?
<gog> i don't have a purpose for them really
<gog> i'm not even really sure how they work
<mrvn> I think nobody does
<zid> what's a them
<zid> is it trees
<Amorphia> it's like a him or a her but gender neutral
<Amorphia> or it's plural people
<zid> plural trees
* Amorphia plants zids a rowan
<zid> do they grow snickers
<Amorphia> sure, whatever you like
* Amorphia casts a spell so the rowan grows snickers
<lav> is this the trans agenda
<zid> you've had that ability the entire time? holding out on us
<Amorphia> zid: :>
<zid> It's like the magic vegetables all over again
<Amorphia> lav: i thought the trans agenda was blaahaj memes
<lav> how do you think the spell works?
<Amorphia> ¯\_(ツ)_/¯
<lav> shork
<zid> The trans agenda is stripey socks, blaahaj, global domination, you know, the usual
<zid> space lasers
<Amorphia> and shitposting in #osdev of coures
<mrvn> gog: I think the purpose with the LDT was that you had task gates and want more than 510 tasks.
<gog> ah
<gog> well that was a disused feature anyway
<mrvn> which I still think is a mistake. They should have optimized that so it actually is faster than doing it manually.
<sakasama> zid: Is there a show featuring sharks in space? ... preferably with lasers attached?
<zid> fricken laser beams
<mrvn> sakasama: phew, phew, phew
<lav> the shark is a deadly laaseeer
<mrvn> sakasama: The Shark is a type of rocket with a nuke lensed to create an X-ray laser so you can hit space ships from a stand off distance before the missile defence takes it down.
<zid> the sun is asking it to not be closed
<sakasama> mrvn: I reject your definition, as it does not mention sufficient quantities of teeth.
<mrvn> sakasama: version 2 produces multiple stearable beams.
<gog> mrvn: yeh probably
<gog> it'd probably have come with some caveats though like the TSS needs to not cross a cache line
<gog> in order to acheive that
<mrvn> gog: That would be impossible. The data to save is way bigger than a cacheline. Caveats should be the same as saving the FPU/SSE state.
<gog> ah true
<mrvn> it should really be just that instruction plus saving the general purpose state toot
<zid> gog do you cross any cache lines
<zid> my mother uses like six
<gog> yes
<zid> I barely use up an entire register
<GeDaMo> ZMM register? :P
xenos1984 has quit [Ping timeout: 246 seconds]
<zid> I'm a spanish yes
* Amorphia registers zid for a mailing list about stripey socks and blaahaj
<zid> Amorphia: how do you know it's not too late for that?
<zid> Maybe I am egg_irl
<Amorphia> :o
<zid> Do I get my space laser now?
xenos1984 has joined #osdev
<gog> i take up a whole 1GB page
* Amorphia awards zid one space laser
<zid> gog: dang girl you fat
<zid> do they roll you to work
<gog> yeh
<Amorphia> lmao
<mrvn> zid: you so fat clocks are running slowe around you
<zid> ngl I'd make a great femboy
<mrvn> gog: you so fat the address space can't contain you
<zid> maybe I should start an onlysharks
<mrvn> and FYI, it's not a space laser, it's a death ray.
<Amorphia> zid: dooo iiiiit
<Amorphia> I'd subscribe :>
<zid> I need hair straighteners and maid uniform
<Amorphia> spanish femboy in maid uniform yespls
Arthuria has joined #osdev
xenos1984 has quit [Ping timeout: 248 seconds]
<mrvn> what's the opposite of femboy? malgirl?
<Amorphia> 'tomboy' surely
<GeDaMo> Don't call me Shirley :|
<mrvn> shirley you don't object.
<lav> gog's cuter than INT_MAX
<gog> eee
<lav> nono that's only 12 bits
<FireFly> maybe it's a very smol int
<FireFly> int being 12 bits should be legal, even if.. unlikely
<mrvn> FireFly: luckily there is a min for what INT_MAX can be.
<FireFly> oh :o
<lav> int needa to be 16 bits at least in c
<mrvn> also 12 bit is a char.
<lav> s/a/s/
<mrvn> so 24 bit for int then I would say, at least.
<mrvn> 18 bit for short just for the fun
<gog> what are these weird char widths
<FireFly> oh okay, might misremember what the spec allows then
Arthuria has quit [Read error: Connection reset by peer]
<mrvn> gog: imaginary fun archs.
<gog> o
<FireFly> fortunately at least posix maintains CHAR_BIT = 8 afaik
<mrvn> An arch where char, short, int, long, long long aren't twice as wide should be fun.
<mrvn> FireFly: does it? it's >= 8 iirc
<lav> i mean on x86 long == long long, no?
<lav> or x86_64
<mrvn> lav: no, windows is 32bit, linux is 64bit
<heat> not in i386
<lav> well windows is windows
dennis95 has quit [Ping timeout: 248 seconds]
andreas303 has quit [Ping timeout: 268 seconds]
<lav> but true
<mrvn> On any modern arch and OS int is 32bit, long long is 64bit and long is the type that's basically useless because you can't assume what it is.
<FireFly> mrvn: C spec requires >=8 and POSIX requires ==8 I believe
<FireFly> (though double-checking might be prudent..)
<lav> yeah c only has minima
<lav> POSODD
<gog> :o
<FireFly> pos ix, pos x, pos xi, pos xii
<mrvn> why is Po6 afraid of Po7? Because 7 8 9.
Arthuria has joined #osdev
xenos1984 has joined #osdev
Arthuria has quit [Ping timeout: 255 seconds]
<gog> lav: LLP64 and LP64
<gog> LLP64 long is 32
<gog> LP64 long is 64
<gog> for ms i think it's because for the longest time ints were 16 bits and longs were 32
<mrvn> gog: that's the reason. They wanted their 32bit code to still compile for 64bit.
<mrvn> their "used to be 16bit, now 32bit" code
* mrvn wonders if linux will ever change to make long long 128 bit. Should we even do that? Just having (u)int128_t should be enough.
Arthuria has joined #osdev
Arthuria has quit [Killed (NickServ (GHOST command used by Guest684531))]
Arthuria has joined #osdev
Arthuria has quit [Remote host closed the connection]
bnchs has joined #osdev
<gog> nya
<lav> nya
<heat> what gets returned (per POSIX and in reality) if you get a signal in the middle of a read?
<heat> if I've already consumed data, returning -EINTR would hide how much you did indeed read, returning how much you read hides the fact that you got a signal
<heat> "If a read() is interrupted by a signal after it has successfully read some data, it shall return the number of bytes read." found it
<mrvn> heat: you get the number of bytes read
<mrvn> that alone signals something happened. signal or EOF.
<mrvn> Note: a signal is signaled by the fact your signal handler gets called.
<mrvn> sometimes I wonder if things wouldn't have been easier with an EEOF error instead of read returning 0 on EOF and EAGAIN on no data available yet.
* gog signals
<mrvn> SIGEOF? That would be horrible to use.
<gog> is there any command in qemu that shows me the contents of msrs
<lav> gog: ..- / .... --- -
<heat> gog, i dont think so
<gog> hm
<heat> hm
<lav> google only turns up planns to add it
Arthuria has joined #osdev
<sham1> Well that's disappointing. You'd expect there to be something like that
<gog> well you'd also think info tlb would let you filter the info you want or paginate it somehow
<gog> doug16k was working on patches for that
<gog> idk if he's finsihed them or PR'd them or anything tho
<gog> last i saw he was busy with other things
airplanemodes has joined #osdev
<heat> doug had patches for caching bits
<heat> I actually had it applied somewhere, but lost it
wootehfoot has quit [Ping timeout: 252 seconds]
<mrvn> would be nice if one could browse the tlb. collapse or expand nodes.
<gog> it'd have helped me numerous times
<gog> instead i end up using x to walk through page tables
<gog> which isn't so bad but it doesn't show you the tlb state
<mrvn> info tlb <addr> and info tlb <start> <end> would be nice
<gog> yeh that's what doug had and more
<heat> i'm a simple man, i want arm64 info tlb
<mrvn> Another cool thing to add to QEMU would be sanitizers. E.g. halve a TLB sanitizer that catches when you modify the page tables without INVLPG and something accesses the page.
<gog> yes absolutely
<gog> aaay
<gog> i can sysret into user mode with the right CS and SS
<gog> but it still crashes heh
<froggey> i've improved my kernel allocator's performance and now the ata driver doesn't detect any drives :tada:
<heat> lol
<gog> aaaay
<bnchs> hi osdev
<lav> s/a/g/
<lav> hi bnchs
<bnchs> hi laugh
<heat> hello light armoured vehicle
<bnchs> why is it that x86 has 8 registers and x86_64 has 16 registers
<lav> *runs u over cutely*
<bnchs> i mean general-purpose registers, before you guys aggressively correct me
<gog> more registers more better
<heat> bnchs, what kind of question is that
<heat> what exactly do you want from us?
<gog> not enough registers started to be a problem later in the life of 686
<gog> passing params on stack gets problematic for crossing privilege boudaries
<gog> but there's so few registers taht the number of params you can pass is very limited
<bnchs> heat: the question is x86(_64) always had half the registers as other architectures
<gog> in silicon there are actually more registers
<gog> but the ISA only exposes some of them
<heat> but did it really?
<heat> 1) what gog says
<heat> 2) i'm not entirely convinced every architecture had more regs
<gog> RISC arches absolutely have more regs
<GeDaMo> x86 is older than things like ARM
<heat> having 30 registers instead of 16 is not an obvious win
<gog> CISC arches tend to have fewer than RISC because more stuff happens on the decoding end in CISC
<GeDaMo> More registers means more to save on task switching
<gog> yes
gildasio1 has quit [Ping timeout: 255 seconds]
<bnchs> hm
gildasio1 has joined #osdev
<mrvn> bnchs: x86 has no general purpose registers
<geist> x86 came out in 1976. at the time 8 registers was pretty solid
<bnchs> 1978*
<mrvn> GeDaMo: even M68k had 16 registers
<geist> it was a complicated microprocessor at the time
<bnchs> and m68k came out a year after with... well what mrvn said
<mrvn> geist: do you know when 68000 came out?
<geist> yep
<geist> 1979
<bnchs> and 32-bit support, where x86 didn't have 32-bit until 1985
<geist> but i also think at the time a sizable amount of the space in the 8086 was used up with microcode and things like the segment registers, etc
<mrvn> That x86 doesn't have general purpose registers was probably the biggest annoyance I had trying to write some asm.
<geist> cs ds es were also 16 bits, etc
<bnchs> mrvn: yeah i forgot, the registers aren't general purpose
<bnchs> in x86
<GeDaMo> Z8000 also had 16 registers in 1979
<geist> note if you look at a lot of minicomputers at the time, notably PDP-11, it was similar: 8 registers, a few of which were special purpose
<mrvn> bnchs: still isn't in x86_64
<geist> VAX which was a supermini that came out in 1979 upped it to 15
<geist> both of which were pretty influential to the intel and motorola team, since they were extremely popular architectures
<geist> 68k was a weird design, but basically dependig on who you ask it had 8 or 16 registers, or 8 * 2 registers
<geist> because of the split D and A registers. it allowed them to only really reserve 3 bits of registers in the opcode space
<bnchs> 8 address registers and 8 data registers
<mrvn> geist: it's clearly 16 registers but they have some special purpose: data vs. address
<geist> but based on the addressing mode it implied which bank
<geist> no, it's not clearly 16 *GP* registers
<mrvn> never said GP
<geist> it's 16 registers you access via different addressing modes with various limitations
* gog #GP
<geist> okay. well then yes same thing. it's not 16 GP regs
<mrvn> it's just a shit ton less restrictive than x86 on the purpose part
<geist> AFAIK no other major architecture had the split A and D thing *except* for some 60s and 70s era mainframes. i wonder where they got that idea from
<geist> like, say CDC6500 had some sort of weird split register arch like that. PDP-10 maybe? I think it may have had something kinda like that
<mrvn> geist: what do you call x86 split between e.g. ax and the string regsiters?
<geist> but those desigs were even weirder
<geist> hmm?
<geist> ax and the string registers?
<GeDaMo> Could the separate address and data registers have been influenced by Harvard architecture?
<mrvn> A, B, C, D are data registers. SI, DI, DP, SP are address registers
<geist> well, i wouldn't say that really. it's more like 7 of the 8 registers are generally addressible, but a fair number of instructions have fixed instruction usage
<geist> ie, string routines implicitly use SI/DI
<mrvn> geist: m68k just labels them clearly. :)
<geist> or some mul instructions implicit output in AX
<geist> or the loop/rep stuff implicitly uses CX (count)
<mrvn> yeah, x86 implicit registers are a total mess.
<geist> look it's a piece of crap, but that's their way of not having solid general purpose addressing modes, which 68k does a far better job of
<mrvn> indeed.
<geist> and 68k is clearly inspired by PDP-11 and VAX, since it looks pretty darn similar
<mrvn> it's not 100% given the Dx/Ax split but it gets pretty close to general purpose.
<geist> with the caveat that PDP-11 and VAX didn't have A and D registers
kpel has joined #osdev
<mrvn> My guess would be that they didn't have enough bits in the opcodes so some things had to be limited do Dx or Ax to save a bit here and there.
<geist> the A and D thing seemed to be a trick to double the register size and still only need 3 bits per register
<geist> yep. for better or worse. it was a compromise to avoid 4 bits of register
<mrvn> nod
<geist> the bit comes from somewhere else because either the A and D bit stuff is encoded into the opcode (mov vs mova or something iirc) or it's from the bits that encode the addressing mode where you select Ax vs Dx and then 3 bits for the register
<mrvn> And seriously, does it limit you at all in general code? It's not like you constantly have to swap Ax around so you can do a "mul".
<geist> and then a bunch of the higher level addressing mdoes just dont le tyou use A as a base, etc
<geist> so it becomes more specialized as you drill into the more complex forms of addressing
<geist> s/dont let you use A as a base/*require* that you use A as a base/
<mrvn> geist: The bits where you have two opcodes to cover Dx and Ax I don't count as restricting the registers. That's just moving the selection bit somewhere else. There are things that exist for Ax that don't exist for Dx.
<geist> so there's specializatin but it's basically boiled down to what you can do with A and D
<geist> right, that's what i'm talkig about
<geist> its generally in the addressing mode selection bit word
<geist> where you have say 3 bits to select the mode and then more bits for regiter or immediate or whatnot
<geist> and there isn't a full suite of modes that let you use A and D equally
<mrvn> For those though you can select any of Dx or Ax. Just that when you select Ax you also have the option of some more stuff like an immediate.
<mrvn> Ax is ment for pointers, hence the name address register. :)
<mrvn> Is there stuff other than the addressing mode that actually limited to what register you can use?
elastic_dog has quit [Killed (molybdenum.libera.chat (Nickname regained by services))]
elastic_dog has joined #osdev
<mrvn> can't remember
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
<geist> i thought of an instruction the other day while taking a shower: horizontal shift
<geist> basically shift left or right, 3 registers
<geist> 1 output, 2 input, one immediate (shift value)
<geist> Rb shifts into Ra where Ra shifts out into Rd
<heat> thinking of instructions while taking a shower haha
<geist> that's the best time to think of random things
<geist> i do lots of programming and ideating while taking a shower
<bnchs> anyway i asked the question because i tried to make a m68k dynarec for my layer but.. well it seems like i'm gonna go use an interpreter for the meanwhile
<geist> was pondering the zba/zbb/zbc/zbs extensions on riscv, whcih seem to be radpidly approching standardized
<gog> i mostly count because i'm often pressed for time and i'm trying to maximize how "ready" i can be :P
<geist> since RVA22 seems to standardizing it. qemu already supports it
<bnchs> i could probably do register spilling
<heat> geist, what's RVA22?
<CompanionCube> you could always borrow someone else's dynarec
<mrvn> "Wait, your tempting aunt is spending your time so much, you have to many horseflies in your tent." in french: tant tant tant tant tant tant tant tant tant ...
<mrvn> geist: you mean a 2 register "rol" or "ror"?
<bnchs> CompanionCube: sure that's always a solution
<bslsk05> ​github.com: riscv-profiles/profiles.adoc at main · riscv/riscv-profiles · GitHub
<geist> looks like a new push to try to standardize feature sets into various profiles
<geist> RVA20, RVA22 RVA23, etc
<geist> i approve
<geist> so new sifive cores for example say RVA22 compliant, so you can how assume it implements all of the mandatory extensions in that list
<mrvn> when you are bored: https://youtu.be/IQhgiL3TqYQ?t=306
<geist> huh `orc` instruction is interesting (in Zbb spec)
<geist> "orc.b sets the bits of each byte in the result rd to all zeros if no bit within the respective byte of rs is set, or to all ones if any bit within the respective byte of rs is set."
<geist> "One use-case is string-processing functions, such as strlen and strcpy, which can use orc.b to test for the terminating zero byte by counting the set bits in leading non-zero bytes in a word."
<geist> cute. you can clz then to see where the rightmost zero is
<geist> ie, find the first null in an 8 byte word
kpel has quit [Quit: .]
<mrvn> is there orc.w, orc.l and orc.q?
<mrvn> what use cases for that other than string are there?
<geist> that seems to be exactly what it's for
<geist> no it always operates on the complete word
<mrvn> imho 0 terminated strings were an error in the first place. :)
<mrvn> geist: orc.w would work on 16bit chars instead of 8bit chars
<geist> yes, but no it does not exist
<mrvn> no windows lovers in the sifive community. :)
<geist> utf8 ftw
<geist> yah end of the doc has an example of it. cute
<geist> too big to paste here
<mrvn> example of orc.b for strings or something else?
<geist> for strlen and strcmp
<geist> basically looks ike you load a word, then orc + not the register
<geist> now all the zero bytes are 0xff and everyting els is 0x00
<geist> then you use clz to find it
<mrvn> geist: the big problem I have with this is that it only works on aligned data. you can't load a word if it crosses a page boundary.
* geist shrugs
<mrvn> I hate having to first branch and halnd any leading bytes to get stuff 8 byte aligned.
<geist> the example seems to take that incto account
<geist> feel free to look at it yourself and rage at the people that wrote it, instead of me. https://wiki.riscv.org/display/HOME/Recently+Ratified+Extensions
<bslsk05> ​wiki.riscv.org: Recently Ratified Extensions - Home - RISC-V International
<geist> see the link in Zba/Zbb/Zbc/Zbs
<mrvn> I guess you could round down to 8 byte alignment, read a word, orc.b and shift by the offset for the first word.
<geist> or probably do the first few bytes the old way
<geist> and then start reading words
<mrvn> just trying to think of a branchless way
<geist> yah
<geist> the 'n' versions would have a little more framing too, since you would know how many wordwise compares to do before you're out of n
<mrvn> you have to handle the trainling bytes of n%8
<mrvn> after doing the leading bytes first. So special branches on both ends. :(
<geist> trying to synthesize code that uses these zb* instructions: https://gcc.godbolt.org/z/P8YK1racb
<geist> sh2add.w is clearly designed to help with loops. it's just a wordwise add with a built in shift
<geist> ie, "add this word * 4 to the other register"
<geist> got it to generate sign extend and bitset stuff too https://gcc.godbolt.org/z/znGsq9rT9
<geist> see the sext and bset instruction, as well as max in clang
<geist> real max instruction: https://gcc.godbolt.org/z/ec3P7PzKe
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 252 seconds]
* gog snickers
<gog> sext
* lav extends gog's sign
<gog> o//o
<mrvn> Where is the shift in the sh2add?
<geist> '2'
<geist> ther'es a 1 2 and 3 variant
<mrvn> So a1 = a0 + a1 * 4?
<geist> yes
<mrvn> the middle register is shifted?
<geist> right
<geist> well, the right regster, not the middle
<mrvn> bset and sext.h are new opcodes?
<geist> yes
<geist> part of the zbs and zbb set
<mrvn> it's a bit annoying that returning an int will sign extend the int.
<mrvn> what does "lui" do? Load 20 bit shifted << 12?
<mrvn> I assume "lui a2, 1048560" load 0xffff0000 into a2.
<nikolar> Yeah that's pretty much it
<geist> yes
<nikolar> Because you can only encode 12bit immediates
<nikolar> So you use lui to fill the rest
<mrvn> and in gcc 12.2.0 "li a5, -65536" does the same?
<geist> or 20, in these sort of specialized case
<mrvn> always makes me wonder why the compiler chooses one over the other.
<nikolar> li is a pseudo instruction
<geist> yah my experience is gcc tends to use pseudo instructions more, whereas clang tends to output what the pseudo would unfold into
<geist> same result
<mrvn> Will "li" split into two instructions loading 12bit each?
<nikolar> Well lower 12bit and upper 20 with lui
<mrvn> sorry, yes, 12 + 20
<geist> yah, also depends on what it has to load, the assembler can choose
<geist> also this is a 64bit machine, so it might be worse than that
<mrvn> sure. sometimes some of the loads would be 0
<nikolar> Yeah there in this case it needs to just clear a5 before lui
<mrvn> In the clang case it skips zeroing the lower bits because the "and" will mask them out anyway?
<nikolar> I forgot how you deal with full 64 big loads
<nikolar> *bit
<mrvn> nikolar: I would guess the same way as ARM/AArch64. At some point you just stuff the value into memory and load PC relative.
<geist> yah, that's fairly common
<mrvn> If it takes >3 32bit instructions to load a value then load + data is simpler.
<mrvn> >= even
<nikolar> Yeah just checked, that's what GCC and clang do
<geist> note that the pattern that thumb2 tends to do where it puts the constant off the edn of the function is no longer what arm64 does
<geist> bit putting a hidden symbol in the .rodata is what you do nowadays
<nikolar> ret():
<nikolar> lui a5,%hi(.LC0)
<nikolar> ld a0,%lo(.LC0)(a5)
<nikolar> ret
<nikolar> .LC0:
<nikolar> Gcc
<nikolar> .dword 1311768467294899695
<geist> yah that two instruction sequence is also generally shortened to 'la' i think
<geist> as a pseudo instruction
<nikolar> Yeah
<geist> er wait i think la is just compute the address of, not indirect
<nikolar> Lol now I have to check
<mrvn> nikolar: can't it do PC relative with -fPIC?
<geist> if it were PIC, it'd use an auipc instead of the lui
<geist> auipc
<nikolar> clang actually uses auipc in this case
<nikolar> so yeah
<geist> yah probably just depends on if it's PIC or not, and/or why not use pic if it's all the same
<mrvn> The benefit of having the constants follow the function in .text is that the compiler knows the offset is small and doesn't need 2 instructions to construct the address.
<mrvn> Why did AArch64 give that up?
<geist> bad performance. it trashes the cache line
<geist> better to put constants together in the same cache lines
<geist> makes sense for thumb because thumb doesn't have a good way to compute PC relative addresses that are very far away
<mrvn> geist: you can easily group them in cache line sized amounts.
Arthuria has quit [Remote host closed the connection]
<geist> read the arm64 optimization manual. i think it explicitly has a section about this
<geist> the grouping is 'the rodata section'
<geist> since arm64 has much better instructions to compute PC relative within a large range, much like riscv here
<geist> so it's just as free to have the constant 'far' away from PC, but within a reasonable reach
<geist> thus, put it there
<mrvn> Even if you mix it does it matter if a cacheline is in the I-cache and D-cache?
<geist> it's a waste of cache line to just reach not far to read one or two words, you bring in a whole 64 byte cache line for that
<mrvn> sure. hence grouping consts together a bit.
<geist> yes, hence grouping the constants in the rodata section
<nikolar> RV also has compressed instruction set
<geist> which is what i just said
<mrvn> But the above needs 2 opcodes to reach into .rodata. That's too far away.
<nikolar> Haven't delved that much into it
<geist> it's not to far away. did you just read what i wrote?
<mrvn> Are you saying AArch64 has the rach but rv64 doesn't?
<mrvn> s/rach/reach/
<geist> they both have the same reach
<geist> pretty similar design
<mrvn> then explain how the example from nikolar is better?
<geist> ie, a auipc to get within 4GB of the current PC, page aligned, and then the load instruction provides the bottom 12 bits
<geist> better than what?
<geist> give me the sequence of arm64 instructions that accomplishes this with one instruction?
<mrvn> than putting th constants nearer so you can do it with just one opcode.
<geist> can you provide me the opcode that does this?
<geist> (hint: there is none)
<geist> PC is not a regster, you can't use it like you can in arm32
<geist> same as RV64
<geist> and again, if you put it locally you dont get a global ability to collapse constants, etc etc. it's simply not a good choice anymore with 'large' machines
<mrvn> There is no "la a5, %imm(PC)"?
<geist> no there isnt
<nikolar> la is a pseudo instruction
<nikolar> It's auipc plus load
<mrvn> sucks. I would be fine with 12bit reach.
<geist> in RV, auipc is IIRC the only real way to get to the PC. i dont think you can access it any other way
<geist> you can of course use auipc 0(pc) to get the current PC
<nikolar> Other than picking it from the stack ¯\_(ツ)_/¯
<geist> well the whole branch and pull it out of ra yeah
<nikolar> Like in x86 (32bit)
<geist> jal i should say
<geist> mrvn: like i said please read the optimization manual. i think it talks *explicitly* about this design choice
<geist> the choice being that having dirty constant pools in the text segment is a) a bad use of cache lines and i think b) not particular PIC anyway, since a lot of the time the constants are just addresses
<nikolar> RV spec really encourages instruction fusion too
<geist> so they built a more powerful PC relative address computation instruction that works better for 64bit machines anyway
<geist> same on ARM64. these two instruction sequences to compute an address the optimization manual will pretty clearly tell you to keep together because isntruction fusion
<geist> effectively they become a 64bit instruction that loads a large constant
<mrvn> geist: instruction fusion changes a lot of design choices.
<geist> indeed
<mrvn> it's basically a cheat to get the CISC syntax back of having an opcode followed by a data word. Except less bits.
<nikolar> Yeah
<gog> my journey to user mode is going poorly
<geist> oh no!
<nikolar> Not much difference between RISC and cisc at this point
<geist> especially in the fusion area
<mrvn> gog: last I read you got stuck on sysret. So you can start a user thread and it can syscall but never returns right?
<gog> no, i identified the problem
<gog> i can sysret to the thread
<geist> except fusion in risc is still simpler, because it's at least fixed sized words. actually now i'm curious if RV mentions that fusion should only happen on 32bit instructions or if it's possible to fuse a 32/16 or a 16/16 pair
<gog> but then as soon as an interrupt happens it crashes because i don't have a proper stack
<gog> because the "thread" is on its own stack
<gog> it's gonna need some tweaking
<geist> ah do you have the whole TSS thing set up so that it switches back to supervisor mode?
<nikolar> Yeah, RISC CPUs fuse instructions to get cisc performance, and cisc architectures work a lot like RISC in the backend
<geist> er ring0.
<mrvn> gog: huh? switching to the kernel loads the kernel stack from the TSS. Did you set that up?
<gog> i did, there's two stacks
<nikolar> geist: yeah good point
<mrvn> gog: you need 3. user stack, kernel stack and stack fault stack.
<gog> yeah
<mrvn> you can have more but you need at least those 3.
<gog> so basically i need to modify my thread spawning code to do that if the thread is user thread
<gog> which shouldn't be too much work
<mrvn> gog: you should just have the kernel stack in the TSS all the time.
<gog> i do
<mrvn> aparently not if an IRQ ends up without one.
<gog> ok, but when an irq happens and the cpu is in ring 3, doesn't it dump part of the state in the user stack?
<mrvn> I don't think so. Then user space could corrupt the SP and crash the kernel.
<gog> huh
<gog> ok i'm gonna trace this again because i must not be fully understanding something
<gog> because i do have rsp0 in my tss
<mrvn> IRQ should switch to ring 0, load the ring 0 SP and then start dumping state into the kernel stack
<mrvn> right?
<heat> doesn't it dump part of the state in the user stack? <-- definitely not
<heat> would be a big security hole
dude12312414 has joined #osdev
<mrvn> heat: why security? The user process already knows it's own state
<mrvn> I'm concerned with user space running out of stack or messing up the alignment.
<mrvn> every IRQ would result in a stack fault then
dude12312414 has quit [Remote host closed the connection]
<mrvn> and how would you recover from that? The user state would be lost
<geist> heat: yu might be interestged in this. i was trying to figure out how to specify riscv cpu extensions on the qemu command line, it's not documented but seems to be a series of boolean properties
<bslsk05> ​github.com: qemu/cpu.c at master · qemu/qemu · GitHub
<geist> and the true/false at the end is the defaults when you select the `rv64` cpu
<geist> ie if you want vector extensions use `-cpu rv64,v=true`
<nikolar> Wonder why they aren't documented
<geist> qemu is all over the place like that. sometimes you can do ,help or ,? and it'll dump stuff
<geist> soetimes it's totally opaque
Arthuria has joined #osdev
<mrvn> too many cooks and no Linus that screams at people doing it wrong.
<nikolar> Lol
<nikolar> Every project needs a bit of Linus
<heat> geist, ohhh, that's cool
<mrvn> as recently poublished a bit of swearing in the source improves the quality
<mrvn> (well they didn't proof causality, just compared the two)
<geist> heat: yeah been poking around inside the target/riscv qemu dir and it's prertty clean
<geist> a) it's a clean arch and b) it's new and hasn't built up lots of cruft
<geist> pretty easy to grok
bgs has quit [Remote host closed the connection]
nyah has quit [Quit: leaving]
<gog> i don't think an irq is responsible for what's happening
<gog> but i can't rule it out entirely
<gog> PIC says IRQ0 is in service
<gog> but EFLAGS.IF is 0
<mrvn> because it didn't get to start the IRQ due to failing to get there?
levitating has quit [Ping timeout: 255 seconds]
levitating has joined #osdev
<gog> i have int debugging on and qemu doesn't show one coming in before the page fault, or at least one that isn't serviced
<gog> but i can test to be sure
<mrvn> So what does qemu show? Just one fault or 3?
<gog> 3, page fault, stack fault (but v says it's double?) and then gp
<mrvn> That seems to support that you aren't loading the ring 0 stack pointer.
<gog> it does
<mrvn> plus your stack fault handler is broken as well. maybe fix that first while you have a test case.
<heat> pls gib -d int
<mrvn> did you make the pages readable / executable for user space or just kernel?
<bslsk05> ​gist.github.com: out.txt · GitHub
<gog> mrvn: it's rx for user mode
<gog> oh shit wait wait
<gog> something just came to me
<heat> no need to thank me
<mrvn> ffffffff80010fc0 is that the kernel SP?
<gog> it's the thread's SP
<gog> i know how it looks
<gog> i'm doing something very weird rn
<moon-child> 0xfffffffuuuuuuuuuuuu
<gog> please trust that i know it's weird and don't expect it to work the way i want
<mrvn> SP=0010:ffffffff80010fc0 SP=0023:ffffffff80018fc0 SP=0023:ffffffff80018fc0 Why does it change from 0010 to 0023?
<gog> sysret
<mrvn> Oh wait the SP itself changes too, they just look similar (0 vs. 8)
<mrvn> So ffffffff80010fc0 is your user stack and ffffffff80018fc0 your kernel stack. seems ok
<gog> hang on tho
<mrvn> Odd that they have the exact same lower bits though.
<gog> ok no the thing i just tried wasn't it
<gog> maybe idk lol
<gog> do i need the U bit propagated all the way up to PML4?
<mrvn> yes
<gog> ok then that's probably it
<heat> yes
<mrvn> first time the permission check fails the page walk aborts
<mrvn> That allows recursive page tables by the way.
<gog> thanks for being my rubber duck everybody :P
<mrvn> gog: now go back breaking it and fix your double fault / stack fault handler.
<gog> you mean implement them
<heat> pog
<mrvn> yep. you will thank me next time something fails.
<gog> yeah definitely gonna need those
<mrvn> hehe, trying to set the clock to 1HZ?
<gog> haha it's placeholder rn, if it's less than the minimum it sets it to 18Hz
<mrvn> gog: why do you have an early page frame allocator? Just add a few pages to the .bss section and initialize the page frame allocator with those. No need for an early one.
craigo has quit [Ping timeout: 260 seconds]
<gog> the early page frame allocator is from my efi.os rump kernel thing
<gog> which may or may not continue to stick around to contain runtime services contaminants
<gog> idk yet, i'm building a house of cards here
<mrvn> many people create one so their actual page frame allocator can allocate some data structures during initialization. Always leaves me with a bad taste.
<gog> it's more than the page frame allocator that needs it
<mrvn> but if that's not what you have it for then fine.
<gog> idk i don't like just tacking on a few pagse to the bss
<gog> that leaves a taste to me
<gog> everything must be d y n a m i c
<heat> yesssssss
<mrvn> that's just so the loader leaves space between the kernel and initrd
<gog> i will never use an initrd
<heat> noooooooooooooo
<mrvn> never say never
<gog> heh my boss asked what my plans were for the weekend... this was it
<gog> he called me a nerd
<gog> :|
<heat> gog tu eres una nerd de mierda joder
airplanemodes has quit [Quit: WeeChat 3.8]
<heat> viene escribir un nuevo servicio REST
<gog> noooo
<gog> i have to go back tomorrow and try to unfuck one of our 3rd party integrations
<gog> only REST for the wicked
<gog> i'm closer to the solution than i was on wednesday when the CEO said hurry up and make it work but ugh
Left_Turn has joined #osdev
Turn_Left has quit [Ping timeout: 248 seconds]
bnchs has quit [Remote host closed the connection]
Matt|home has quit [Quit: Leaving]