#stanix OS
1 messages ยท Page 2 of 1
ic
On spinlocks you disable preemption and maybe interrupts depending on when the lock will be taken
mmm.. and what if i use mutex everywhere
the only place where i use spinlock is in the mutex itself
Blocking mutexes you dont need to disable interrupts
mmm.. so maybee i shouldn't use mutex for things like the proc state
cause an irq can happend
and the trigger premption
and then the premption itself try to acquire lock
Which would block and the other thread would run
Are your mutexes a spinlock or something
no my mutex are blocking mutex
wait
but blocking use mutex 
what i have done
okay let do like everyone else
spinlock disable irq
also this make me feel like i should use spinlock for proc state
seem like the new scheduler don't work
but it's getting close
there is just a race condition somewhere
made some progress on multi threading
i can in theory create new thread now
but waitpid don't work anymore
and the thread system don't do cleanup
tomorow i need sleep queue and separate kill_proc from kill_thread
and then i can get some basic pthread and even SMP safe waitpid
okay
sleep_queue is hella hard
๐ญ cause i need to be able to sleep on multiples queues
i hate SMP and multithreading
me too bro, me too
HOW DO I SLEEP ON MULTIPLES QUEUES ๐ญ
join me on the single global queue side ๐
uh you don't understand
i mean sleep queue
ah
so like wait you waitpid you a process grouo you can sleep on the queue of each process
yea ok ic
stanix boot now
with kernel multithreading
next is providing some userspace interface
with clone syscall
and also make waitpid kill and stuff accept tid
and task cleanup ofc
this is gonna be hard
also some stuff are not multithread safz
tomorow i'll be back
stanix is back!!
yes !
now i need to finish cleanup
and do pthread_join
and see what mesa need to run
i think pthread_kill shoud be easy since i already have signal
sleep and signals don't work anymore actually
multithreading introduce a lot of shit
๐
also i need to do thread cleanup when main thread die
so much to do
STANIX IS BACK
new scheduler now has signal support
tomorow i'll try fixing pthread_join
welcome back
Welcome back
finnaly fixedd
this work using pthread_join
next is mutexes
shutdown command + refactoring done today
its fixed
and i have d_type on dirent now
i think i'm going to make a new proper bus system
umount done
utf8 work
automount work now
i might want to do actual part cleanup when i unmount it
soon i will start sockets
to get a GUI later on
i started doing unix socket and well its harder than i tought
i really need a lot of refactoring to fit my new philosophyes also ๐ญ
doom saves are faster thanks to the new caching in my libc
and well progress on socket stack + unix socket
socket stack is praticly finished
unix socket are well pretty hard
socket syscall moslty done
just missing socket opt and getname shit
oh anf shutdown
and well unix socket are veru buggy
i can'g bind a fucking address ๐ญ
so uh
socket stack is 100% operational
outside some minors function with no impl it work
but unix socket is still buggy
i can bind and listen
but connect and accept get stuck
cleanup of unix socket work
and did some changes to the tmpfs that now nativly support socket
devices are now normal inode
and not hacky mount point
so i can chmod/chown them
working unix socket
a bit of refactoring + working on something cool
i think i might got a pretty good bus system
i got the core kernel to compile
but the devices don't work perfecly
next is open flags + finshing devices +bringing back /proc /sys and pty
mmm... now the kern should boot until userspace now
i got the OS to boot
and even go in userspace and launch a shell but pty are kind of broken
dev restart today
stanix is one year old today
Wowsie! Happy birthday stanix.
thx
no dev for this week
the entire terminal emulator has been rewritten
so now the terminal emulator run nyancat without any problem
i still need to bring back utf8 support
top tier gui
trying to do modesetting
i got framebuffer abtsraction that it
What do you mean with that?
i have an abstraction layer over framebuffer
i do not use limine struct anymore
and instead i just do generic framebuffer operations
aha.
this question is prob stupid but why?
this will later allow me to add another framebuffer implementation using TRM (my DRM-like video api)
Nice!
the partitions system is back
i started doing a new shell
got cursor to work
okay tash2 is ready
it has all standard loops (for while and until) if else elif stament, pipes, process group (with { ; }) subshell with ( ) bracket expansion, quote, break/continue, ...
so it's more than the old one
and can replace it
Does stanix run on multiple arches?
no
aarch64 and i386 are really just stub sadly ๐ญ
lol
some day maybee
Hopefully someday.
but at least now i have a really powerfull homemade shell
cool
probably one the most powerfull out there
not a lot of people make shell
im still battling scheduling issues caused by reworking my whole os lol
scheduling ๐
most ppl (including me) will just port bash lol
yeah writing a parser for shell is pretty hard
the syntax is so shit even yacc cannot generate a complete parser and lexer for it ๐
i'm on my 5th shell btw 
gl, i hope you don't run into too many race conditions
๐
ehh rn it triple faults as soon as i jump into a thread lol
yeah it's so fucked
oh wow
i like how this didnt happen before the rewrite and the rewrite didnt even touch sched and proc code
5th, are you mad????
each time it gey better and better
let me give you a list of some features
quote support
if/else/elif statements
for/while/until loops
pipes
&& and || support
subshell with ( )
command groups with { xxx ; }
tilde expansion
variables (assignements, temporary environement variables and expansion)
redirections (only on commands
i also have continue/break and other stuff
also
on some script i'm faster than bash since i do not have all the non posix stuff bash has (like array)
nicee
would only wish to be close to be able to do smth like that
now all features of tash work on stanix
Niceee.
today i just did some refactoring
not much improvemenr
tomorow maybee mmap tmpfs files + mutex and lock in vfs
i got mutex to work and some very primitive locking in vfs
tomorow is probably vector impl in kernel + page cache
pmm refc count kind of work
and i got new mmu to work
so i can start to work on CoW
i got CoW to work
next is seg spliting
a bit of refactoring on arch abstraction
and ofc page cache
the main reason i do all of this
the new scheduler is hella broken
making progress on the page cache
the goal is to get an async capable page cache
and then get an async api in vfs
but this probably require to be able to register callback in sleep_queue_t
most of the page cache api is done
the page cache work and i can mmap files
ooo mmaping files has been on my radar for a while now! Well done, was it hard implementing?
not that hard actually
the hard part is the page cache
once you have CoW and page cache you really just mmap the cache
but i'm actually still missing two thing
cache evict
and mark cache as dirty on unmap/msync
i now map anonymous mapping as copy on write
cool
now i'm trying to do futexes so i can add pthread_mutex and get -pthread option on gcc
multithreading has been a hassle for me tbh.
yea... I should also do futexes tbh.
since mlibc depends on them.
oh right mlibc
i just wrote my own libc, way more pain
yea
but hey, it "work"
well im having whatever abnomation this is:
assertLibC
i think it try to set gs/fs
same
might have to try and endure whatever pain archctl will give me
need to have it to run bash ig
it's pretty simple actually
just a few wmsr and ofc saving it on task switching
it was actually quite simple
already had quite a big part of the logic
that is the new todo list
for the kernel
- evict page
- slab allocator
- inode/dentry cache
- flush page cache
- better blocking system interuptible/uninteruptible, sleeping on multiples queue and time out (with block_until/block_timeout)
- make fat use new page cache
the slab allocator work !
trying to make a dcache
dcache work
and now for cwd i can just store a vfs_dentry_t
which allow me to get an inode for it
but also get back the path needed to open it
here the getcwd impl is just a wrapper around vfs_dentry_path
i'm changing a lot of vfs operations
one binary for all commands !
fat with dcache
i brough back automount
now i can do some refactoring on fat and do writing
what disk driver you have
for the moment just ATA ๐ญ
doing some refactoring
then i can continue on more basic stuff (permission checking, safe user copy, and fix some race condition)
race conditions everyones favorite
i've got permission checking in vfs
and now user can only get info on their own processes
after too days of work i got the new dynamic linker to compile and gcc to compile with shared library support
next step is trying to see if it work and add interpreter support to the kernel's elf loader
so i don't have to /usr/lib/ld-tlibc.so myprogram each time
Ohh you didn't have that before??
Or well everything is so easy with mlibc
i don't use mlibc
i use a homemade libc
nop, static linking was enought
but now i want it
it will be easier to load opengl this way
True
You should maybe port sdl2?
yeah i'm also trying to port sdl3
but for mesa and sdl3 the big problem is the same
i'm missing a lot of pthread stuff
:(
i've removed 3 out of 10
once i remove them all i get dynamic linking !
wich will reduce memory usage
since if two process use the same library i can just mmap the library to map the page cache
letsgooo
i removed all relocs from the dynamic linker
and got pretty far
sadly it has a weird bug where it try to write it's own stack
RIP
also is that bash?
tash
it's tash, a homemade posix shell
how easy is it to port 
pretty simple really
c library?
you need basic stuff (open/write/...) termios and basic libc stuff
ofc
termios 
it's meant for unix like OSes
fair
mine might be literally anti unix like 
might have to write my own shell idk
or port a stdc and use bash or smth
well my goal is to be able to run the configure script of stanix and gcc on stanix itself (for self hosting)
so i need a unix like shell
some stuff can probably be stubed but this is what it need : abort chdir close closedir dup2 environ execvp exit fcntl fflush fork fprintf fputc fputs free getchar getcwd getenv geteuid getpgid getpid getwchar ioctl isatty localtime_r malloc memcmp memcpy open opendir pipe printf putchar putenv puts putwchar read readdir realloc setpgid signal snprintf sprintf stat stderr stdin stdout strcat strchr strcmp strcpy strdup strerror strlen strncmp strndup strrchr strsignal strtol tcgetattr tcsetattr tcsetpgrp time ungetc vfprintf waitpid
for exemple opendir is needed only for globing/auto completion
or signal/strsignal is needed only for job control
yo is that bash
it's tash, my homemade posix shell
^
are you doing own libc
yes
but since it want to use a copy reloc with environ it's annoying
mmm... made some progress
but global variable from libc (stderr, environ, ...) still not work
looks good, when syntax highlighting?
syntax highlighting is comically complex ngl
idek
you either hard code it or you write like a parser for insane syntax files
i will load modules using my new dlopen ! :D
or that 
here it is
nice
i have a few small issues
since dynamic linking tcc does not work anymore
and strdup is broken in my GUI WTF
ls running with dynamic linking
make own x11
Cool
i will
i got + - = and ? on parameter expansion on shell
i'm getting pretty close to quake2
Looks fire
i'm starting to make a GUI
here a window with the terminal running in it
no input, window moving or resizing yet
why not to just port xorg
i want to make my own window manager and api :D
my final goal is to make everything by myself
then do x11 protocol
to launch some cool stuff in future
well i don't really want to port any x11 app
ane i can just port SDL and glfw to get the few things that i want
i'm making layout files
now i have layout files !
azerty for exemple is ```# use qwerty as base
include qwerty
0x02 & 1
0x03 รฉ 2 ~
0x04 " 3 #
0x05 ' 4 {
0x06 ( 5 [
0x07 - 6 |
0x08 รจ 7 `
0x09 _ 8
0x0a รง 9 ^
0x0b ร 0 @
0x0c ) โฐ ]
0x0d = + }
0x10 a
0x11 z
0x12 e
0x13 r
0x14 t
0x15 y
0x16 u
0x17 i
0x18 o
0x19 p
0x1a ^ {
0x1b $ }
0x1e q
0x1f s
0x20 d
0x21 f
0x22 g
0x23 h
0x24 j
0x25 k
0x26 l
0x27 m
0x28 % รน
0x29 ยฒ
0x2b * ยต
0x2c w
0x2d x
0x2e c
0x2f v
0x30 b
0x31 n
0x32 , ?
0x33 ; .
0x34 : /
0x35 ! ยง
0x37 *
0xb8 ALTGR
now i'm working a GUI
good luck !
from scratch as usual?
yes 
it look ugly and is pretty slow but it work
oh thanks
what is ur gui library built upon?
it's made from scratch
and for the moment is not used in stanix
so its not based on ex SDL2
i can close windows now
and i fonally got the gui lib to work on x11
now i have to make it work on stanix
gg
You may need to upgrade your version of Doom to v1.9

