#EvalynOS

1 messages · Page 21 of 1

rancid viper
#

well new_addr - original_section but yeah

hazy saddle
#

And then for static GS I can still do gs:whatever and have a fixed struct at the top of a section

rancid viper
#

you'd need to place the newly allocated sections after the kernel afaik

hazy saddle
#

I don’t think my allocator can handle that

rancid viper
#

it may be easier to just have macros

#

because you'd need to use __atomic* accessors or whatever anyway

#

to guarantee atomicity

hazy saddle
#

Yeah

#

Il have a macro that takes in the variable and reruns the pointer to it based on GS?

#

Or the data inside or etc

rotund furnace
#

And what I do since I shamelessly stole the macros directly :3

magic saffron
#

the compiler knows the offset of data from gs_base because it knows where it put the data in that section, similar to how we discussed it somewhere somewhere else (and how managarm does it). The difference here is that the compiler does it all for you. Its the same as it knowing how to access int x;, just using gs: instead of an implicit ds: (with assumed 0 base).

#

__seg_gs is convinient but the big downside is that pointers are only valid in the "gs address space", not the default one.

#

actually the real downside is its not compatible with c++ semantics, so its C only 😔

hazy saddle
#

i think ive manages to swap over CPU local

#

but this runs slow

#

nvm its just this laptop

#

the QEMU framebuffer is slow as balls

gentle quest
#

if u wanna see an example of automatic cpu locals with seg gs i do it like that in my kernel

#

so for me a cpu local load costs the same amount of operations as loading any variable

#

mov eax,DWORD PTR gs:[rip+0x1da40] # ffffffff800280b0 <g_this_cpu_id>

#

the trick is what i load into GS_BASE is not actually a gs base, rather it's an addend that must be added to the .per_cpu section to make the address overflow into the dynamically allocated per-cpu section

#

and that addition is done by cpu transparently

#

also with this setup u get super early cpu locals by just setting gs base to 0

#

and if u end up in a single cpu environment u can just continue using that section

hazy saddle
gentle quest
#

wdym?

hazy saddle
#

On syscall I have to swap stacks right

#

Before I had CPU local I stored the thread block directly under GS

#

But with this I need an extra pointer deref

#

Which needs another register

gentle quest
#

linux uses a field in the tss as scratch space for rsp

#
SYM_CODE_START(entry_SYSCALL_64)
    UNWIND_HINT_ENTRY
    ENDBR

    swapgs
    /* tss.sp2 is scratch space. */
    movq    %rsp, PER_CPU_VAR(cpu_tss_rw + TSS_sp2)
    SWITCH_TO_KERNEL_CR3 scratch_reg=%rsp
    movq    PER_CPU_VAR(cpu_current_top_of_stack), %rsp
rotund furnace
#

isn't it like the rsp2 field

#

because that's never used

gentle quest
#

yep

rotund furnace
#

using rsp as the kpti scratch reg is insanely smart

hazy saddle
#

So the TSS is stored fully inside of cpu local on linux?

#

And then it just uses a spot inside that?

gentle quest
#

all of cpu locals are stored in cpu local

hazy saddle
gentle quest
#

u just duplicate the entire .per_cpu section for all cpus

hazy saddle
#

So I can technically just do what I was doing withhh

rotund furnace
#

wait linux dumps the tss inside the cpu local struct

gentle quest
#

also linux has dynamic per cpu variables

rotund furnace
#

fuck that's kinda smart

hazy saddle
#

Which is the equivalent to what linux was doing

#

Except not reusing the TSS?

gentle quest
#

yeah

gentle quest
#

thats the thing

neon karma
hazy saddle
#

So my idea wasn’t even dumb and I redid all this for nothing

gentle quest
#

u have to understand its just a normal binary section

rotund furnace
#

oh yeah

#

linux does it like that

#

forgot

gentle quest
#

just custom data allocated for every cpu

neon karma
#

what could that be used for

gentle quest
#

anything that can be used per cpu, counters, queues, stuff like that

neon karma
#

sure but why not a global cpulocal variable

gentle quest
#

wdym?

neon karma
#

the thing I do now

gentle quest
gentle quest
neon karma
#

yes

#

reduces the binary size I guess

hazy saddle
gentle quest
#

because modules may introduce their own percpu variables

#

and those are loaded dynamically

neon karma
#

oh yeah

#

well I don't support that :P

gentle quest
#

also shoving unrelated variables into one struct doesnt really achieve anything

#

and a section just automatically groups unrelated variables

#

u can have a static per-cpu variable and it will work

#

without global visilibity

hazy saddle
#

Though it is cheaper with that

gentle quest
#

gsbase = pcpu_base - .per-cpu-section

hazy saddle
#
    this_cpu_offset = g_per_cpu_base;
    this_cpu_offset -= (ptr_t)SECTION_MARKER_BEGIN(PER_CPU_SECTION);

then its gs:varrible?

gentle quest
#

yep

#

the offset is calculated by the cpu with one instruction

#

its atomic

hazy saddle
#

whats the proper way to refer to that inside assembly?

#

that also lets me use clang address spaces right i think too?

gentle quest
#

%gs:var(%rip)

gentle quest
hazy saddle
#

