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
guideX has quit [Ping timeout: 252 seconds]
troseman has joined #osdev
<mpetch> _ngn I noticed that in my build I can reproduce your problem. I haven't investigated the how but I think the reason you are having issues is that the TSS address in the TSS GDT entry is encoded incorrectly. As a result you end up pointing at a bogus address for the GDT.. I believe the issue is in your gdt_tss_set macro. that is improperly using
<mpetch> array indexing.
troseman has quit [Client Quit]
<zid`> ooh do you have a binary?
<mpetch> They provided a Github repo. Was able to build from that.
<zid`> sounds like a no, rip
<mpetch> Bogus TSS address in the GDT ends up providing them with garbage for RSP0 when the ring transition occurs.
<_ngn> mpetch: but then how do the kernel interrupts work?
<zid`> ring0 to ring0 doesn't need to touch the tss
<heat> kernel interrupts dont look at RSP0
<zid`> tss is only for finding a valid rsp while in ring3
<_ngn> ill try to set a random address as the TSS lets see
<mpetch> Because there are no ring transitions in that case
<bslsk05> ​github.com: sdx/kernel/inc/boot/gdt.h at 2fda75232dac82adbc5925832b893c40a72281b9 · mpetch/sdx · GitHub
<_ngn> oh
<_ngn> okay ill check the encoding then
<zid`> which is why it's "rsp0" you're filling out
<zid`> because it's the rsp used for ring0 if you need to switch to it
<_ngn> i thought maybe it checks the tss anyway
<_ngn> zid`: i would dm you the image but you didnt respond
<heat> casts incorporated
<_ngn> i assume you have dms closed or smthng
<zid`> yea this isn't twitter
<heat> @zid` @nikolar kernal programming
<zid`> why would you need to pm a link to a binary though?
<heat> uint64_t serial; // file serial (unique)
<heat> did you mean: inode number
<zid`> try it
<heat> oh ngn implemented fat32 as their first fs
<heat> yeah that explains the brain damage
* kof673 stares at dcc ghost
<_ngn> heat: "An inode is denoted by the phrase "file serial number", defined as a per-file system unique identifier for a file." (read it here https://en.wikipedia.org/wiki/Inode)
<heat> why are you looking at posix for technical guidance?
<heat> posix stat still returns... st_ino
<_ngn> idk i was struggling with my implementation
<_ngn> so i looked up how others do it
<heat> just call it an inode number, thats how others do it
<_ngn> im not tryna be posix compatible or anything obv
<heat> dont be stupidly vague
<_ngn> alr
<heat> reminds me of sun or microsoft code just beating around the bush
<_ngn> i thought the inode number used as a index for a list to find inodes
<heat> inode? hmmm, vnode. the v stands for virg-
<heat> hm?
<zid`> if it's an int it should be inodei
<nikolar> heat: KRNL
thinkpol has quit [Remote host closed the connection]
<nikolar> (what did i miss)
<mpetch> _ngn those << operators in the gdt_set_tss macro look like they should be >>
<heat> @nikolar we're on twitter now
<nikolar> ah sorry
<heat> @nikolar not on X, dont be racist
<nikolar> @heat: KRNL
thinkpol has joined #osdev
<zid`> Yea we're on twitter, not X, so you're not allowed to say the stuff you normally say heat
<zid`> there's a content policy on twitter
<_ngn> mpetch: im actually stupid i see
<_ngn> i was filling the entry with zeros
<heat> better warn nikolar
<heat> the least racist serb > most racist KKK member
troseman has joined #osdev
<zid`> 100% true
troseman has quit [Client Quit]
<_ngn> mpetch: thank you so much that was it
<zid`> did anyone keep a timer
<zid`> for how long it took for you to dump the right bytes of your tss and show that they were infact, not right? :P
<nikolar> hey i am not racist online
<nikolar> just in person
<_ngn> no that was right
<_ngn> it was the gdt entry
<zid`> yes, the gdt entry *is* the tss
<nikolar> are we still debuggin this stuff
<zid`> nah mpetch eventually dumped it as zero, then looked at the code and noticed the shifts were backwards
<heat> the gdt entry is not the tss
<zid`> yes it is
<heat> the gdt entry points to the tss, the tss is its own struct
<zid`> it's just a union with a gate/task/whatever
<zid`> it's a gdt entry
<_ngn> zid`: thank you as well and sorry for wasting your time with the stupid hex formatting
<zid`> kek, to be fair, you were dumping the wrong thing the entire time :P
<zid`> I think, depends if they were the same zeros or not
<zid`> gdt_set_tss_entry(&e[5], &tss); /* TSS */ Explain this heat?
<zid`> why is it in gdt
<heat> notice the &tss
<mpetch> There is a GDT descriptor for the TSS that points at the actually TSS structure.
<mpetch> actual
<zid`> yea there's another level of indirection in there
goliath has quit [Quit: SIGSEGV]
mpetch has quit [Quit: Client closed]
gildasio has quit [Remote host closed the connection]
gildasio has joined #osdev
mpetch has joined #osdev
troseman has joined #osdev
<mpetch> _ngn I noticed in the qemu log that your TSS was not the correct size. Without an IO bitmap the size should be 0x68 (limit is 0x68-1=0x67) but yours was 0x70 (limit 0x6f). I noticed in the `struct tss` that `reserved1` and `reserved2` are both `uint64_t`. Combined they should be a single `uint64_t`. Could also fix it by making both `reserved1` and
<mpetch> `reserved2` a `uint32_t` . Since you aren't using an IO bitmap (yet) you should set `io_bitmap_offset` to something higher than what you set the TSS limit to. You could easily do this with `im_tss.io_bitmap_offset = sizeof(struct tss);` in `im_init`
troseman has quit [Client Quit]
<mpetch> I didn't go looking at the cause but after fixing your TSS issue I started getting `v=0d e=0000 i=0 cpl=3 IP=001b:00010102464c457f` . I think it is interesting to note that the IP(RIP) address contains the ELF header in it.
msv has joined #osdev
<geist> yah you use LTR to load it
<geist> and then it'll cache a pointer to the current TSS
<geist> side note if you're fiddling with qemu, breaking into the console and using `info registers` is *highly* useful for this sort of stuff
<geist> since it dumps the full state of the cpu plus all the shadow registers
<geist> though sounds like you're already qemuified
jeaye has quit [Quit: WeeChat 4.2.2]
<heat> based and qemupilled
jeaye has joined #osdev
<geist> random thing i learned on quora today: https://godbolt.org/z/x9z3x7qxq
<bslsk05> ​godbolt.org: Compiler Explorer
<geist> that's valid, yo
<geist> presumably for terminals that didn't have { }
<heat> is that sort of a trigraph?
<\Test_User> digraphs
<geist> https://godbolt.org/z/5Kj5xa553 is more descriptive
<bslsk05> ​godbolt.org: Compiler Explorer
<geist> yeah, according to some quora post `compl` should equal ~ but that may be via some header thing, like whatever that standard is that defines and/or/not/etc
<geist> also i noticed clang doesn't support it
<bslsk05> ​cpprocks.com: Alternative tokens in C++
_ngn has quit [Remote host closed the connection]
<geist> oh actually more are supported in C++ as in that page: https://godbolt.org/z/hh1GGKcsx
<bslsk05> ​godbolt.org: Compiler Explorer
<geist> huh i knew about the xor/and/etc stuff but i always thought that was a header
<geist> i should try to slip one of these into work and see if someone notices it
<heat> iso646.h
<geist> and clang does understand these, just only in C++: https://godbolt.org/z/dnWzbj4z5
<bslsk05> ​godbolt.org: Compiler Explorer
<geist> and that's with no header
<heat> yeah these are c++ keywords
<geist> makes sense, since they need to be context sensitive or it'd mess up all sorts of casual uses
<heat> they still do
<heat> struct A { int xor; /* compiles in C, not in C++ */ };
<heat> "who would ever name a struct member xor?" the TPM spec, actually
<geist> heh, well, if it was a #define it'd be even worse
<bslsk05> ​codesearch.debian.net: Debian Code Search: #include <iso646.h>
<heat> tfw you include an obscure ass header just to write
<heat> if (not info->send_events)
heat has quit [Ping timeout: 246 seconds]
qubasa has quit [Ping timeout: 248 seconds]
<the_oz> isn't c23 removing digraph?
<the_oz> trigraph?
terrorjack4 has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack4 has joined #osdev
pabs3 has quit [Quit: Don't rest until all the world is paved in moss and greenery.]
pabs3 has joined #osdev
CompanionCube has quit [Quit: ZNC - http://znc.in]
Stary has quit [Quit: ZNC - http://znc.in]
Stary has joined #osdev
CompanionCube has joined #osdev
guideX has joined #osdev
qubasa has joined #osdev
xenos1984 has quit [Quit: Leaving.]
xenos1984 has joined #osdev
xenos1984 has quit [Client Quit]
xenos1984 has joined #osdev
qubasa has quit [Ping timeout: 246 seconds]
x64S has joined #osdev
netbsduser has quit [Ping timeout: 252 seconds]
qubasa_ has joined #osdev
GeDaMo has joined #osdev
qubasa_ is now known as qubasa
osdev199 has joined #osdev
spareproject has joined #osdev
qubasa has quit [Ping timeout: 252 seconds]
cloudowind has quit [Ping timeout: 252 seconds]
cloudowind has joined #osdev
osdev199 has quit [Ping timeout: 245 seconds]
x64S has quit [Quit: Leaving]
Left_Turn has joined #osdev
_ngn has joined #osdev
ThinkT510 has quit [Ping timeout: 276 seconds]
Turn_Left has joined #osdev
spareproject has quit [Remote host closed the connection]
Left_Turn has quit [Ping timeout: 265 seconds]
craigo has joined #osdev
heat has joined #osdev
ThinkT510 has joined #osdev
mpetch has quit [Quit: Client closed]
housemate has joined #osdev
Turn_Left has quit [Ping timeout: 248 seconds]
Turn_Left has joined #osdev
goliath has joined #osdev
npc has joined #osdev
<nikolar> heat: oh we got another int class; then
<heat> no we have a linux kernel;
<nikolar> kornul
<Ermine> N T O S K R N L . E X E
<heat> /kickban Ermine
* Ermine runs
housemate has quit [Remote host closed the connection]
housemate has joined #osdev
<Ermine> what does xor mean in c++ actually
<heat> ^
<zid`> funny trigraph for ^?
<heat> they made the iso646.h macros keywords
<heat> int foo(bool a, bool b, bool c)
<heat> return (not a and not c or b) xor c;
<heat> {
<heat> }
<heat> C++ second favorite language of python programmers
<Ermine> ascii was not enough for them...
* Ermine sighs
housemate has quit [Quit: Nothing to see here. I wasn't there. I take IRC seriously. https://files.catbox.moe/4e9k81.pdf]
zhiayang has quit [Ping timeout: 260 seconds]
zhiayang has joined #osdev
<Ermine> seems like seabios can't read virtio cdroms?
<heat> dunno, i always use -cdrom
<Ermine> -cdrom makes ide drive
<heat> or ahci drive, depends on the machine
<heat> virtio is definitely supported by seabios btw
<bslsk05> ​github.com: seabios/src/hw/virtio-blk.c at master · coreboot/seabios · GitHub
<heat> afaik the only thing seabios doesn't support is nvme
<Ermine> interesting, it failed to boot virtio cdrom for me
<Ermine> well, anyway
<heat> onyx doesn't support cdromen anyway so idc
<heat> cdrom support is a trap
<heat> ATAPI -> SCSI, proper SCSI support is herd, then the fucking ISO filesystem
<heat> top 10 filesystems i don't want to write
<heat> (fat is #1)
<Ermine> #1 fat #2 iso #3 zfs
<nikolar> is fat really that bad
<Ermine> yes
<nikolar> seemed simple enough to me (not that i would've bothered writing it)
<Ermine> this is the case when appearance is deceptive
<heat> it's a garbage filesystem, very old, fat12/16/32 sucks ass, LFN sucks ass
<heat> fits horribly on any UNIX vfs
<heat> slow as shit, unreliable
<nikolar> add a journal to it :P
<heat> CoW btree FAT
<nikolar> kek
<Ermine> nikolar: then you can implement ext4 as well
<nikolar> (it was a joke)
<heat> ext4: based, peak technology, very fast (but not xfs fast, which is too fast)
<Ermine> I can find you logs where sortie described his pain while implementing fat support
<Ermine> (from #sortix)
<heat> doesn't it have something really weird like O(n) seeks through files due to blocks being in a linked list or something?
<nikolar> yeah something like that
<heat> oh: also no file permissions, no uid/gid, no ACLs
<heat> just nothing
<nikolar> just 777 everything kek
<Ermine> > no permissions, no uid/gid
<Ermine> I actually dream of such an fs
<heat> you best believe linux derives the i_mode executable bit from the file extension
<nikolar> kek
<Ermine> It would be nice for interoperability between linux and windows
<Ermine> rn I use ntfs for partition with shared data
<heat> terrible for securiteh
<nikolar> Ermine: there is apparently a really good btrfs driver for windows
<Ermine> otoh everything there is 777 anyway
<nikolar> i'd rather use that for a shared drive than ntfs
<nikolar> i think there's also an ext4 driver too
<nikolar> not sure though, it's been a while since i've ran windows
<heat> btrfs?
<heat> does it lose your data more or less frequently than the linux implementation?
<nikolar> no clue
<Ermine> also: you can't ext4 on flash drives
<nikolar> what do you mean
<bslsk05> ​openzfsonwindows/openzfs - OpenZFS on Linux and FreeBSD (is fork /19 forks/503 stargazers/NOASSERTION)
<nikolar> that's a thing?
<nikolar> kek
<Ermine> you save data on one computer under uid 1000, and then you can't open it on the other computer under uid 1001
<heat> you CAN ext4 on flash drives
<heat> but it is a bad idea
<heat> yes you can
<nikolar> yeah i don't see why you couldn't
<Ermine> how
<Ermine> if file mode doesn't allow that
<heat> you can do uid/gid mappings
Turn_Left has quit [Remote host closed the connection]
<nikolar> yea
Turn_Left has joined #osdev
<Ermine> okay, hopefully GUIs can do such mappings
<heat> YOTLD
<heat> fwiw this isn't any different from ntfs, where files also have permissions and owners and etc
<nikolar> yeah that too
<Ermine> idk, people don't seem to have issues with tranferring files on flash drives
<heat> it might be because year of the windows desktop has been the past 30 years
<nikolar> are you formatting your flash drive as ntfs
<heat> also yeah that, you dont ntfs flash drives
<heat> flash drives are FAT32!!!!!!!!!!
<nikolar> or, if you're desparate, exfat
<Ermine> fair enough
<heat> what happens if you zfs an sd card though
<heat> does it explode immediately
<nikolar> why would it
<nikolar> zfs is actually kind of nice to flash storage
<Ermine> can't afford this experience, my sd card has 32G of data
<nikolar> how fast is it
<Ermine> experiment*
<Ermine> it is fast enough to show me photos and play music
<Ermine> that's what I can say
<nikolar> copying 32gb from it will take a while i imagine
<Ermine> yes
mpetch has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
mpetch has quit [Quit: Client closed]
<heat> nikolar, cant imagine it being nice to flash storage if it keeps writing and writing and writing and writing
<nikolar> doesn't everything keep writing and writing and writing and writing
<nikolar> at least zfs doesn't overwrite
mpetch has joined #osdev
<heat> idk man ext2/3/4 has a lot less writes
<heat> zfs journals your data like 3 times
<nikolar> it doesn't?
<heat> what's the zil then?
<nikolar> that's an optional separate device
<nikolar> to speed up writes
<nikolar> not a mandatory log #432
<heat> it's optional?
<nikolar> yes
<heat> well afaik mkfs creates a zil by default and that was the explanation for that fsync() st_blocks stuff
<nikolar> > The ZFS ZIL SLOG is essentially a fast persistent (or essentially persistent) write cache for ZFS storage
<nikolar> it's shouldn't be
<heat> idk boss im not a zfs guy
<heat> that's what people kept telling me, that it was the zil's problem
<nikolar> zil is a separate device
<nikolar> how could it create it by default
<zid`> nikolar why are you arguing with heat instead of
<zid`> replying to me on dicks cord
<nikolar> kek
<bslsk05> ​github.com: Creating + writing to a file + stat() in quick succession returns bad st_blocks · Issue #13991 · openzfs/zfs · GitHub
<nikolar> so zil has two meanings
<nikolar> one is the write cache as i said earlier
<nikolar> the other is the in ram cache to group writes
<heat> i would expect this to be in disk
<heat> unless fsync() is a lie
<heat> in which case LOL ZFS LOL
<nikolar> i don't think fsync is a lie
<nikolar> but don't most filesystems lie about fsync anyway
<heat> no?
<heat> ext4 even waits for the journal
<heat> (in some capacity)
<heat> ext4 even fsyncs when you e.g overwrite a file with a rename
<heat> implicitly
<heat> i dont see how fsync cant be a lie if I fsync and it says "yessir there you go" but everything is in RAM, which is not the explanation i had wayyyyyyyyyy back
<nikolar> zil has two meanings and i haven't read closely enough to tell you
<nikolar> so no clue
<Ermine> seems like artix website is banned in russia
<nikolar> oh yeah i think someone mentioned that a while ago
<nikolar> more like russia is banned from accessing the website because our host blocks them
<Ermine> well, hosts which geoban usually give 403, not time out
<nikolar> i might be misremembering it, but that's what i think is going on
<Ermine> it might be also that your host has enabled ESNI, which authorities here are also trying to block
<nikolar> esni?
<Ermine> encrypted SNI
<Ermine> a tls thingie
<nikolar> oh maybe
<the_oz> ZIL and actual write is two writes, whether ZIL hits or not is an eventually, but it's usual to expect ZIL to hit
<the_oz> whether it happens or not on ZFS on Linux is whatever they're doing over there
<the_oz> so they're talking about fsync on the second hit when only first hit has happened/not happened
<bslsk05> ​www.servethehome.com: What is the ZFS ZIL SLOG and what makes a good one
<the_oz> So you can futz around for whgat exactly it means to you, either way
xenos1984 has quit [Quit: Leaving.]
xenos1984 has joined #osdev
Arthuria has joined #osdev
Arthuria has quit [Ping timeout: 252 seconds]
<heat> ok so two writes, thanks, as i thought
<the_oz> yeah ZFS is fucky with not letting disks idle too because of this
<the_oz> because ZIL gets flushed every 5 seconds by default and if your ZIL is on the spinning disk welp
<heat> if your ZIL is on an sd card or flash drive you can say goodbye to your storage medium lol
<the_oz> yeah double plus ungood
<heat> wait how does the ZIL impact your disk's idleness?
<heat> like, if you write to ZIL you were going to write to disk anyway, right?
<the_oz> more stuff gets read and written to than just the writes that were going to happen anyway
<the_oz> especially atime, stuff that monitors fs for changes and so on
<the_oz> so it's a combination of retardation
<heat> well yes but that's what happens for normal journalled filesystems too
<heat> the big difference is that data writes also hit the ZIL
<heat> also atime sounds like a freebsd problem, unless zfs doesn't support relatime/noatime For Some Reason
<the_oz> yeah I'm not doing a comparative analysis
<the_oz> no it definitely supports turning atime off
<the_oz> but it amplifies by default
<nikolar> the_oz: i don't know what you're talking about but only one write hits the storage device
<nikolar> zil is either in ram or on another device
<the_oz> not by default
<the_oz> default it hits the disk in addition, but of course you can set it up differently
<the_oz> ZIL SLOG link up thar ^
<nikolar> SLOG: Separate intent LOG SSD
<nikolar> so yea
<the_oz> you also can set longer intermittency, etc etc
<nikolar> zil is in ram, or optionally, additionally on a separate device
<the_oz> it still writes out to disk, cached in ram sure
<the_oz> plus replicatability for recovery on boot to compare what is on disk vs just ram
<the_oz> (and futzing by changing the setup where the zil log resides)
nur has quit [Ping timeout: 265 seconds]
netbsduser has joined #osdev
troseman has joined #osdev
d5k has joined #osdev
xenos1984 has quit [Ping timeout: 248 seconds]
xenos1984 has joined #osdev
xenos1984 has quit [Ping timeout: 272 seconds]
netbsduser has quit [Ping timeout: 252 seconds]
xenos1984 has joined #osdev
Turn_Left has quit [Quit: Leaving]
Left_Turn has joined #osdev
frkazoid333 has quit [Ping timeout: 246 seconds]
Turn_Left has joined #osdev
foxsecu has joined #osdev
Left_Turn has quit [Ping timeout: 260 seconds]
Turn_Left has quit [Quit: Leaving]
npc has quit [Remote host closed the connection]
d5k has quit [Quit: leaving]
d5k has joined #osdev
d5k has joined #osdev
netbsduser has joined #osdev
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #osdev
troseman has quit [Quit: troseman]
goliath has quit [Quit: SIGSEGV]
netbsduser has quit [Ping timeout: 248 seconds]
d5k has quit [Ping timeout: 252 seconds]
Gordinator has joined #osdev
GeDaMo has quit [Quit: 0wt 0f v0w3ls.]
netbsduser has joined #osdev
childlikempress has quit [Quit: !]
childlikempress has joined #osdev
netbsduser has quit [Ping timeout: 244 seconds]
Left_Turn has joined #osdev
muffin has joined #osdev
<cloudowind> mmm yum
<geist> boo internet has been down for a day and a half here
<geist> now i cant program!
<geist> i'm so dumb i need AI assistance and stack overflow!
<the_oz> "how do I program without google?
<kof673> geist's cat is pretty smart, able to frame him
<the_oz> *watches the wheel spinning backwards"
Starfoxxes has joined #osdev
<the_oz> hmmmmmmmm
<the_oz> it says here my DNS can't be found
<the_oz> thanks google, hope that helped
muffin has quit [Quit: leaving]
craigo has quit [Ping timeout: 260 seconds]
<zid`> I swear if SO went away, webdev would crawl to a total halt :P
<nikolar> Sounds like a good thing to me zid`
<zid`> same tbh
<zid`> Imagine if they had to change stack less often than once every 4 weeks
<zid`> and care about long term maintainability
<the_oz> zaml!
netbsduser has joined #osdev
Gordinator has quit [Quit: My client has closed - perhaps I did that, perhaps I didn't]
Xyon has joined #osdev
frkazoid333 has joined #osdev
netbsduser has quit [Ping timeout: 260 seconds]
netbsduser has joined #osdev
TkTech has joined #osdev
netbsduser has quit [Ping timeout: 252 seconds]
<kof673> unless it effects $$$$$$$$$$$$ then ............
<kof673> *affects
Left_Turn has quit [Read error: Connection reset by peer]