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
Mutabah has quit [Ping timeout: 256 seconds]
<bslsk05> ​lore.kernel.org: Re: [REGRESSION] Re: [PATCH] crypto: pkcs7: remove sha1 support
<Ermine> onyx-libre
navi has quit [Quit: WeeChat 4.1.2]
gorgonical has quit [Remote host closed the connection]
gorgonical has joined #osdev
netbsduser has quit [Ping timeout: 260 seconds]
gog has quit [Quit: byee]
sbalmos has quit [Ping timeout: 272 seconds]
sbalmos has joined #osdev
Vercas9 has quit [Ping timeout: 260 seconds]
voidah has joined #osdev
Vercas9 has joined #osdev
Vercas9 has quit [Remote host closed the connection]
Arthuria has joined #osdev
Vercas9 has joined #osdev
Arthuria has quit [Killed (NickServ (GHOST command used by Guest684531))]
Arthuria has joined #osdev
gxt_ has quit [Remote host closed the connection]
gxt_ has joined #osdev
netbsduser has joined #osdev
Arthuria has quit [Ping timeout: 260 seconds]
goliath has quit [Quit: SIGSEGV]
skipwich has quit [Quit: DISCONNECT]
skipwich has joined #osdev
netbsduser has quit [Ping timeout: 272 seconds]
rustyy has quit [Quit: leaving]
netbsduser has joined #osdev
heat has quit [Remote host closed the connection]
rustyy has joined #osdev
heat has joined #osdev
heat has quit [Ping timeout: 255 seconds]
netbsduser has quit [Ping timeout: 256 seconds]
gorgonical has quit [Remote host closed the connection]
netbsduser has joined #osdev
netbsduser has quit [Ping timeout: 268 seconds]
netbsduser has joined #osdev
zetef has joined #osdev
masoudd_ has joined #osdev
xFCFFDFFFFEFFFAF has quit [Quit: 0xC0000138 STATUS_ORDINAL_NOT_FOUND]
netbsduser has quit [Ping timeout: 260 seconds]
ski has quit [Remote host closed the connection]
ski has joined #osdev
Matt|home has joined #osdev
netbsduser has joined #osdev
spareproject has joined #osdev
netbsduser has quit [Ping timeout: 260 seconds]
gbowne1 has quit [Quit: Leaving]
netbsduser has joined #osdev
masoudd_ is now known as masoudd
Nixkernal has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
netbsduser has quit [Ping timeout: 260 seconds]
zetef has quit [Ping timeout: 268 seconds]
Mutabah has joined #osdev
neo_ has joined #osdev
GeDaMo has joined #osdev
neo|desktop has quit [Ping timeout: 260 seconds]
gog has joined #osdev
netbsduser has joined #osdev
ski has quit [Ping timeout: 264 seconds]
netbsduser has quit [Ping timeout: 260 seconds]
zetef has joined #osdev
pog has joined #osdev
gog has quit [Killed (NickServ (GHOST command used by pog))]
pog is now known as gog
gildasio has quit [Ping timeout: 260 seconds]
gildasio has joined #osdev
netbsduser has joined #osdev
leon_ is now known as leon
navi has joined #osdev
zetef has quit [Ping timeout: 260 seconds]
pog has joined #osdev
neo|desktop has joined #osdev
Gooberpatrol66 has joined #osdev
gog has quit [Ping timeout: 260 seconds]
neo_ has quit [Ping timeout: 260 seconds]
Matt|home has quit [Ping timeout: 260 seconds]
Gooberpatrol_66 has quit [Ping timeout: 260 seconds]
ski has joined #osdev
foudfou has quit [Remote host closed the connection]
foudfou has joined #osdev
zxrom has quit [Quit: Leaving]
kfv has joined #osdev
goliath has joined #osdev
bauen1 has quit [Ping timeout: 246 seconds]
elastic_dog has quit [Ping timeout: 272 seconds]
gildasio has quit [Ping timeout: 260 seconds]
gildasio has joined #osdev
xvmt has quit [Remote host closed the connection]
xvmt has joined #osdev
<mcrod> hi
elastic_dog has joined #osdev
<nikolapdp> hello mcrod
<mcrod> hard faults suck
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mcrod> this might be why
<mcrod> printf() new lib calls malloc
<mcrod> nice!
<pog> smh
<pog> hidden allocations
<mcrod> i’m still not sure that’s the problem yet
<mcrod> i don’t think it is
<mcrod> it’s dying on __swsetup_r
<mcrod> dies more specifically on a half word store…
bauen1 has joined #osdev
<mcrod> ok so it isn’t calling sbrk
<pog> brk brk
<mcrod> i hate this :)
<mcrod> but i’m closer and closer
<mcrod> it’s not stack pointer issues i don’t think
<pog> you know what, fuck it
* pog misaligns your stack pointer
* GeDaMo pushes pog onto the stack
m3a has quit [Ping timeout: 255 seconds]
<pog> oh nooo
<zid> pog can we round up all the people who like to make software that never visibly 'goes wrong' and shoot them
<zid> people who catch exceptions then exit(0)
<zid> people who redirect 404 page to /index.html
<zid> etc
<pog> yes
<pog> please shoot me
<GeDaMo> It's "resilient" :P
<zid> can it resist bullet
voidah has quit [Ping timeout: 264 seconds]
<GeDaMo> Is "bullet" some kind of software framework? :|
netbsduser has quit [Remote host closed the connection]
netbsduser has joined #osdev
<mjg> fearless bullet
<mcrod> ok so it’s a bus fault that escalated to a hard fault
<mcrod> i didn’t think ARM bare metal would be this painful
<mcrod> it’s 0x23
<mcrod> that’s IMPOSSIBLE.
<mcrod> “it” being the PC that caused the fault
<sham1> I've already whinged about this elsewhere, but man, I'm so tired. I've been interviewing a bunch of people who are interested in a summer trainee position and next week I'll have to also do it. Exhausting
<clever> mcrod: is VBAR set? what does that table contain?
<clever> maybe one of the exception vectors caused the fault?
<mcrod> that’d be weird
<clever> i had a similar problem booting linux a few years back
<mcrod> they do nothing but for (;;) nop
<clever> it turns out, linux doesnt initialize the vector table early on
<mcrod> and my hardfault handlers DO get called
<clever> and one of the very first things an SMP build of linux does, once switching on the MMU, is grab a mutex for printk
<clever> except, i had SMP support turned off, and loadex was an illegal opcode
<clever> so it jumped to an undefined exception vector
<clever> that took days to diagnose
<sham1> You'd think that loadex would degrade to a simple load of SMP is not on, but I also understand why that doesn't happen
<clever> prior to SMP arm, that opcode didnt exist
<mcrod> note this is bare metal
<clever> and to emulate that older system, it takes the normal illegal opcode route
<mcrod> but one sec
<clever> on the rpi2, SMP support is optional, and you need to enable it in a control reg
<sham1> Hm, if the opcode doesn't exist then that makes sense
<zid> sham1: Can I be a summer trainee?
<clever> also, by pure chance, the same control bit fixed an unrelated pi3 problem
<clever> on pi3, that allows non-secure kernel to flush the arm L2 cache
<clever> without that, i was getting insane memory corruption on the pi3
<sham1> zid: well the application submission time passed last month, so no
<zid> sham1: you can't take me in the backdoor? (oi oi)
<clever> mcrod: are you able to jtag that system?
<mcrod> of course
<clever> for my linux issue, the only thing that worked in the end, was to single-step until it behaved odd
<mcrod> it dies almost immediately calling printf()
<clever> but, single-stepping from linux entry, to post-mmu, is a huge chunk of code, including all of bunzip'ing itself
<sham1> Unzip those buns
<clever> so it was a lot of bisection, setting breakpoints at random spots
<clever> and constantly rebooting
<clever> and dealing with the fact that i'm bouncing between 3 different arm binaries (bootloader, linux premmu, linux postmmu)
<clever> and the breakpoints fail when switching modes
<mcrod> possibilities: newlib sucks, .bss/.data not properly initialized, some random thing i’m not doing that i’m supposed to magically just know
<clever> mcrod: what is between _start and main()? nearly everything ive done has .bss not yet cleared
<clever> and i have to clear it myself
<mcrod> i clear it’s
<mcrod> it
<mcrod> when i say bare metal
<clever> and my .text and .data are all just one big blob
<mcrod> i really mean “i’m on my own except for newlib”
<sham1> So more like embedded
<mcrod> yes
<mcrod> I guess it’s okay if I set the stack pointer to a specific address directly in the vector table
<clever> mcrod: can you set a breakpoint in printf, and then just single-step until it malfunctions? and compare the disassembly to the pc as it runs, and see where it goes off the rails
<mcrod> problem
<mcrod> i can’t single step into newlib code
<clever> why not?
<mcrod> the source isn’t included in arm gnu embedded toolchain, just the blob
<mcrod> which is *bull*
<clever> single-step should still work, you just wont have source to back it up
<clever> and you can always `objdump -d` to see the assembly
<mcrod> right i’ve done all of that
<clever> look at the pc and assembly, run the opcode in your head, single-step, did it go where you expected? repeat
<mcrod> wellll
<mcrod> i call puts(), which is actually _puts_r(), which calls _sinit(), then it promptly dies on an ldr instruction
<clever> what is the exact ldr instruction?
<mcrod> ldr r3, [r4, #100] @ 0x64
<clever> and what is the value of r3 and r4?
<mcrod> no clue
<clever> `info registers` in gdb
<clever> ah yes, and r3 is the dest register, so that one doesnt matter
<mcrod> it is bad
<mcrod> 0x89ab83f8
<mcrod> for r4
<clever> now check the disassembly, where did it get r4 from?
<zid> now go in reverse and see where it came from, fun
<sham1> Not having the source code for the toolchain feels weird
<mcrod> blame ARM
<zid> I've never looked at the gcc or binutils source though?
<mcrod> that’s why i’m quite annoyed
<mcrod> i’m waiting for zi- yep
<clever> source alone doesnt fully help, you also need debug info that maps addr to source line
<mcrod> anyway
<clever> it can sometimes be simpler to just throw it into a decompiler like ghidra or ida
<zid> I used ida too much this week sorry, it's banned
<mcrod> the next time r4 is referenced
<zid> nikolar made me do a ctf
<zid> not next time, mcrod
<zid> previous time
<mcrod> yes that’s what i mean
<mcrod> the previous instruction is ldr r4, [r0, #8]
<mcrod> note that we are VERY close to the top of the function
<mcrod> only a few instructions down
<zid> yea that's natural, and good
<zid> it's likely just a bum arg
<zid> puts(0x89ab83f8) likely
<mcrod> puts(“hi”); doesn’t seem like it
<clever> mcrod: which function exactly are you in?
<zid> it does if your linker script is fucky
<mcrod> _puts_r
<mcrod> it might be
<mcrod> thankfully i have a wonderful map file
<zid> I would probably quickly cheat and make sure the arg register isn't loaded with 0x89.. before puts is called, it's unlikely to have come from anywhere else
<clever> mcrod: what does `bt` report? can you pastebin the entire `objdump -d foo.elf` ?
<mcrod> no
<mcrod> it’s not that i don’t want to
<mcrod> it’s work related :p
<clever> just the bt to start with?
<mcrod> bt is literally
<mcrod> 0x00000120: main
<mcrod> 0x00000334: _puts_r
<zid> if it doesn't do ldr r4, =0x89sjdsd; bx puts
<zid> I will be surprised
<mcrod> sig handler called
<zid> bblxlrlxlr
<clever> if you `objdump -d foo.elf`, how sensitive is the body of main? can you pastebin just that part?
<mcrod> irq_cm3_HardFault
<mcrod> i. cannot. pastebin.
<clever> do you see a `bx _puts_r` in the body of main?
<mcrod> standby
<zid> oh I guess it'd be ldr r0 or whatever
<clever> zid: yep
<zid> what's [r0, #8], I know arm likes to decorate things
<zid> so that could be a shift or an index or anything
<clever> zid: thats just r0 + 8, as the src addr
<zid> ah index
<zid> is r0.. the stack pointer?
<clever> i already had to google it earlier, for the #100
<clever> r0 is the first argument to a function
<mcrod> i see
<zid> what else would it be doing indexed deref on
<mcrod> ldr r0, [pc, #8]
<clever> int_puts_r (struct _reent *, const char *);
<zid> ohh the reent struct
<clever> and a random header online, says the first arg is that struct
<mcrod> bl 3c4 <puts>
<bslsk05> ​github.com: esp-homekit-devices/sdk/esp-open-rtos-rsf/libc/xtensa-lx106-elf/include/sys/reent.h at master · RavenSystem/esp-homekit-devices · GitHub
<zid> stdout
<clever> mcrod: so it sounds like you called puts, and then puts tail-called _puts_r
<mcrod> puts() calls puts_r
<mcrod> yes that’s right
<zid> and it tried to load stdout from the reent struct and exploded
<zid> nobody called _start
<zid> for the crt
<mcrod> sure I did
<clever> and `ldr r0, [pc, #8]` is loading the _stdout of the _reent
<clever> so, did you initialize stdout at any point?
<zid> "sure I did"
<clever> where? before or after the print?
<clever> how?
<mcrod> no, but isn’t newlib supposed to take care of that?
<zid> crt0.s or whatever is
<clever> how does newlib know where stdout should go?
<zid> and you need to port newlib first
<zid> so you need to do the porting, *and* call the code that initializes the libc from start
<mcrod> gnu arm toolchain has newlib working out of the box
Left_Turn has joined #osdev
<mcrod> so they say
<zid> in some hosted env
<mcrod> no
<zid> there's no way to make puts work freestanding
<mcrod> i mean, i had to implement syscalls
<zid> 'out of the box'
<mcrod> and one was _write
<mcrod> except it explodes long before it gets there
<zid> okay so likely just the lack of initialization then
<bslsk05> ​github.com: newlib/newlib/libc/stdio/puts.c at master · bminor/newlib · GitHub
<bslsk05> ​github.com: newlib/newlib/libc/include/sys/reent.h at master · bminor/newlib · GitHub
<clever> mcrod: which _REENT are you using?
<mcrod> looks like impure
<clever> i think that gets filled in by libgloss, which you may have to write parts of?
<zid> yea I am looking through libgloss now
<zid> to see if they do any special init for libc
<mcrod> as i said, it made me implement a bunch of syscalls
<zid> blFUNCTION (initialise_monitor_handles)
<clever> and if i cant see those implementations, i'm going to be guessing blindly
<zid> newlib/libgloss/arm/crt0.S:408
<zid> appears to be what we want
<clever> if your boss doesnt want you using pastebin, then tell him you cant do your job because he tied your hands behind your back
<zid> I mean, he can still just tell u s
<mcrod> welcome to corporate america
<zid> if he linked in crt0.s
<zid> or not
<mcrod> no i didn’t because that’s not what any guide whatsoever on the internet told me to do
<zid> does _start run a bunch of code you didn't write before main() hits
<zid> the toolchain 'out of the box' *should* do it, but we have no idea how you linked or what you linked
<zid> whether you provided your own _start etc
<clever> 2024-03-15 11:45:56 < clever> mcrod: what is between _start and main()? nearly everything ive done has .bss not yet cleared
<mcrod> i wrote a startup.c, as many guides demanded that I do
<zid> okay, so your startup.c needs to initialize stdout
<zid> newlib does this on crt0.S:408
<mcrod> this clears .bss, sets the vectable and copies .data
<mcrod> zid: what’re you looking at? the link i mean
<bslsk05> ​github.com: newlib/libgloss/arm/crt0.S at 176b19fbe5e77c4ee8199b3895d0299bd4f8267e · bminor/newlib · GitHub
<zid> this is the code that clears bss, sets up the stack etc, that lives in _start and calls main()
<zid> for default arm targets
<zid> it *also*, initializes the standard file handles
<mcrod> oh my god wait i think i got it
<bslsk05> ​github.com: newlib/newlib/libc/sys/arm/syscalls.c at master · bminor/newlib · GitHub
<clever> which is done here
<clever> and its just calling open on ":tt"
<clever> its then up to your open implementation to send that somewhere useful
<mcrod> this isn’t documented anywhere on the toolchain
<mcrod> at all
<zid> in the porting guide?
<mcrod> ok hold on
Turn_Left has joined #osdev
* Ermine gives pog a piece of cheese
* pog prr and nibbl
<mcrod> still crashes. i don’t know.
<Ermine> pog: are you fascinated
<mcrod> clever: i can get some code to you at some point
Left_Turn has quit [Ping timeout: 255 seconds]
<mcrod> at least so you can see a basic idea
<pog> Ermine: i am!
<pog> it is true that you may fascinate a woman with a bit of cheese
<zid> 100%
<Ermine> Cool
<mcrod> wait, progress
<zid> time for frieren
<Ermine> what do people find in frieren
<zid> funny autism elf with black hole magic animations
<mcrod> ok i need to figure out why there’s an undefined reference to end
<mcrod> probably heap bullshit
<Ermine> meanwhile my boss underestimates what it takes to port linuks on yet another arm soc
Maja_ has joined #osdev
<clever> zid: is it time? i dont see the ep in the usual place
<zid> yea subsplease is late idk why
<zid> I grabbed it off nyaa
<clever> subsplease is late with a number of todays shows
<zid> it just uploaded like 4 in one tick
<mcrod> i have done it
<mcrod> i am now convinced that newlib is bullshit
<mcrod> honestly i’m not even sure i should be using it
<mcrod> in fact… why am I?
<zid> good ep, as usual
<clever> zid: ah, there it is
<zid> so it is
Gooberpatrol66 has quit [Quit: Konversation terminated!]
Gooberpatrol66 has joined #osdev
Arthuria has joined #osdev
<Ermine> cool, fastboot can boot a kernel
pog has quit [Quit: Konversation terminated!]
<clever> zid: weirdly, it was one of the best eps, yet it was entirely talking!
<zid> yea it was great
<zid> frieren getting to show off to fern, and showing off fern, is always great though
<zid> and we got both
kfv has joined #osdev
kfv has quit [Read error: Connection reset by peer]
kfv has joined #osdev
bauen1 has quit [Ping timeout: 260 seconds]
bauen1 has joined #osdev
kfv has quit [Remote host closed the connection]
xenos1984 has quit [Ping timeout: 256 seconds]
<zid> gog: https://i.imgur.com/xO5Lvvg.jpeg sabrina was such a good show
<bslsk05> ​i.imgur.com <no title>
xenos1984 has joined #osdev
kfv has joined #osdev
<geist> mcrod: it's okay for embedded stuff
<geist> quickly falls apart after that
kfv has quit [Read error: Connection reset by peer]
kfv has joined #osdev
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mcrod> but it uses a heap :(
<mcrod> only for printf it seems
bauen1 has quit [Ping timeout: 252 seconds]
masoudd_ has joined #osdev
masoudd has quit [Ping timeout: 268 seconds]
kfv has joined #osdev
xenos1984 has quit [Ping timeout: 256 seconds]
gorgonical has joined #osdev
xenos1984 has joined #osdev
heat has joined #osdev
<heat> newlib printf uses the heap because it's bad
<heat> also wasn't it only for floats? i think so
<clever> have fun putting a printf in your heap implementation!
<zid> malloc(size_t len) { #if DEBUG printf("Allocating %zu bytes\n", len); #endif ... }
voidah has joined #osdev
<heat> newlib apparently still has DEFUN macros
<heat> lovely stuff
gbowne1 has joined #osdev
zetef has joined #osdev
<Mondenkind> tbf I don't think it was widely known how to format floats without allocating until recently
<Mondenkind> if you want to do a good job
<heat> apparently they also do it for cases where precision > the statically allocated buffer
zetef has quit [Ping timeout: 260 seconds]
bauen1 has joined #osdev
kfv has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<gorgonical> somafm needs a drum and bass channel
ski has quit [Ping timeout: 264 seconds]
netbsduser has quit [Ping timeout: 260 seconds]
netbsduser has joined #osdev
linear_cannon has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
spareproject has quit [Remote host closed the connection]
masoudd_ has quit [Ping timeout: 264 seconds]
carbonfiber has joined #osdev
gog has joined #osdev
<gorgonical> gog is it your policy that because your name as a palindrome all yuor aliases are, too
<mcrod> yeah i dropped printf()
<mcrod> the nice thing is it’s weakly defined
<gog> no
<mcrod> so, that makes me very happy
<gog> my alias is not a palindrome
<gorgonical> gog is a palindrome
gog is now known as pog
<gorgonical> trickster
<mcrod> goggles
<Mondenkind> magogam
<mcrod> goggies
<mcrod> if you look up gog on discord funny things happen
<Mondenkind> what's up gog
zetef has joined #osdev
GeDaMo has quit [Quit: That's it, you people have stood in my way long enough! I'm going to clown college!]
<sham1> poggers
* pog pogs
<pog> :o
heat has quit [Read error: Connection reset by peer]
heat has joined #osdev
<zid> chimpanzees licking the camera on tenor
<zid> notbad
netbsduser has quit [Ping timeout: 272 seconds]
heat has quit [Remote host closed the connection]
heat has joined #osdev
netbsduser has joined #osdev
heat has quit [Remote host closed the connection]
heat has joined #osdev
<Ermine> heat: that rk3588s chip barely handles 1080p videos lol
Arthuria has quit [Ping timeout: 260 seconds]
linearcannon has joined #osdev
linear_cannon has quit [Ping timeout: 260 seconds]
carbonfiber has quit [Quit: Connection closed for inactivity]
spareproject has joined #osdev
kof673 has joined #osdev
Turn_Left has quit [Read error: Connection reset by peer]