?? i mean how do i know how to refer to that var from inside asm?

gentle quest
hazy saddle
#

what wiuld var be in this case?

gentle quest
#

the per cpu variable u want to read

hazy saddle
#

but how do i know what that is in assembly?? where i cant refer to the C linker stuff?

gentle quest
#

what C linker stuff

#

after you set up the base u dont need any linker stuff

hazy saddle
#

because if the varrible is defined in C how do i refer to it from assembly?

gentle quest
#

the workflow is

DEFINE_PER_CPU(current_thread);

in asm:

mov %gs:current_thread(%rip), rax
hazy saddle
#

would the offset be like :0 if its at the very start of perCPU

gentle quest
#

no, it would be the offset from end_of_kernel_half - 2GiB + .per_cpu

#

not that u care anyway because the compiler puts the right number by itself

#

thats why this approach is so cool

hazy saddle
#

so how do i get that into assembly??? because i dont know what it is at all from there?

gentle quest
#

get what into assembly

hazy saddle
#

if i need to refer to CPU local things in asssembly

gentle quest
#

i literally showed so many examples 😭

hazy saddle
#

i dont know how any of them work 😭

#

i get how this works within C

gentle quest
#

how do u access normal variables from assembly

hazy saddle
#

wait

#

no

#

i can do that just fine

wanton grove
hazy saddle
#

i can just use extern varrible

#

then its gs:varrible + rip

gentle quest
#

well yeah thats kind of how it works

hazy saddle
#

my brain farted

gentle quest
#

just like any other variable in asm

hazy saddle
#

💀

#

sorry

gentle quest
#

np

gentle quest
hazy saddle
#

Time to redo CPU local for the fith time today

#

😭

#

But now it should be perfect

#

wanton grove
gentle quest
#

how the hell do u know which cpu ur on

wanton grove
#

im storing cpu num to struct in gs

gentle quest
#

yeah so you use percpu

#

just emulated and slow af

#

this stores all of the data in gs

#

not just the idx

#

so any operation on cpu local is 1 cycle and atomic

hazy saddle
#

this also means i wont need the CPU local head thing mangarm does iirc

#

because i can refer to gs: cleanly

gentle quest
#

yep

hazy saddle
#

i think for the BSP i can always reuse the orignal section too?

#

as long as i dont have loadable modules that need cpu_local

gentle quest
#

technically u can i guess

neon karma
hazy saddle
#

im pretty sure this is some fuckery of CISC arches

gentle quest
neon karma
#

yea, because then this is not an option for me

gentle quest
#

why not

hazy saddle
#

if you do x86 and aarch do both

neon karma
#

I'd like to not have two cpu local implementations for different arches

gentle quest
#

why not?

#

if one arch allows the implementation to be much more optimized

#

cpu locals in general are very arch specific

hazy saddle
#

since im only on the BSP rn this is all i need? and then later i calcuate the delta

gentle quest
#

e.g. on linux they store the current thread pointer in a scratch reg as you've seen

#

yeah

#

dont forget to load 0 to gs base

hazy saddle
#

yes yes. IIRC my gdt should do that for me?

#

anything else you think i should add to the _Generic's?

gentle quest
#

not sure why u need generics like that

#

did u see how i do it?

hazy saddle
#

oh thats pretty neat

#

though _Generic can do it comptime iirc?

#

ig if anything i can be explicit where its annoying

gentle quest
#

a fixed switch on sizeof is definitely also comptime

hazy saddle
gentle quest
#

well ive seen that it is by looking at my disassembly

#

at O0

gentle quest
#

that causes a base reload

hazy saddle
#

ahh

floral kettle
gentle quest
#

why is it so bad on msvc?

#

so msvc just straight up generates incorrect code?

#

and i guess clang just does the right thing but not rip relative

#

at least the load is still atomic

floral kettle
#

yeah it looks like msvc got rid of the gs segment and in the clang code there is a redundant eax eax move + the lea isn't merged to the load

coarse oasis
#

the mov eax, eax truncates to 32 bits no?

gentle quest
#

maybe 'a' is actually annotated with gs somewhere?

#

no way they have a bug that bad there

coarse oasis
floral kettle
gentle quest
#

well your kernel shouldnt be larger than 4gb right

coarse oasis
#

sure but you lose potential sign bits

gentle quest
#

hm

#

does this work or not?

coarse oasis
#

gs would need the upper 32 bits of the address + lower 32 bits of the offset ig

floral kettle
#

I guess you could account for the missing bits in the gs base

#

ye

hazy saddle
#

https://godbolt.org/z/67MW6511o
it looks fine for me?

gentle quest
#

we're talking about msvc targets

hazy saddle
#

ahh

#

sorry

rotund furnace
#

if it isn't msvc being stupid

gentle quest
#

yeah this cant be real

hazy saddle
#

msvc is not a c compiler, its a source code mutilator that sometimes manages to emit valid x86 and aarch64 code

urban vale
#

nobody asked but the preferred way to do a cpu-local structure on mips was to map it into the last page of the address space using a manually created tlb entry and then access it using negative offsets from the zero register

rotund furnace
#

that's fucking horrifc

hazy saddle
#

sounds good for RISC tbh

urban vale
#

