#Astral

1 messages · Page 27 of 1

gritty shore
#

And is actually pretty

grand shadow
#

interestingly it also skipped fd 4?

#

this might be some refcounting issue but where the refcounting is bad I have no idea

#

since on refcount = 0 the vnode gets set to null

#

flags too

carmine swallow
#

it's kinda weird that the close of an unrelated fd affects it at all

#

or well not unrelated given that its the dirfd passed to openat but at that point it shouldn't depend on it in any way

grand shadow
#

yeah looking at the code theres nothing that immediatelly comes to my attention

carmine swallow
grand shadow
#

wtf why is it not using fd 4

carmine swallow
#

and the same slab is allocated for both the dirfd and the new file opened from it

grand shadow
#

thats

#

and its not coming from cleanfile

#

slab bug???

#

but I dont run into that which is so weird

#

can u print the slab allocations and frees

#

like in slab.c

carmine swallow
#

that's probably going to be a ton of logs, will have to print to e9

#

its freed twice at some point

grand shadow
#

bruh wtf why is it not assert failing

#

oh I think I might have put that behind an ifdef

carmine swallow
#

turns out that its a bug in dirfd_enter

#
static inline int dirfd_enter(char *path, int dirfd, file_t **file, vnode_t **dirnode) {
    if (*path == '/') {
        *dirnode = proc_get_root();
    } else if (dirfd == AT_FDCWD) {
        *dirnode = proc_get_cwd();
    } else {
        *file = fd_get(dirfd);
        if (file == NULL) {
            return EBADF;
        }

        *dirnode = (*file)->vnode;

        if ((*dirnode)->type != V_TYPE_DIR) {
            //fd_release(*file);
            return ENOTDIR;
        }
    }
    return 0;
}
``` that commented out line, at least as far as I can tell the usual functions that use dirfd_enter unconditionally call dirfd_leave if a node was returned even in the case of an error which does `fd_release(file)` so if its already released by dirfd_enter it does a release twice
obsidian pivot
#

btw i wrote this script (in c++) that parses logs similar to those allocation logs to check for discrepancies

#

might be helpful, just ping me I'll send source code

scenic epoch
#

sorry that im not participating in the tech jargon here but does astral have loop devices

robust geyser
#

no

robust geyser
#

@grand shadow sorry for ping but if you have 2 minutes of free time could you check if commenting out the lines in ps2mouse.c which construct and queue a mouse packet reproduce the issue from yesterday for you? i kinda narrowed the crash down to that lol

grand shadow
prime juniper
#

And that’s planned. Your point?

robust geyser
#

running a chromium binary linked against glibc?

prime juniper
#

Oh no

#

Native port

#

But maybe one day

#

Missed the glibc part lmao

opal lotus
#

yeah no our point was a glibc chromium

robust geyser
#

cuz steam linux client

prime juniper
#

Yeah that’s a yikes

grand shadow
#

Glibc shm? troll

#

Shim

#

@robust geyser quick question, did you remove the datac = 0

robust geyser
#

💀

#

yeah that would explain a lot

#

thanks

#

LMAO

grand shadow
robust geyser
#

Me when im retarded

opal lotus
#

this guy

grand shadow
#

I mean, how its grouped in the code probably does not help mich

robust geyser
#

noooo it does not lol

#

but it's all good, that was a good find

#

im just blind it is what it is🥀

marsh sparrow
#

chromium with binary compat is kinda lame

#

since you can just as well do it w/o

scenic epoch
grand shadow
#

there is a network loopback

#

but no disk loopback

blazing atlas
#

why would you need a disk loopback

grand shadow
#

mounting partitions out of a image

blazing atlas
#

actually i forgot i did use them and they are pretty usefull lmao

#

completely forgot

robust geyser
#

loop devices made me think about disk, not network

#

probably my skill issue

scenic epoch
robust geyser
#

no

carmine swallow
#

at least I now know that xorg works on this libc KEKW now idk what should I try to get running, ig I could try factorio (though it probably has the weird thing that's there on linux too on this libc where the save files are incompatible with the normal glibc version for some reason)

#

also unrelated to this it'd be nice to have a script to update the disk image instead of recreating it every time, ig I might make one

grand shadow
#

I never made one because I'm p sure that would need like root for mounting and that'd be kind of annoying

#

but if you figure something out I will merge it

grand shadow
robust geyser
#

yes it does need root for mouting the image, but honestly it's worth it

grand shadow
#

that does not work normally

carmine swallow
#

idk it just worked lol

grand shadow
#

💀

#

guess its a linux sysdep unimplemented thing

#

I should look into it

#

having the sidebar would be epic

carmine swallow
#

tbh I didn't even know there should be a side bar normally, I just assumed it was an update or smth

grand shadow
#

fvwm has a side bar normally it just doesnt work on astral

#

you know those two windows that appear on boot?

#

thats supposed to be the side bar

#

I think it might be an unimplemented epoll causing issues

carmine swallow
#

how would it be any different on a different libc if that would be the case though?

grand shadow
#

do you expose epoll?

carmine swallow
#

yes but all the epoll functions just return enosys

grand shadow
#

oh wtf then

#

guess thats a mlibc bug

carmine swallow
#

I guess printf debugging the sidebar might help

grand shadow
#

@prime juniper when you eventually do mlibc-linux, can you build fvwm3 as well?

prime juniper
#

Sure

#

I’ve confirmed the weekend to be available

#

So pending weather and the EOY post we can ball

grand shadow
#

helll yeah

carmine swallow
#

I think it might actually just work (granted it takes like a ton of time to load, ig it might be better if the graphics would be forced to very low)

#

plus it needs /proc/self/exe symlink, I just created that manually

grand shadow
#

wtf real

#

factorio on astral

#

I guess I already fixed that weird bug that you hit on your mlibc shim attempt?

carmine swallow
#

possibly, idr what that bug was about anymore

grand shadow
#

iirc it was a page fault

#

what was the xorg corruption btw

#

or was it just the file stuff

#

also even on windows space age takes an eternity to load for me I cant imagine it on astral 💀

carmine swallow
#

the xorg stuff was at least partly a skill issue on my part as I forgot to install the xf86 drivers

grand shadow
#

oh lmao

carmine swallow
#

it does let me load to an existing save tho

grand shadow
#

💀

#

insane that it even loaded with space age

#

how is perf btw

robust geyser
#

2026 year of astral desktop

#

???

carmine swallow
#

5fps 💀

#

ig this might possibly be somewhat improved by building the libc in release mode (though the allocator there isn't the best in general, its not the worst but its not the best either)

grand shadow
#
  • bad smp perf cuz of shootdowns etc
#

insane that it works tho

#

gaming is real

carmine swallow
#

also factorio is only using 1 render thread due to sched_getaffinity not being implemented

grand shadow
#

oh right that could be an issue

carmine swallow
#

idk how much it affects the perf

#

I guess it might be a decent boost especially if qemu is given more actual cores

grand shadow
#

likely

#

although with the current vmm page fault code it might not be that big of an improvement

#

since paging in a writeable page means a shootdown

#

I need to add a fast path for that case

#

that doesn't involve 2 faults

willow rapids
carmine swallow
#

btw what is printing the stuff you type to the left of the screen? because its kinda annoying as it messes up any windows in there

grand shadow
#

to disable the console echoing stuff u need to use stty -iecho or whatever

#

I dont have something like linux which I think allows you to completely disable a vtty

#

so my startwm script just disabled echoing etc

carmine swallow
#

ah

grand shadow
#

I need to stop procrastinating and actually sit down and finish the vmm page locking code for dmaing into userspace and also some more optimizations

#

but my brain wants to read voxel raytracing papers instead

robust geyser
#

i wonder how i should handle console keyboard input with the evdev implementation

#

i wanted to create a mux input device which just gives you all events queued to any device but i realized that won't work because there's some more state i'd have to somehow replicate, each device can expose ABS_* limits (for ABS_X, ABS_Y and stuff like that) so that won't work with a mux device

carmine swallow
#

and store a device identifier in each packet so then the info can be queried either through the ioctl or got from a cache indexed by the identifier or smth

#

idk

robust geyser
#

that's not how evdev works

#

you can query limits for each type of event using an ioctl, yes

#

but they are per event type, not per event

#

so multiplexing events from multiple devices where they could have different limits wont work

carmine swallow
#

ah, yeah I haven't looked into how evdev works at all it was just a random idea lol

opal lotus
#

how does linux do this for tty

#

i assume they just mux all keyboards

robust geyser
#

¯_(ツ)_/¯

#

i am not gonna subject myself to reading linux source code

#

no, thank you

carmine swallow
# carmine swallow 5fps 💀

it was like 24fps with 2 threads (and getaffinity stubbed to return that) but then when I wanted to try it with 8 threads it took almost an hour to load and runs like shit (even worse than with 1 thread at least in the menu, it just froze when I tried to click a button)

grand shadow
#

💀

carmine swallow
#

but tbh 24fps is pretty close to playable already

#

its not a huge stuttery mess like 5

grand shadow
#

there defo needs to be some smp work in astral to make it better

carmine swallow
#

and drm drivers gigachad

opal lotus
#

fun

formal patio
lucid marten
carmine swallow
bronze nexus
#

Looks like transport belts and trains are also distinct threads

carmine swallow
#

interesting, I just knew about the render threads because there is an option for it

bronze nexus
#

I think that's the limit of threads it spins up. I said threads here but what I really meant was more like in parallel.

#

They didn't go into very specific detail of how they start the threads themselves, but there's a decent chance this is a thread pool situation.

opal lotus
#

what happens if you run on one cpu

robust geyser
#

you can still have multiple threads on one cpu

#

but it won't help, and will probably hurt performance if your workload is compute bound

gleaming bay
#

That’s sick

grand shadow
#

@carmine swallow do you expose/implement shmget/fstatfs on your libc?

#

I am looking at the fvwm3 logs and trying to see if it really isn't an unimplemented thing

#

because like, maybe it would shm to communicate the living processes to the sidebar or w/e

carmine swallow
#

they are enosys too, I didn't implement any new sysdeps that you didn't have in mlibc

#

except yesterday I implemented sched_yield because it was spamming it when loading factorio but that's not related to the fvwm thing

grand shadow
#

hmmmm

#

weeeird

#

disabling shm didn't help so like blegh I really will have to dive into the source

grand shadow
carmine swallow
grand shadow
#

based

proper meteor
grand shadow
#

iirc as long as you don't cross a 4 byte boundary you're fine

proper meteor
#

alright

wild marsh
#

so 16-bit accesses need to have lsb clear in the address

grand shadow
#

oh

#

still, that code should be fine

proper meteor
#

i'll stay 4-aligned just in case

analog berry
#

4 aligned is the safe bet but yeah this works too

robust geyser
#

how the heck did you open this file, skip all of the functions that do the reading and come to the conclusion that it does unaligned accesses?

#

pci_read16 literally aligns it before reading

gleaming bay
#

😭

opal lotus
#

lmaoooo

grand shadow
#

☠️

opal lotus
#

it happens

#

i don't think linus remembers every single line he wrote

bronze nexus
#

Nobody remembers every single line they write

analog berry
grand shadow
#

Been super busy lately so almost no work on this damn

scenic epoch
#

RIP

grand shadow
#

400 stars on github gg

surreal wraith
obsidian pivot
#

@grand shadow i got this while booting ur shit

#

on qemu

#

i used the images on ur site

#

and the qemu command in the pinned message

#

gl

obsidian pivot
grand shadow
#

☠️ 🥀

#

no idea that image is super outdated by now

obsidian pivot
#

ill just build it myself bleh

grand shadow
#

there were some issues with monkuous' xsave detection code that iirc I have since then fixed

#

so that could be it

obsidian pivot
#
DISTROTYPE=minimal make```
this is the command to build a minimal distro right
grand shadow
#