i'm working on a GUI lib
X cursor
here a grid widget with buttons widgets inside
not enougth place to install a window manager
i need hexpand on grid
better widget that expand
new poll finally work
only timeout is missing
and we should be good to go on something else
like finishing tgui
trying to do rounded rects
Hey, is the source code of your VM in any repo, need some inspo for my own VM.
you mean WM ?
Ohh shit my phone autocorrected it.
i mean i made a very small 8086 emulator but it's not really a complete VM
it's in the main stanix repo
curently going trough a small rewrite to let clients draw their own titlebar
i got it to work next is making the thing faster and getting a logo for stanix
okay much better
Fancy
lspci is back
does it handle multiple pcie roots?
it's just a userspace programm
it does not direcly interact with hardware
and well the kernel's pci driver does not even handle pcie 
ah
i just have a /sys/bus/pci where pci addresses are exposed
are u also doing linux abi?
no
making progress on UI
Cool!
thx
i need to bring back doom to new ui
since decorations are now client side
i also fixed the close button so now it's the same size
How optimized is it btw
And do you plan to make an xorg compatability layer, or just port SDL, GLFW etc
without logging it work great
but it could be optimised more i think
i'll just port glfw and SDL
it can always be more optimized
๐ฅ
working on taskbar :
the popover system is close to complete
popover menus work
make these things smaller
the icons ?
the bar has the minimum height with padding and size of icons
to make thz bar smaller i'd need smaller icons
i got a scrolled window widget
and now i can scroll anything !
for exemple here i can scroll text horizontally
i got a working dynamic list view
You got gcc ported?
no i'm using tcc + binutils
and make ofc
and tash, my own shell
i think the seg fault actually comes from tcc
since i picked a non offical releasz
Ohhh
why ๐ญ
so i'm going to port another version and see
the last official release was in 2017 
ohh
how hard is it porting normal gcc
wonder
well for you it might be quite hard
as you make everything by yourself
apparently not that hard
i might try
the only issue is that compiling gcc takes so long
so i didn't do it for a long time
but now i have dynamic linking so i should be able to modify and libc and retry without recompiling gcc
so i might try tomorow
its not hard
i think you just need a decent libc
might try
im bored anyways
ohh astral has a port that i can steal
well then its not hard at all lol
fair, how is tlibc going btw
pretty good
i have enought for most stuff i want to port
at this point the biggest issue is bugs in kernel
and GUI lib
not even the libc
i have reach around 400 funcs implemented in tlibc
doom, but compiled from with in stanix
Cool!
I'm porting gcc right now so ima try and do it too
shouldnt be that hard right
Is make a pita to port or is it easy?
make is extremly easy to port
you only need to be carefull for envp
the actual signature of main is not int main(int argc, char **argv);
it's int main(int argc, char **argv, char **envp)
Thanks
for some reason libgmp does not want to compile for stanix
I have had a hell with all of these lol
send me the error if ya need help
im stuck at gcc being stupid rn
this is it
GMP does not even declare it'own funcs flr some reason
huh
sounds like something wrong at configure
gmp messes with many internal macros
idk . I just did ./configure with a few options
basicly the same except i didn't use --with-sysroot
grep -r __gmpz_inp_str_nowhite
and find what it requires
maybe you didnt implemented something in your libc and configure doesnt like it
what it require ?
oh
yea well GMP has quite a lot of macros that it checks your LIBC with, if something isnt implemented it might lead to errors like this
idk usually they are #ifdef with macros like HAVE_somelibcfunc
but GMP should not need that much
it's just a library for large number right ?
do you want to compile libgmp in stanix or for cross compiler on your host ?
i'm cross compiling it from linux to stanix
i'm on my phone rn but i can try that
wait a minute im I supposed tl run configure in another dir than the sourve dir ?
yea i do that
might be that
out of tree build works better for me atleast
even if i sad bananymous not doing it so it should't be the problem
let me configure on my phone and see for the grep -r
i found the declaration is wrapped into something like this
but it is wrapped inside _GMP_H_HAVE_FILE
what the hell is that
now
look to configure config.log or configure src and find how it detects it
but i searched i don't find definition of these kind lf contants in config log
oh it's defined in gmp.h
it check if _STDIO_H or FILE is defined
you have FILE right ?
yeah but not as a macro
no i define STDIO_H
that the issue !
thanks
Let me know how it goes
well i had to enable libstdc++ on my cross compiler
and now when i compile it it complain about a missing libgcc_eh.h
idk why
now i'm onto compiling libstdc++
that so fucking hard
i'm missing toons of math funcs
and for some reason it complains about my types
the one shiped with gcc
ah, well if you are using mlibc you have to add a few symlinks + disable localization
i'm using my own libc
thanks ๐ญ
i'm missing mblen
should be easy
it's just mbtowc
its really depends on libc
yeah my libc kind of suffer rn ๐ญ
setbuf done
step after step we are getting closer
i got libstdc++ to compile but linking with it is fucked
it does not find symbols with libgcc
Trying to get libgcc_eh and libgcc_s to work
I hate libgcc so much
use clang?
I don't want to port llvm ๐ญ
uh
i mean
using clang to cross compile
and im pretty sure gcc is harder then llvm
since i had a lot more problem porting gcc then porting llvm
I want to use the same for both cross compiling and porting
Oh what
idk it might just be im using clang all along
getting further on running cpp programs :
i finnally got it (with a few hacks) :
for some reason when i pipe the cpp hello world in a file the newline work :
probably a termios issue
I'm redoing a lot of vfs and process management
To fix race conditons and memory leaks
At some point i'll need some to evict the page cache too
The vmm is now free of race conditions i belive
But now waitpid seem to be kind of broken
Xarray_foreach implemented
So now i can fully switch to xarray for proc list
I'm also trying to use it for the devices list but it's kind of broken
fixed
Unix sockets are fixed and now the GUI work again
do you have doomgeneric
Yes
And quake2 kind of work
Like the menu and thebdemo work
But when i launch a game everything appear at 0 0 0
quake2 on stanix :
hell yea
I inverted red and blue channel 

