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
srjek has quit [Ping timeout: 240 seconds]
thinkpol has quit [Remote host closed the connection]
thinkpol has joined #osdev
heat has quit [Ping timeout: 240 seconds]
ZipCPU has joined #osdev
ZipCPU has quit [Ping timeout: 248 seconds]
ZipCPU has joined #osdev
gog has quit [Ping timeout: 264 seconds]
_xor has quit [Quit: brb]
toluene has quit [Ping timeout: 240 seconds]
toluene has joined #osdev
smeso has quit [Quit: smeso]
<klange> ToaruOS reached 5000 stars on Github.
papaya has joined #osdev
papaya has left #osdev [#osdev]
papaya has joined #osdev
<sbalmos> congrats
gorgonical has quit [Ping timeout: 252 seconds]
<klys> yeyy!
<sbalmos> klange: always wondered / figured... Yutani is your tongue-in-cheek callback to Wayland (really Weyland)? :D
<klange> yes
RAMIII has quit [Quit: WeeChat 3.5]
smeso has joined #osdev
<klange> I used to have a FAQ page explaining that one :)
<sbalmos> yeah actually I just read the old Yutani article you had on the site. Shoot me.
Likorn has quit [Quit: WeeChat 3.4.1]
gildasio has quit [Ping timeout: 268 seconds]
gildasio has joined #osdev
_xor has joined #osdev
terrorjack has joined #osdev
Matt|home has joined #osdev
vai has joined #osdev
<vai> morning all friends
vai is now known as Jari--
toluene has quit [Quit: Ping timeout (120 seconds)]
toluene has joined #osdev
mrvn has joined #osdev
mzxtuelkl has joined #osdev
nur has quit [Quit: Leaving]
Likorn has joined #osdev
antranigv has quit [Ping timeout: 276 seconds]
antranigv has joined #osdev
qubasa has quit [Ping timeout: 248 seconds]
qubasa has joined #osdev
PapaFrog has quit [Ping timeout: 246 seconds]
PapaFrog has joined #osdev
Likorn has quit [Quit: WeeChat 3.4.1]
papertigers has quit [Ping timeout: 246 seconds]
papertigers has joined #osdev
psykose has quit [Remote host closed the connection]
psykose has joined #osdev
X-Scale` has joined #osdev
X-Scale has quit [Ping timeout: 264 seconds]
X-Scale` is now known as X-Scale
X-Scale` has joined #osdev
X-Scale has quit [Ping timeout: 246 seconds]
X-Scale` is now known as X-Scale
Matt|home has quit [Ping timeout: 248 seconds]
papertigers has quit [Ping timeout: 256 seconds]
<stephe> ih
GeDaMo has joined #osdev
sortie has quit [Quit: Leaving]
sortie has joined #osdev
vdamewood has joined #osdev
nick64 has joined #osdev
sortie has quit [Quit: Leaving]
sortie has joined #osdev
dennis95 has joined #osdev
papertigers has joined #osdev
heat has joined #osdev
zaquest has quit [Remote host closed the connection]
zaquest has joined #osdev
papaya has quit [Quit: Lost terminal]
gog has joined #osdev
SGautam has joined #osdev
gog has quit [Ping timeout: 246 seconds]
gog has joined #osdev
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nick64 has quit [Quit: Connection closed for inactivity]
terminalpusher has joined #osdev
the_lanetly_052 has joined #osdev
mzxtuelkl_ has joined #osdev
SGautam has quit [Quit: Connection closed for inactivity]
srjek has joined #osdev
mzxtuelkl has quit [Ping timeout: 268 seconds]
terminalpusher has quit [Remote host closed the connection]
jafarlihi has joined #osdev
<jafarlihi> How do you tell if GDT entry points to a normal descriptor or system descriptor?
<zid`> check the bits
<jafarlihi> zid`: which bits?
<zid`> in the descriptor
<jafarlihi> There are many bits in the descriptor
<zid`> I recommend the 'system' bits
gog has quit [Ping timeout: 272 seconds]
<zid`> which is easy on x86 at least, because it only has two types, system and gate
<zid`> although it splits it into code data and system electric boogaloo deeper down for some reason, manual is weird
<bslsk05> ​shogun.rm-f.net: GDT Parser
<zid`> hit decode for some fun ^
<jafarlihi> zid`: Got source code of that?
<zid`> ..right click view source?
<zid`> but, it's just a copy of table 5.1 in the manual
<jafarlihi> How do you know if you are dealing with long mode system descriptor? You get the higher half first, how do you not interpret it just as regular descriptor?
<heat> L bit
<jafarlihi> So you first determine that it's a system descriptor by first 4 bits of access byte? It's considered system if those bits are either 0x2, 0x9, or 0xB?
wand has quit [Remote host closed the connection]
gog has joined #osdev
<gog> #join ##transsmut
<gog> whoops
<j`ey> accident or advertising?
<gog> accident
<ddevault> going to do a little live stream going over some details about my kernel for a few people who were curious
<ddevault> probably nothing new for any seasoned kernel hackers, but if you're curious to join or offer comments: https://spacepub.space/w/aPiJQ8HdXsgHLHhd9mTwCG
blockhead has quit []
<jafarlihi> Is there header I can include in LKM for getting shit like uint16_t?
wand has joined #osdev
<clever> jafarlihi: usually, that would be stdint.h
<mrvn> The kernel makes the GDT, why would it ever have any doubts about what each entry is?
radens has joined #osdev
<jafarlihi> I'm working backwards with LKM, not making a kernel
srjek has quit [Ping timeout: 268 seconds]
gorgonical has joined #osdev
<radens> In an x86 boot sector with 16 bit code, is it possible to access memory above the address (1 << 20) ?
<radens> Alternatively, is it possible to call into the bios via eg int 0x13 from 32 bit mode?
<radens> I'm wasting space changing between 32 bit and 16 bit mode all the time when reading from disk
<mrvn> just use a bootloader, you are just wasting your time with dead legacy crap.
<radens> mrvn: playing code golf is kinda fun, but also I want to build and run on OS's where it's hard to install grub into shit
dennis95 has quit [Quit: Leaving]
<heat> > Alternatively, is it possible to call into the bios via eg int 0x13 from 32 bit mode?
<heat> no
<heat> you have no choice
<mrvn> who says int 0x13 even exists?
<heat> don't you have unreal mode?
* heat doesn't know how that works
<radens> Ah I forgot about that
<heat> hmm ok that is interesting, it's basically abusing the segment caches
<heat> the CPU itself does a similar thing in the reset vector
<heat> cs base = 0xffff0000, ip = 0xfff0
<jafarlihi> clever: You can't include stdint.h in the LKM
<jafarlihi> No standard library allowed
<heat> u16 is your linux kernel equivalent
<jafarlihi> heat: What do I include for that? Or if nothing is required then how I make CoC happy with it?
<heat> <linux/types.h>
<jafarlihi> CoC doesn't give a shit about that, how do I fix it?
<heat> CoC?
<jafarlihi> Conquer of Completion lol
<jafarlihi> It's a vim plugin
<heat> i dunno
<GeDaMo> stdint.h is a set of compiler / platform specific typedefs
<heat> it's not allowed in the linux kernel
<heat> partly because it was using C89, partly because who supplies it depends on the platform and toolchain
<heat> in linux, it's the libc
mahmutov has joined #osdev
<zid`> plus the type names are annoying so you end up defining u16 yourself anyway :P
<zid`> defining it as uint16_t is no different to doing it as unsigned short, it's a per arch header regardless
dude12312414 has joined #osdev
jafarlihi has quit [Quit: WeeChat 3.5]
gxt has quit [Remote host closed the connection]
gxt has joined #osdev
mzxtuelkl__ has joined #osdev
mahmutov has quit [Ping timeout: 246 seconds]
mrvn has quit [Ping timeout: 246 seconds]
toluene has quit [Ping timeout: 246 seconds]
toluene has joined #osdev
mzxtuelkl_ has quit [Ping timeout: 246 seconds]
mahmutov has joined #osdev
Likorn has joined #osdev
the_lanetly_052 has quit [Ping timeout: 272 seconds]
gorgonical has quit [Quit: Client closed]
toluene has quit [Ping timeout: 246 seconds]
toluene has joined #osdev
FatAlbert has joined #osdev
<FatAlbert> Oh, Ass dev!
gorgonical has joined #osdev
mrvn has joined #osdev
FatAlbert has left #osdev [Bye]
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
blockhead has joined #osdev
nur has joined #osdev
mzxtuelkl__ has quit [Quit: Leaving]
<gorgonical> The stuff I barely understand in this kernel really frightens me and reminds me of how much some of you guys must know. Like this head.S I'm modifying has so much "magic asm" that I don't understand very well
<bauen1> uncommented code is nice, but magic code is just something else
<gorgonical> I even think I could understand it, but the art of coordinating low-level asm with linker scripts to put all the stuff in the right places is very obscure to me
foudfou has quit [Ping timeout: 268 seconds]
foudfou has joined #osdev
Vercas has quit [Remote host closed the connection]
Vercas has joined #osdev
gorgonical has quit [Quit: Client closed]
foudfou has quit [Quit: Bye]
foudfou has joined #osdev
<heat> bauen1, nice????
<bauen1> heat: i _could_ add /s
<sbalmos> void get_foo(void) // gets the foo
<sbalmos> gee, thanks /s
<j`ey> but returns void??
<gog> foo is a void
<heat> it returns the foo in a global variable, obviously
<sbalmos> heat: bingo!
<gog> lmao
<mrvn> void get_foo(void) // set foo to void
<sbalmos> extern struct foo_t* g_foo; // global Foo object
<heat> gFoo for bonus hungarian notation points
<mrvn> don't you all have: int errno; void * result;?
<sbalmos> heat: ah, that'd be extern struct foo_t* glphFoo; // global Foo handle
<sbalmos> mrvn: E_NOEXIST
<heat> i'm not convinced
<heat> can we add a GUID just so we know its unique and extendable?
<sbalmos> sure
Likorn has quit [Quit: WeeChat 3.4.1]
<gog> gpFoo
Likorn has joined #osdev
Likorn has quit [Client Quit]
Likorn has joined #osdev
sham1_ is now known as sham1
Likorn has quit [Client Quit]
Likorn has joined #osdev
jafarlihi has joined #osdev
<sbalmos> ah but is it a pointer or a long pointer?
<jafarlihi> Hey - I've got this LKM that prints GDT: https://github.com/jafarlihi/kernsec Now the issue is it reports 16th entry as this 0x40f50000000000 -- which means that it's a system segment but doesn't have one of the possible 3 long mode types, and both base and limit are 0. What the fuck is it?
<geist> sbalmos: wouldn't that be a glp?
<sbalmos> geist: exactly
<heat> jafarlihi, gdts don't have 16 entries
<heat> you need the size
<jafarlihi> size is 127
<jafarlihi> i loop over it all
<jafarlihi> 17th is just 0x0
<heat> I guarantee you your GDT isn't size 127
<\Test_User> 127 meaning 128 bytes probably
<geist> right, which is 16 entries. that lines up
<heat> correct
<jafarlihi> No, it means 128 entries
<jafarlihi> wait what
<geist> GDT/IDT/LDT length on x86 is always -1 for Reasons
<geist> and it'sin bytes, so 127 is a 16 entry GDT
<geist> which makes sense. there are probaby a bunch of auxillary GDT entries in linux
<geist> jafarlihi: it's possible it's a 32bit entry, or some task thing or whatnot
<geist> go to the source and decode it according to the manual. there's only one interpretation
<jafarlihi> you want me to find in linux kernel source where that gets populated? lol
<geist> the 'source' being the manual
<jafarlihi> what manual?
<geist> the intel or amd manual, take your pick
<geist> the AMD manual has nicer tables for GDT types, IMO
<jafarlihi> it doesn't fit, maybe my program is fucked
<geist> huh?
<geist> what doesn't fit what?
gorgonical has joined #osdev
<jafarlihi> doesnt fit what you'd expect of descriptor
<geist> did you decode it?
<jafarlihi> with the lkm program yes
<jafarlihi> maybe its buggy is what im saying
<heat> the TSS is 2 descriptors long btw
<geist> and what type is it?
<jafarlihi> no type
<geist> it has a type, it has to
<geist> and yes, could be part of a two entry. what's in the 15th entry?
<jafarlihi> empty
<jafarlihi> 0x0
* geist shrugs
<geist> well, i mean, up to you. i'd just decode it manually and see what it is. with no assumptoins about what it *should* be
<geist> ah well i found where it's defined in the linux source if you want that
<geist> super easy to find
<jafarlihi> geist: tell me how you found it and where it is
<heat> https://edk2.groups.io/g/devel/message/90564?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3Acreated%2C0%2Ccrosvm%2C20%2C2%2C0%2C91811743 <-- if anyone is interested, there are patches to run any UEFI-compatible OS on crosvm
<bslsk05> ​edk2.groups.io: Running OVMF on crosvm
<geist> jafarlihi: please?
<jafarlihi> please?
<bslsk05> ​github.com: linux/segment.h at master · torvalds/linux · GitHub
<geist> that is your 16 entries
<geist> for x86_64. _32 has more
<jafarlihi> shit
<jafarlihi> sheet
<geist> then it's fairly easy to grep around and find where those are used
<geist> arch/x86/kernel/cpu/common.c seems to be where it's set up and whatnot
<geist> so it's 'cpunode' whatever that means, but you should be able to figure that out
<jafarlihi> thanks
<heat> they align relevant gdt entries on cachelines wtf
<geist> ah https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/segment.h#L244 is the trick. they're doing some cheezy trick there with that GDT entry to encode the current cpu number
<bslsk05> ​github.com: linux/segment.h at master · torvalds/linux · GitHub
<geist> so it's entirely possible the GDT entry is intentionally invalid
<sbalmos> weird
<heat> holy shit that's pretty cool
<geist> yah i dont really grok that fully
<heat> they store it in the segment limit
<heat> and there's an instruction to get the segment limit, lsl
<heat> this is truly galaxy brain kernel programming
<geist> ooooh. load segment limit. i was reading it as 'left shift logical'
<geist> hah cute.
* geist head asplode
<geist> and it works becuse they have a separate GDT per cpu
<heat> yup
<heat> and everything is pretty much useless in the GDT apart from that and the standard segments
<geist> and apparently if PCID is eavailable they just store it there too
<geist> somehow
<heat> just compat stuff
<sbalmos> insert head into table
<geist> presumably they have a custom PCID per cpu
<sbalmos> repeatedly slam until make: sense
<heat> geist, where?
wxwisiasdf has joined #osdev
<wxwisiasdf> hello people i ported my os to or1k
<wxwisiasdf> finally i can use gdb
<heat> are you reading rdpid? rdpid does not mean read pcid
<heat> wxwisiasdf, cheers, love the weird architectures, keep it going
<wxwisiasdf> heh
<wxwisiasdf> multiarch os :D
<heat> maybe once you port your OS to 2 or 3 more architectures you can try the truly weird architecture, x86
<geist> heat: ah. read processor id
<geist> wxwisiasdf: yeah LK is ported to or1k as well. all in all it's a pretty boring arch though
<wxwisiasdf> oh
<sbalmos> and cpunode is probably named that way because of NUMA
<geist> sbalmos: yes it encodes the cpu number and the node number, according to the comments
<geist> makes sense that it's faster than rdtscp, since i think that also serializes things
<geist> where rdtscp is the usual canonical way to read the cpu id in one instruction
foudfou has quit [Remote host closed the connection]
GeDaMo has quit [Quit: There is as yet insufficient data for a meaningful answer.]
<geist> without a memory reference i guess, since a read from gs:offset would do it too
<jafarlihi> cpus have seperate GDT? how do I get them all with my LKM? just run many times and hope it schedules into every cpu at least once?
foudfou has joined #osdev
<geist> jafarlihi: yes and sure
<geist> see if you can pin the thread on a current cpu
<heat> smp_call_function_many
<geist> i have no idea whatyou're trying to *do* here, but if the intention is tor ead all the GDTs then yes
<geist> or that
<jafarlihi> i wanna make a security application that checks shit like gdt for shady stuff
<jafarlihi> wanna check syscalls and shit to make sure no one's hooking
<geist> via a kernel module. that' not shady at all
<heat> how do you know what's shady shit
<jafarlihi> save state and find changes
<heat> this reeks of anti virus software
<heat> or patch guard
<geist> yah
<geist> anyway, there ya go
<jafarlihi> i thought it'd be more useful than making another fucking kernel
<jafarlihi> there's already this: https://github.com/lkrg-org/lkrg
<bslsk05> ​lkrg-org/lkrg - Linux Kernel Runtime Guard (40 forks/229 stargazers/NOASSERTION)
<heat> whats the problem with another fucking kernel
<heat> i feel attacked
<sbalmos> heat: shouldn't you feel more violated?
<heat> no
<heat> just attacked
<jafarlihi> bro you can make all the kernels you want, just dont steal my idea
<heat> you stole your idea from like every anti virus vendor out there, and microsoft
<heat> its not your idea
<gog> i will make 30 kernels before bedtime
jafarlihi has quit [Quit: WeeChat 3.5]
<gog> I'm not making any kernels before bedtime i lied
<gog> i have to work until bedtime basically
mahmutov has quit [Ping timeout: 268 seconds]
<bslsk05> ​paste.gg: pastefile1 · paste.gg
<j`ey> all my memory is 0xffffffff how could that happen..
<j`ey> ok, I guess qemu loaded me at 0, and there's some MMIO around there and something funky happened
wxwisiasdf has quit [Ping timeout: 240 seconds]
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
andreas303 has quit [Quit: fBNC - https://bnc4free.com]
foudfou has quit [Ping timeout: 268 seconds]
foudfou has joined #osdev
andreas303 has joined #osdev
sebonirc has quit [Remote host closed the connection]
sebonirc has joined #osdev
srjek has joined #osdev