<bslsk05>
klange/nyancat - Nyancat in your terminal, rendered through ANSI escape sequences. This is the source for the Debian package `nyancat`. (139 forks/1395 stargazers)
<heat>
while there are mentions of mmap in sauce, there's no syscall for it
<geist>
well, so far things that are different are stuff like there's no const, there's only K&R style function decls
<geist>
no array initialiers
<heat>
>no const
<heat>
PRAISE BE
troseman has joined #osdev
<zid`>
yea this doesn't look too bad, it's very C89 for the bits I've seen so far
<geist>
yep, just been slowly going through it
<geist>
also a bunch of missing stuff like no getopt and no concept of SIGWINCH
troseman has quit [Client Quit]
<zid`>
there's a little mixing decs and code, which is technically c99
<geist>
but that's fine to comment out
<heat>
C++ people doing void foo(const int a) in shambles
<geist>
oh and no //
<zid`>
but it has C89 comments at least
<geist>
yeah except a few places
<heat>
gnulib has a getopt if you want one, i think
<heat>
drink the gnulib koolaid
<geist>
there's some chance the whole thing wont *fit* since it needs to fit in a 64k binary
<geist>
but pretty sure it will
<zid`>
seems like it should fit with plenty of room to spare
<geist>
surprisingly i did a 'file' on the linux one and it was like 49KB text
<zid`>
it's a couple of k of character arrays and like a thousand bytes of machine code, from my eyeing
<geist>
and there's no dynamic libraries so have to consider what comes in via libc, but yeah should be fine
<geist>
oh also another thing i found is you can't do multi line strings
<zid`>
that's going to make porting those strings annoying, convert to ' ', style maybe?
<heat>
for a modern gcc built dynamically linked x86_64 nyancat
<geist>
yah the 45K is surprisingly large considering
<zid`>
I hope that's with 4k of padding between each section, and .debug and .note and stuff..
<zid`>
can you build it omagic? :P
<geist>
anyway working on it, it takes a while since it takes about a minute for the compiler to spit out the errors
<geist>
then i got side traceked on something else, just coming back to it now
<heat>
actually this may be a clang version
<geist>
using these old machines i really get back into using ctrl-z and jobs and whatnot (on tcsh which is the most sophsticated shell here)
<heat>
which explains some of the crap codegen i'm seeing
<geist>
since you are sitting in front of *the* console
<heat>
no bash?
<geist>
no bash
<heat>
:(
<geist>
tcsh is pretty good, but it's big for this era machine
<geist>
apparently just fits
<geist>
but it has history, tab completion, etc
<geist>
which is about as far as i can hope
<zid`>
go full nethack and break it up with overlays
<geist>
zid`: actually that's precisely how it works
<zid`>
monst.c got too big so they split it up with #ifdef PARTA /* half the file */ #endif #ifdef PARTB /* half the file */ #endif essentially
<geist>
you can link programs over 46K, what you do is when you link it with ld you do `ld -o out foo.o bar.o -Z overlay1.o someother.o -Z another overlay` etc
<zid`>
so that the compiler could actually deal with it
<zid`>
source overlays, not code overlays, I mean
<geist>
apparently what it does is it puts the first block in the first 48k and the linker seems to generate some code to auto switch the last 8k on demand
<zid`>
code overlays are still a feature in ld which is handy for like, playstation
<geist>
the kernel itself is actually about 150k, so there's something like 9 overlays. you have to edit the makefile and move .o files between them to satisfy the linker
<geist>
obviously there's overhead to switching the overlay, so you ideally decide intelligently where to put each .o file so that it minimizes switches
<zid`>
put each animation frame in each bank :P
<geist>
yah
<geist>
that being said i dont know if you can overlay data, i thin it's text only
<geist>
there's a separate I & D space. so really your program can be 128K (64K text, 64K data) before needing it
<geist>
late model PDP-11s worked that way
<zid`>
ld can do it at least
<zid`>
OVERLAY { sec1 {frame1.o} sec2{frame2.o} }
<geist>
basically in the hardware there's 4 sets of 8 MMU 'pages', each corresponding to an 8K I and D range for supervisor and user mode
mctpyt has joined #osdev
<zid`>
and sec1 and sec2's load address end up the same
<geist>
0x0000 - 0x2000, 0x2000 - 0x4000, etc
<geist>
and each of those registers describes a physical base and length
<zid`>
=8KB it
<geist>
so kinda like 286 segmentation, except the segments you use are fixed based on the linear address
<zid`>
NOCROSSREFS if you want ld to error if sec1 and sec2 try to use each other's symbols
<zid`>
for some nice automatic cosnsitency checking
<geist>
but the hardware addresses up to 4MB (22 bits) so there's a fair amount of space, and the OS does full swapping and everything
agent314 has joined #osdev
<geist>
so its *kinda* like an early paging unit, where there are always 8 pages of 8K per process
<geist>
except the base of the pages can be anywhere in physical and have a length associated with them (and i think they can be set to grow upwards or downwards within the page)
<geist>
so i guess physical memory management is more like a big heap of all physical space that you're mapping pieces of user processes to
<geist>
but you can GC them at the cost of copying data
<heat>
yo
<heat>
whats the difference between supervisor and kernel? for the PDP-11
<geist>
actually i think.. heh you called me on it, there's 3 modes
<geist>
i dont precisely know, but kernel and supervisor are actually separate
<geist>
i *think* the kernel mode always runs in physical address maybe? so the kernel generally sits at 0?
<geist>
0 physically
<geist>
i haven't done it yet but i'll probably hack some low level code to at least hello world this thing so i can put it to bed :)
<heat>
lk on the PDP-11 when???!?
<geist>
not really doable do to the 16bit ness of it, but might be fun to build a little tasker for it for lulz
<geist>
LK has a pretty hard floor with 32bit
<heat>
you should build a little shitnix too
<heat>
with struct user u!
<geist>
shitnix!
<geist>
nyanix
<geist>
hmmm! that kinda has a ring to it
<kazinsal>
everyone should write a comedy unix at least once
<heat>
i prefer shitnix
<heat>
it's self describing
<geist>
haha someone already make a github bootloader called nyanix
<heat>
sadly i had to make due with a 386 targeted shitnix
<heat>
the 386 is far after historical shitnixes
<geist>
yeah i had a little 386 shitnix i was working on at some point
<geist>
well, got it 386ing, but hadn't started adding the user space shitnix
<geist>
i got to the point where i was like ehhh i should just switch to building an lk based shitnix
<heat>
unix in 85 was already portable-ish and all, cuz of the vax
<heat>
and did things
gog has quit [Ping timeout: 255 seconds]
<heat>
heck, the first system v release predates the 386, cool
<geist>
what's kinda interseting that i didn't realize with K&R C is you dont really need to declare *all* of the arguments to a function
<geist>
just the ones that aren't implicitly an int, it seems
<heat>
yep
<heat>
its great
<geist>
foo(a, b, c) char *c; { ... }
<geist>
and of coirse it implicitly returns an int
<heat>
implicit int is the greatest invention known to man
<geist>
c2 is fun, when you invoke the optimizer, it runs the c2 binary on it
<geist>
and apparently it does a list of standard things and just modifies the binary i guess, in place?
<geist>
ie, not built at all into the compiler itself
<kazinsal>
I think in modern gcc you can still do register ints but you can also do like register int foo asm ("r12") to make foo just a reference to %r12
<zid>
oh if you're in qemu it's much easier to just.. look at qemu's source
<zid>
if you wanna know how something works
<pounce>
qemu source is great
<wutno>
qemu internals 🤢
gildasio has quit [Remote host closed the connection]
gildasio has joined #osdev
Arthuria has quit [Ping timeout: 260 seconds]
innegatives has quit [Server closed connection]
innegatives has joined #osdev
DrPatater has joined #osdev
meisaka has quit [Ping timeout: 264 seconds]
meisaka has joined #osdev
<puck>
wutno: i think your CdbLength isns't set, and your second byte's definition i believe is incorrect (ignoring that i'm not sure the bitfield is oriented the right way around)
<puck>
also did you consider printing the error that the device returnend :p
dzwdz has quit [Server closed connection]
dzwdz has joined #osdev
rustyy has joined #osdev
tanto has quit [Server closed connection]
tanto has joined #osdev
TkTech has joined #osdev
Celelibi has quit [Ping timeout: 240 seconds]
netbsduser` has quit [Ping timeout: 255 seconds]
Celelibi has joined #osdev
agent314_ has joined #osdev
netbsduser` has joined #osdev
netbsduser` has quit [Read error: Connection reset by peer]
agent314 has quit [Ping timeout: 246 seconds]
[itchyjunk] has joined #osdev
[itchyjunk] has quit [Max SendQ exceeded]
[itchyjunk] has joined #osdev
[_] has quit [Ping timeout: 246 seconds]
[itchyjunk] has quit [Remote host closed the connection]
[itchyjunk] has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
[itchyjunk] has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
[itchyjunk] has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
agent314_ has quit [Ping timeout: 255 seconds]
xenos1984 has quit [Quit: Leaving.]
xenos1984 has joined #osdev
netbsduser has joined #osdev
gog has joined #osdev
rustyy has quit [Quit: leaving]
rustyy has joined #osdev
heat has joined #osdev
<gog>
hi
<heat>
puck, to be fair that interface looks like a mess