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
eddof13 has joined #osdev
Burgundy has quit [Ping timeout: 246 seconds]
eddof13 has quit [Client Quit]
[itchyjunk] has joined #osdev
netbsduser` has quit [Ping timeout: 256 seconds]
dutch has joined #osdev
Jari-- has quit [Ping timeout: 246 seconds]
elastic_dog has quit [Ping timeout: 244 seconds]
TheCatCollective has quit [Quit: Meow Meow Meow Meow Meow Meow Meow Meow]
elastic_dog has joined #osdev
TheCatCollective has joined #osdev
gildasio1 has quit [Quit: WeeChat 4.0.2]
CaCode has quit [Ping timeout: 246 seconds]
heat has quit [Ping timeout: 246 seconds]
heat has joined #osdev
MiningMarsh has quit [Ping timeout: 250 seconds]
<mcrod> where the hell is everyone
<bl4ckb0ne> hi mcrod
<mcrod> hi bl4ckb0ne
<bl4ckb0ne> how is it hanging
<mcrod> it is good
<mcrod> you?
<kof123> eh, what type of lines are you spitting out for printf() logging? i mean some "compressed" form will be more complicated and need pre & post-processing, but cut down how much data needs sent.
<bl4ckb0ne> sweaty
<heat> hi mcrod
[itchyjunk] has quit [Remote host closed the connection]
netbsduser` has joined #osdev
<mcrod> hi heat
<mcrod> tell me
<mcrod> how do I tell someone that disabling interrupts, and then waiting for interrupts is going to work
<mcrod> *isn't
<mcrod> kof123: I cannot even do a simple printf("%02X\n");
<heat> "if you disable them, how are they going to come?"
<mcrod> not *once*
<heat> and if they don't get it, quit
<kof123> i recommend a meme teaching device. doctor "it hurts when i do this" "don't do that" . spaceballs clip, dark helmet crashes into wall
<mcrod> what happened to that kid who didn't know how to count
<heat> what kid?
<mcrod> there was some dude in here ages ago that you told me about
<mcrod> you and zid were teaching him how to count
<heat> trolled us mercilessly
<mcrod> and I say "kid" because I'm pretty sure I remember he was like 14
<heat> out of our good will
<mcrod> that whole thing popped up in my mind today.
<kof123> i have a nephew who thought it was a great idea to run around with eyes closed. and then he crashed into kitchen cabinet, that is kind of what i am going for, maybe find a picture of this
<kof123> well, just get it to output a byte...then i was just saying you could send "binary" data of whatever kind, make up a smaller format if too slow, etc. but it still may be too slow
bnchs is now known as Cindy
netbsduser` has quit [Ping timeout: 245 seconds]
heat has quit [Quit: Client closed]
heat has joined #osdev
SGautam has joined #osdev
FreeFull has quit []
netbsduser` has joined #osdev
vdamewood has joined #osdev
netbsduser` has quit [Ping timeout: 245 seconds]
austincheney has quit [Read error: Connection reset by peer]
heat has quit [Remote host closed the connection]
heat has joined #osdev
netbsduser` has joined #osdev
CaCode has joined #osdev
netbsduser` has quit [Ping timeout: 246 seconds]
m3a has quit [Ping timeout: 246 seconds]
netbsduser` has joined #osdev
bgs has joined #osdev
goliath has quit [Quit: SIGSEGV]
netbsduser` has quit [Ping timeout: 246 seconds]
valshaped7424 has quit [Ping timeout: 260 seconds]
valshaped7424 has joined #osdev
torresjrjr has quit [Ping timeout: 246 seconds]
torresjrjr_ has joined #osdev
GeDaMo has joined #osdev
dutch has quit [Ping timeout: 256 seconds]
dutch has joined #osdev
SGautam has quit [Quit: Connection closed for inactivity]
CaCode has quit [Ping timeout: 246 seconds]
CaCode has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
goliath has joined #osdev
heat has quit [Ping timeout: 246 seconds]
morgan has quit [Ping timeout: 245 seconds]
duderonomy has quit [Ping timeout: 246 seconds]
morgan has joined #osdev
Burgundy has joined #osdev
zxrom has quit [Quit: Leaving]
danilogondolfo has joined #osdev
zxrom has joined #osdev
divine has quit [Ping timeout: 250 seconds]
Left_Turn has joined #osdev
stolen has joined #osdev
CaCode has quit [Quit: Leaving]
gog has joined #osdev
gildasio has joined #osdev
Burgundy has quit [Ping timeout: 246 seconds]
divine has joined #osdev
nyah has joined #osdev
<zid> I think I'm going to change my nick, xXxDeathStrike420xXx seems best
<gog> how are oyu gonna have xXx and 420 in your nick
<gog> straightedge stoner? how?
<zid> that isn't what xxx means in nicks
<zid> different dialect
phoooo has joined #osdev
<zid> (similarly it doesn't mean explicit content)
lg has quit [Ping timeout: 246 seconds]
<Ermine> XXX means 'shitty code ahead'
<gog> i should wrap all my code in that
<zid> yea that seems perfect for me
netbsduser` has joined #osdev
<phoooo> question time, in my case it is riscv, but this applies to everything really, is it more common to do basic device machine initialization in assembly or in c?
<phoooo> with basic machine initialization i mean setting up basic registers and such
<gog> well, to write or read directly to/from specific registers you need to use assembly at some level
<gog> you can do it inline in the C code or you can write thunks to call in an assembly code file
<gog> i do a mix of both depending on the nature of what i'm doing
<phoooo> yeah, i would wrap every register write/read inside an inline function to make things clearer
xenos1984 has quit [Ping timeout: 245 seconds]
<zid> why would you care?
<zid> C doesn't care what value anything has before you write to it, it's UB to read uninitialized vars etc
netbsduser` has quit [Ping timeout: 245 seconds]
phoooo has quit [Ping timeout: 246 seconds]
phoooo has joined #osdev
<phoooo> zid: i was referring to the fact of putting the inline assembly inside an inline function to avoid repeating everything everywhere, abstracting it
<phoooo> nothing else
sparklysara has joined #osdev
<mcrod> gog: may i pet you
<gog> yes
* mcrod pet gog
MiningMarsh has joined #osdev
<zid> I was talking about
<zid> <phoooo> question time, in my case it is riscv, but this applies to everything really, is it more common to do basic device machine initialization in assembly or in c?
* gog prr
<zid> There's certain initialization you *must* do in asm, for some architectures, I can't speak to riscv, but for anything that doesn't need it, don't do it.
<gog> yeh assembly code is a hazard
[itchyjunk] has joined #osdev
<zid> It's just something that needs porting
andreas808 has joined #osdev
<zid> keeping that surface low is good in general
<zid> regardless of any other constraints like maintainability etc
andreas303 has quit [Ping timeout: 260 seconds]
dutch has quit [Quit: WeeChat 4.0.2]
dutch has joined #osdev
<clever> geist: i know cortex-a53 isnt meant to be as deterministic as cortex-m, but is there any documentation on clock cycle counts? i have a for loop with 5 opcodes and its taking 12 clocks per loop, if i add 1 nop its still 12, but with a second nop added, 16 clocks, and that pattern roughly holds
sparklysara has quit [Quit: Leaving]
<clever> when crossing some critical boundary (maybe a conditional branch between cache lines), a nop pair cost 5 clocks rather then 4
zxrom has quit [Quit: Leaving]
<clever> ah, found most of the answer in the datasheet
<clever> > In-order pipeline with symmetric dual-issue of most instructions.
<clever> if you assume the pipeline takes 2 clocks to execute every opcode pair, then 12 clocks can run 6 opcodes
<clever> the original for loop with 5 opcodes left a slot in dual-issue empty/wasted
<clever> because of conditional branching not being compatible with dual-issue
<clever> adding 1 opcode filled that wasted slot, and had no extra clocks where taken
netbsduser` has joined #osdev
Matt|home has joined #osdev
phoooo has quit [Quit: Client closed]
lg has joined #osdev
gareppa has joined #osdev
zxrom has joined #osdev
phoooo has joined #osdev
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 246 seconds]
<phoooo> i've run into a weird problem in my riscv kernel.... every time the timer interrupt hits the machine trap handler, i set the relevant bit in the mip register and do mret to go to the supervisor trap handler. the problem is that when the supervisor trap handler returns with sret, it goes into an infinite loop
<phoooo> the thing is that the supervisor handler runs perfectly until it returns, which causes it to loop as i described
<phoooo> (note that in that infinite loop, the supervisor handler gets called again and again)
<gog> do you have to tell some external device that the interrupt is serviced?
<gog> pretty sure the same thing happens on x86 if you don't send and EOI to the relevant controller
<phoooo> that is what i initially thought, but it does not seem to be the case
Left_Turn has joined #osdev
Vercas0 has joined #osdev
Turn_Left has quit [Ping timeout: 260 seconds]
Vercas has quit [Ping timeout: 240 seconds]
Vercas0 is now known as Vercas
xenos1984 has joined #osdev
<phoooo> wait, it *might* be the case
<phoooo> let me dig a little bit
<phoooo> yup, looks like i need acknowledge the interrupt
* gog fingerguns
Harriet has quit [Quit: Leaving]
Harriet has joined #osdev
Harriet has quit [Client Quit]
<phoooo> it does not work tho :^)
Harriet has joined #osdev
zxrom has quit [Quit: Leaving]
<gog> dang
<phoooo> wait, got it working
<phoooo> weird way of doing so but whatever
<gog> osdev is an inherently weird activity
<gog> believe it or not i'm the most normal person here
<Cindy> gog: being normal is dumb
<mcrod> I have to tell you all
<mcrod> there is nothing more painful on this planet than dealing with STM8
Amanieu has left #osdev [#osdev]
<mcrod> thank god ST saw the light and dropped their stupid architecture entirely
<gog> u wot m8
<mcrod> picture this
<mcrod> you're an embedded person
<mcrod> breakpoints are already often painful enough as it is
<mcrod> now imagine having to press "break" to set a breakpoint
<mcrod> first off that's annoying, second that fucks with absolutely everything else
<mcrod> now i'm pulling out an oscilloscope
<mcrod> STM8 is honestly a great architecture to fuck with, it's small and fairly simple
<mcrod> but not for anything like this
<gog> sux
<mcrod> eh I don't want to bitch too much
<mcrod> done enough of that already about this god forsaken architecture
<gog> i have scary doctor appointment scheduled can i have a hug pls
<mcrod> ok
* mcrod hug gog
* gog hug
<mcrod> what do they plan to do
<mcrod> if you don't mind my asking
<mcrod> if it helps I don't like doctors either
<gog> heart checkup
<mcrod> see, what I admire about other countries
<mcrod> other countries don't treat medical care like a business
<mcrod> it's probably been forever since you've seen a drug commercial
<gog> well, i stopped watching regular tv providers with ads around 2016 or so
<gog> so i haven't seen a drug ad in like 6-7 years
<phoooo> news: i rtfm myself and learned what i was doing wrong :^)
<phoooo> problem solved
<mcrod> reading the manual is always a good brain massage
phoooo has quit [Ping timeout: 246 seconds]
goliath has quit [Quit: SIGSEGV]
phoooo has joined #osdev
zxrom has joined #osdev
m3a has joined #osdev
Burgundy has joined #osdev
eddof13 has joined #osdev
heat has joined #osdev
phoooo has quit [Ping timeout: 246 seconds]
goliath has joined #osdev
joe9 has quit [Quit: leaving]
Cindy is now known as bnchs
xenos1984 has quit [Ping timeout: 240 seconds]
xenos1984 has joined #osdev
Jari-- has joined #osdev
qubasa has joined #osdev
phoooo has joined #osdev
phoooo has quit [Client Quit]
phoooo has joined #osdev
phoooo has quit [Client Quit]
phoooo has joined #osdev
phoooo has quit [Remote host closed the connection]
phoooo has joined #osdev
Turn_Left has joined #osdev
Left_Turn has quit [Ping timeout: 240 seconds]
antranigv has quit [Quit: ZNC 1.8.2 - https://znc.in]
antranigv has joined #osdev
dude12312414 has joined #osdev
antranigv has quit [Read error: Connection reset by peer]
antranigv has joined #osdev
xenos1984 has quit [Ping timeout: 246 seconds]
gog has quit [Quit: Konversation terminated!]
Jari-- has quit [Ping timeout: 245 seconds]
nvmd has quit [Quit: WeeChat 3.8]
nvmd has joined #osdev
xenos1984 has joined #osdev
SGautam has joined #osdev
FreeFull has joined #osdev
gog has joined #osdev
phoooo has quit [Quit: Client closed]
PublicWiFi has quit [Quit: WeeChat 3.7.1]
<sham1> hi
<Ermine> Hey
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
danilogondolfo has quit [Quit: Leaving]
<heat> mjg, TIL CONFIG_PREEMPT_RCU
<heat> which TIL I also have on
<Ermine> me too
<heat> what distro are you on?
<Ermine> fedora
<heat> oh cool
<heat> zgrep CONFIG_PREEMPT /proc/config.gz
<heat> thanks
PublicWiFi has joined #osdev
<bslsk05> ​paste.sr.ht: e75b4c2 — paste.sr.ht
<heat> much thanks
<mjg> is this a reasonably new fedora?
<mjg> can you grep it for _KSTACK ?
<Ermine> 38
<heat> aw shit you don't have PREEMPT=y?
<heat> thats bizarre
<heat> PREEMPT_RCU but no PREEMPT
<Ermine> mjg: CONFIG_HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET=y CONFIG_RANDOMIZE_KSTACK_OFFSET=y CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
<mjg> senkju
<heat> but ... PREEMPT_BUILD is on? fucking what
<heat> oh thats part of _DYNAMIC
hmmmm has joined #osdev
<heat> Ermine, can you paste your cmdline too? thanks
<mjg> WTF POLICE
<mjg> _*_ ....iiooiioo
<mjg> __/_|_\__
<mjg> [(o)_R_(o)]
<heat> feel free to edit out UUIDs or whatever
<Ermine> BOOT_IMAGE=(hd1,gpt2)/boot/vmlinuz-6.3.12-200.fc38.x86_64 root=UUID=[REDACTED] ro resume=UUID=[REDACTED] rhgb quiet
<heat> huh ok
<mjg> paste uuid
<Ermine> no
<heat> send me a pic of your drivers license
<mjg> all of your drivers
<Ermine> it won't be unique then
<heat> oh yeah im going to replicate your UUID on my disk
<heat> you'll feel uncomfortable forever
<Ermine> Yes
<mjg> heat: wanna exchange some uuids?
<heat> fuck yeah
<mjg> BOOT_IMAGE=/boot/vmlinuz-6.5.0-rc5+ root=UUID=cfbd1281-2f20-46b3-b6fe-98ce58f0009b ro console=tty0 console=ttyS0,115200n8 quiet
<Ermine> I won't be able to sleep with this knowledge
<mjg> that's me bro
<heat> BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=3ed51b6c-12de-4627-b6b8-11c4896fd74b rw loglevel=3 quiet intel_iommu=on i915.enable_guc=0 i915.enable_gvt=1
<mjg> aight
<heat> bro you're booting rc5??
<heat> this a test bench or?
<mjg> TRICKED, it's from my dev vm
<Ermine> heat: do these i915 options work?
<mjg> i'm pulling of an Ermine and not sending an uuid from my laptop
<heat> yeah they used to be needed for i915 GVT
<mjg> i just noticed i have 'console' specified twice
<mjg> :p
<mjg> freakin tooling
<Ermine> I tried to experiment with those options but there are no visible improvements for me...
<heat> wdym improvements?
<Ermine> Like tear-free xorg or not laggy wayland
<heat> oh those have nothing to do with that
<heat> it's for i915 GVT
<CompanionCube> mjg: do you actually have something connected to that serial port
<bslsk05> ​wiki.archlinux.org: Intel GVT-g - ArchWiki
<Ermine> heat: I mean, I tried other options listed on ArchWiki as well
<mjg> CompanionCube: it's a vm, i read the content with 'virsh console'
<CompanionCube> ah
<heat> seriously? libvirt?
<heat> fucking hell
<CompanionCube> probably for virt-manager?
<Ermine> oic I see why do you use these options
<mjg> i'm a simple man, i don't whip out book-sized qemu one-liners
<heat> oh i see i see
<heat> i'm going to start using GNOME boxes
<Ermine> I like it when they talk about intel graphics generations and their mobile generations have another names
<heat> mofos aint ready for that
dutch has quit [Quit: WeeChat 4.0.2]
<Ermine> Have PREEMPT_RCU appeared after 5.15 ?
<heat> no
<heat> 10+ years old
<Ermine> I've just grepped config of alpine virt kernel, and it found no PREEMPT_RCU
<mjg> if there is no mention of it, the kernel is too old
<Ermine> It's 5.15
<heat> then its off
<heat> alpine configs are weird and don't have the off switches like a typical kconfig .conf
<mjg> normally when it is off, it is denoted as not set
<bslsk05> ​elixir.bootlin.com: CONFIG_PREEMPT_RCU identifier - Linux source code (v2.6.39.4) - Bootlin
<mjg> which i think is a great practice
<Ermine> because other distros use kconfig to write config files
<Ermine> (I guess)
<heat> no
<heat> the whole build uses kconfig
<heat> but the alpine people are probably stripping them of comments
<heat> for... reasons
hmmmm has quit [Quit: Leaving]
<Ermine> Configs lie in aports
<heat> mjg, seriously tree rcu might be overkill
<heat> yes, im doing this with 4 threads, but absolutely HAMMERING RCU with a bunch of call_rcus has 0 contention on the spinlock
<heat> quiescent states happen at ever so slightly different times
<Ermine> There are actually "# ... is not set" lines
<mjg> heat: it is not an overkill for what it was done for
<mjg> heat: a 4096 cpu box
<heat> they mention hundreds or thousands of CPUs
<heat> and lol lmao stop
<heat> too many cpus
<mjg> what is an overkill is shipping laptops with that config
<gog> i want 4096 cpus
<mjg> unless mckenney made it optimize itself away, whch i doubt
<heat> oh it optimizes itself
<heat> it folds the tree
<mjg> does it?
<Ermine> Is it harmful to ship laptops with this config?
<mjg> look mate, i'm sure it maeks the tree certain size based on topology
<heat> a system with 64 CPUs will have a single tree node
<Ermine> .. no
<mjg> but best case would WHACK IT MOFO
<heat> it'll be nearly the same as classic rcu
<mjg> for a lolcored laptop
<heat> ... which they killed in like 08 or 09
<heat> TINY rcu is still there though, for !SMP
<Ermine> TINY is useful on embedded stuff, no?
<heat> it's smaller, sure
<heat> and i understand the point of killing classic rcu, all the fancy features would require double the effort
<mjg> for half the pay lmao
<heat> but seriously RCU is a genius idea
<mcrod> hi
<Ermine> hey mcrod
<heat> props to paulmck
<mcrod> Ermine: hi
<mcrod> does someone wanna make me food
<heat> no
<mcrod> :(
<heat> mjg, RCU does *not* play well with SLAB pcpu caching though :(
hmmmm has joined #osdev
<mjg> dude you think everything is genius
<Ermine> want: try cooking something finnish and japanese cuisine
<heat> shut up mjg
* mjg remembers you praising SMR
<heat> SMR is cool
<mjg> it is mostly lame
<heat> SMR lets you have much faster path lookups
<mjg> there are multiple ways to get the same result
<mjg> did you know openbsd has their own variant
<heat> i dont see you complain about SMR when you dick measure will-it-scale with linux
<mjg> i'm not benching performance of rcu, smr or delayed reclamation do jour
<mjg> if you meant comparinv VERSUS linukkkz, i will have you know it entering the protected section requires a full memory barrier
<mjg> so it is slower for most uses
<mjg> among other slodowns
<mjg> so if oone is to mess with it on freebsd, you are automatically behind in the fast path
hmmmm has quit [Client Quit]
<gog> hmmmm
<Ermine> gog: did I pet you today?
<gog> idk
<Ermine> Anyway, may I?
<gog> yes
<mjg> no
* Ermine pets gog
* gog prr
<mjg> i wanted to be first :[
<Ermine> mjg: u r late
<mjg> tomorrow, same time
<gog> i accept pets at all times
bgs has quit [Remote host closed the connection]
<Ermine> I still want to get into i915 development
* moon-child pets gog
* bl4ckb0ne gives Ermine some sanity
Burgundy has left #osdev [#osdev]
<Ermine> bl4ckb0ne: -inf + something = -inf
dutch has joined #osdev
<bl4ckb0ne> what if not
gareppa has quit [Quit: WeeChat 3.8]
<Ermine> floating arithmetics work like this
<moon-child> that's how limits work
<Ermine> limits do not introduce the notion of infinity though
<moon-child> kindaa
<moon-child> lim_x->0- 1/x = -inf
<moon-child> lim_x->0- 5 + 1/x = -inf
<moon-child> is the logic behind 5 + -inf = -inf
<Ermine> this is a formal writing for something written in the definition of limit
<moon-child> (where -inf is shorthand for 'decreases without bound')
<heat> mjg, i know EBR is slower in read sections
<heat> that's not the point
<Ermine> Like for any K > 0 there exist a real number delta < 0 such that for any x in interval (delta, 0) 1/x < -K
<moon-child> yeah
<heat> thats the result of freebsd being a BSD-Licensed freedom fest orgy
<Ermine> So 'infinity' is kind of jargon here
<heat> EBR may not be optimal (at least in read sections, i don't know how write or reclamation works there), but it's a heck better than not having shit at all
<moon-child> i wanna hazard pointers
<heat> i wanna hazar potr
<Ermine> You can add an infinity to your number point, sure. That's how it turns into projective line (iirc)
<Ermine> s/point/line
CaCode has joined #osdev
<Ermine> bl4ckb0ne: so you don't like gpudev?
<heat> i915 develolpment
duderonomy has joined #osdev
<bl4ckb0ne> i like gpu
<heat> i dont wanna discourage you but GPUs are ridonculously complicated
<heat> i915 included
<heat> the docs *are not enough*
<heat> the kernel driver has multiple 10KLOC+ files
Hammdist has joined #osdev
<heat> and *that's not even the hard part*
guideX has joined #osdev
<Hammdist> hi all. I'm relatively fresh to my OS development journey so I'm trying to get the serial port working. but it's not working. if I write a char and read the status I get 5. if I pause and read the status I also get 5. hence my code cannot distinguish when the fifo is full and when I try to write alternating As and Bs they do not always alternate.
<Hammdist> the datasheet for the UART I am trying to interface with is here: https://gaisler.com/products/grlib/grip.pdf
<Hammdist> I do not understand why I always get '5' when I try to read its status
<heat> more details
<heat> what arch, what hardware (soc?)
<Hammdist> aarch64, rk3328 (renegade)
<heat> is your caching right?
<heat> that seems like a typical "moooooooooooooom i mapped device memory as normal memory"
<Hammdist> well I didn't do anything to the memory map myself. I am in the post-kexec environment, whatever that is. I believe all caches are off
<heat> so you're kexecing your hobby kernel?
<gog> meow
<Hammdist> yes
<heat> i don't know what the state for that is
<heat> i assume the MMU is off
gorgonical has joined #osdev
<gorgonical> Stupid hotel wifi blocks irc and also all vpn connections.
<Hammdist> I think it's off or maybe read somewhere it's 1:1
<heat> 1:1 is a problem
<heat> check that first
<gorgonical> Anyway, for those who know about virtio drivers, what would happen if I set the queue size to 1? The wording of the spec makes me think that this is likely to cause problems
<sham1> I didn't even know that you could kexec non-Linux kernels
<heat> yeah you can
<heat> you can even exec multiboot1
<heat> gorgonical, idk, maybe it'll work? why wouldn't it work?
<Hammdist> my hobby kernel is compiled just like linux, it just has an extra unconditional branch into my code
<gorgonical> heat: the spec suggests that the device starts looking at new descriptors when you move idx forward so that the new descriptors are behind where idx points
<Hammdist> (for now)
<heat> oh, so its linux?
<gorgonical> But if you have only one slot, there's not a well-defined notion of behind or in front of idx is there
<heat> i'd suggest you avoid doing that then :)
<Hammdist> well I'm not calling into any other linux code. so it's basically not linux but I still have to sort out how to build a proper Image without relying on the linux build scripts
<heat> thats ez
<gorgonical> In theory this might not be a problem because the spec says you might need to notify the device, but sometimes you don't
<bslsk05> ​github.com: Onyx/kernel/arch/arm64/image.S at pedro/arm64 · heatd/Onyx · GitHub
<bslsk05> ​github.com: Onyx/kernel/arch/arm64/linker.ld at pedro/arm64 · heatd/Onyx · GitHub
<gorgonical> So I'm guessing you can move idx and the device will get around to it "eventually" or you can notify if you want prompt service
<heat> this builds a linux image with a linux arm64 boot header
<heat> then you just objcopy to binary
<heat> the details of the arm64 boot protocol are https://www.kernel.org/doc/Documentation/arm64/booting.txt
<immibis> heat: for a certain type of person ridiculously complicated is where the fun is. (make sure you're that type of person before starting)
<immibis> there's also nothing wrong with hacking on something like that just a little bit and feeling satisfied when you, say, get a simple framebuffer
<heat> hacking on what?
* heat doesn't know what you're replying to
<Ermine> heat: I know it's super hard and I don't expect to do anything meaningful any time soon. I'm just seeking a way into it
<Hammdist> how would I check if the mmu is currently enabled? (arm64, rk3328) would this be SoC specific or is it an arm standard? if the latter, where would I find the datasheet for it?
<immibis> heat: "gpus are ridiculously complicated"
<heat> oh yeah sure
<heat> but ermine isn't writing his own driver I believe
<heat> just hacking on the i915.ko
<Ermine> Hammdist: you need ARM Architecture Reference Manual
<heat> yeah ARM ARM ftw
<heat> Hammdist, but if you read the link I gave you, you'd know the answer
<Hammdist> well I know it -says- it should be disabled but what if it isn't for some reason I guess. I don't have much else to go on if its disabled then the uart should work
<heat> that'd be a bad bug
<heat> geist: I believe caches are off when the MMU is off, right?
<heat> Hammdist, can you show me your code?
<Hammdist> heat: https://paste.ee/p/ldpaH as you can see it's using naps for the most part to get sensible uart output. the printed status value is 5 both times, both immediately after writing and after pausing
<bslsk05> ​paste.ee: Paste.ee - View paste ldpaH
<heat> wait, what
<heat> can you show me the whole linux patch?
<heat> i was expecting asm, not C
FireFly has quit [Quit: Leaving]
FireFly has joined #osdev
<bslsk05> ​paste.ee: Paste.ee - View paste ZSira
<Hammdist> I was wondering if I need to do anything to set up the stack for example
<zid> + static const char nibble[] = {
<zid> Do they not have strings in kernel land
<heat> you do
<zid> oh it's a C++ programmer
<zid> just noticed all the types are backwards
<zid> carry on
Terlisimo has quit [*.net *.split]
air has quit [*.net *.split]
DanielNechtan has quit [*.net *.split]
Starfoxxes has quit [*.net *.split]
skipwich has quit [*.net *.split]
merry has quit [*.net *.split]
amj has quit [*.net *.split]
air has joined #osdev
<heat> Hammdist, serious advice: drop linux
<heat> if you wanna do this, do it methodically
<heat> you can't jump to C code this early *without risk*
DanielNechtan has joined #osdev
<heat> jumping to it with the MMU off is even riskier
skipwich has joined #osdev
<heat> if you want to get a basic arm64 image working, i can help you
amj has joined #osdev
merry has joined #osdev
gorgonical has quit [Quit: Client closed]
stolen has quit [Quit: Connection closed for inactivity]
<heat> mjg, do you know why linux's __fget_files_rcu is a loop?
<mjg> the fd may be getting replaced
<mjg> and you need to pretend lookup is atomic
<mjg> they even have a comment
<mjg> dafaq you asking me for
<heat> i don't see it?
<heat> they explain why get_file_rcu -- that makes sense to me
<heat> i don't understand (b) though
<heat> is there some sort of POSIX requirement?
* gog floats
<mjg> oh
<mjg> ye the *b* thing makes no sense on its own
<mjg> as in you could have refed the file few cycles prior and then what
<mjg> blame says 054aa8d439b9185d4f5eb9a90282d1ce74772969
<mjg> Jann Horn points out that there is another possible race wrt Unix domain
<mjg> socket garbage collection, somewhat reminiscent of the one fixed in
<mjg> commit cbcf01128d0a ("af_unix: fix garbage collect vs MSG_PEEK").
<mjg> The race comes from how we can locklessly look up a file descriptor just
<mjg> as it is in the process of being closed, and with the right artificial
<mjg> (blahblah)
<mjg> see the commit
<mjg> this remind me of a funny bit, there was a fix in the area few years back
<mjg> and a guy posted a followup starting wiht +/- "a coworker asked to explain the fix, and while doing it i realised it does not work"
<mjg> :d
<mjg> 00:00 * gog floats
* mjg pets gog
<mjg> 1st
<mjg> in your face Ermine
<gog> it's only 22:00 here
<gog> sorry
* gog prr anyway
<mjg> i hope to not be up by that time gog
<gog> fair
<mjg> you are above 30, you understand
<gog> no i constantly stay up later than 02:00
<gog> earlier?
<gog> whatever
<gog> ADHD things
<mjg> LARPing your 20s?
<gog> yes
<gog> gotta feel young somehow
<Ermine> mjg: you won this one
* Ermine hands chocolate medal to mjg
<gog> i have scary diagnostic appointment monday morning
* mjg shares with gog
* heat hogs gogs
<mjg> gog: 20 years is what phil leotardo spent in the can
<gog> hhh
<mjg> a little known fact
<bslsk05> ​nvd.nist.gov: NVD - cve-2021-4083
<mjg> i don't think it is funny
<heat> i think its hilarious
<mjg> if you want funny you browse windows cvds
<mjg> fucking A+
<mjg> comedy show
<heat> when jann horn sends patches you best believe there's a CVE behind that shit
<Ermine> Time to upgrade my server
<mjg> CVE-1999-0179 Windows NT crashes or locks up when a Samba client executes a "cd .." command on a file share.
<heat> CVE-1999
<heat> bruh
<mjg> CVE-1999-0549 Windows NT automatically logs in an administrator upon rebooting.
<mjg> CVE-1999-0560 A system-critical Windows NT file or directory has inappropriate permissions.
<mjg> CVE-1999-0562 The registry in Windows NT can be accessed remotely by users who are not administrators.
<Ermine> 1999
<mjg> ye the old shit is particularly funny
<mjg> the criterion was "funny", not "current"
<bnchs> mjg: what about
<heat> CVE-2003-1604
<bnchs> currently funny vulnerabilites
<Ermine> What are Linux CVEs of that time?
<heat> The redirect_target function in net/ipv4/netfilter/ipt_REDIRECT.c in the Linux kernel before 2.6.0 allows remote attackers to cause a denial of service (NULL pointer dereference and OOPS) by sending packets to an interface that has a 0.0.0.0 IP address
<heat> wow found an ia64 CVE
<Ermine> related to CVE-2015
<mjg> CVE-1999-1011 The Remote Data Service (RDS) DataFactory component of Microsoft Data Access Components (MDAC) in IIS 3.x and 4.x exposes unsafe methods, which allows remote attackers to execute arbitrary commands.
<heat> A flaw was found in the exFAT driver of the Linux kernel. The vulnerability exists in the implementation of the file name reconstruction function, which is responsible for reading file name entries from a directory index and merging file name parts belonging to one file into a single long file name. Since the file name characters are copied into a stack variable, a local privileged attacker could use this flaw to overflow the kernel stack.
<heat> in 2023
<mjg> bnchs: these are *currently* funny
<heat> long filename exploit
<bnchs> mjg: i mean
<heat> this is hilarious
<bnchs> funny but current vulnerabilites
<mjg> heat: if you think a buffer overflow is funny....
<mjg> genz i guess
<heat> it's fuckign hilarious
<mjg> bnchs: see pwnie awards
<heat> Windows NT 4.0 SP2 allows remote attackers to cause a denial of service (crash), possibly via malformed inputs or packets, such as those generated by a Linux smbmount command that was compiled on the Linux 2.0.29 kernel but executed on Linux 2.0.25.
<heat> crossover!
<Ermine> da best crossover
<bnchs> BREAkING NEWS
<bnchs> linux ddoses windows
<mjg> Microsoft Internet Information Services (IIS) 7.5 uses weak permissions for the Operational log, which allows local users to discover credentials by reading this file, aka "Password Disclosure Vulnerability."
<bnchs> :OOOO
<heat> Certain operations in Linux kernel before 2.2.19 on the x86 architecture copy the wrong number of bytes, which might allow attackers to modify memory, aka "User access asm bug on x86."
<heat> The iBCS routines in arch/i386/kernel/traps.c for Linux kernels 2.4.18 and earlier on x86 systems allow local users to kill arbitrary processes via a a binary compatibility interface (lcall).
<heat> this shit is great
<mjg> now *that* is funny
<zid> And these are just the bugs that happen when you're NOT an adversary running on the same hyperthread!
<heat> FreeBSD kernel 4.6 and earlier closes the file descriptors 0, 1, and 2 after they have already been assigned to /dev/null when the descriptors reference procfs or linprocfs, which could allow local users to reuse the file descriptors in a setuid or setgid program to modify critical data and gain privileges.
<zid> same cpu core's*
<SGautam> bruh
<SGautam> I just got to know
<SGautam> You can't exit(3) from a signal handler
<zid> Try and stop me
<SGautam> Wait is the signal handler running on another thread?
<SGautam> What is this magic
<bnchs> SGautam: i have an idea
<mjg> that's nothing mate
<heat> SGautam, no
<heat> signals are asynchronous
<bnchs> overwrite the process' memory in the signal handler
<mjg> there was a program once which would crash on exit, maybe
<heat> exit() holds locks
<bnchs> so that it crashes
<heat> you want _exit() there
<bnchs> rather than exit
<mjg> it was multithreaded, calling exit from tons of threads at the same time
<heat> or abort()
<zid> abortforrealsies()
<mjg> and crashing when processing the atexit list
<mjg> at least 10 years ago glibc *really* did not like that
<mjg> besdies, who tf calls exit() from all threads
<heat> abort() from tons of threads is still broken in glibc
<Ermine> gigamind: modprobe a module which panic()s
<mjg> heat: now that makes sense to do and i totally believe it is broken
<zid> galaxy brain: execve into a process that just does return 0;
<mjg> glibc has a rather... funny quality at times
<mjg> universe fucking brain: RUN ONYX
<bnchs> zid: galaxy brain
<heat> run onyx
<bnchs> overwrite the kernel variables after getting the signal
<bnchs> so that the kernel crashes
<bnchs> instead of you
<heat> stop enjoying life and install a worse UNIX than what you currently have
<bnchs> TRY TO STOP ME MMU!
<mjg> yo
<mjg> you reminded me of something bnchs
<Ermine> run code to hack your power plant and disable it to get your process terminated
<mjg> there is this concept of "securelevels" in the bsd land, and it says you can't move it down
<mjg> only up
<mjg> so one guy reported a bug, this can be bypassed mon!
<SGautam> Programming C++ on Windows from the command line is extremely cumbersome imo https://usercontent.irccloud-cdn.com/file/02uWWbyD/image.png
<mjg> here is how: load a kernel module which changes the value
<mjg> gg man
<bnchs> >windows
<bnchs> now i'm not surprised from your bug
<heat> what bug?
<heat> there's no bug here
<heat> exit was never callable from signal handlers
<heat> POSIX explicitly tells you to fuck off too
<SGautam> Windows POSIX emulation is fairly accurate nowadays.
<heat> same for malloc, for the *exact* same reason
<heat> exit needs locks, malloc needs locks
<mjg> right, they got all the bugs did not the they ;s
<bnchs> windows never emulated POSIX
<heat> WRONG
<bnchs> i mean it did, but it was shit
<mjg> windows was posix certified
<heat> anyway im going to reboot to the best UNIX out there
<mjg> they did absolutely bare minimium to get the cert
<bnchs> yes
heat has quit [Remote host closed the connection]
<mjg> which turns out to not be enough to run real world programs
<bnchs> that's why i said their POSIX emulation was shit
<SGautam> I mean the C/C++ library of MSVC does seem to work with all standard POSIX stuff so far
<mjg> great work certificatin program
<SGautam> but yea
<SGautam> theres stuff like ioctl that wont
<bnchs> OS-9 had a syscall for system-state processes
<bnchs> that allows you to read or write to kernel variables
<bnchs> for some reason
<mjg> :A
<bnchs> the CD-i runs games in system-state
<zid> problem with windows' posix is that the C runtime is not posix, and the bits of posix they did add like select, have MAX_FDS of 32 and stuff :D
<mjg> lol i did not know about the fd stuff
<SGautam> honestly I wish I learned C++ from POSIX cuz since school they taught us Win32 related stuff coz it was so easy to get MessageBoxes and other UI type stuff on the screen and ofc all the PCs were running Windows.
<zid> so you still have to seek between fwrite and fread and other C things that posix changed, which caused me a bug while porting before etc
<zid> I learned winapi first, didn't do me any harm
<zid> It was a good exercise in seeing what sort of API types existed too tbh
heat has joined #osdev
<SGautam> I spent 4-5 minutes wondering why MessageBox() was not available when I was compiling on WSL-Ubuntu yesterday
<zid> out params via pointers, return codes, handles, etc
<heat> hello from the windows 11 operating system
<zid> posix's APIs are really boring, compared :p
<bnchs> i hate how most CD-i players don't have a MMU, so you get programs that read data from where they shouldn't be reading
<bnchs> fucking hell, how expensive was a MMU
<SGautam> WinAPI has its own variation of everything is a file, they just turn everything into a handle
<mjg> getFuckedByHandle
<SGautam> One of the coolest things I think is even turning memory into a handle
<SGautam> Using GlobalAlloc
<zid> To be fair, void * are just handles that you give to free
<zid> re malloc
<bnchs> SGautam: no stop, what are you doing, what. are. you. doing
<heat> fds are handles
<heat> the problem is EVERYTHING IS A **FILE**
<heat> on the fucking automagic filesystem
<zid> Yea posix is boring cus all the handles are the same handle
<zid> int fd
<bnchs> but anyway, why would you turn memory into a handle
<zid> even mmap deals with fds
<SGautam> bnchs: Sometimes it can be useful, e.g. embedding file data into the executable itself.
<SGautam> Like having an internal font file
<bnchs> can you already do that with a static variable?
<zid> main thing I like about winapi is that.. it's homogenous. I don't have to switch style 18 times to do message boxes + sounds + files
<zid> or do very awkward conversions, or specially build packages so that they interopt, etc
<zid> DirectSound takes a 'hwnd' so that mute on focus loss works, etc
<SGautam> Yah, on Linux every component usually has a different maintainer.
<SGautam> ALSA for Audio, OpenGL for graphics, X for Window management
<zid> year of the linux desktop will be when they all die in a freak nuclear attack
<zid> and we start over with systemd/linux
<bnchs> more like
<bnchs> openbsd
<bnchs> amirtie
<Ermine> Year of the linux desktop will never happen
<zid> hey, freak nuclear attacks CAN happen
<Ermine> It will be year of CollapseOS something
<Ermine> Anyway, it's more about social and economical reasons
<bnchs> i will run collapseOS on an afghanistan clone of sega mega drive found in the rubbles of a house exploded by a airstrike
<Ermine> I used to worry about Linux desktop, but I don't anymore
Vercas has quit [Remote host closed the connection]
Vercas has joined #osdev
<Hammdist> when I compile I get command lines that state "-march=armv8.5-a". is this suitable for rk3328 (which afaict is arm-v7a)?
<Hammdist> context is I'm trying to use the mrc instruction in inline asm and I get "unknown mnemonic" so I was wondering if perhaps the arch version is off
<zid> binutils is what does the assemblering
<Hammdist> ah wait
<Hammdist> I think I copied the instruction from 32-bit arm. no wonder it won't work
<Hammdist> hm but it is still defined on page 1706 of ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition
<Hammdist> ah it's mrc for 32-bit but msr for 64-bit
<geist> it is not suitable
<geist> -march=armv8 is more appropriate (or -mcpu=cortex-a53)
<geist> because the rk3328 is cortex-a53 which is armv8.0
<Hammdist> ah. part of my problem is I mistyped 3288 when looking it up and that is also a rockchip model number
<SGautam> aaaa my little HTTP Server is being detected as a Severe Trojan Virus
<Ermine> Don't write trojans :)
<zid> SEVERE TROJAN VIRUS is an amazing mix of words
<mjg> hopeless situation warrior
<Hammdist> so I am trying to determine whether mmu is enabled or not, but my program hangs when invoking this function: https://godbolt.org/z/qceTrMWGb
<bslsk05> ​godbolt.org: Compiler Explorer
<Hammdist> I am trying to print the results of invoking that function to the serial port, but something hangs and nothing appears
<Hammdist> are there perhaps processor states in which mrs is not valid?
FreeFull has quit []
<bslsk05> ​godbolt.org: Compiler Explorer
<zid> It will now just inline into everywhere you use it, also
<Hammdist> if I change it to mov x0, sp it hangs also. so something is very wrong. maybe the stack isn't set up properly or something
<zid> I assume related to
<zid> [22:21] <heat> if you wanna do this, do it methodically
<zid> [22:22] <heat> you can't jump to C code this early *without risk*
Matt|home has quit [Quit: Leaving]
<Hammdist> why do the useful parts of this code get optimized away? https://godbolt.org/z/zGrvYb1GE
<bslsk05> ​godbolt.org: Compiler Explorer
[_] has joined #osdev
antranigv has quit [Ping timeout: 260 seconds]
[itchyjunk] has quit [Ping timeout: 246 seconds]
<zid> what useful parts?
gog has quit [Quit: byee]
<zid> Every line of code is present
gog has joined #osdev
<zid> I don't think you understand what =r means though
<bslsk05> ​gcc.gnu.org: Extended Asm (Using the GNU Compiler Collection (GCC))
<Hammdist> I think the problem is 'stack' is not otherwise used so it becomes a don't care for optimization purposes
<zid> it isn't code
<zid> so it isn't in the code output
<zid> but yes, it doesn't need to exist so it doesn't
<zid> because all you do is take the address of it then immediately discard it
<bslsk05> ​gcc.gnu.org: Modifiers (Using the GNU Compiler Collection (GCC))
terminalpusher has joined #osdev
<Hammdist> I get the same strange behavior if I initialize the stack with a loop though :/
ZipCPU has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
<zid> { int x = 0; }
<zid> do you expect this block to do anything? You wrote a 0 to it, afterall.
<heat> setting up the stack in C is topkek behavior
<zid> also yes, this is fundamentally insane
<zid> as well as being incorrectly implemented
<zid> even if it were possible
ZipCPU has joined #osdev
TheCatCollective has quit [Quit: Meow Meow Meow Meow Meow Meow Meow Meow]
Turn_Left has quit [Read error: Connection reset by peer]
<Hammdist> ah I solved one major impediment - I forgot the language on Godbolt is C++ by default which is less forgiving than C.
<Hammdist> but yeah there are problems with the generated code even in C
gog has quit [Quit: byee]
<Hammdist> ah double wait - switching the language just turned off -O2. ok now I'm convinced I have to initialize the stack in asm
nyah has quit [Ping timeout: 252 seconds]