Search logs:

channel logs for 2004 - 2010 are archived at http://tunes.org/~nef/logs/old/ ·· can't be searched

#osdev2 = #osdev @ Libera from 23may2021 to present

#osdev @ OPN/FreeNode from 3apr2001 to 23may2021

all other channels are on OPN/FreeNode from 2004 to present


http://bespin.org/~qz/search/?view=1&c=osdev2&y=24&m=4&d=14

Sunday, 14 April 2024

00:00:00 <geist> i'm kinda stuck to be honest. every time i think about doing something grander with LK i think of all the folks i'll break downstream
00:00:00 <geist> so i just sort of fiddle with it
00:00:00 <geist> and port it to new things as long as i dont break anything else
00:00:00 <nikolapdp> you can have a separate fork that builds on it maybe
00:00:00 <heat_> Ermine, exists in a PR, that PR has some problems, i haven't been able to successfully run it on actual ARM cores
00:01:00 <nikolapdp> and backport some useful stuff
00:01:00 <geist> a lot of the big things i want to do is like rewrite the driver layer, etc. things that will maximally break people
00:01:00 <geist> so i dunno.
00:01:00 <heat_> fork?
00:01:00 <Ermine> geist: It's nice you're so responsible, but concerned folks could pay you as well
00:01:00 <geist> thsi is true
00:03:00 <gog> help me kernel
00:03:00 <gog> you're my only hope
00:04:00 <Ermine> heat_: oh. Maybe I'll get myself some eval board eventually
00:05:00 <geist> heat_: oh you want me to try it out on something?
00:05:00 <geist> or did you boot it on qemu?
00:05:00 <heat_> i'm getting some timer issues and i'm not sure what those are
00:05:00 <heat_> i booted it on qemu kvm
00:05:00 <heat_> linux boots IIRC, so it should work, even if rpi kernels don't compile KVM in by default
00:06:00 <heat_> i *suspect* that the arm timer ticks so slowly that i'm getting problems in my fixed point path
00:06:00 <heat_> s/path/math/
00:07:00 <leg7> Do you guys run a service to get the chats you missed when you were gone or nah?
00:07:00 <geist> hmm, possible
00:07:00 <geist> i use irccloud, which stays logged in all the time so yeah
00:07:00 <geist> not that much different to discord in that sense
00:07:00 <leg7> should I use that?
00:07:00 <heat_> anyway, i haven't looked at it in a loooooooooooooong time. might do so in the future, i'll ping you if i need help
00:07:00 <geist> but before that i would just run a command line irc client on a machine that i'd screen into
00:07:00 <geist> like the VAAAAAX
00:08:00 <leg7> yeah my raspberry pi server has been down for a while though so I can't do that
00:08:00 <heat_> VAAAX as an irc bouncer is like the most expensive heater ever
00:08:00 <geist> actually now that i have a full account on sdf.org i could switch to using that again
00:08:00 <leg7> Whatever Ig I'll miss chats *shrug*
00:08:00 <geist> heat_: well, a microvax is surprisingly low power
00:08:00 <heat_> isn't sdf super slow?
00:08:00 <geist> heat_: for a irc client does it need to be fast?
00:09:00 <geist> i mean my VAAAAX does it just fine
00:09:00 <geist> or my 386 dos machine
00:09:00 <heat_> it doesn't need to be fast, but it probably shouldn't be super slow either
00:09:00 <geist> but really i should finish my irc client on LK and use that on some board. that's the Achievement some of us have unlocked around here
00:09:00 <heat_> but idk how slow sdf is
00:10:00 <leg7> guys thanks for helping me debug the gdt
00:10:00 <geist> it's not particularly. sdf shells are just into one of about 8 fairly reasonable netbsd machines
00:10:00 <leg7> It's 2am
00:10:00 <leg7> gtm
00:10:00 <leg7> gtg*
00:10:00 <geist> maybe 100 people logged in, but most people are just running some command line app
00:10:00 <geist> leg7: later! grats on getting it working
00:10:00 <leg7> ^^
00:10:00 <leg7> o/
00:10:00 <nikolapdp> my irc client is running on a pdp-11 emulated at realistic speed
00:11:00 <nikolapdp> irc clients are not very demanding
00:11:00 <geist> nikolapdp: hmm, i was just thinking of doing that? what OS is that on?
00:11:00 <nikolapdp> this is bsd 2.11
00:11:00 <geist> i have RSX11m running on mine right now, but i doublt there's an IRC client there
00:11:00 <kof673> sdf use to run alpha on netbsd IIRC :D
00:11:00 <kof673> *netbsd on alpha
00:11:00 <nikolapdp> i sent you my port of sic haven't i, geist :)
00:11:00 <heat_> does 2.11 BSD have named fifos?
00:11:00 <geist> nikolapdp: ooh no. i was gonna ask what irc client is available for BSD 2.11?
00:12:00 <heat_> if so you could use that horrible suckless irc client that uses fifos
00:12:00 <geist> i would lvoe to get that running on my pidp11 or so
00:12:00 <CompanionCube> geist: there is also an openbsd one now
00:12:00 <nikolapdp> geist: https://github.com/minnerlas/sic
00:12:00 <bslsk05> ​Minnerlas/sic - Sic IRC client for BSD 2.11 (0 forks/2 stargazers/MIT)
00:12:00 <nikolapdp> i ported it to 2.11 a while ago
00:12:00 <geist> oh cool, will do!
00:13:00 <CompanionCube> https://sdf.org/?status load looks fine too
00:13:00 <bslsk05> ​sdf.org: SDF Public Access UNIX System - Free Shell Account and Shell Access
00:13:00 <Ermine> there's ahti.space also
00:13:00 <geist> CompanionCube: yeah, it's surprising (not really) how many shell accounts a modern machine can sustain at once
00:14:00 <geist> simple command line stuff you probably run out of /dev/tty entries before the machine starts to show load
00:14:00 <geist> unless everyones compiling at once or whatnot
00:15:00 <heat_> Ermine, you have an ahti acc?
00:15:00 <Ermine> I don't
00:15:00 <geist> nikolapdp: is that yours?
00:15:00 <Ermine> but you do I guess?
00:15:00 <geist> like did you write it from scratch?
00:15:00 <heat_> yeah i have one
00:16:00 <nikolapdp> no, i ported it geist
00:16:00 <heat_> sic is what the naz- i mean the suckless people have
00:16:00 <geist> it is MIT, i might be able to port it to LK. honestly the main reason i dont do much with IRC on LK is because i really have no interest in writing an IRC client aside from the very basics
00:16:00 <heat_> they think its a great great client
00:17:00 <geist> oh hmm, seems to rely on select and whatnot
00:17:00 <CompanionCube> the thing with irc-on-sdf is that they don't include screen/tmux in the one-time upgrade, that's part of a monthly package with mostly other stuff
00:17:00 <heat_> geist, write a unix
00:17:00 <nikolapdp> yeah it's waiting on stdin and socket
00:17:00 <heat_> on top of lk
00:17:00 <Ermine> heat_: gotta admit that the idea is ingenious, though it's not practical
00:18:00 <geist> yah i've been fiddling with it fro time to time, but honestly dealing with libc is so much un-fun i just ugh
00:18:00 <Ermine> like pifs
00:18:00 <heat_> geist, use musl and implement the linux interface, ez
00:18:00 <geist> pifs like the things in windows 3.1 to point to a program?
00:18:00 <heat_> well "ez"
00:19:00 <geist> heat_: i did make an attempt at it
00:19:00 <geist> got it kinda compiling
00:19:00 <heat_> you don't need to deal with libc is my point
00:19:00 <heat_> musl even packages its own uapi headers
00:19:00 <geist> i mean i have it kinda working with newlib, but only to the poit that it starts and runs a few user programs
00:20:00 <geist> but then i got side tracked trying to finish the FAT implementation so i had enough FS to do something interesting with
00:20:00 <geist> and clever was working on ext4 at the time, so i left that to him
00:20:00 <Ermine> geist: https://github.com/philipl/pifs
00:20:00 <bslsk05> ​philipl/pifs - πfs - the data-free filesystem! (291 forks/6557 stargazers/GPL-3.0)
00:20:00 <geist> but then clever didn't finish it.
00:20:00 * geist curses clever
00:20:00 <heat_> your big problem is that as soon as you start implementing UNIX you'll need to rework stuff to be more complex
00:20:00 <Ermine> s i m p l i c i t y
00:21:00 <heat_> like you'll need a full vfs for basic fd usage and poll and all that jazz
00:24:00 <geist-sdf> ah here we go
00:24:00 <Ermine> Hello there
00:24:00 <heat_> netbsd
00:25:00 <nikolapdp> hello there
00:25:00 <geist> heat_: yeah i had implemented a fair amount of that for newos back in the day
00:25:00 <geist-sdf> i should leave a client connected here too
00:26:00 <Ermine> which shell is there on sdf?
00:29:00 <geist> looks like a giantic array, base don what is in /etc/shells
00:30:00 <geist> pretty much anything you could want
00:30:00 <geist> the default seems to be ksh
00:33:00 <heat_> is there a way to get a block IO journal from QEMU? or at least some kind of log
00:33:00 <geist-sdf> like a log of all the activity other than -d trace:something?
00:35:00 <heat_> -d trace would be /okay/ as long as there's some stable-ish tracepoint to attach to
00:35:00 <heat_> ideal would be an actual journal
00:36:00 <zid> geist is doing signed distance fields now?
00:36:00 <zid> oh nikolapdp is alive
00:36:00 <nikolapdp> hello zid
00:37:00 <zid> nikolapdp did you EoE yet
00:37:00 <nikolapdp> not yet
00:37:00 <zid> smh
00:37:00 <zid> do it quick before shinji's mental state evaporates from your consciousness
00:37:00 <zid> you really wanna be in the zone the moment it starts
00:37:00 <nikolapdp> lol
00:37:00 <zid> cus.. of a certain scene
00:38:00 <nikolapdp> lol ok
00:48:00 <Ermine> what are you trying to accomplish?
00:48:00 <heat_> debug fs corruption
00:50:00 <geist-sdf> yah a log of all the writes would be ace
00:56:00 <heat> i need something to just... randomly trace functions
00:56:00 <heat> that would be great
00:56:00 <heat> i think logging all the writes wouldn't be as amazing as i was thinking cuz then i'm lacking all of the context
00:57:00 <Ermine> I have no single idea of how kvm works, but maybe it's doable with some ebpf program?
00:58:00 <heat> no, most (virtually all) devices are handled in qemu
02:24:00 <zid> some bastard thing bit me, I blame heat
02:25:00 <heat_> sorry
03:31:00 <heat_> found the bug
03:32:00 <heat_> my nvme driver was mishandling the case where i had 2 sgls instead of >= 2 or just 1, so i was writing trash to contiguous sectors when block IO plugging was happening (and i was merging requests)
10:49:00 <leg7> btw
10:50:00 <leg7> whoever told me I couldn't have the intel manual under cvs was right
10:50:00 <leg7> so I removed it
10:50:00 <leg7> :(
10:50:00 <leg7> proprietary 0s and 1s
10:50:00 <GeDaMo> https://en.wikipedia.org/wiki/Illegal_number
10:53:00 <leg7> nice read tp
10:53:00 <leg7> ty*
10:56:00 <Ermine> books tend to be proprietary
10:57:00 <zid> anything written down by anyone is instantly copyrighted
10:57:00 <zid> you need a licence to do anything with it
10:58:00 <leg7> not really afaid if you write down something it's unlicensed
10:58:00 <leg7> afaik*
11:41:00 <zid> where heat
11:42:00 <zid> https://i.imgur.com/AKjzRH8.jpeg
11:42:00 <bslsk05> ​i.imgur.com <no title>
12:13:00 <leg7> When you read hex codes do you convert them to binary in your head?
12:13:00 <leg7> or decimal?
12:13:00 <leg7> I find myself always converting to binary
12:14:00 <zid> depends what I am doing?
12:14:00 <leg7> ok
12:14:00 <zid> "number of elements in this array", decimal
12:14:00 <zid> "This is a bitmask for selecting bits 13 throug 17", binary
12:14:00 <zid> "this is an address", hex
12:14:00 <zid> etc
12:14:00 <leg7> ok I was wondering when do you just interpret it as hex
12:14:00 <zid> hex is just binary written funny though bear in mind, each digit is 4 binary digits
12:15:00 <zid> so either work
12:15:00 <leg7> yeah that's how I use it
12:15:00 <leg7> I just find that most of the time it should be written in a different base
12:15:00 <leg7> because you're going to be converting it so there wasn't really much point in writing it hex besides making it concise
12:15:00 <zid> should be?
12:15:00 <leg7> and avoiding errors maybe
12:16:00 <leg7> What is octal good for?
12:16:00 <zid> for values that express things in groups of 3 bits
12:16:00 <leg7> like linux perms
12:16:00 <zid> unix file permissions is on-
12:16:00 <zid> which is why chmod takes an octal value
12:17:00 <leg7> yeah makes sense
12:28:00 <leg7> are there cpus that don't use interrupts?
12:34:00 <zid> sure, just don't connect the interrupt pins to things
12:35:00 <zid> pretty sure every microwave oven i've ever used has done this, given how shitty and unresponsive the buttons always are
12:35:00 <zid> just gotta wait for it to poll
12:35:00 <wantyapps> zid: ROFL
12:37:00 <leg7> So the only alternative to interrupts is polling?
12:38:00 <zid> there's also telepathy
12:38:00 <zid> (results may vary)
12:39:00 <leg7> well quantum magic would work
12:40:00 <zid> we have that already it's called DMA
12:41:00 <leg7> I meant quantum entanglement
12:44:00 <zxrom> leg7, Quantum entanglement is bullshit, forget it.
12:45:00 <leg7> Why?
12:47:00 <gog> i'm in a box and im simultaenously dead and alive
12:55:00 <leg7> Should I bother setting up the 8259 pic or use the APIC straight away?
13:03:00 <heat_> 8259 pic
13:03:00 <heat_> it's drastically simpler and you won't need to mess with fucking ACPI
13:12:00 <zid> 8259 is nice and easy
13:12:00 <zid> and works well enough even for pci-e
13:13:00 <zid> according to qemu
13:14:00 <gog> MADT
13:41:00 <pounce> qemu is poggers
13:44:00 <zid> pumas are qoggers
14:02:00 <nikolar> You can't use 8259 and other cores though
14:02:00 <nikolar> You need apic for that
14:08:00 <heat> good
14:08:00 <heat> other cores are pessimal
14:08:00 <nikolar> Locks are PESSIMAL
14:08:00 <nikolar> we do cli here
14:09:00 <zid> other cores honestly slows down your main core significantly
14:09:00 <zid> from all the locking and ipis and stuff, just don't bother, way faster
14:09:00 <heat> cache line bouncing is a fraud
14:10:00 <heat> they don't wnat you to look into it
14:11:00 <heat> i feel exhausted after saying awake all night watching ufc
14:11:00 <heat> totes worth it tho
14:18:00 <nikolar> Lol
15:50:00 <kof673> > [PDF] An Overview of the NetWare Operating System - USENIX www.usenix.net › library › proceedings › full_papers › minshall The hardware poll list is a regular, background, polling list > https://man.freebsd.org/cgi/man.cgi?query=polling
15:50:00 <bslsk05> ​www.usenix.net: USENIX | The Advanced Computing Systems Association
15:50:00 <bslsk05> ​man.freebsd.org: polling
15:51:00 <kof673> > when done properly, polling gives more control to the operating system on when and how to handle devices, with a number of advantages in terms of system respon-siveness and performance
15:51:00 <kof673> in particular, it supposedly is better under "heavy load" in any case, some osen have such features
15:54:00 <heat> yea
15:54:00 <heat> linux also supports polling on the storage stack
15:54:00 <heat> no idea if windows does
15:59:00 <kof673> > What is octal good for? https://en.wikipedia.org/wiki/36-bit_computing
16:01:00 <kof673> > CompuServe was launched using 36-bit PDP-10 computers in the late 1960s. It continued using PDP-10 and DECSYSTEM-10-compatible hardware and retired the service in the late 2000s. # there is a k&r c compiler, sort of hacked to compile on dos/windows/linux/etc. i believe, and you would then transfer the output and assemble on the target :D
16:01:00 <kof673> *on github kcc maybe? do not recall
16:02:00 <kof673> somewhere i read that is why it exists/was "ported", because compuserve was still using it at some point lol
16:12:00 <zid> Polling? In my kernel? It's more likely than you think!
16:12:00 <nikolar> Lol
16:13:00 <heat> polling is like the most micro-optimization feature one could add to a kernel
16:13:00 <zid> It makes sense for certain loads
16:14:00 <zid> a router maybe
16:14:00 <zid> or file server
16:14:00 <zid> where you'd rather not get 0 work done because you're getting 800 interrupts a second, and would rather just churn through an ever-lengthening backlog
16:14:00 <zid> 80000*
16:14:00 <heat> like storage polling makes sense if you have 100 nvmes hooked up and at 100% usage such that hogging the CPU for an extra bit makes sense just to avoid the interrupt churn
16:14:00 <zid> exactly
16:15:00 <zid> if load == 100%
16:15:00 <zid> then interrupts are a waste of time
16:15:00 <zid> interrupts are mainly useful for wakeup
16:15:00 <heat> it's basically a "i'm a hyperscaler and need this for a very very specific reason" feature
16:16:00 <kof673> 24-bit, 48-bit (DSPs) i guess too :D > http://chameleon.synth.net/english/developers/ the sdk has a simulator, works with wine, as does the sdk (command-line utils at least) > the only open DSP hardware in the world [*] [* around 2006] > The development tools are completely free and there are no strings attached
16:16:00 <bslsk05> ​chameleon.synth.net: Home of the Chameleon
16:16:00 <kof673> in any case, there are 2 "octal" systems with simulators :D
16:34:00 <bauen1> can someone give me a reality check ? I have an armv7m system, and if I run
16:34:00 <bauen1> can someone give me a reality check ? I have an armv7m system, and if I run 'bx r1' with r1 = 0x20003439 ; then the processor for the love of everything should NOT attempt to switch from Thumb mode to ARM mode, right ?
17:42:00 <heat> is there a good term for "make something positive"
17:42:00 <heat> negativize sucks, positivize also sucks
17:43:00 <GeDaMo> Absolutize?
17:44:00 <leg7> pessimize
17:44:00 <leg7> optimize
17:44:00 <heat> GeDaMo, no, this is not a number
17:44:00 <heat> but negative cache dentry vs positive cache dentry
17:45:00 <leg7> https://dictionary.cambridge.org/dictionary/english/optimize
17:45:00 <bslsk05> ​dictionary.cambridge.org: OPTIMIZE | English meaning - Cambridge Dictionary
17:48:00 <GeDaMo> reveal, embody, materialize
17:50:00 <heat> hmm, good words, thanks
17:50:00 <GeDaMo> posit
17:50:00 <heat> this is a wordle moment
17:50:00 <GeDaMo> Wake up, zid! :P
17:54:00 <zid> heat: https://www.youtube.com/shorts/L2UMyb9PIHI?feature=share
17:54:00 <bslsk05> ​'Why Is C SO Dangerous? #programming #coding #lowcode' by Low Level Learning (00:00:51)
17:54:00 <zid> heat: positive metaphrically or positive numerically?
17:54:00 <zid> (close after 3 seconds)
17:54:00 <heat> his explanation is wrong
17:55:00 <zid> yea he's an idiot, but the first one second is great
17:55:00 <zid> better comedian than anything else
17:55:00 <heat> ok so basically: the directory cache has positive entries (actual files) and negative entries (not files, basically THIS NAME IS NOT HERE)
17:55:00 <heat> so it's positive metaphorically
17:56:00 <zid> but
17:56:00 <zid> what computer wise makes them positive or negative
17:56:00 <heat> the presence of a file in the filesystem with that name
17:56:00 <zid> no
17:56:00 <zid> not what causes it
17:57:00 <zid> struct { ??? }
17:57:00 <heat> oh, it's just a flag
17:57:00 <zid> but it's not a sign bit?
17:57:00 <zid> it's literally just a flag?
17:57:00 <heat> yep
17:57:00 <zid> That's weird, grats
17:57:00 <heat> this has no relation with numbers at all
17:57:00 <zid> red and black
17:58:00 <heat> negative dentries basically just cache the absence of stuff
17:58:00 <zid> black dentries.
17:58:00 <zid> Rather than red dentries.
17:58:00 <heat> which is the exact opposite of a normal cache entry for most caches
17:59:00 <GeDaMo> "We searched but did not find"
18:17:00 <netbsduser> they have those in dragonfly bsd
18:17:00 <heat> don't they have them in every unix?
18:17:00 <netbsduser> negative entries not so often
18:17:00 <kof673> (paraphrase) "they were digging for the source of the water, but could not find it. they couldn't see because they were blind" [putrification is done in darkness lol]
18:18:00 <netbsduser> i think the BSD VFS is quite ugly and dragonfly does a much nicer job at it because they use namecache locking to carry out e.g. the lookup-and-if-negative-create which on other BSDs is done by having a special flag to lookup VFS op that keeps the directory locked
18:21:00 <netbsduser> or i might be thinking of rename
18:23:00 <netbsduser> whatever be it, i don't care for the 4.4bsd vfs much, they introduced innovations which diluted the cleanness of the vfs as it was in solaris, which it's roughly copied from, but with horrible complicated new locking protocols and the use of the `lock` vnode op for kernel synchronisation purposes rather than just for file locking
18:28:00 <leg7> heat you could name the flag `cached`
18:28:00 <leg7> or `treated`
18:28:00 <leg7> known
18:29:00 <leg7> exists
18:30:00 <heat> i dont need a name for the flag, i need a name for the verb
18:31:00 <kazinsal> "confirm"
18:32:00 <GeDaMo> potentiate
18:32:00 <zid> what action are you performing
18:32:00 <heat> turning a negative dentry into a positive dentry by the means of creating something at that location
18:33:00 <zid> flipping
18:33:00 <zid> is nice and generic
18:33:00 <heat> flip is good
18:33:00 <heat> i also liked materialize
18:33:00 <zid> please like it less
18:33:00 <zid> https://i.imgur.com/AKjzRH8.jpeg
18:33:00 <bslsk05> ​i.imgur.com <no title>
18:34:00 <heat> i agree
18:38:00 <Ermine> meow
18:40:00 * Ermine writes down the idea of caching absence of something
18:41:00 <heat> it's super required for unix filesystem performance, cuz of all the silly queries for shit that doesn't exist
18:42:00 <heat> locally other caching may somewhat save you, remotely you're dead in the water
18:44:00 <Ermine> Are that many queries that get enoent response?
18:45:00 <heat> yes
18:46:00 <heat> for a quick test just do "command_that_totally_doesnt_exist" in your shell and watch it try to stat for it for every path in $PATH
18:46:00 <heat> with strace ofc. or just compile a program in gcc and watch it access() or stat() a bunch of include paths looking for your include
18:46:00 <Ermine> i saw that behaviour in musl execp*
18:47:00 <Ermine> i see now
18:47:00 <kof673> IMO at some level conceptually/metaphorically if it was memoization, say void * lookup(int a) you would surely memoize all results, not just the non-NULL ones etc.
18:48:00 <kof673> i don't think it is that strange anyways, just approached from another angle may seem like it is
18:48:00 <heat> well, that's exactly what you do
18:48:00 <heat> you cache valid results and you cache ENOENTs (other results are tricky to cache cuz they may be transient)
18:49:00 <kof673> well transience is a separate issue, but makes sense
18:49:00 <kof673> was just replying to that > writes down the idea of caching absence of something
18:49:00 <Ermine> so open(O_CREAT) should invalidate the cache?
18:50:00 <Ermine> or the entry
18:50:00 <heat> no!
18:50:00 <heat> say the dentry is something like
18:51:00 <heat> struct dentry {unsigned int flags; struct inode *inode;};
18:51:00 <heat> O_CREAT sees the negative dentry, creates the entry in-filesystem and does "dent->inode = new_inode; dent->flags &= ~DENTRY_NEGATIVE;"
18:51:00 <heat> done, converted to positive dentry, ezpz
18:52:00 <Ermine> z
18:52:00 <heat> it saves me a bunch of work too, cuz you had to create a positive dentry anyway
18:52:00 <Ermine> ah, i see
20:12:00 <leg7> Can someone share their IDT ISR implementation?
20:17:00 <geist> the IDT itself, or the implementation of the handlers?
20:17:00 <geist> https://github.com/littlekernel/lk/blob/master/arch/x86/32/exceptions.S stamps out 256 of them and fills in an IDT pointing to them all
20:17:00 <bslsk05> ​github.com: lk/arch/x86/32/exceptions.S at master · littlekernel/lk · GitHub
20:19:00 <leg7> the idt itself I wrote in C earlier
20:19:00 <leg7> I would like to know how to fill it up with isrs now
20:19:00 <geist> then only the top part is of your concern
20:20:00 <geist> that code does the standard thing: for every vector it implements a 2 or 3 instruction stub that pushes the interrupt number and then branches to a shared piece of code
20:20:00 <geist> which pushes all the state and then calls into C code (x86_exception_handler)
20:21:00 <geist> if you're not familiar with gnu assembly, the trick is https://github.com/littlekernel/lk/blob/master/arch/x86/32/exceptions.S#L22
20:21:00 <bslsk05> ​github.com: lk/arch/x86/32/exceptions.S at master · littlekernel/lk · GitHub
20:21:00 <geist> that repeats the stamping out of that macro 256 times
20:22:00 <geist> in this case, since every entry point is 16 byte aligned, the code that later fills in the IDT can just start at the base of the vectors and add 16 for each of them
20:22:00 <leg7> What macro is it repeating
20:23:00 <geist> everything between rept and endr
20:23:00 <leg7> ok
20:23:00 <geist> sorry it's not a macro
20:23:00 <zid> either push i jmp, or push 0 push i jmp
20:23:00 <geist> it just stamps out that body 256 times
20:23:00 <zid> for exception vs interrupt
20:23:00 <geist> yep that's what that if statement at line 25 is
20:23:00 <zid> push %0 rather, argument 0
20:23:00 <zid> not an actual 0
20:24:00 <geist> it skips pushing an extra zero. this way when you get to the C code there's a consistent iframe
20:24:00 <zid> or maybe I read it wrong cus at&t idk
20:24:00 <leg7> gas is so bad omg
20:24:00 <geist> https://github.com/littlekernel/lk/blob/master/arch/x86/include/arch/x86.h#L28
20:24:00 <bslsk05> ​github.com: lk/arch/x86/include/arch/x86.h at master · littlekernel/lk · GitHub
20:24:00 <geist> is the iframe that endsup being pushed
20:25:00 <geist> $ means constant
20:25:00 <zid> ah okay so it is an actual 0
20:25:00 <zid> so that you have a consistent frame and it's just padding, right
20:26:00 <geist> and yeah the other trick as i was saying is it aligns each of those on a 16 byte boundary, so the IDT code that fills it in later can just for offset = 0, offset += 16
20:27:00 <geist> i used to have the vaneers packed in but the problem is due to the codegen and whatnot they're not a consistent size
20:28:00 <geist> and the amount of code later to manually fill in every vector is greater than just adding the padding
20:28:00 <geist> and the padding nicely aligns things for performance purposes anyway
20:29:00 <zid> I wonder if push rax would be better because smaller
20:29:00 <zid> or worse because it might stall a bit sometimes
20:29:00 <geist> cant because we haven't saved rax at this point
20:29:00 <geist> so can't use any registers
20:29:00 <zid> you're only pushing it, as a dummy value, it doesn't 'use' it
20:30:00 <geist> ah i see what you mean. nah i think the push 0 is pretty small
20:30:00 <geist> anything < 0x80 ends up being like a 2 byte instruction i think
20:30:00 <geist> it's when it goes over 0x80 that it switches to a 4 byte constant
20:30:00 <geist> there's a push imm8 form
20:31:00 <geist> this was a bug that heat hadn pointed out to me a few months ago, because the vaneers for vectors >= 0x80 were 4 bytes longer and i hadn't reserved enough space in the alignment
20:31:00 <zid> oh yea it's literally 6A
20:31:00 <zid> pushsx :P
20:31:00 <leg7> I need to handle interrupts to get PS/2 kb input right?
20:31:00 <zid> not if you don't use interrupts, yes if yes
20:31:00 <geist> if you're willing to poll, no
20:31:00 <zid> no if no
20:32:00 <geist> but you'll want interrupts soon enough for timers too
20:32:00 <zid> I still don't have timers, cus I don't have that kind of task switching
20:32:00 <leg7> wouldn't polling involve a timer that uses interrupts?
20:32:00 <geist> generally getting interrupts working, at least trapping things and dumping a "i fucked up heres the regs" is about the second thing i'd do
20:32:00 <geist> which is about where you're at
20:32:00 <zid> leg7: insteadof while(1) hlt();
20:32:00 <zid> you do while(1) { check_keyboard(); check_ethernet(); check_...(); }
20:33:00 <zid> a timer interrupt would stop it catching fire, but isn't needed
20:33:00 <zid> not that we're recommending it
20:33:00 <zid> just add interrupts
20:33:00 <geist> but like i said at least catching all the exceptions and halting the system is pretty good at this point
20:33:00 <zid> It's actually really eas
20:33:00 <geist> since you'll be able to debug other failures
20:34:00 <Ermine> geist: I guess you can't make IDT in C like you did arm vectab?
20:34:00 <zid> You do 11 magic outbs, and fill out a table and execute lidt
20:34:00 <zid> done
20:34:00 <zid> The table is like the gdt but way way simpler
20:34:00 <leg7> yeah I didn't plan to skip interrupts I was just reading the osdev wiki and it didn' really mention you need interrupts for ps/2
20:34:00 <geist> Ermine: I could. i did it in asm because it branches to it very very early before C is even ready
20:34:00 <zid> I mean, you don't, unless you want interrupt driven ps/2
20:35:00 <geist> really i wish i could hard code it, but that's a limitation of ELF and whatnot
20:35:00 <geist> since the base address is split across two fields, the linker can't handle that
20:35:00 <geist> in both asm and C you can't do something like
20:35:00 <zid> can you not add a relocation type for it? :D
20:35:00 <zid> HI() and LO() and stuff sometimes exist to generate those etc
20:35:00 <geist> yeah but they dont exist for x86
20:35:00 <zid> rip
20:36:00 <zid> time to port binutils and add a custom reloc
20:36:00 <geist> wel, ctualy one of the issues is LK also compiles with clang and links with lld, and those tend to be a bit pickier
20:36:00 <geist> a bit less easy to badger those tools to weird places
20:36:00 <geist> they'r emore by the book
20:37:00 <zid> I just use attribute__((interrupt)) which actually works on x86 now!
20:37:00 <geist> i do that for a few of the arches i haven't put much time into, but they all have a fatal flaw
20:37:00 <geist> you can't get an iframe from then, because they just pushed whatever on the stack it needs
20:37:00 <geist> it's nice for quick n dirty ports, but it falls apart super fast
20:38:00 <zid> it'd work if you had a kernel stack per thing that could interrupt though right? just put away the stack page along with the stack pointer etc. I assume the reason you want to know how much of the stack is used etc is so you can inspect it
20:38:00 <geist> it's all about having a consistent frame so you can dump the state on error
20:38:00 <zid> disregard errors
20:38:00 <geist> it's per arch, but the arches where the compiler has it they just dump what they need to
20:39:00 <geist> it's true if you disregard errors it's a convenient and probably fairly efficient way to handle the state dump
20:39:00 <zid> the amd64 one at least is hardcoded and I know what it does.. I could cheat that way
20:40:00 <zid> it always pushes r11, r10, r9, r8, rdi, rsi, rcx, rdx, rax in that order
20:40:00 <zid> oh right, boo
20:40:00 <geist> but at this point i actually want to really press upon leg7 the notion that they (preferred pronoun?) need to build up the debuggability so it can accellerate future development
20:40:00 <zid> It *doesn't* push r15, because it wasn't used in what was called-into, as as 'optimization'
20:41:00 <zid> I see exactly what you mean now
20:41:00 <zid> It'd be nice if there was an option for that
20:41:00 <geist> yah i think it basically pushes the temp registers, and then the rest as needed
20:41:00 <zid> yea it just pushes the sysv-abi regs
20:41:00 <zid> oh wait, no
20:41:00 <zid> r15 is callee saved, so they *won't* corrupt it
20:41:00 <zid> this should be fine in all cases
20:41:00 <geist> indede. though of course depending on that layout is a Bad Idea
20:41:00 <heat_> yeah when doing an arch port trap handling is like... the second thing i deal with, right after getting a bare bones boot environment
20:42:00 <zid> yea it's not.. ideal
20:42:00 <zid> but it should be so robust that most other things will break before it tbh
20:42:00 <geist> also its per arch and per compiler. no idea if clang or whatnot implements that yet
20:42:00 <zid> amd64 attribute interrupt isn't exactly getting a lot of churn
20:42:00 <zid> yea the main issue is wtf do you do on other compilers
20:42:00 <geist> well, except AFAIK it wasn't implemented a few years ago
20:42:00 <zid> buut you might end up with 'other assemblers' in the case, so it's not like doing it in inline assembly is going to work either
20:42:00 <heat_> i do roughly early mmu -> early boot env -> traps -> actual mmu and then add things as the need arises
20:43:00 <geist> sort of. on arches that implement attribute((naked)) you can do it in C
20:43:00 <zid> so imo interrupt entry code is probably pretty heavily tied to compiler/assembler/binutils combo enough that you could probably just rely on this *in the gcc case*
20:43:00 <heat_> eventually jumping to interrupts for scheduling and/or userspace
20:43:00 <geist> but in that case you're just using inline asm instead of putting it in an .S file
20:43:00 <zid> yea this is just "my inline asm impl. is attribute interrupt"
20:43:00 <geist> heat_: yah asically
20:44:00 <geist> i should formally name it like stage 1 stage 2 stage 3 or something, since various ports in LK are in various places
20:44:00 <zid> if clang doesn't support it then clang can get its own inline for its weird plan9 syntax
20:44:00 <geist> like for example, microblaze (i'm thtinking about deleting it since its not really used anywhere) uses the attribute interrupt
20:44:00 <geist> https://github.com/littlekernel/lk/blob/master/arch/microblaze/exceptions.c#L13
20:44:00 <bslsk05> ​github.com: lk/arch/microblaze/exceptions.c at master · littlekernel/lk · GitHub
20:44:00 <zid> geist: stage 2 should be called warp, 3 should be for work groups
20:45:00 <geist> though somewhat as you'd expect, the cisc architectures are generally much easier to write exception handlers for: https://github.com/littlekernel/lk/blob/master/arch/m68k/exceptions_asm.S#L18
20:45:00 <bslsk05> ​github.com: lk/arch/m68k/exceptions_asm.S at master · littlekernel/lk · GitHub
20:45:00 <leg7> I'm a dude
20:45:00 <geist> push and go
20:45:00 <geist> leg7: cool, i just dont like to assume pronouns
20:45:00 <leg7> yeah
20:45:00 <heat_> least texan texan
20:46:00 <leg7> I got a pretty comfy debugging setup
20:46:00 <leg7> rn
20:46:00 <geist> i saw that, i've only seen that level of gdb + qemu set up with i think doug16k
20:46:00 <heat_> what level?
20:46:00 <geist> it's over 9000
20:46:00 <leg7> I automated everything so I just need to open the debugger and set a breakpoint
20:47:00 <leg7> tbh the gdb gui is doing the heavy lifting it's so nice
20:47:00 <heat_> i also have gdb, i just barely use it
20:47:00 <heat_> except for inspecting crash state
20:47:00 <heat_> i do that pretty often
20:47:00 <geist> yah same. i dont use gdb at all, but if other folks put the time in to get it going, good for them
20:47:00 <leg7> you should try the gui I use it'll make you use it all the time
20:47:00 <zid> heat_: He's very open minded, he don't care if you're a trans girl, trans boy, or normal.
20:48:00 <zid> *redneck by red truck jpg*
20:48:00 <heat_> lmao
20:48:00 <heat_> leg7, no, i have like literally 0 use for gdb
20:48:00 <heat_> it doesn't work when you add scheduling, it doesn't work when you add SMP
20:48:00 <zid> I use gef it's great :p
20:48:00 <geist> wel i mean just new people to the channel i never assume pronoun until either they use it themselves, say something, or eventually i just ask
20:49:00 <leg7> https://github.com/nakst/gf
20:49:00 <bslsk05> ​nakst/gf - A GDB frontend for Linux. (42 forks/1420 stargazers/MIT)
20:49:00 <heat_> and most importantly you don't have gdb in real hardware
20:49:00 <heat_> printf is goated
20:49:00 <heat_> or, if you're fancy, an actual tracing interface
20:49:00 <Ermine> printk
20:49:00 <geist> agreed, Back In My Day we didn't have emulators
20:49:00 <geist> you wrote the shit to a floppy disk and booted it
20:49:00 <leg7> https://gitlab.com/nakst/essence
20:49:00 <bslsk05> ​gitlab.com: nakst / essence · GitLab
20:49:00 <geist> if you were fancy you hooked up a com port
20:49:00 <geist> (actually that's almost mandatory, since real PCs have a tendency to triple fault and clear the screen)
20:50:00 <Ermine> My first success in editing linux sources was making it swear in some places
20:50:00 <geist> my usual i dunno where it's failing thing is to just put in an infinite loop and then binary search for where it goes off in the weeds
20:50:00 <Ermine> (I was figuring out why goodix driver stopped working for my touchscreen)
20:50:00 <geist> but yeah i guess GDB would be noice sometimes
20:50:00 <zid> https://cdn.discordapp.com/attachments/417023075348119556/1229172005530632202/image.png?ex=662eb6a3&is=661c41a3&hm=34b6a7139f6c0ae9bd9cee696605223880aa449c5c3b26bd1873b99c54a27fa9&
20:50:00 <zid> gef is the tits
20:51:00 <heat_> Ermine, oh yeah i've just used printk("fuck") and panic("fuck")
20:51:00 <leg7> Is this channel bridged with discord?
20:51:00 <heat_> no
20:51:00 <zid> godno
20:51:00 <leg7> ok I just see discord links
20:52:00 <zid> That's a link to a picture
20:52:00 <zid> of gef
20:52:00 <Ermine> I've printed fuck $exit_code or fuck $funcname
20:52:00 <zid> I usually use the serial port cus printk is easy to not be able to see
20:52:00 <leg7> yeah I thought maybe you were on discord and uploaded the image and I just see the link
20:52:00 <zid> my playstation debugging is all printfs over the serial port
20:52:00 <Ermine> but why panic("fuck")?
20:53:00 <zid> heat_: do u liek my debuger?
20:53:00 <zid> other than the fact for some reason the stack isn't showing
20:53:00 <leg7> isn't it just gdb tui?
20:53:00 <zid> it's gef
20:53:00 <leg7> when you type `layout asm`
20:53:00 <zid> it's some big python repl thing over gdb
20:53:00 <zid> with a bunch of built ins for doing debuggering
20:54:00 <zid> it can spit out pwntools scripts and other weird things
20:54:00 <heat_> Ermine, because usually my problems are too complex for an 80x25 screen
20:54:00 <zid> That's why I use 6 of them, heat
20:54:00 <leg7> lol
20:57:00 * geist-sdf yawns
20:59:00 <heat_> i hate refcounting i swear
20:59:00 <geist-sdf> agreed
21:00:00 <heat_> https://i.imgur.com/BwwM1WS.png this is what i mean
21:00:00 <bslsk05> ​i.imgur.com <no title>
21:00:00 <heat_> gdb will not help at all
21:00:00 <heat_> i have hundreds of file system operations per boot, and my boots are pretty simple
21:00:00 <zid> file kernel.bin file <whatever process is running>, throw a breakpoint on the 'killing cpus' line, gg
21:01:00 <zid> but yea, debuggering that isn't a debugger job
21:01:00 <zid> it's a FLAMEGRAPH job
21:01:00 <leg7> What is refcounting?
21:02:00 <zid> counting references
21:02:00 <kof673> http://catb.org/jargon/html/koans.html
21:02:00 <bslsk05> ​catb.org: Some AI Koans
21:02:00 <heat_> literally what zid said
21:02:00 <kof673> Moon instructs a student
21:02:00 <leg7> duh in what context
21:03:00 <zid> thing cab be free
21:03:00 <zid> when no more reference to thing
21:03:00 <zid> how do you know no more refernece? count them.
21:03:00 <zid> i.e if I tell you to delete a file, but file has 3 people with file open, I know I can actually delete file when 0 people have file open
21:03:00 <leg7> oh ok
21:03:00 <zid> I need to count to 3 to know this
21:04:00 <zid> heat_: Have you considered adapting rfc-2322?
21:09:00 <Ermine> nonetheless, stopping windows by attaching kd is fun
21:11:00 <Ermine> supposedly there are more useful ways to use kd
21:52:00 <Ermine> lol https://www.reddit.com/r/archlinux/comments/1c3p2i7/why_is_there_so_much_people_building_librewolf/
21:52:00 <bslsk05> ​www.reddit.com <no title>
22:08:00 <heat_> i oopsied my namei code into creating a file with a / in it
22:09:00 <nikolapdp> lol
22:10:00 <gog> oopsie doodle
22:11:00 <heat_> anyway NEGATIVE DENTRIES!
22:11:00 <nikolapdp> does it show up when you ls or something
22:11:00 <heat_> and refactored a bunch of shit and i think i fixed some more namei tests
22:11:00 <heat_> nikolapdp, yep
22:11:00 <nikolapdp> lol nice
22:12:00 <wantyapps> Yay I got a shell working :)
22:12:00 <geist> i've neer completely figured it out but i think some shells prune things out of the path too
22:13:00 <geist> i've seen situations where a path comes into existance where PATH points, and the shell wont pick it up
22:13:00 <geist> so presumably it keeps a list of dirs that it wont even try next time
22:13:00 <heat_> there's a cache in most shells, but it's a positive cache only
22:13:00 <nikolapdp> you need to hash -r to update usually
22:14:00 <geist> ah, TIL!
22:14:00 <heat_> but this does mean that if it gets a hit and then you change PATH, it probably won't pick it up
22:14:00 <heat_> unless you hash -r
22:14:00 <geist> yah actuall i think it happens when you add some sort of overriding thing in /usr/local/bin or something, and it doesn't pick up the new one
22:15:00 <geist> hash -r, that's useful. i aways just restart the shell
22:15:00 <clever> bash will also rehash if you `export PATH=$PATH`
22:15:00 <clever> even though its a no-op, bash still considers it a change
22:15:00 <nikolapdp> you're welcome geist :)
22:16:00 <heat_> iirc hash -r can take an optional argument just to invalidate a single command
22:16:00 <geist> i've seen hash -r before, i just never bothered to look at what it does
22:16:00 <heat_> doing just 'hash' prints the hash table
22:19:00 <geist-sdf> pretty neat
22:19:00 <clever> oh, neat!
22:21:00 <heat_> shellz
22:22:00 <heat_> i hate unix so so so fucking much jesus
22:22:00 <nikolapdp> why are you writing one then
22:22:00 <heat_> i have 2000 lines of confusing path walking
22:22:00 <heat_> stockholm syndrome at&t version
22:22:00 <nikolapdp> lol
22:23:00 <kof673> 1) csh i think has "rehash" 2) Bill Gates and Paul Allen originally wrote Altair BASIC using an Intel 8080 simulator running on a PDP-10 at Harvard University. Allen repurposed the PDP-10 assembler as a cross assembler for the 8080 chip.
22:23:00 <kof673> anyway, i think kcc sort of works to output assembly...but not sure if cross-assembler + linker exist or not...
22:23:00 <kof673> found that when looking lol
22:24:00 <heat_> nikolapdp, if you ever want to find out horrible corner cases in path walking just see my namei.c
22:24:00 <heat_> it found problems in every UNIX
22:27:00 <kof673> > the cancellation of the PDP-10 line was announced in 1983 compuserve kept going another 20 years or so lol
22:28:00 <geist> note there's a new rpi based pdp-10 emulator nearly ready for mass consumption
22:28:00 <geist> https://pidp.net/pidp10.html
22:28:00 <bslsk05> ​pidp.net: PiDP-10
22:29:00 <nikolapdp> heat_ that sounds thrilling
22:30:00 <heat_> it's AWFUL
22:30:00 <heat_> funny to test, horrible to implement
22:30:00 <kof673> > The KA10 weighs about 1,920 pounds anyways...
22:31:00 <heat_> and above all i hate hate hate hate hate hate rename
22:31:00 <geist> that was kinda where i got with newos, it started to get more into the esoterica of posixy stuff and my interest waned
22:31:00 <heat_> fuck rename
22:31:00 <geist> and that was 25 years ago, when libc was much more straightforward to implement and unix wasn't as complicated
22:32:00 <nikolapdp> yeah rip
22:32:00 <heat_> i dont find posix fun to implement at all
22:33:00 <heat_> and it's normal, because it's hairy and is basically "what this old unix code did, but text form"
22:33:00 <nikolapdp> when i get around to writing my own os, posix support is going to be best effort, ie don't expect corner cases to be correct
22:33:00 <geist> right
22:33:00 <heat_> tty semantics were super ad-hoc
22:34:00 <heat_> fortunately most of POSIX is easy enough that it doesn't get in the way
22:34:00 <heat_> like, mmap is mmap
22:34:00 <nikolapdp> yeah but i won't be bothering with special handling for symlinks or whatever other edge cases there are
22:34:00 <nikolapdp> screw that
22:34:00 <heat_> did you know
22:35:00 <heat_> open("broken_symlink", O_CREAT) repairs your broken symlink
22:35:00 <nikolapdp> lol how
22:35:00 <heat_> posix defines path walking with symlinks to be more or less "as if the two paths were concatenated"
22:36:00 <heat_> so it ends up having the broken target as the last path segment and just... creates it
22:36:00 <nikolapdp> cursed
22:37:00 <heat_> also when creating a file the permissions don't really apply
22:37:00 <heat_> eg you can create a read-only file but open it O_RDWR first time
22:38:00 <nikolapdp> i mean kind of makes sense
22:38:00 <nikolapdp> got to initialize it first
22:38:00 <nikolapdp> i guess
22:46:00 <clever> heat_: i can see that being useful, to initialize a file, and prevent any other process from messing with it
22:46:00 <heat_> that doesn't make much unix sense
22:46:00 <heat_> like why is your process afraid of other processes running under your user
22:47:00 <geist> becuse everyone is kung fu fighting
22:47:00 <clever> and the O_CREATE flag kind of prevents the same kind of clash
22:47:00 <clever> you cant both open the same new file at once
22:49:00 <nikolapdp> reminder to not paste non ascii stuff into pdp-11 lol
22:51:00 <heat_> not-america moment lmao
22:52:00 <clever> i remember a trick about the c64, the string compare routine, will just xor the 2 chars together i think, and then check bit7
22:52:00 <nikolapdp> D
22:52:00 <nikolapdp> lol
22:52:00 <clever> and the strings in the rom are terminated by having bit7 set on the last char
22:53:00 <nikolar> oh yeah for the basic right
22:53:00 <clever> so `(a ^ b) == 0x80` means its both the final char and it matches
22:53:00 <clever> but, if bit7 is set on the last character of the user-supplied input character, it terminates the search early
22:53:00 <nikolapdp> that's also why you can use shorthands for basic keywords lol
22:53:00 <clever> nikolar: and yep, by using shift or something, on the r in `pr`, you can kinda auto-complete `print`
22:54:00 <clever> yep
22:54:00 <nikolapdp> kind of neat "feature" lol
22:54:00 <clever> one mans bug is another mans feature!
22:54:00 <nikolapdp> exactly
22:57:00 <heat_> one mans linux is another mans kernel
22:58:00 <clever> https://imgur.com/a/0G8b8BN
22:58:00 <bslsk05> ​imgur.com: Imgur: The magic of the Internet
23:20:00 <netbsduser> heat: gdb works fine with SMP