indeed

obsidian pivot
#

amazing

grand shadow
#

though iirc it now by default builds a minimal image and only builds the full image on a make disk

obsidian pivot
#

spotted in Makefile

#

(this is the only occurence of DISTROTYPE in Makefile)

grand shadow
#

which I mean you probably should boot it from disk anyways

#

so yeah just DISTROTYPE=minimal make all disk

#

then to run make run-disk-kvm

obsidian pivot
#

bleh why does debootstrap have to be so slow

#

"sh: 13: chroot: not found"

grand shadow
#

cro does not have coreutils installed 🥀

#

wtf

obsidian pivot
#
I: Checking Release signature
E: Invalid Release signature (key id 0E98404D386FA1D9)
#

🥀

grand shadow
#

maybe my jinx version is too old or something

#

don't have the energy to update it and go through every single package to fix any issues that appear

obsidian pivot
#

oh well

grand shadow
#

but thats still super weird considering a few weeks ago iretq managed to build it just fine

#

lemme do a fresh git clone and see if I get teh same issue

grand shadow
#

use a real distro other than debian

obsidian pivot
#

so this problem is literally just because im using debian

grand shadow
#

that and my outdated jinx probably

#

I mean I think u could maybe update the snapshot in jinx directly

obsidian pivot
#

ill just rename my keyring file for a second