so youd put it at the same virtual address on every cpu but it would be mapped to a different phys addr

gentle quest
#

isnt that all cpu locals

#

or well

#

sort of

urban vale
gentle quest
#

same virtual on x86 because virtual on x86 is before segmentation is applied

#

then its linear

floral kettle
# gentle quest yeah this cant be real

I think it is, without O2 it generates a proper gs relative access and if you use O2 + put the address to a volatile variable then it also works (though the code is very much unoptimized)

gentle quest
#

u should really submit a bug report to them

rotund furnace
#

msvc? fix a bug?

#

what timeline is this

gentle quest
#

i got an email saying they fixed a bug that i reported

#

(that was 5 years ago btw)

hazy saddle
#

in nasm it should be like?
mov [rel gs:syscall_scratch_space], r15

gentle quest
#

and it was fixed a month ago

hazy saddle
#

yeah it seems its angry at this?

neon karma
#

I'd need to extern "C" my variables if I did that smh

hazy saddle
#

i dont think nasm is getting the symbol right

#

this compiles jist fine

#
src/syscalls/syscalls.asm:9: warning: 32-bit relative section-crossing relocation [-w+reloc-rel-dword]
src/syscalls/syscalls.asm:10: warning: 32-bit relative section-crossing relocation [-w+reloc-rel-dword]
src/syscalls/syscalls.asm:13: warning: 32-bit relative section-crossing relocation [-w+reloc-rel-dword]
src/syscalls/syscalls.asm:34: warning: 32-bit relative section-crossing relocation [-w+reloc-rel-dword]
src/syscalls/syscalls.asm:53: warning: 32-bit relative section-crossing relocation [-w+reloc-rel-dword]
src/syscalls/syscalls.asm:54: warning: 32-bit relative section-crossing relocation [-w+reloc-rel-dword]
src/syscalls/syscalls.asm:57: warning: 32-bit relative section-crossing relocation [-w+reloc-rel-dword]
hazy saddle
# gentle quest `%gs:var(%rip)`

do you know why nasm isnt allowing this proper?

global syscall_handler
extern execute_syscall
extern current_thread
extern syscall_scratch_space

syscall_handler:
    swapgs

    mov [rel gs:syscall_scratch_space], r15
    mov r15, [rel gs:execute_syscall]
    mov [r15 + 32], rsp
    mov rsp, [r15 + 24]
    mov r15, [rel gs:syscall_scratch_space]
    ...

it just fully double faults and accepts bunk externs and it compiles fine. am i gonna have to remake this in GAS? wahhgone

gentle quest
#

tbh no idea, i dont use nasm

#

have u looked at the final assembly

#

via objdump etc

hazy saddle
#

it works with GAS

gentle quest
#

u probably just didnt convince it to use the right encoding

hazy saddle
#

I’m too lazy tbh

#

Il just be a freak and mix Nasm and GAS

#

I like NASMs macro syntax too much for my ISRs

#

but now i have proper fast CPU locals

#

ty for this method infy

gentle quest
#

i like gas because i can do #include and pass it my C flags and it works out of the box

hazy saddle
gentle quest
#

also it autoamtically defines __ASSEMBLER__ i can even share header files

#

between c and assembly

hazy saddle
#

Oh sick

rotund furnace
hazy saddle
floral kettle
hazy saddle
#

sick

hazy saddle
rotund furnace
#

so?

hazy saddle
#

nothing ig

#

now im gonna make my idle thread set the preemption flag

#

so when idleing any IRQ wakes the system up

rotund furnace
#

I just yield :P

hazy saddle
#

well then it wont sleep :p

rotund furnace
#

but that's prob a better idea

hazy saddle
#

Now CPU local works

#

But like good

#

And its atomic

#

And nothing used fixed blocks in assembly etc

floral kettle
#

the reason it didn't work on nasm is probably because you accidentally used execute_syscall instead of current_thread

hazy saddle
#

💀

#

Fuck

gentle quest
#

lmao

urban vale
hazy saddle
#

But I don’t even have SMP right now

#

I’m not ready for NUMA shit

hazy saddle
#

But that may be annoying

hazy saddle
#

yup nasm works

#

💀

hazy saddle
#

I wonder why astral dosnt do this?

#

And why it uses fucking CR2

#

Like how much of a rework is that under astral?

#

To just use a fucking thing like that

#

Similarly to Linux and mine

neon karma
hazy saddle
hazy saddle
#

Oh yeah timers are now separated from preemption

#

The timers just set the CPUlocal flag

round shoal
round shoal
wanton grove
hazy saddle
#

What?

wanton grove
#

if cr2 is rw why not to use it

hazy saddle
wanton grove
#

a

hazy saddle
#

Which makes it slow as balls

#

And it also causes a vmexit

#

Which makes it even more slow as balls

hazy saddle
#

It just puts it into the unused part of the TSS

hazy saddle
round shoal
#

bro really translated "kalajadu" to "black majick"

hazy saddle
#

No

#

I took a guess

#

:p

#

That you were confused

round shoal
#

kala = black in bangla
jadu == magic in bangla

#

is it daemon or demon

hazy saddle
#

daemon is a background process

floral kettle
#