fixed
now that's better
blue looked better tbh
I've fixed various vfs issues
I can find ACPI tables now
congrats and well done
APIC now work :
After some fix to ps2 stanix can boot again on virtual box
But sadly the initrd take years to unpack
Slow tmpfs_write i belive
long name support on stanix :
I had a big paging issue that made booting much slower than it should
Much faster now
I'm doing a lot of refactoring and fixing race conditions
Maybee page evict soon
I fixed so much race conditions in the page cache
Now i only have a few left
And i have a few lru lists of pages in page cache
So i will be able to do evict later on
The -pthread option finnaly work on gcc!
And now it link with libgcc_s
So i should be able to link with cpp programs
newline with libstdc+= work now ! :
Trying to get a shared library so OSMESA can link
I need to actually implement tons of stubs now
mesa work finnaly :
hardpipe
Are you doing fully custom Userspace?
Yes
cool
i changed colors a bit
Trying to get a sdl port
I would have to write my own gdk backend
i added server side borders :
sdl !
cool
Thx, next step is input and opengl support for sdl
And i'll be able to port raylib i think
Raylib huh.
Which games are u trying to run?
Games made by friends
For exemple @wintry crag made a small minecraft clone with it
I got sdl2-compat to work and did a bit of refactoring for my wm library and added support for more stuff to sdl port
Getting a sdl12-compat port
a nes emulator on stanix :
sdl input work now and i have a libarchive port
quake2 running on the gui :
when ffmpreg
I don't really know
It complain about not finding thr movv atom
Let me show
On my host this video work
So it's really weird
I'm going to port my libc to linux
It will be a lot easier to debug
Cause rn i don't know where the ffmpeg issue come from
Ffprobe work now