grand shadow
#

change the debian_snapshot="" variable in jinx

obsidian pivot
grand shadow
#

change it to whatever gloire has in its jinxfile

#

20251202T083052Z

obsidian pivot
grand shadow
#

talk is cheap send patches

obsidian pivot
grand shadow
#

I need to eventually update jinx

obsidian pivot
#

mathewnd why doesnt my fvwm-root thing work i get no wallpaper nooo

#

is it just skill issue?

grand shadow
#

probably

#

it works for me

#

the only thing that doesn't work is the sidebar

#

but it worked in qwinci's libc

#

so I am inclined to think its something with mlibc

#

but I've never debugged it

obsidian pivot
#

other than like python what external dependencies did fvwm3 need

#

not including the libraries

grand shadow
#

it has been like almost 2 years no way I will remember that

obsidian pivot
#

damn

marsh sparrow
obsidian pivot
#

obos-strap always works as long as you are using my exact build environment trl

opal lotus
#

put it in a container galaxybrain

grand shadow
#

someone I don't recognize opened a pr and caught a very interesting issue

#

it seems like the osdev wiki page for the madt is just wrong

#

it does seem that there was some issue with how I handled the apic nonetheless

#

so maybe once I finish looking into that maybe that is what was wrong with ps/2? meme

#

since it does use the i/o apic

#

@analog berry though one thing I am not understanding, what should one do in the 00 case?

#

just have a table that maps irq -> mode?

#

ah wait nevermind I am stupid

analog berry
grand shadow
#

yeah

#

if that is what was wrong with ps/2 on real hardware its gonna be so funny

analog berry
#

could be

grand shadow
#

me: never able to get that shit working
random savior from github:

analog berry
#

how were u even able to make it this far with this bug

grand shadow
#

I have no idea

#

I guess qemu just did not care and I didnt use any other ISA interrupts

#

yeah I only use it for like ps/2, the serial port and 32-bit hpet without msi

#

and acpi

#

I should probably fix that in the osdev wiki as well

grand shadow
#

there

#

anyways, if anyone whose ps/2 did not work before wants to try it again I would be thankful cc @fleet osprey @robust geyser

fleet osprey
#

alright, but I won't be able to test on the Optiplex 755 that had the fucked up PS/2 emulation

#

that machine died dead

#

will test it on the t14 gen 1 amd and the precision t1650 when I get home tho

grand shadow
opal lotus
#

not working on framework 13 :(

analog berry
grand shadow
grand shadow
#

updated image with super early logging enabled + some nvme fix

opal lotus
#

@grand shadow

grand shadow
#

This guy got a point

#

I gotta add that to astral to stay relevant

viscid flame
#

😔

elfin turtle
#

as long as you prefix every sentence describing your OS with AI you will make billions

#

you don't even need to finish the sentence, when an investor reads the sentence their brain turns off after AI and they will give you millions

grand shadow
#

Ai in kernel making scheduling decisions

elfin turtle
#

lol

willow rapids
# grand shadow

he is missing one thing, make the ai generate the gdt at runtime

viscid flame
grand shadow
marsh sparrow
#

⁨⁨```
$ gcc main.c
You have reached your daily Astral limit, how would you like to proceed?
[*] Learn about Astral Plus™ offers -- 3000 daily commands for just $9.99 if you buy within the next 3:24
[ ] Watch 2 minutes of ads to unlock an extra 100 Bash commands
[ ] Wait for your limit to reset

fleet osprey
#

adopt a semi-proprietary model like Chromium vs Chrome, Code OSS vs VS Code, etc

#

Astralium (FOSS) vs Astral (proprietary)

#

Astralium is just a shitty kernel shell, Astral gives you a full OS

marsh sparrow
# grand shadow

this idea has a lot of potential, what about some GCC patching:
⁨⁨```
$ gcc main.c
main.c: In function ‘main’:
main.c:2:9: error: implicit declaration of function ‘print’ [-Wimplicit-function-declaration]
2 | print("hello world");
| ^~~~~
While programming is a lot of fun, remembering the exact header that contains a specific standard library function can be exhausting.
That's where today's sponsor Brilliant.org comes in. Brilliant offers courses that make it easy to refresh your C knowledge. Sign up with code Astral to get 20% off in your first two months.

prime mulch
#

i think linux has at least one scheduler based on a neural net lol

marsh sparrow
#

but it probably (hopefully?) doesn't evaluate that in the kernel, right?

grand shadow
somber wraith
fleet osprey
#

nah, too complete

#

you can't let them unlock the "full" version troll_shrug

#

technically with newlib, busybox, and tcc, you could (with enough pain and suffering) build your own copy of mlibc, all of the gnu stuff, and gcc

neon crane
gleaming bay
prime geyser
#

port llama2.c or something of that calibre

grand shadow
#

Im thinking of porting a new wm/de

#

Maybe I finally take the cde pill

robust geyser
#

Do xfce

#

:)

