#EvalynOS
1 messages · Page 21 of 1
And then for static GS I can still do gs:whatever and have a fixed struct at the top of a section
you'd need to place the newly allocated sections after the kernel afaik
I don’t think my allocator can handle that
it may be easier to just have macros
because you'd need to use __atomic* accessors or whatever anyway
to guarantee atomicity
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
And what I do since I shamelessly stole the macros directly :3
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 😔
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
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
e.g.
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
When you do this how do you get the thread block on syscalls? So you can do swap swapping etc
wdym?
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
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
yep
using rsp as the kpti scratch reg is insanely smart
So the TSS is stored fully inside of cpu local on linux?
And then it just uses a spot inside that?
all of cpu locals are stored in cpu local

u just duplicate the entire .per_cpu section for all cpus
So I can technically just do what I was doing withhh
wait linux dumps the tss inside the cpu local struct
also linux has dynamic per cpu variables
fuck that's kinda smart
yeah
there isnt a cpu local struct
thats the thing
what does that mean?
So my idea wasn’t even dumb and I redid all this for nothing
u have to understand its just a normal binary section
alloc_pcpu()
just custom data allocated for every cpu
what could that be used for
anything that can be used per cpu, counters, queues, stuff like that
sure but why not a global cpulocal variable
wdym?
the thing I do now
if u wanna see examples https://elixir.bootlin.com/linux/v6.19.9/A/ident/alloc_percpu
u mean as opposed to just a section?
Is GSbase = top of CPUlocal data and then calculating the offset still considered atomic/one instruction?
because modules may introduce their own percpu variables
and those are loaded dynamically
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
Or do I still need the fancy delta stuff
Though it is cheaper with that
what
gsbase = pcpu_base - .per-cpu-section
this_cpu_offset = g_per_cpu_base;
this_cpu_offset -= (ptr_t)SECTION_MARKER_BEGIN(PER_CPU_SECTION);
then its gs:varrible?
whats the proper way to refer to that inside assembly?
that also lets me use clang address spaces right i think too?
%gs:var(%rip)
__seg_gs is actually an alias for address space
?? i mean how do i know how to refer to that var from inside asm?
^
what wiuld var be in this case?
the per cpu variable u want to read
but how do i know what that is in assembly?? where i cant refer to the C linker stuff?
because if the varrible is defined in C how do i refer to it from assembly?
the workflow is
DEFINE_PER_CPU(current_thread);
in asm:
mov %gs:current_thread(%rip), rax
would the offset be like :0 if its at the very start of perCPU
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
so how do i get that into assembly??? because i dont know what it is at all from there?
get what into assembly
if i need to refer to CPU local things in asssembly
i literally showed so many examples 😭
how do u access normal variables from assembly
why people need per cpu section
well yeah thats kind of how it works
my brain farted
just like any other variable in asm
np
storing cpu local state
just allocating it with allocator would be enough ?
☠️
how the hell do u know which cpu ur on
im storing cpu num to struct in gs
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
this also means i wont need the CPU local head thing mangarm does iirc
because i can refer to gs: cleanly
yep
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
technically u can i guess
do you happen to know if a similar thing be done on aarch64?
im pretty sure this is some fuckery of CISC arches
well one cycle locals are not possible on aarch64 no
yea, because then this is not an option for me
why not
I'd like to not have two cpu local implementations for different arches
why not?
if one arch allows the implementation to be much more optimized
cpu locals in general are very arch specific
since im only on the BSP rn this is all i need? and then later i calcuate the delta
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
yes yes. IIRC my gdt should do that for me?
anything else you think i should add to the _Generic's?
oh thats pretty neat
though _Generic can do it comptime iirc?
ig if anything i can be explicit where its annoying
a fixed switch on sizeof is definitely also comptime

