<heat>
moon-child, good point, why is unsigned char not short short
<heat>
this reeks of a C conspiracy
<heat>
a Conspiracy
<moon-child>
honestly int should have been 8 bits and 16 bits should have been long, because who really needs to count higher than 255 anyway
<moon-child>
32 is long long, 64 long long long, etc
<immibis>
the only correct name is int8, int16, etc
<immibis>
or u8, u16, etc
<immibis>
if you like being ivory towery you can call your unsigned integers "nat"
bnchs has joined #osdev
<heat>
one infinite-precision type called integer
<immibis>
if you want to be a dick you can also call it elem_GF(2³²) including the unicode superscripts
gmacd has joined #osdev
gmacd has quit [Ping timeout: 240 seconds]
zaquest has quit [Remote host closed the connection]
zaquest has joined #osdev
gmacd has joined #osdev
gmacd has quit [Ping timeout: 240 seconds]
gmacd has joined #osdev
elastic_dog has quit [Quit: elastic_dog]
elastic_dog has joined #osdev
pmaz has joined #osdev
[itchyjunk] has quit [Ping timeout: 265 seconds]
<qxz2>
i have a data structure whose total size in memory is about 2gb. assuming there's adequate memory and we're on a 64-bit machine, are there other issues that could arise?
[itchyjunk] has quit [Remote host closed the connection]
dude12312414 has joined #osdev
pmaz has quit [Quit: Konversation terminated!]
rnicholl1 has joined #osdev
<heat>
sizeof(struct) == 2gb?
<heat>
this should be a crime
pmaz has joined #osdev
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
osmten has joined #osdev
rnicholl1 has quit [Quit: My laptop has gone to sleep.]
heat has joined #osdev
heat_ has quit [Read error: Connection reset by peer]
rnicholl1 has joined #osdev
pmaz has quit [Quit: Konversation terminated!]
pmaz has joined #osdev
bgs has joined #osdev
pmaz has quit [Quit: Konversation terminated!]
Arthuria has quit [Ping timeout: 240 seconds]
gmacd has quit [Ping timeout: 240 seconds]
crankslider is now known as slidercrank
gmacd has joined #osdev
gmacd has quit [Ping timeout: 240 seconds]
<heat>
tzcnt is a big brained instruction
<heat>
it's just bsf with a redundant prefix
<heat>
backwards compatible instructions!
gmacd has joined #osdev
xenos1984 has quit [Read error: Connection reset by peer]
gmacd has quit [Ping timeout: 268 seconds]
gmacd has joined #osdev
bgs has quit [Remote host closed the connection]
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
vin has quit [Quit: WeeChat 2.8]
gmacd has quit [Ping timeout: 248 seconds]
gmacd has joined #osdev
gmacd has quit [Ping timeout: 246 seconds]
xenos1984 has joined #osdev
goliath has joined #osdev
<mrvn>
Note that there is a limit on the size of a struct. A 2+GB struct isn't allowed even if you are in 32bit compat mode and do have near 4GB of memory per process. But in full 64bit 2GB is nothing.
<mrvn>
-even
gmacd has joined #osdev
gmacd has quit [Ping timeout: 240 seconds]
gmacd has joined #osdev
divine has quit [Remote host closed the connection]
divine has joined #osdev
gmacd has quit [Ping timeout: 265 seconds]
<zid>
hello my dudes, it is mynesday
<sakasama>
Myne won't share any of her snacks.
<zid>
she's about to become supreme overlord of yoghurtland so that's understandable
heat has quit [Read error: Connection reset by peer]
heat_ has joined #osdev
gmacd has joined #osdev
gmacd has quit [Ping timeout: 250 seconds]
gmacd has joined #osdev
q3lont has joined #osdev
gmacd has quit [Ping timeout: 240 seconds]
zxrom has quit [Quit: Leaving]
q3lont has quit [Ping timeout: 240 seconds]
rnicholl1 has quit [Quit: My laptop has gone to sleep.]
heat_ has quit [Remote host closed the connection]
heat_ has joined #osdev
gmacd has joined #osdev
gmacd has quit [Ping timeout: 240 seconds]
osmten has quit [Quit: Client closed]
osmten has joined #osdev
gmacd has joined #osdev
gmacd has quit [Ping timeout: 240 seconds]
bauen1_ has quit [Ping timeout: 246 seconds]
pmaz has joined #osdev
GeDaMo has joined #osdev
terminalpusher has joined #osdev
gareppa has joined #osdev
bauen1 has joined #osdev
osmten has quit [Ping timeout: 245 seconds]
Left_Turn has joined #osdev
gareppa has quit [Quit: Leaving]
Vercas has quit [Remote host closed the connection]
Vercas has joined #osdev
CryptoDavid has joined #osdev
Vercas1 has joined #osdev
Vercas has quit [Quit: Ping timeout (120 seconds)]
Vercas1 is now known as Vercas
SGautam has joined #osdev
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 265 seconds]
pmaz has quit [Quit: Konversation terminated!]
gxt__ has quit [Remote host closed the connection]
gabi-250 has quit [Read error: Connection reset by peer]
Vercas has quit [Write error: Connection reset by peer]
gabi-250 has joined #osdev
Vercas has joined #osdev
gxt__ has joined #osdev
<mcrod>
hi
zxrom has joined #osdev
<nikolar>
Hello
<zid>
no
<mcrod>
why not
<zid>
Because I said so, obvs
<mcrod>
my wisdom tooth hurts.
<zid>
No it doesn't. There, be healed.
<mcrod>
thanks zid, I knew I could count on you
<mcrod>
i really want to know why this C book smells so weird
<mcrod>
i'm telling you all, it's a combination of salt and ink
<zid>
squid ink
<zid>
why do you have a 'C book'
<mcrod>
why not?
<mcrod>
i have two: K&R 2nd edition and C: a modern approach by k.n. king
<zid>
They're all garbage, and the one that isn't is for beginners only
<mcrod>
both are officially #c approved :')
<zid>
(K&R2)
<mcrod>
i think the latter book is quite good so far
<mcrod>
hell it was even recommended on comp.lang.c.moderated
<zid>
yea I've heard of it
<zid>
I don't have personal experience with it and K&R2 is good enough
<zid>
(because printed copies of n1256.pdf are expensive)
<heat_>
the best C book is the rust lang standard
<heat_>
oh wait there's no rust lang standard
<zid>
RUST
<sham1>
Don't you mean "crablang"
<zid>
I haven't figured out how to port int main(void){ return 42; } yet
<kof123>
not taking a side, but after hearing "c has no abi (because varies)" "c has no reference implementation, therefore no standard" ... it is pretty much inevitable "there is no rust lang standard" ...
<kof123>
this sounds like one of those cheap/fast/reliable things. abi (multiple implementations) THE reference implementation THE documentation pick one, or maybe 2
<bslsk05>
ferrous-systems.com: The Ferrocene Language Specification is here! - Ferrous Systems
<nortti>
*standard
<nortti>
though unlike C or C++ or idk common lisp the spec is derived from implementation rather than the other way around
<sham1>
Would be interesting to see how well that compares with MISRA for example
<zid>
is it 10pm yet
<kof123>
your code, their code, the truth and what the documentation says
dude12312414 has joined #osdev
dude12312414 has quit [Remote host closed the connection]
heat_ has quit [Read error: Connection reset by peer]
heat_ has joined #osdev
SGautam has quit [Quit: Connection closed for inactivity]
gmacd has joined #osdev
gmacd has quit [Ping timeout: 240 seconds]
[itchyjunk] has joined #osdev
Left_Turn has joined #osdev
Turn_Left has quit [Ping timeout: 250 seconds]
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 250 seconds]
terminalpusher has quit [Ping timeout: 245 seconds]
terminalpusher has joined #osdev
CryptoDavid has quit [Quit: Connection closed for inactivity]
awita has joined #osdev
goliath has quit [Quit: SIGSEGV]
heat has joined #osdev
heat_ has quit [Read error: Connection reset by peer]
awita has quit [Remote host closed the connection]
Left_Turn has joined #osdev
zxrom has quit [Remote host closed the connection]
zxrom has joined #osdev
Turn_Left has quit [Ping timeout: 265 seconds]
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 256 seconds]
goliath has joined #osdev
<sham1>
Code is the only documentation*
<sham1>
*: until you need to find out why something is done like it is
<zid>
If you intend to improve my code you better know more about the subject matter than I do
<zid>
ergo you don't need comments to explain why I did it, I must be wrong to have written it that way
<zid>
QED
bauen1 has quit [Ping timeout: 240 seconds]
heat_ has joined #osdev
heat has quit [Ping timeout: 265 seconds]
gmacd has joined #osdev
slidercrank has quit [Ping timeout: 240 seconds]
gmacd has quit [Ping timeout: 240 seconds]
terminalpusher has quit [Ping timeout: 245 seconds]
<mcrod>
hi
xenos1984 has quit [Ping timeout: 246 seconds]
xenos1984 has joined #osdev
gmacd has joined #osdev
gog has joined #osdev
<zid>
mcfrdy is it 10pm yet
<zid>
mcrod*
<gog>
hi
<mcrod>
zid i think you mean 10am
<mcrod>
are you going to watch the WWDC too
<zid>
no
<mcrod>
oh.
gmacd has quit [Ping timeout: 265 seconds]
<zid>
world wide.. dustpan.. collection?
<mcrod>
gog: hi
<zid>
also it's very past 10am, it's 17:38
<zid>
o'clock
<gog>
it's only 16:38
<gog>
your daylight is not saved
<zid>
My daylight is saved
<zid>
I am in +1
<zid>
instead of +0
<gog>
an hour doesn't save your daylight
<zid>
we don't even get night in the summer
<gog>
you still get the same daylight
<gog>
true
<zid>
I always thought it was weird that summer gets adjusted, and not winter
<zid>
why are we not -1 in winter and 0 in summer
<gog>
that actually makes more sense
<gog>
sorta
<zid>
we're all dressing in the dark!
<gog>
yes
<zid>
I like it in winter though when everybody is commuting home in pitch black
<gog>
if daylight is earlier that makes more sense but then you have earlier dark which means evening commute has tired people who worked all day and are driving in the dark
<zid>
and all the street lights and shopfronts are lit up and stuff
<zid>
feels christmasy
<zid>
good memories of christmas shopping and coming home on the bus in the dark even though it's only 5pm
<gog>
i think this is an indictment of the 8 hour work day
<gog>
we should have the 4 hour workday
<mcrod>
goggles
<zid>
4 hour workweek I could manage
<mcrod>
may i pet you
<gog>
yes
* mcrod
pets gog
* gog
prr
* zid
gets pot
<zid>
pog, fuk
gog is now known as pog
<pog>
i'm poggin out rn
slidercrank has joined #osdev
vdamewood has joined #osdev
crankslider has joined #osdev
slidercrank has quit [Read error: Connection reset by peer]
terminalpusher has joined #osdev
<sham1>
Very poggers
<sham1>
Frfr
<pog>
no cap
<bnchs>
hiiii
<bnchs>
how are you all?
<heat_>
im ok
<heat_>
how are u
heat_ is now known as heat
<sham1>
I'm being absolutely poggers rn
<sham1>
Just in general even. I no longer feel crap like last night
<pog>
nobody ever messages me and says hola guapa :(
<zid>
is that asking for noods
gmacd has joined #osdev
awita has joined #osdev
<heat>
mjg, freebsd still no ktsan?
gmacd has quit [Ping timeout: 240 seconds]
<mcrod>
heat may I pet you
<heat>
no me llamo gog
<mcrod>
:(
<junon>
Is there a way to get QEMU to turn on -d all after a specific point? I'm trying to navigate to a point in my code with the gdb server and then turn it on because right now getting there is taking at least 20 minutes with -d all from the beginning lol
xenos1984 has quit [Ping timeout: 265 seconds]
<zid>
you can load a snapshot
<zid>
with different options set
gmacd has joined #osdev
<heat>
there's a whole qemu protocol that *may* have support for this
<junon>
what does snapshot mean in this context? like saving and restoring a complete snapshot of memory/etc?
<heat>
qmp
eschaton has quit [Ping timeout: 248 seconds]
riverdc has quit [Ping timeout: 265 seconds]
les has quit [Ping timeout: 250 seconds]
riverdc has joined #osdev
<junon>
nvm I got it, just had to set up the monitor and do "log all"
<junon>
now I have to figure out how to parse this output to figure out why I'm triple faulting. :D
les has joined #osdev
<zid>
well that's easy, new 0x
gmacd has quit [Ping timeout: 268 seconds]
<zid>
and -no-shutdown -no-reboot and it'll just be at the end anyway
<junon>
right okay, these lines you mean? "check_exception old: 0xffffffff new 0xe"
<zid>
yea that means "no previous exception, new exception is 14"
<zid>
then it'll go "old: 14, new: 15" or whatever
eschaton has joined #osdev
<junon>
gotcha, thank you zid :)
<junon>
okay, page fault, page fault, segment not present, triple fault. Strange that my page fault handler wasn't called.
xenos1984 has joined #osdev
<zid>
you made that segment not present one up, or did you get a gp and dig into the fault code
<heat>
then it's page fault -> in handler -> page fault
<heat>
(probably)
<junon>
Right so this is just a test of the interrupt handlers after the IDT has been loaded, I'm manually triggering the breakpoint interrupt with an int3, which tries to call the handler which causes a page fault. Weirdly enough, it should be in the same segment as the other code. So not sure why it couldn't jump to it... I can try some things though.
<zid>
the reg dump it gives is pretty good for figuring out what's wrong
<junon>
check_exception old: 0xffffffff new 0xe -> 0xe new 0xe -> 0x8 new 0xb
<junon>
yeah definitely
<zid>
ah you do double fault
<zid>
so yea, it failed to run your page fault handler
<junon>
Yeah. So if I understand correctly, it's failing to load the interrupt handler at the address in the IDT, then when it tries to jump to the page fault handler, it similarly fails, so then it triples, right?
<zid>
either the IDT entry is faulty, or the address isn't mapped or executable
<junon>
Cool, makes sense.
<junon>
Thanks! will debug :)
terminalpusher has quit [Remote host closed the connection]
<zid>
I actually had a bug in my 'set up the descriptor' code once that causd a fun bug, I messed up the constant on one of my masks
<junon>
Does qemu have 'info idt' or something?
<zid>
so I was ignoring like, bit 19 in the address
<heat>
no
<zid>
the double fault should give you some info on what it *tried* to do I think?
<heat>
bochs does though
<heat>
if you wanna go down that route :v
<zid>
which did nothing, except randomly break things when handlers happened to have that address bit set :D
<zid>
so things like changing strings would make random IRQs stop working
<junon>
mrh not especially wanting to go down the bochs route lol
<zid>
it prints your idtr, you can do the lookup yourself to verify it, then x the addr to see if it's readable at least
<zid>
and info tlb should have the permission flags
<zid>
but tbh you'll probably find it before that point
<heat>
check if your idt entry struct is packed
<heat>
padding will screw you over
<zid>
that's why I'd do the lookup as the first step
<junon>
ah yeah, IDT=
<zid>
x /8bx it at 14*8
gmacd has joined #osdev
LambdaComplex has quit [Quit: WeeChat 2.0.1]
LambdaComplex has joined #osdev
gmacd has quit [Ping timeout: 240 seconds]
<zid>
accidentally ran it on his casio watch, taking a while to run
<junon>
The structure is padded correctly and the address is correct in the IDT (hex((4294967295 << 32) | (32768 << 16) | (2272)) -> 0xffffffff800008e0 -> print irq_page_fault -> {fn (x86_64::structures::idt::InterruptStackFrame, x86_64::structures::idt::PageFaultErrorCode)} 0xffffffff800008e0)
<junon>
what's the best way to see if that memory is readable in gdb... hmm
<zid>
gdb? just type x into the monitor
<zid>
not gdb
<zid>
although gdb would do the same thin tbh
<zid>
(x does translation, xp looks at physical memory, in qemu)
<junon>
Thanks for the hint on info tlb, where can I look up the meanings of these?
<zid>
It's like, malicious compliance. "I am present, and I'm staying here, but I ain't going to do any work"
<zid>
info
<zid>
info
<junon>
wait wouldn't "info mem" also show these mappings as x? none of them are.
<zid>
no info mem does something else entirely
<junon>
just the virtual memory mappings, yeah? from the cr3 register, or am I misunderstanding what info mem does?
<zid>
no it doesn't do that at all
<junon>
Oh
<zid>
okay maybe it does, but it doesn't do flags
<zid>
which you're trying to find rn
<junon>
also, another stray question, after loading a new cr3, shouldn't that invalidate TLB?
<zid>
except for G stuff
<zid>
which yours is
<junon>
aha. That makes... lots of sense.
<junon>
is there a way to make it flush G's as well?
<zid>
invlpg
<zid>
modifying kernel mappings between cpus needs shootdowns and shit anyway, so having to invlpg is no big deal
<zid>
why are you modifying mappings for shit that's clearly static and part of .text btw
<zid>
bootstrap should have done all this properly in the first place the first time around
<junon>
in this case this is directly after switching from a boot stage to the kernel, and I set up global pinning on parts of the loaded ELF segments of the kernel so that interrupts don't get flushed
<zid>
well you forgot the permission flags
<junon>
the bootloader has a direct map set up, so I load the kernel ELF into memory using its segments, set up its new page table in the new memory space, then set the cr3 to point to the physical location.
<zid>
you apprently did page.flags = PRESENT | GLOBAL;
<junon>
yeah looks like it, idk why I did that...
gmacd has joined #osdev
<junon>
wild okay, let me try that after removing global.
<zid>
After this, you have to pay for winrar as penance
<junon>
Okay tlb no longer shows G. Still only "A" though, not executable.
<zid>
this is why I wanted the 8bx
<zid>
but now I want it for pte
<zid>
:D
<junon>
I basically have "if (phdr.p_flags & PF_X) == 0 { flags |= NO_EXECUTE }", is that not right for loading an ELF?
<junon>
for loading ELF segments
<zid>
oh right, X is just -W technically, I legit forgot which bits existed for ptes
<zid>
it's what, mtrrs and the selectors that control it, but your selectors should be hardcoded cus they're interrupts
wootehfoot has joined #osdev
<zid>
are you NX?
<zid>
If you're NX then there is an actual X bit in bit 63
<zid>
(but even if you ignore it, it just makes kernel space W^X)
<junon>
oh derp my GDT isn't set up
<junon>
>.>
<junon>
that'd be a problem yeah? lol
<zid>
Probably
<junon>
it's still left over from whatever the bootloader set up
<zid>
It should work though, tbh
<zid>
you needed a working one to get into long mode, and this is just a fancy jump that doesn't reload descriptors unless you're doing it between priv levels
<junon>
It's not, all the same privilege levels. I'm jumping from Limine.
<sakasama>
zid: People routinely get the bends while free diving. It even occurs with repeated dives of less than 20m if care isn't taken to get adequate rest between dives.
<bslsk05>
github.com: kernel-sanitizers/spinlock.c at d2e70538e060e4dc87b9bbf834e4af17eee22622 · google/kernel-sanitizers · GitHub
innegatives has joined #osdev
bauen1 has joined #osdev
dza has quit [Quit: ]
innegatives has quit [Quit: WeeChat 3.8]
dza has joined #osdev
rnicholl1 has joined #osdev
rnicholl1 has quit [Client Quit]
gmacd has quit [Ping timeout: 256 seconds]
ss4 has quit [Read error: Connection reset by peer]
gxt__ has quit [Ping timeout: 240 seconds]
gxt__ has joined #osdev
<vny>
is there a way to know the total number of pages initialized/mapped by a process on linux? I was hoping /dev/cgroups/memory can give this sort of information
<klange>
`/proc/$PID/maps`?
<heat>
Private_Dirty is the amount of dirty private pages you have (not shared with anyone else, barring maybe CoW on fork()?)
<heat>
in smap
<heat>
then Rss is the amount of memory you have mapped
<vny>
Ah perfect, smap is what I was looking for!
<heat>
:)
<heat>
fwiw IIRC they also track these stats per region in another proc file
<vny>
How frequently is /proc/ updated?
<vny>
heat: what proc file is that?
<heat>
procfs is always up to date
<heat>
as long as you read the whole file, that is
<heat>
like on the first read it will gather data and write the file's string in its internal kernel buffers, you then need to consume it all so it can regen this data
<heat>
oh it's smaps, i forgot. smaps gives it to you per-vma
<vny>
At first glance, I see smaps contain all the information maps contain, why have two files?
<heat>
yes
<vny>
Also can you ellaborate on "pre-vma"? It is still virtual addresses in these files right
<heat>
what
wlemuel has quit [Quit: Ping timeout (120 seconds)]
<heat>
given that a kernel vma or vm region or vm area or whatever represents a range of virtual addresses, the stats you get are per-vma or vm region or vm area or whatever
wlemuel has joined #osdev
<vny>
Cool, what was the other file to track stats per region?
<heat>
there's no other file, it's smaps
<vny>
Ah okay!
<heat>
other files have similar-but-not-quite-as-detailed info on vm too (status, statm)
<vny>
Got it, smaps is what I was looking for!
rnicholl1 has joined #osdev
rnicholl1 has quit [Quit: My laptop has gone to sleep.]
rnicholl1 has joined #osdev
<heat>
fuck it, im writing ktsan
<heat>
this is way too cool
rnicholl1 has quit [Quit: My laptop has gone to sleep.]
rnicholl1 has joined #osdev
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]