analog berry
#

kde

robust geyser
#

not even managarm has that so

#

i wouldn't get my hopes up

analog berry
#

well astral is always one step ahead in ports

robust geyser
#

well, kde is not gonna be it 💀

#

considering you need logind

#

udev

#

all that uh

analog berry
#

never underestimate mathew

robust geyser
#

yeah

#

i don't think bro is gonna port systemd

#

but tbf kde with openrc is possible

#

elogind exists, sadly

#

kde would be sick tho

#

but xfce is nice :^) and xorg, mathew likes that

obsidian pivot
#

when wayland

robust geyser
#

probably never

#

need libinput, need udev, need netlink

analog berry
#

when mathew adds drm

robust geyser
#

💀

#

and drm i guess

obsidian pivot
#

when uDRM trl

robust geyser
#

u need the kernel drm interface

analog berry
#

@ marvin

obsidian pivot
#

lmao

analog berry
#

yes

obsidian pivot
#

and that uDrivers thing

robust geyser
#

i should work on fusl

#

not calling it uUSB

obsidian pivot
#

ahhhhrhehhshshs USB

analog berry
#

uSB

obsidian pivot
#

micro serial bus trl

opal lotus
winged basin
grand shadow
analog berry
#

astral copilot when

viscid flame
#

download dotfiles from some github repos and post it to r/unixporn

fleet osprey
grand shadow
#

So much to do and so little {time,motivation} to do it

#

I need to get back on this

#

Last thing I was doing was a proper memory locking thing for dmaing directly into userspace without breaking posix fork semantics

neon crane
grand shadow
#

So true

#

Everything is ub so the program should not expect any behaviour at all

#

There is a 3.33% chance a open() instead deletes the file

fleet osprey
#

may cause a triple fault

neon crane
#

it should be UB to do a fork during read/write

opal lotus
#

port xfce4

marsh sparrow
#

which would be severely limiting

neon crane
#

Or expect some writes from your parent to still go through as a child

#

UB doesn't have to mean "crash"

marsh sparrow
marsh sparrow
neon crane
#

How do you "implement this properly"?

#

so the logic is, while you are performing a read(), reading from that data is UB, because you either have old data from before the read(), or actually new data. if you perform a write(), writing to the buffer during that is UB because the data written will either be old data or new data.

#

if you fork a process while reading, you'd be taking a snapshot of the data during a read.

#

if the read() happens to finish then you just have the new data.

#