it wouldn't really make any sense given that there are no control bits or anything in there and even for regs that do like cr3 they don't always cause vmexits (it depends on what you configure the vmx/svm settings to and what's supported by the cpu)

neon karma
#

I thought of the same thing lol

hazy saddle
neon karma
#

I believe so

floral kettle
#

its possible that it does yeah, though again it depends on how you configure it as + what's supported

full fern
#

I really really want to be the first one to run steam for shits and giggles

gentle quest
full fern
#

I have been consistently getting it to crash in a new way which makes me assume it detected an update

#

Before it would just keep trying to check and inevitably give a "pls connect to the internet" error after 10-20 seconds

#

(now that only happens when I forget to run netd, which I really should improve on at some point to run automatically in /etc/rc)

hazy saddle
hazy saddle
#

Updated todo

  • meson & jinx
  • cpu local
  • unite prremption from schedular (which is pretty much already the case but i dont wana push my half assed messy patches)
  • make generic linked list helpers & support circular ones too
  • make the chunked linked list helper funcs ontop
  • implement a generic bitmap allocator for things
  • implement the VFS
#

Now it’s just linked lists and then bitmaps and the VFS

hazy saddle
#

i think ive got atomic INC/DEC for cpu local now

#

this works under -O0 and generates the proper opcodes etc

#

yeah this should work

#

though 64 bit writes may need to increment and decremt the preemption counter using the INC/DEC operations?

#

but thoes remain single instruction

#

and it means they wont cause issues™

#

Though I wonder what other causes may cause the compiler to do that?

#

Maybe having a set of them that handle the preemption counter themselves before doing the load/store

#

To be used inside of places where preemption can happen

#

Though this depends on what actually is using CPU local and how much of an issue it is if it ends up cross core?

#

Though in the cases where I don’t wana be preempted I’d possibly need that to last longer than a basic load/store

#

Eg if I’m doing an operation where I need to fetch the LAPIC ID and use it for somthing to map an IRQ to me

hazy saddle
neon karma
#

yeah I have inc/dec for the preemption counter and I manually disable it if I need to when I'm reading a cpu local

#

or a few helpers that do it, if I just want to load/store

hazy saddle
#

Though for plain load and stores (that generate one instruction) I think it’s fine for setting a Boolean etc

#

Depends on the section but it will work then

hazy saddle
#

Apparently my kernel has enough for fork

#

Which means the VFS is delayed again babyyyy

#

I’m going to rework process spawning

#

So that way I can pass data to new threads

#

And then I am going to implement fork

#

I have everything I need for CoW too

#

Which means I can get bash

#

Without any VFS syuff

#

It would be pretty useless

#

But I am going to at least get it loading

#

And in theory it should work

#

And I will have fork and exec()

wanton grove
hazy saddle
#

I’m thinking with fork() I can have a special lock for it?

#

Syscalls will take it when doing anything to do with virtual memory etc

#

But many can take it at once as long as the fork() call or anything else similarly critical needs it etc

#

That way fork() can have exclusive access to do its work when needed

#

But other things can just go wild when not fork()ing and use the locks of the backing data structures to keep it safe?

#

Yeah I would need two locks I think

#

One lock for the data structure it’s self that’s locked when modifying it

#

And one lock to prevent those functions from being called when they shouldn’t

wanton grove
hazy saddle
#

Eg in a fork()

hazy saddle
#

But I need a lock I can take more long term for these data structures

hazy saddle
#

I am curious what Linux does here?

#

If only it were free and open source

#

And I could just go look for myself

#

Ehh like with what JW said I shouldn’t prematurely optimize this

#

Having a regular process local mem lock isn’t horrible

#

And then I still have the local locks for the underlying things if I change it up etc

clear bison
#

Get it working first

hazy saddle
#

Yeah exactly

#

I have everything I need

#

Though I should make my process creation a bit more flexible first anyways

hazy saddle
#

That way I can actually deliver data to it

#

And I need a stub to conform to the ABI

sterile plank
neon karma
#

I recommend a self-sealing stem bolt

hazy saddle
neon karma
#

I can give you hundred gross self-sealing stem bolts

#

I don't know what else to do with them

hazy saddle
#

How did you get so many self-sealing stem bolts

neon karma
#

I traded five thousand wrappages of cardassian yamok sauce for them

hazy saddle
#

😭

rotund furnace
neon karma
#

some dumbass waiter in my uncle's bar accidentally ordered them so I took it off their hands

rotund furnace
#

mhm

#

okay

hazy saddle
#

I now properly handle passing arguments to threads

#

I’m now gonna make a way to spawn threads generically from a path to an elf file

#

Yeah not really a huge thing

#

And I should have supported this for ages

neon karma
#

kernel shell nooo

hazy saddle
#

But

hazy saddle
#

😭

wanton grove
#

when font change

hazy saddle
#

It dosnt even do any shell like things

#

Also I’m literally working on this so I can nuke this thing from the sky

#

No more “shell” in the kernel

hazy saddle
#

And if I don’t I will eat a raw onion

#

I have the stuff I need for fork and everything

neon karma
#

big bite

hazy saddle
#

Il eat into it like a fucking apple

neon karma
#

you don't need fork to run bash

hazy saddle
#

Yeah but to make it run apps properly

neon karma
#

apps 😭

hazy saddle
#

Programs

#

😭

#

Software

full fern
hazy saddle
hazy saddle
#

I’m just testing the argument crap

#

In response to the ❓

hazy saddle
#

me when i used to not zero registers when jumping to userspace

#

leaking kernel data

hazy saddle
#

a generic app spawner

sudden mirage
hazy saddle
#

and then the libc manages that

sudden mirage
hazy saddle
#

i should be able to just poop out a fork now

#

i think

#

I should have everything

#

And now I have a proper way to create processes with arguments

#

So I can have a fork() trampoline thread

#

Which handles things differently than making a new process

#

Because it has to some restore registers

#

Which may be a bit cursed because il have a
mov rsp, [rsp]

#

And il give the assembly function a pointer to use as the stack

hazy saddle
# sudden mirage ah ok

But yeah if you don’t do this the user app can technically be getting some kernel data leaked

#

Also make sure to always use the 32bit register versions

#

It’s faster

sudden mirage
#

makes sense

wanton grove
#

32 bit is for virgins when real chad use 128bit

sudden mirage
true oak
sudden mirage
hazy saddle
#

And some CPUs don’t see xor r64 r64 as dep breaking

#

I think with my new build system

#

Bash shouldn’t be horrid

#

And I can just get inspired by emmas jinx recipie and patch

#

Bash like

#

Won’t do much

#

But I can atleast have it “ported”

#

IIRC I should have enough sysdeps for it to load?

hazy saddle
#

genuily

#

what the fuck

#

why did updating mlibc cause everything to break

#

every app in diffrent ways

#

hello world?

#

just fine

#

doom? GPFs in the middle of some enviroment shit

#

badapple? jumps to zero

#

:/

hazy saddle
#

why does everything make it WORSE?????

#

mlibc wont even compile

#

after updating to master

hazy saddle
warped ermine
#

frigg.cpp

hazy saddle
#
Kernel Shell> hello
Started playing HELLO in userspace
Kernel Shell> Entering ld.so
ldso: Executable PHDRs are at 0x10000040
rtld: Loading (executable)
rtld: TLS of (executable) mapped to 0x-120, size: 288, alignment: 8
rtld: tcb allocated at 0x20101220, size = 0x90
rtld: tls allocated at 0x201010c0, size = 0x160
rtld: wrote tls image at 0x20101100, size = 0x120
rtld: Running DT_PREINIT_ARRAY functions
rtld: Initialize (executable)
rtld: Running DT_INIT function
rtld: Running DT_INIT_ARRAY functions
In function doInitialize, file ../options/rtld/generic/linker.cpp:1318
__ensure((object->initArraySize % sizeof(InitFuncPtr)) == 0) failed
!!! mlibc panic !!!
#
Kernel Shell> badapple
Started playing BAD APPLE in userspace
Kernel Shell> Entering ld.so
ldso: Executable PHDRs are at 0x10000040
rtld: Loading (executable)
rtld: TLS of (executable) mapped to 0x-120, size: 288, alignment: 8
rtld: tcb allocated at 0x2bff60, size = 0x90
rtld: tls allocated at 0x2bfe00, size = 0x160
rtld: wrote tls image at 0x2bfe40, size = 0x120
rtld: Running DT_PREINIT_ARRAY functions
rtld: Initialize (executable)
rtld: Running DT_INIT function
rtld: Running DT_INIT_ARRAY functions
rtld: Object initialization complete
Leaving ld.so, jump to 0x100009dc
qemu: terminating on signal 2
hazy saddle
#

?????

#

I call bullshit on the universe

#

and doom only prints the panic

#

and i know i did a clean build

#

A full entire clean rebuild

#

Doom still only panics

#

And prints no extra debit debug shit

#

What the actual fuck

hazy saddle
hazy saddle
#

“Mlibc sucks I’m porting musl”

#

- speaking from a crazed madwomen going insane from fixing this

hazy saddle
#

claude fixed it

#

cc: @rotund furnace

#

200k fucking tokens

#

😭

#

it was just told "fix it"

#

it fucking did it

#

my elf loader was cooked

soft snow
hazy saddle
#

🥀

hazy saddle
#

💀

#

That shit was funny

#

Watching it go for like an hour

#

Just thinking on loop

soft snow
hazy saddle
#

water does

soft snow
hazy saddle
#

he just fed my kernel into there

soft snow
hazy saddle
#

because we were bored

#

and banging our head against the wall

soft snow
#

Why not

hazy saddle
#

we say there for like an hour

#

watching it go in a loop

soft snow
#

I use Codex for debugging sometimes

hazy saddle
#

it eventualy shat out like 20 lines of fixes

soft snow
#

Its half baked tbh

hazy saddle
#

after 200k tokens

#

💀

soft snow
hazy saddle
#

it even tried to find bugs inside mlibv

soft snow
#

It's fast asf

soft snow
hazy saddle
#

i dont do AI crap much

#

atleast not inside my ide etc

soft snow
#

Codex hallucinates so much though

#

It's sad.

#

I only use it if I'm physically looking at the files

rancid viper
#

only reason I'd really use codex over claude is cuz its cheaper

hazy saddle
#

@claude fix code no mistake

#

that was the prompt

#

💀

rancid viper
#

yeah

#

if @rotund furnace just did "fix elf loader" woul've been done in a minute

#

but no

#

point it at the entire fucking distro

#

impressive it found the issue at all

hazy saddle
#

it was fucking funny

hazy saddle
#

I do gotta say

#

The new mlibc sysdep format is good

rancid viper
#

eh

#

money for amount of querying u can do is cheaper

#

sure the free plan exist if that is enough

viral bison
#

GH copilot makes codex free

#

they nuked claude from the student tier

rancid viper
#

u need to buy copilot

#

then

#

lol

viral bison
#

no

#

as a student it's free

rancid viper
#

im not a student

viral bison
#

also, copilot is like 10 buck a month else

hazy saddle
#

force push

#

The new mlibc version is running well

#

Time to uhhh

#

Port bash

#

Il get the shit for it later to be full full

#

But I’m not eating an onion

#

also by popular demand

#

make bootstrap now also makes the initramfs

#

and make initramfs regenerates it

wanton grove
hazy saddle
soft snow
hazy saddle
#

bash works

#

ts is fucking cursed tho

#

yes let me just sed some random shit out

cold barn
# hazy saddle

btw for clarity I would recommend using [.] instead of \.

#

also while [[:space:]] can be nice if you want it to match unicode whitespace characters, or at least theoretically depending on what the implementation supports, you can also use \s. err, you might need to use -E with that, I'm not sure. but \s is part of many common regex implementations and should be at least "all ascii whitespace characters" if not "all whitespace characters in my character set"

cold barn
neon karma
#

c++ reflection so good that they added it in sed

cold barn
#

I go by the rule of thumb that if something need the literal value, and I can't just do -F (for grep), then it should use [] instead of \ except where it explicitly doesn't make sense

hazy saddle
#

but the ither things worked

#
    sed -i 's/\bgetenv[.]o\b//g'    lib/sh/Makefile
    sed -i 's/\bstrchrnul[.]o\b//g' lib/sh/Makefile
    sed -i 's/[$]{LIBOBJDIR}strchrnul[$]U[.]o[[:space:]]*//' lib/sh/Makefile
wanton grove
hazy saddle
#

sed works fine for this

cold barn
hazy saddle
#

i tried to edit it more

#

and it broke

#

im not good at sed

cold barn
#

😔

#

oh uh

#

it is probably smart enough to realize you don't mean a range or exact match here, but you should [] the { and }

#

though, those might only be special characters on extended/perl regex

hazy saddle
#

With jinx it is a pinned Debian thing running this so technically it shouldn’t ever cause issues

cold barn
#

wdym?

#

like a pinned debian container?

hazy saddle
#

Yes

#

So the behavior shouldn’t muck up across system

cold barn
#

ah ok

hazy saddle
#

The rest of the bash sysdeps shouldn’t be terrible tho?

#

Atleast I can stub them for the most part

#

Very heavily

hazy saddle
#

💀

#

tf is bash trying to do

#

🥀

#
addr2line -e extras/initramfs/bash.elf 0x00000000100003ca
/build_dir/builds/mlibc/build/../subprojects/frigg/include/frg/manual_box.hpp:20 (discriminator 2)
round shoal
#

cr7 did not do that error AEEE

hazy saddle
#

what?

round shoal
hazy saddle
#

invalid opcode??????

wanton grove
hazy saddle
#

not fucking again

wanton grove
#

or its your mmap thing

#

it shouldnt invalid opcode

hazy saddle
#

i dont have MMAP

#

💀

wanton grove
#

then elf loading is baddd

hazy saddle
#

ahh

#

my get time fucntion was garbgo

#
    int Sysdeps<ClockGet>::operator()(int clock, time_t *secs, long *nanos) {
        *secs = 0;
        *nanos = 0;
    }
#

for somre reason

#

this isnt valid

neon karma
hazy saddle
#

Also me when I forget a return value

#

😭

wanton grove
#

ub moment

#

@hazy saddle do you check for clock also

clear bison
neon karma
hazy saddle
hazy saddle
#

God the new sysdep system is nice

#

Because it can just say fuck you ENOSYS

neon karma
hazy saddle
#

so it can do compile time asserts better

#

and if it cant find a sysdep it can now fallback to ENOSYS

#

yoooo its bash printing

neon karma
#

nice

hazy saddle
#

sadly i think il need my VFS to go further

#

🥀

#

or i can fake more sysdeps

neon karma
hazy saddle
#

yes

#

Wait

#

Panic

#

Nvm my phone caches it wrong

neon karma
#

stupid quick reaction row

neon karma
hazy saddle
#

yeah

#

or i can fake it

neon karma
#

nuh uh

hazy saddle
#

what even is the sysdep for this

neon karma
#

probably getcwd :P

hazy saddle
#

i cant find it in others sysdeps

#

💀

hazy saddle
#

there we go

#

Let’s see what happens with more memory

#

I know my shit is so fucking inefficient esp with any file ops

round shoal
hazy saddle
#

no

#

i dont have any filesystems

#

:p

#

bash really be suckling my memory

#

💀

#

That was with 8gb ram

round shoal
hazy saddle
round shoal
#

or is it too hard

hazy saddle
#

i mean i am gonna make my vfs soon™

#

along with NVMe etc

round shoal
#

u have ahci or ata

hazy saddle
#

no

round shoal
#

just start with ata

hazy saddle
#

no

round shoal
#

then move to ahci

#

btw ur birthday is April 29,2026

hazy saddle
#

i know

#

id rater just do nvme and virti

#

:p

round shoal
hazy saddle
#

Yes

#

I made a typo

#

Shocking

normal turret
hazy saddle
#

Now onto Trisha takanaw for the forecast for today

round shoal
#

how ischt my new name

#

it will show "DoorsOS Shill/AMD hater"

hazy saddle
#

okay

#

the only issue

#

is faking stdin enough

#

That’s a bash port

#

The input layer is all sorts of FUCKED

#

But it works

marble ridge
#

neat!

true oak
marble ridge
#

would be nice if i could read anything but still

hazy saddle
#

Once I get my VFS for a proper input layer

#

It should be usable

#

Then I can tape on fork()

hazy saddle
marble ridge
#

nah don't bother, i trust you lol

#

i can just zoom in the image

#

it's just basically unreadable on my 1440p screen without zooming in though

hazy saddle
#

Backspace is the main broken thing it seems

true oak
hazy saddle
#

no?

#

im only using bultins

true oak
#

why does it print all of this stuff after echo

hazy saddle
hazy saddle
soft snow
hazy saddle
#

ya know what

#

im not fixing that issue

#

until i get my VFS done

#

Somehow bash internally is just fucking up?

#

It’s getting the data it copied to it?

#

But it keeps stale data in its buffer

#

Making it fuck up bad

neon karma
#

I'm guessing you're doing a unix like vfs?

hazy saddle
#

I do want to yes

hazy saddle
#

wtf

#
bash-5.3$ echo "helloooo"
helloooo
bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ echo "testtt"
testtt
o
bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ 
hazy saddle
#

i did stub that last one

#
    int Sysdeps<SetPgid>::operator()(pid_t pid, pid_t pgid) {
        return 0;
    }
#
bash-5.3$ echo "hello"
0x65 0x63 0x68 0x6f 0x20 0x22 0x68 0x65 0x6c 0x6c 0x6f 0x22 0xa 
hello
bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ echo "a"
0x65 0x63 0x68 0x6f 0x20 0x22 0x61 0x22 0xa 
a
llo
bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ echo "a"            
0x65 0x63 0x68 0x6f 0x20 0x22 0x61 0x22 0xa 
a
llo
bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ echo "hello"
0x65 0x63 0x68 0x6f 0x20 0x22 0x68 0x65 0x6c 0x6c 0x6f 0x22 0xa 
hello
bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ 
#

i am sending the right bytes?

#

It looks like bash isn’t clearing its buffer

#

it seems when i send a \n here

#

it breaks the buffer?

#

That’s a \n being printed there

#

And the rest of the buffer still has data

#

So bash gets angry?

viral bison
#

maybe bc you are breaking?

hazy saddle
#

wdym?

viral bison
#

the break;

#

should it be there?

hazy saddle
#

maybe not?

viral bison
#

idk, i can't see the full code

hazy saddle
#

that breraks it

viral bison
#

XD

hazy saddle
#
bash-5.3$ stdin: count=1024 rpos=0 len=0
echo "test"
test
bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ stdin: count=1024 rpos=12 len=12
echo "t"
t
st
bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ stdin: count=1024 rpos=9 len=9
viral bison
#

well, now to this bug

hazy saddle
#

ts is cursed af

#

but it should work enough?

#

after fixing th bug*

viral bison
#

the breaks are strange there

#

that means stdin stops working when you press return

hazy saddle
#

its getting a \n stuck somwhere i think

viral bison
#

this should be before any other case btw

#

else there might be cases where pressing return or any other chars will do a buffer overflow

hazy saddle
#
echo "test"
test
bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ stdin: count=1024 rpos=12 len=12
echo "1"
1
st
bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ stdin: count=1024 rpos=9 len=9

bash-5.3$ ot set terminal process group (1): Operation not implemented (ENOSYS)
bash: no job control in this shell
bash: //.bashrc: Access denied (EACCESS)
bash-5.3$ stdin: count=1024 rpos=1 len=1
viral bison
#

yeah well, stdin is not the problem here i think

hazy saddle
#

ah

viral bison
#

oh wait

#

no it might be

hazy saddle
#

this is my fuckass sysdep for it

viral bison
#

idk how bash wants the buffer

#

maybe try to not put \n inside the buffer?

hazy saddle
#

It should be mostly standard stdin?

viral bison
#

but only print it

hazy saddle
#

Let me try again

#

yeah

#

it ends up thinking its an exit

viral bison
#

ah

hazy saddle
#

This is the termios I report

viral bison
#

then time to check the .bashrc file thing

#

or why it throws op not implemented

hazy saddle
#

I don’t have a .bashrc file

#

lol

viral bison
#

i think bash wants one

hazy saddle
#

Idk why it says ENOSYS tho

viral bison
#

lol

hazy saddle
#

True

#

But why would it do this

viral bison
#

maybe this can help?

#

i think the first error is the problem

#

anyway, it should still work

#

it will just throw the warnings / errors at you

hazy saddle
#

what even are the sysdeps for pgrp

viral bison
#

wdym pgrp?

hazy saddle
viral bison
#

ah that

hazy saddle
#

i dont get any mlibc errors

#

wait

#

In function mlibc::sysdep_return_t<Tag, Args ...> mlibc::sysdep_or_enosys(Args&& ...) [with Tag = Tcgetattr; Args = {int&, termios*&}; sysdep_return_t<Tag, Args ...> = int], file ../options/internal/include/mlibc/all-sysdeps.hpp:53

#

???

#

right there

viral bison
coarse oasis
viral bison
#

go look here for the chat log

hazy saddle
#

fuck

#

💀

viral bison
#

i asked it for the pgrp

#

LOL

hazy saddle
#

Me when UB is undefined

neon karma
hazy saddle
#

Yeah I’m just stubbing the fuck out of it

neon karma
#

real

hazy saddle
#

Still having the same issue

viral bison
#

well, go look at that chatlog

coarse oasis
viral bison
#

maybe the compiler auto added return 0?

hazy saddle
#

wtf is this

coarse oasis
#

no the compiler only does that for main in hosted environments

hazy saddle
#

Could it be anything to do with this

#

💀

#

I swear it feels like something inside of bash isn’t being cleared out on \n

#

What else is strange

#

Is every newline

#

It complains about no job control

true oak
hazy saddle
#

I’m not

#

😭

#

Like

#

Wtf is it doing

#

@viral bison it says its an issue with the tty

viral bison
#

lol

wanton grove
#

do vfs in 3 days or you gonna eat onion

hazy saddle
#

no

#

🥀

true oak
#

thanks for challenge

hazy saddle
#

yeah well

#

the fucking AI cant rewrite th thing to work

wanton grove
hazy saddle
#

this is what it says now

viral bison
hazy saddle
#

No

#

🥀

viral bison
#

you should not use perplexity for code

hazy saddle
#

Yeah it fucking sucks ass

viral bison
#

use Copilot in your IDE

#

it will work better

hazy saddle
viral bison
#

bc it can actually get the context

hazy saddle
#

I don’t got that in my ide

#

🥀

viral bison
#

install copilot

hazy saddle
#

I use KATE

viral bison
#

it can be installed in most IDEs

#

ah

#

make a push

hazy saddle
viral bison
#

i'll try

hazy saddle
#

It should be able to

#

If it dosnt il regenerate

viral bison
#

well, in the meantime

#

time to opt out

viral bison
hazy saddle
#

Let me regenerate it

#

Just a moment

#

do a git pull

#

then apply that

#

and use this for the libc

viral bison
#

idk why it fails

#

i did a pull

hazy saddle
#

did you use codeberg?

#

or my main git server

viral bison
#

codeberg

hazy saddle
#

Yeah codeberg is always a bit behind

#

Use the git server

#

@viral bison did ze patch work?

viral bison
#

yeah, now it applied

hazy saddle
#

lol

#

There we go

#

Now it should just be a make bootstrap

#

Then make run

#

And then BASH

#

And you should be able to reproduce it

#

If you put the zip file in the right spot

viral bison
#

ye, making now

hazy saddle
#

How’s the new build system btw?

viral bison
#

@hazy saddle

hazy saddle
#

You didn’t unpack the thing

#

You need to put the zip file

#

Unzip it

viral bison
#

ah

viral bison
hazy saddle
#

Yes

viral bison
#

seems like so, pain

hazy saddle
#

The cross compiler

#

For userspace

viral bison
#

how much time do i need for it? XD

hazy saddle
#

How good is your cpu

viral bison
#

i5 12th gen (mobile)

hazy saddle
#

Rip

#

Gonna take like half an hour

viral bison
hazy saddle
#

Most libcs require this sadly

viral bison
#

all my poor cores

#

can't you just send me the gcc binaries? @hazy saddle

viral bison
#

XD

hazy saddle
#

im zipping the jinx folder

#

so make initramfs? should just work after

#

and or cd ./jinx && ./jinx rebuild mlibc

viral bison
hazy saddle
#

it will rebuild gcc

#

again

#

💀

viral bison
#

ah

#

make run does not work

#

ooof

hazy saddle
#

hm?

viral bison
#

says it cannot find limine.h

hazy saddle
#

uhh

#

cd ./jinx && ./jinx host-rebuild limine edk2-bin

#

and where did you put the folder

viral bison
#

still nope

hazy saddle
#

screenshot

#

;wah

#

wait

#

./kernel/getdeps.sh

viral bison
hazy saddle
viral bison
#

this normal after running bash?

hazy saddle
#

yes

#

thats mlibc auto stubbing sysdeps

#

making it return ENOSYS

viral bison
#

k

#

sent copilot to fix the bug

#

let's hope for the best

hazy saddle
#

🤞

#

maybe we can find it manually

#

if that wont work

viral bison
#

it's adding stuff here

hazy saddle
#

cd ./jinx && ./jinx rebuild mlibc && ./jinx rebuild bash && cd .. && make initramfs && make run && cd ./jinx

#

that will rebuild mlibc & bash btw

viral bison
#

k thx