only if u explicitly load something into the gs
that causes a base reload
ahh
this is very nice, I hadn't though about using the gsbase like that. I were also thinking that I could do this on msvc and without opts it kinda works but it really fucks it up when you enable optimizations lol (and even on clang the code is questionable) ```c
#include <intrin.h>
char a = 20;
char load(void) {
return __readgsbyte((unsigned long long) &a);
}
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
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
the mov eax, eax truncates to 32 bits no?
maybe 'a' is actually annotated with gs somewhere?
no way they have a bug that bad there
or am i tweaking
ah yeah, I forgot that the intrinsics take 32-bit offsets and that also makes this approach not work at all with those 💀
well your kernel shouldnt be larger than 4gb right
sure but you lose potential sign bits
gs would need the upper 32 bits of the address + lower 32 bits of the offset ig
https://godbolt.org/z/67MW6511o
it looks fine for me?
#define CPU_LOCAL_X86_APPLY_GS(VAR) (((typeof(VAR) __seg_gs)(&VAR)))
#define CPU_LOCAL_READ8(VAR) CPU_LOCAL_X86_APPLY_GS(VAR)
#define CPU_LOCAL_READ16(VAR) CPU_LOCAL_X86_APPLY_GS(VAR)
#define CPU_LOCAL_READ32(VAR) CPU_LOCAL_X86_APPLY_GS(VAR)
#define CPU_LOCAL_READ64(VAR) CPU_LOCAL_X86_APPLY_GS(VAR)
#define CPU_LOCAL_WRITE8(VAR, VAL) (CPU_L...
we're talking about msvc targets
well well well
if it isn't msvc being stupid
yeah this cant be real
msvc is not a c compiler, its a source code mutilator that sometimes manages to emit valid x86 and aarch64 code
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
that's fucking horrifc
sounds good for RISC tbh
so youd put it at the same virtual address on every cpu but it would be mapped to a different phys addr
1984
same virtual on x86 because virtual on x86 is before segmentation is applied
then its linear
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)
u should really submit a bug report to them
in nasm it should be like?
mov [rel gs:syscall_scratch_space], r15
and it was fixed a month ago
I'd need to extern "C" my variables if I did that smh
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]
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? 
u probably just didnt convince it to use the right encoding

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
i like gas because i can do #include and pass it my C flags and it works out of the box
also it autoamtically defines __ASSEMBLER__ i can even share header files
between c and assembly
Oh sick
ew :P
you don't need the q postfixes etc here btw
sick
so?
nothing ig
now im gonna make my idle thread set the preemption flag
so when idleing any IRQ wakes the system up
I just yield :P
well then it wont sleep :p
but that's prob a better idea
Now CPU local works
But like good

And its atomic
And nothing used fixed blocks in assembly etc
the reason it didn't work on nasm is probably because you accidentally used execute_syscall instead of current_thread
lmao
okay now do node-local
I’d possibly store inside CPU local a pointer to node local
But I don’t even have SMP right now
I’m not ready for NUMA shit

I could even use fs maybe
But that may be annoying
Ya know
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
// TODO
Oh yeah timers are now separated from preemption
The timers just set the CPUlocal flag
kalajadu
use cr7 suuu not cr3 and cr2
free register ig
What?
if cr2 is rw why not to use it
It’s a m serializing write
a
Which makes it slow as balls
And it also causes a vmexit
Which makes it even more slow as balls
This is what linux does BTW
It just puts it into the unused part of the TSS
.
bro really translated "kalajadu" to "black majick"
daemon is a background process
why would it cause a vmexit?
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)
I thought of the same thing lol
Or was that cr8 that did that?
I believe so
its possible that it does yeah, though again it depends on how you configure it as + what's supported
Not really that much, I just got bigger fish to catch
I really really want to be the first one to run steam for shits and giggles
is that still blocked on net memes
Networking on wine is weird and some things work and other don't BUT
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)
Understandable
Updated todo
meson & jinxcpu localunite 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
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
So this ends up back to being fine
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
So I should be able to for x86 use a CPU local INC/DEC for the preemption counter and be all good™ and then have some helpers to do it for that
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
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()
stop procrastinating your vfs
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
do you have lock in vmm
Eg in a fork()
Yes
But I need a lock I can take more long term for these data structures
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
Get it working first
Yeah exactly
I have everything I need
Though I should make my process creation a bit more flexible first anyways
I’m gonna change it so it runs a fixed assembly stub that gets the actual RIP to jmp to and a pointer to a structure that gets passed as an argument
That way I can actually deliver data to it
And I need a stub to conform to the ABI
i recommend Mul-T-Lock Cronus High Security Deadbolt
very good lock