if you start messing around with the buffer while the data is still being read in in the parent process you're probably doing something wrong even if you don't know it, since you're implicitly accessing another thread's state (the former thread that used to be in the parent but didn't come in with the child)

#

that's like if a thread poked and prodded into another thread while it's reading/writing, except only until the point of the extant read finishing, and only as long as you don't write to that memory, because otherwise CoW applies

wild marsh
#

doesn't a similar race exist with just normal anon memory that gets CoWed?

#

one thread is writing to a buffer while another forks

#

ah no i didn't read the context

marsh sparrow
#

the valid outcomes if a read() and fork() happens at the same time are:

#
  • neither parent nor child have modified data
  • parent has (partially) modified data, child has a copy of the old data
  • both parent and child have (partially) modified data but the child has a private copy (either via CoW or an actual copy)
#

what's certainly forbidden is that the child first sees unmodified data and then modifications happening

neon crane
neon crane
#

so as long as neither the parent nor child write to the memory they both see the new data

marsh sparrow
#

Managarm certainly implements this properly

#

by eagerly copying pages that are currently DMAd to

#

instead of using CoW for them

neon crane
#

sure. I could do that. but in reality, what is the risk that this happens, and that this affects anything? whatever the child process sees it probably won't understand

#

chances are it'll be half-read data (parts of old data and parts of new data)

#

or the entirety of new data

#

or the entirety of old data

#

whatever it is, this state is "expected" during a read, and a thread probably isn't interested in reading from this buffer unless it's fully read

marsh sparrow
#

i think much more subtle things are possible

#

if the child can see DMA modifications happening after fork

#

for example:

  • T1 fork()s
  • T2 allocates memory location P and read(P)s
  • the allocator page is processed by fork() before T2 has allocated (and hence location P is free in the child)
  • the child allocates memory location P and uses it for something else
#

(malloc() itself is not async-signal-safe, but if you use your own allocator that doesn't need locks, this would be allowed by posix)

#

a less stupid example is if you DMA to the stack

#
  • T1 fork()s
  • T2 read()s to a buffer on T1's stack
  • the child does something else with the same stack space (e.g., by returning from the current function)
neon crane
marsh sparrow
#

Hm?

#

by memory location I meant virtual address

neon crane
#

the pages backing the buffer are pinned

#

so if you unmap that buffer and map something else, the same virtual address will have different memory and won't be affected by the ongoing "DMA"

#

at least that's how it works in my OS

marsh sparrow
#

well the buffer can already be allocated

neon crane
#

if you mean that e.g. the buffer is malloc'd, then free'd, and then someone mallocs something on top, and the allocator didn't decide to unmap anything, then yeah, there is a problem

marsh sparrow
#

i'm sure that you can get into situation where some thread in the parent does read(P) and the child uses virtual address P for something else at the same time

sharp carbon
#

the initializer for the value means that the stack page it occupies is allocated before the fork

#

if the read does dma (it wouldn't since it's /dev/zero but pretend it's some other file and it's using O_DIRECT) before the child gets to the assert, the child would see the new value

neon crane
#

With my current scheme, read() pins the pages after the fork(), so the pages are eagerly copy-on-write-faulted

#

Meaning the address of value is already replaced with a new page by the time the actual "DMA" takes place.

#

You have to use two threads for this

#

And the fork has to happen during the actual read operation, but after the pages have been pinned

sharp carbon
#

right

opal lotus
#

bro has been typing for 20 minutes 😭

sharp carbon
#

okay revised example

#define BUFFER_SIZE 0x1000

static int can_read;

void *do_read(void *ptr) {
    int fd = open(tmpnam(NULL), O_RDWR | O_CREAT | O_EXCL | O_DIRECT);
    ftruncate(fd, BUFFER_SIZE);
    while (!atomic_load(&can_read)) {
        futex_wait(&can_read, 0);
    }
    read(fd, ptr, BUFFER_SIZE);
    close(fd);
    return NULL;
}

int main() {
    uint8_t *ptr = mmap(NULL, BUFFER_SIZE * 2, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
    pthread_t thread;
    pthread_create(&thread, NULL, do_read, ptr);
    memset(ptr, 0xcc, BUFFER_SIZE);
    atomic_store(&can_read, 1);
    futex_wake(&can_read);
    while (atomic_load(&ptr[0]) == 0xcc) {
        // spin until read has begun
    }
    if (fork() == 0) {
        memcpy(ptr + BUFFER_SIZE, ptr, BUFFER_SIZE);
        sleep(1);
        assert(memcmp(ptr, ptr + BUFFER_SIZE, BUFFER_SIZE) == 0);
        _Exit(0);
    }
}
sharp carbon
opal lotus
#

been there, done that

sharp carbon
#

anyway with this code it's possible that the child starts execution before the read has finished

#

in this case the read will finish during the child's sleep call

#

with your scheme the two copies of the data in the child wouldn't be the same, since the bottom half of the buffer has the finished results of the read while the top half has the unfinished results that were copied before the read was done

proper meteor
opal lotus
#

aka a value of 0 means 1

proper meteor
#

huh

robust geyser
#

not that crazy

opal lotus
#

read the spec 💀

robust geyser
#

same with the read/write io commands

#

you provide nlb=0 if you want one block

formal patio
#

how cursed do you think it would be to use Astral as a test kernel/OS for lil?

#

I'm basically looking for something that I can quickly run in QEMU + real hw, that has a sane build system, and preferably can be netbooted

marsh sparrow
#

what would the advantage be over Managarm?

formal patio
#

if it's trivially netbootable, convenience and having a second impl to check against

#

being monolithic is a big plus bc that would verify the capability to build it freestanding

marsh sparrow
#

why would it be more easy to netboot than Managarm?

formal patio
#

the pain of managarm is not the netboot itself

marsh sparrow
#

well, my question is what the pain is lol

formal patio
#

ehci memes etc

#

I just want an easy testbed for validation meme

marsh sparrow
#

you won't run into ehci memes when you netboot

#

and astral doesn't have ehci anyway (?)

viscid flame
grand shadow
#

update: astral will have a permanent install on a real machine starting next month so some of my development will now pivot to writing drivers for it

#

it'll be on an older amd64 machine at my uni

marsh sparrow
#

nice, what dirvers do you still need?

grand shadow
#

ahci + rtl8169 (I think, waiting for a lspci -nn to confirm) + maybe xhci

#

indeed

#

10ec:8168

grand shadow
#

the first thing I'm gonna do is probably the nic, since it seems simpler

#

then ahci then maybe finishing the xhci work with iretq

#

the page cache rewrite being pushed once again but it is what it is

marsh sparrow
#

NICs are also generally the most useful devices

#

since if you have a NIC you can ssh in or transfer logs out etc

grand shadow
#

true

obsidian pivot
grand shadow
#

lmfao osdev wiki

grand shadow
obsidian pivot
obsidian pivot
#

oki

#

my pc also technically has the r8169 but its a newer NIC

fleet osprey
#

Oh nice more datasheets to grab trl

obsidian pivot
#

ik it doesnt work with mine

#

and i used that same spec

#

ig I should've actually paid attention to the mac type specific init code

obsidian pivot
#

btw

proper meteor
wild marsh
#

zero based => value of 0 means 1, value of 1 means 2 etc?

formal patio
#

NVMe 1.3d, 1.5 Conventions, p. 12

grand shadow
#

what is the osdev controller code doing bruh

#

it sets the 9346CR register while its completely unescessary

#

it does not write to these registers at all

#

also sets a reserved bit

#

trolled

obsidian pivot
#

i need to make sure i dont accidentally do that

grand shadow
#

I misread that

#

oops

analog berry
#

I cant believe u use osdev wiki as driver writing guide lmfao

grand shadow
#

unless you want me to vibe code this troll3dflip

#

also wtf why does qemu not support msi for this

#

thats just stupid

analog berry
#

That might end up being more productive tbh

grand shadow
#

I really do not want to get into pci pin bullshit

#

but ig I might have to if I want to test thi sout

analog berry
#

Its pretty easy since you already have uacpi anyway

grand shadow
#

time to learn how to do that with uacpi and how I am gonna abstract that away

#

probably just have each driver register a handler callback and have every pin have a list of callbacks

carmine swallow
grand shadow
#

if I knew how the qemu codebase worked I would have honestly tried to implement it but I have no idea how to even begin there

carmine swallow
#

(I just wanted to see how hard would it be to add msi support to it and turns out its not hard at all, I just looked at the hda driver and copied the msi code from there slightly modified to fit the rtl8139)

grand shadow
#

interesting

grand shadow
obsidian pivot
#

qemu doesnt have r8169... at all

grand shadow
#

it has a similar nic

#

and that does not have msi

obsidian pivot
#

r8139?

grand shadow
#

yeah

obsidian pivot
#

ic

grand shadow
#

oh wait I dont think they are even compatible

#

☠️

#

I'm stuopid

obsidian pivot
#

no not really

#

Linux has a separate driver for it iirc

grand shadow
#

welp

#

that was useless

#

I dont think any emulator implements it soooo

#

you'll test for me troll3dflip

obsidian pivot
#

yea sure

obsidian pivot
#

but uh I would test it on my laptop but its ethernet port has ran out of hopes and dreams

#

(it used to run on hope and dreams but it ran out)

#

((maybe it needs to be filled with determination?))

#

cc @mild sentinel

mild sentinel
#

@obsidian pivot my desktop uses the same Linux driver right?

#

Also I got another 4 hours of off forsaken sleep

mild sentinel
mild sentinel
marsh sparrow
#

the sample set is small and the LLM can't really iterate to test it

#

unless you somehow hook it up to real hw

flat copper
#

they'd just turn into copypaste engines (well, more than they already are)

#

with license and quality implications

marsh sparrow
#

yeah

carmine swallow
obsidian pivot
#

the rtl8168 and rtl8169 are more similar to each other than they are to the r8139

#

afaik

carmine swallow
#

at least in my driver there are like 3 small differences between the 8139/8168

#

granted there might be more regarding the phy setup (and probably is), that's something that I haven't properly done lol

grand shadow
#

well good news and bad news

somber wraith
#

yay! (and aww)

grand shadow
#

good news? apparently my desktop has an 8168

#

bad news?

#

I don't think I can pull an ethernet cable to my room dawg 💀

fleet osprey
grand shadow
#

maybe if I buy a super long one

fleet osprey
#

I have a bunch of PCs with Realtek 816x NICs that have cables run to them

somber wraith
#

do you have another device in your room that runs linux (and has an internet connection)

fleet osprey
grand shadow
#

closest thing is a laptop with wsl

#

oh wait

#

I do have one

#

a laptop from 2004 with linux from scratch 🥀

somber wraith
#

that works

grand shadow
#

that I don't even know if it boots

somber wraith
#

it has an ethernet port and a wifi card right?

grand shadow
#

yeah

somber wraith
#

ok, then you can make a network bridge

#

networkmanager makes this super easy

#

you act as a router basically, and can either NAT or just plain forward the requests for the ethernet device

grand shadow
#

guess I gotta pull out the good old dell latidude 110l

#

smart honestly

#

its gonna make life much easier compared to having to send the iso over to other ppl

#

it was just by chance that I opened the windows device manager to look at what my NIC is

#

and saw that it literally matches 1:1 the vendor:id of the rtl8168

#

wonder if you can use windwos for that because I really really do not want to search for the charger of that laptop

#

apparently windows has something called ICS?

#

this comes with the benefit of being able to wireshark, which sounds nice

#

oh right

#

I need to buy a fkin usb stick

#

good thing theres a place selling them nearby

mild sentinel
robust geyser
#

not sure what kind of bridge it creates though, so if that matters to you then you should use linux lol

grand shadow
#

I jus want a working NIC driver

#

so if I can get that shit talking its profit

grand shadow
#

anyhow, I think I have all of the initialiaztion including phy stuff working

#

well not working

#

haven't tested

#

but its there

#

so I am writing the interrupt code and then I will hook it up and test

marsh sparrow
#

for testing you don't even need a bridge

grand shadow
#

okay so I think I have the whole driver written now

#

its not perfect but its probably enough for now

#

tomorrow I'll buy a usb stick and test it

#

I have pushed the code

#

or rather would have if my gh token hadn't expired

#

there

grand shadow
#

well today is carnival so all the stores are closed

#

testing will have to wait till tomorrow

mild sentinel
#

could i help you test it?

#

@obsidian pivot said we had similar nics right?

grand shadow
#

if u want to I can send an iso

mild sentinel
#

send one over il boot it on my desktop

#

no virus right PSP1G_pspTrollar

grand shadow
#

I can't even write to non nvme disk 🥀

mild sentinel
#

i only have nvme

#

better not corupt my stuff

grand shadow
#

maam your computer has virus

mild sentinel
#

im gonna redeem

#

i need to test this as excuese to not make PMM & paging code rn trl

grand shadow
#

what vendor:id is your card btw, the driver is hardcoded to realtek:8168

mild sentinel
#

how i check that on linux? sudo lspci -vvvv or some thing

#

iirc? the linux driver r8169 supports the RTL8111H and r8168?

grand shadow
#

lscpi -nn

#

ok just from the name I think its the same nic

mild sentinel
#

send over ISO and lets try it yahooo

#

if it dosnt work il help you debug

grand shadow
mild sentinel
#

does this include the cool minecraft port

grand shadow
#

the initrd does not

#

it only contains the bare minimum really

#

but if you can connect it to the internet I think you could xbps install everything

#

as long as you have enough ram for it 💀

mild sentinel
#

32gb PSP1G_pspTrollar

#

should be enough right

#

Okay rebooting into it now

#

Thank you REFIND for not making me go into my BIOS

#

@grand shadow how long is it expected for there to be a black screen with the initrd option?

grand shadow
#

💀

#

wtf

#

like not long at all

obsidian pivot
#

once im back home

grand shadow
#

let me send you the early boot logs

mild sentinel
#

You do support AMD hardware right

grand shadow
#

how big is your screen btw

grand shadow
mild sentinel
#

1080p

grand shadow
#

wtf

mild sentinel
#

I do have 3. Monitors tho?

#

One is vertical too

#

@grand shadow I do have an idea to make the PC speaker be able to output debugging logs if that could help 💀

grand shadow
#

this should have early boot logs enabled (flanterm set up the earlist thing possible)

#

czapek also had some issues with a black screen booting astral and it was something related to flanterm init, maybe I need to update flanterm or smth

#

I havent personally really tested in real HW in a long while so maybe there was some regression on all real hw boots

mild sentinel
#

I also have an Intel laptop and another amd laptop I can test on

#

@grand shadow page fault

#

Looks like null derefrence

#

Also no stack trace slongesab

analog berry
#

Kernec

mild sentinel
grand shadow
#

that explains why the screen was black

mild sentinel
#

Uhhh any idea what could be causing it

grand shadow
#

gotta find out

mild sentinel
#

Want me to test on that Intel laptop?

#

Maybe it’s a uACPI bug

grand shadow
#

its in pushlock.c

#

probably acquiring a pushlock on a slab which is not craeted somehow

#

I should really add a backtrace print to my panic function at some poin

mild sentinel
#

This is why I test hardware before pushing any commit

mild sentinel
#

@grand shadow it is working on an Intel laptop it seems AND OH SHIT IT HAS THE SAME NIC

#

I saw the driver pop up

grand shadow
#

yo??

mild sentinel
#

Let me plug in Ethernet

#

How should I test it from there

grand shadow
#

u'll have to reboot to get the nic to work again after plugging it in btw I don't really reset the phy and do autonegotiation on a link up irq

grand shadow
#

or whatever the device node is called in /dev/

mild sentinel
#

Okay let’s see if this works

#

Failed to bind to device??

grand shadow
#

uhh does the node exist in /dev

mild sentinel
#

It shows in ls

grand shadow
#

oh u don't need the /dev/

#

it'll append it to the path automatically

#

also crazy ps/2 works

mild sentinel
#

Okay what should it be outputting

#

Because it says it’s hardware address all 0s

grand shadow
#

can u send a pic of what its outputting to see if everything else is ok

#

also nice seems like the nvme driver also works

mild sentinel
#

That’s all it said before hanging

grand shadow
#

oh it just locked up damn

mild sentinel
#

And control C isn’t working

grand shadow
#

does a ctrl+C kill it or

mild sentinel
#

Nope

grand shadow
#

oh we LOVE deadlocks

mild sentinel
#

But it shows the words

#

So it’s not deadlock deadlocked

grand shadow
#

hmmm

mild sentinel
#

It just can’t take the signal?

grand shadow
#

probably is just stuck somewhere

mild sentinel
#

Shouldn’t the signal override that PSP1G_pspTrollar

grand shadow
#

and that 00:00:00:00:00 is sus

mild sentinel
#

Well clearly the driver is doing somthing

grand shadow
#

during the driver init does it like print the mac address properly?

#

maybe it doesnt have a preconfiured one or something

mild sentinel
#

MATHEWND IS BEST KERBEL DEV
100% NOT HACKED ACCOUNT

mild sentinel
#

The bootlogs etc

grand shadow
#

it'll print the driver maybe just record a vid and see what it prints

#

I don't have a dmesglike ringbuffer yet

mild sentinel
#

No dmesg

grand shadow
#

which is also another good idea to have probably

#

oh yeah to reboot can u do like

#

reboot

#

oh press the power button

mild sentinel
#

Well it’s locked up

grand shadow
#

just to see if acpi is working

analog berry
mild sentinel
#

And power button made it goto sigKILL before I just held power button

#

But the shutdown command worked earlier

grand shadow
analog berry
mild sentinel
#

Btw what prize do I win for helping

grand shadow
grand shadow
mild sentinel
#

My phone at 3%

#

let me charge my phone

#

To take video 😭

analog berry
#

as long as it doesnt cause any kernecs

#

its good

mild sentinel
#

Gotta keep that in mind

analog berry
#

true

grand shadow
#

ççççççççç

#

ç is right next to l on my keyboard

mild sentinel
#

I actually ended up having to mirror limine and flabterm

#

Because codeberg was crashing

#

So my friend couldn’t make the build system work 😭

mild sentinel
grand shadow
mild sentinel
#

TS is kinda funny

#
  • the git history gonna be wiped once i686 is done and the repo fully cleaned up to standards by me anyways so PSP1G_pspTrollar
willow rapids
mild sentinel
#

I’m an American scum so I don’t have that key at all PSP1G_pspTrollar

#

Except on my phone

willow rapids
#

so instead of accidentally terminating messages in \ i would get ç, but since i use the us layout mostly nowadays then yeah

mild sentinel
grand shadow
#

during uacpi init, spooky

analog berry
#

try mammogram or pmos or obos

grand shadow
#

can't really make out the rip

mild sentinel
grand shadow
#

hey

#

at least its printing the mac address correcltly there

mild sentinel
#

It went on more after it locked up

#

And I stoped recording

#

😭

analog berry
#

yeah this and bad checksum tells me crazy memory corruption

grand shadow
#

how tf did this not happen on the first boot

mild sentinel
analog berry
#

probably because it dirtied some memory

#

maybe u have uninitialized reads somewhere

mild sentinel
analog berry
#

🤷‍♂️

grand shadow
#

let me see if reseting on qemu breaks things

mild sentinel
analog berry
#

make sure it doesnt clean the memory

grand shadow
#

I ran it with randomized limine memory some weeks ago and it worked fine

mild sentinel
#

I better be getting extra pocket lint with my paper clips and and bottle caps for this

analog berry
#

maybe a race condition or smth

#

or something that triggers with a specific amount of physical memory

mild sentinel
#

Trying once more

#

If this dosnt work your cooked 🥀

#

AstralV2 time

grand shadow
#

tried with randomized memory again and it works

mild sentinel
fleet osprey
mild sentinel
fleet osprey
#

nope

grand shadow
#

🥀

#

does a cold boot give such problems?

mild sentinel
#

It it a UACPI bug?

mild sentinel
grand shadow
#

I doubit its a uacpi bug

mild sentinel
#

🥀

mild sentinel
analog berry
mild sentinel
#

HP = Have Problems

analog berry
#

we need a mammogram boot test

mild sentinel
#

Can you get me managarm ISO to test on here

fleet osprey
#

I've always thought of it as HP = Hinge Problems, or Huge Problems

grand shadow
#

I'm gonna see if I can fix that first slab bug, maybe theres an allocator issue that I have not found

analog berry
mild sentinel
grand shadow
#

which is weird because this allocator works perfectly fine otherwise (ran stuff like meicnraft and wine)

analog berry
mild sentinel
#

That will cost an extra napkin ontop of the paper clips pocket lint and bottle caps

analog berry
#

how rich do u think the community is

mild sentinel
#

You have enough to afford ram

analog berry
#

had*

mild sentinel
#

Well we can do a payment plan

analog berry
#

also maybe my ram is a google drive swap partition trl

fleet osprey
#

$1000/mo for 5 years might get you 2GB

mild sentinel
#

how should i burn this image

#

unzip it?

analog berry
#

unzip and dd

mild sentinel
#

flashing

#

okay that makes it worse

#

😭

#

with the thing math said

analog berry
#

wdym

mild sentinel
#

well the reaction

analog berry
#

ah

mild sentinel
#

why is the image 4gb exact

analog berry
#

good question

mild sentinel
#

is it a disk image?

analog berry
#

yes

mild sentinel
#

so it has R/W space etc?

analog berry
#

i guess so

mild sentinel
#

Uhhhh so

#

@analog berry

analog berry
#

yeah thats a known issue

#

it made it past uacpi init

mild sentinel
#

Ahh damn

analog berry
#

so yeah an astral bug

mild sentinel
#

Wait let me try some extra boots

analog berry
#

yeah give it a shot

#

if u wanna get rid of that assert you will have to comment out some code

mild sentinel
#

Also the printing on here is much faster

analog berry
#

but it doesnt matter much

mild sentinel
#

Kernel mode setting for the nvidia GPU?

analog berry
#

nah, it allocates from an irq handler

#

which was prohibited recently

#

so now it dies

mild sentinel
#

No I mean

#

For why it prints so fast

analog berry
#

ah good q idk

#

mammogram is just fast

mild sentinel
#

Okay it did more stuff before failing there?

mild sentinel
analog berry
#

its sorta non deterministic when it will trigger the assert exactly since it depends on when the embedded controller irq comes in

mild sentinel
#

Ahhh

analog berry
carmine swallow
#

yeah its not flanterm

mild sentinel
#

What do you use for the terminal

analog berry
grand shadow
analog berry
#

causes the assert

mild sentinel
#

Let me check in shitdows

grand shadow
#

I'm thinking it might be something related to it using huge slab sizes when the cpu counts passes a certian point so I just wanna confirm

mild sentinel
#

I mean I saw it giving CPUids of like 40 somthing

grand shadow
#

wait how did u

#

it never even got to that part of the boot

mild sentinel
grand shadow
#

wait is that the same machine?

mild sentinel
#

Yes

#

This is the laptop

analog berry
#

astral has race conditions 😱

mild sentinel
grand shadow
#

I thought u tested on like a desktop the first time

#

which had the black screen

mild sentinel
#

It never got any further on there

#

So I switched to the laptop

analog berry
#

probably because logging was disabled

mild sentinel
grand shadow
#

the desktop is the one which had that slab page fault right?

mild sentinel
#

The desktop had page fault yeah

analog berry
#

ah

grand shadow
#

and how many cores does it have

mild sentinel
#

8c/16t

grand shadow
#

ty

#

bam, I can reproduce it here

analog berry
#

which bug

grand shadow
#

the slab init page fault

analog berry
#

ah good

obsidian pivot
grand shadow
#

oh its calling into a alloc before the alloc infrastructure is set up

#

awkward

obsidian pivot
#

when in doubt disable smp

grand shadow
#

yeah its because theres enough cpus for it to become an indirect slab

#

which calls into the main allocator

#

oops!

mild sentinel
#

Chat I may have to go and work on my kernel slongesab

#

So no more debugging right now

grand shadow
#

thats fine, I gotta debug ts

carmine swallow
# mild sentinel What do you use for the terminal

managarm uses custom font rendering for the boot logging, idk if its maybe the fact that it draws the text of the lines scanline by scanline up to down (first drawing the first line of all chars of the line, then second etc)

grand shadow
#

I'll ping when I got a new iso

carmine swallow
analog berry
mild sentinel
analog berry
#

yeah because WC works properly in this case

#

since the entire cache line is filled before eviction

mild sentinel
#

And is the terminal a userspace server I presume?

analog berry
#

i mean it runs before userspace so probably not

carmine swallow
#

and its not really a full terminal as you can't type in it

mild sentinel
#

I think somebody here said having a terminal emulator in the kernel would be against micro kernels for debugging logs PSP1G_pspTrollar

#

Exactly like this is doing

analog berry
#

well its just a text sink in this case

#

not a terminal per se

#

it would be hell to debug otherwise

mild sentinel
#

Well yeah but it would have the same things except there isn’t a keyboard or such hooked into it wahhgone

analog berry
#

perhaps

grand shadow
#

I think the solution is to just turn that alloc() into a cache of itself

prime mulch
#

astrole

grand shadow
#

casserole

carmine swallow
analog berry
#

true

analog berry
#

if it can devirtualize the call but idk how easy that is

#

like its an optimization that exists for c++ virtual functions

grand shadow
#

@mild sentinel @obsidian pivot new iso with early slab crash (hopefully) fixed

#

cc @robust geyser since I think this also happened on your machine

#

I think this is also what caused that black screen

#

since the slab init can run before the term init as one does not depend on the other

carmine swallow
#

I wonder whether I should test astral on an old samsung laptop that I have meme

analog berry
#

yes

grand shadow
#

I just noticed I never actually copy the mac address to the actual netdev struct

#

wooooops

mild sentinel
#

want me to wait for that fix?

carmine swallow
#

(or well its not really an actual laptop anymore as I removed the casing and screwed the mobo + screen to a piece of wood)

grand shadow
#

its compiling its just a one liner

grand shadow
sage locust
#

should i test something too?

grand shadow
#

if u want

mild sentinel
#

flashing rn

#

sorry got distracted

#

@grand shadow it boots on the laptop again but i forgor the ethernet

#

leme test desktop

#

@grand shadow

grand shadow
#

banger

mild sentinel
#

Is that what it’s meant to do now

grand shadow
#

I have no idea why it is doing that, I guess I can add some debug prints

mild sentinel
#

Does it do this on QEMU?

#

@grand shadow I don’t think it is even able to SIGKILL it

#

💀

#

It’s stuck

analog berry
#

its crazy that ps2 works

mild sentinel
#

How is it crazy that ps2 works?

#

USB dosnt even work

#

💀

analog berry
#

because astrals ps2 driver is known to not work literally anywhere

#

even in vms

mild sentinel
#

It’s a QEMU bug then

winged basin
mild sentinel
#

Let me test a third device

#

If it works there

#

Uhhh

#

💀

analog berry
#

did it blow up

mild sentinel
#

Nah works fine

analog berry
#

damn

mild sentinel
#

Skill issue?