I recommend a self-sealing stem bolt
What about a latchkey lock
I can give you hundred gross self-sealing stem bolts
I don't know what else to do with them
How did you get so many self-sealing stem bolts
I traded five thousand wrappages of cardassian yamok sauce for them
😭
and how did you get five thousand wrappages of cardassian yamok sauce
some dumbass waiter in my uncle's bar accidentally ordered them so I took it off their hands
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
kernel shell 
when font change
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
By the end of this week I am having bash ported
And if I don’t I will eat a raw onion
I have the stuff I need for fork and everything
big bite
you don't need fork to run bash
Yeah but to make it run apps properly
apps 😭
Chop chop
This I fail il record another video like this
me when i used to not zero registers when jumping to userspace
leaking kernel data

does zeroeing it affect the user program?
it zeros the registers on entry to userspace. arguments go onto the stack instead
and then the libc manages that
ah ok
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
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
makes sense
32 bit is for virgins when real chad use 128bit
actual chads use 512 bit registers
actual chads have a supercomputer and use 4096 bit registers
damn didnt think of that
on x86-64 zeroing a register with xor takes up less code size with the 32bit versions and it still clears the entire full register
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?
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
:/
why does everything make it WORSE?????
mlibc wont even compile
after updating to master
?????
frigg.cpp
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
why does THIS one fail
?????
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
you have a career in politics ahead of you
“Mlibc sucks I’m porting musl”
- speaking from a crazed madwomen going insane from fixing this
claude fixed it
cc: @rotund furnace
200k fucking tokens
😭
it was just told "fix it"
it fucking did it
my elf loader was cooked
huh
Thanks for using your Claude tokens water
💀
That shit was funny
Watching it go for like an hour
Just thinking on loop
you got Claude subscription
he just fed my kernel into there
Lol
Why not
I use Codex for debugging sometimes
it eventualy shat out like 20 lines of fixes
Its half baked tbh
Damn you should test codez
it even tried to find bugs inside mlibv
It's fast asf
It always does
Codex hallucinates so much though
It's sad.
I only use it if I'm physically looking at the files
only reason I'd really use codex over claude is cuz its cheaper
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
it was fucking funny
And the entire fucking libc
I do gotta say
The new mlibc sysdep format is good
eh
money for amount of querying u can do is cheaper
sure the free plan exist if that is enough
im not a student
also, copilot is like 10 buck a month else
https://git.evalyngoemer.com/evalynOS/mlibc-evalynos/commit/5e7489a44a9889ec52981e649ceb7df1d5a9e46c
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

still no vfs
how much does claude even cost
bash works

ts is fucking cursed tho
yes let me just sed some random shit out
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"
same for $, basically anything except [/], I guess? reducing the amount of \ in a regex statement is almost always nice, especially when there's special meaning for it like in sed, where if it's in the s//replace/ part, it places a previous capture group there
c++ reflection so good that they added it in sed
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
it seems \s makes things break
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
why not to use patches instead of sed
odd, just use a named character classes (not the "official" name but I can't find one) then I guess lol
😔
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
With jinx it is a pinned Debian thing running this so technically it shouldn’t ever cause issues
ah ok
The rest of the bash sysdeps shouldn’t be terrible tho?
Atleast I can stub them for the most part
Very heavily
💀
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)
cr7 did not do that error AEEE
what?
steal some cash in the name of GNU
elf loader is broken
then elf loading is baddd
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
I'm also permanently stuck in 1970
It’s chill here
Also me when I forget a return value
😭
Wouldn't the compiler or LSP complain about that
no warnings?
My LSP is fucked for mlibc rn

what else is different in it?
it uses operators and a list of sysdeps you give
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
nice
for getcwd?
stupid quick reaction row
I mean you just need to store current directory for a process
nuh uh
what even is the sysdep for this
probably getcwd :P
there we go

Let’s see what happens with more memory
I know my shit is so fucking inefficient esp with any file ops
your fat32 or filesystem is broken,happened to me yesterday
no
i dont have any filesystems
:p
bash really be suckling my memory
💀
That was with 8gb ram
what the fuck are you doing without any filesystem
running doom and bash
do you plan to host everything inside ram
or is it too hard
u have ahci or ata
no
just start with ata
no
virtio

Now onto Trisha takanaw for the forecast for today
okay
the only issue
is faking stdin enough

That’s a bash port
The input layer is all sorts of FUCKED
But it works
neat!
the onion was spared
would be nice if i could read anything but still
Once I get my VFS for a proper input layer
It should be usable
Then I can tape on fork()
Let me change the font for this
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
so you restart the shell instead of waitpid?
why does it print all of this stuff after echo
still need a better one for sharing elssewheree

errors
your returning works atleast :D
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
I'm guessing you're doing a unix like vfs?
I do want to yes
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$
HOME
also setpgid
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?
maybe bc you are breaking?
wdym?
maybe not?
idk, i can't see the full code
XD
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
well, now to this bug
its getting a \n stuck somwhere i think
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

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
yeah well, stdin is not the problem here i think
ah
It should be mostly standard stdin?
but only print it
I’d I do that it never gets the /n for bash to run the command
Let me try again
yeah
it ends up thinking its an exit
ah
i think bash wants one
Idk why it says ENOSYS tho
lol
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
what even are the sysdeps for pgrp
wdym pgrp?
ah that
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
return 0 where
go look here for the chat log
Me when UB is undefined
process groups are for job control
Yeah I’m just stubbing the fuck out of it
real
well, go look at that chatlog
ftr this should have emitted a warning
maybe the compiler auto added return 0?
wtf is this
no the compiler only does that for main in hosted environments
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
thats why i thought you were just restarting the shell every time
I’m not
😭
Like
Wtf is it doing
Perplexity AI: bash still can run commands but something is fucked up with its buffer when reading stdin. It is not these things https://www.perplexity.ai/search/bash-still-can-run-commands-bu-buPycj8ERzy2PlKTcjFtyQ
@viral bison it says its an issue with the tty
lol
without vfs you gonna cry
@viral bison
https://www.perplexity.ai/search/kernel-shell-hello-icanon-on-e-4mPZ46uGTZW0gY1DUhnzJA#3
this is what it says now
did it fix it?
you should not use perplexity for code
Yeah it fucking sucks ass
bc it can actually get the context
install copilot
This can be applied to the dev branch rn
i'll try
Let me regenerate it
Just a moment
@viral bison
do a git pull
then apply that
and use this for the libc
codeberg
Yeah codeberg is always a bit behind
Use the git server
@viral bison did ze patch work?
yeah, now it applied
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
ye, making now
How’s the new build system btw?
@hazy saddle
ah
wait, it has to build its own GCC?
Yes
seems like so, pain
how much time do i need for it? XD
i5 12th gen (mobile)
XD
im zipping the jinx folder
so make initramfs? should just work after
and or cd ./jinx && ./jinx rebuild mlibc
and if i run make bootstrap?
hm?
says it cannot find limine.h
uhh
cd ./jinx && ./jinx host-rebuild limine edk2-bin
and where did you put the folder
still nope
this normal after running bash?
it's adding stuff here
cd ./jinx && ./jinx rebuild mlibc && ./jinx rebuild bash && cd .. && make initramfs && make run && cd ./jinx
that will rebuild mlibc & bash btw
k thx




