#Nyaux
1 messages Β· Page 18 of 1
alright sure
uacpi_gas_read or uacpi_gas_write
where are those functions
which source file
does it matter? gdb will find them
kk
they're in io./c
can u walk up to read_register_field
how do i do that
up
thanks
thats not where i told u to walk up
what it looks liek
and up once again
alr
and whats the value in read_one
i dont understand how the pointer gets transformed into 0x1 lmao
just p reg
okay now walk down and print it again
did u walk one line?
n
okay yeah this one is normal
and it will succeed
your gas read fails after initialization
so just skip to next invocation
so just continue?
yes
continue until u see the namespace iniitalization done in log
Rogue Option<T>?
yeah this is where u die
huh
nah
it was just because he never stepped into the function
this is where i die
but the
gas looks valid
wtf
oh
now restart your os and breakpoint on the one we looked at earlier
lets see if it gets corrupted during init
which?
the first read
read_one?
sure
okay
p registers[1]
here
now do p registers[1].accessor0
well deref it
alr
and print this again
bt?
u didnt do continue did u
i did
continue to where we finished last time
ok what does p say
im unsure
try again i guess
ur corrupting random parts of memory ig lmao
this is literally a static table
no its cause
a global variable
see this? also offset + 312, but zeroed out
same as this one
but this one is not zeroed out
so figure out how it gets zeroed out
maybe causeeeee i zero out memory regardless
okay so wtf
no idea
lol
I am also currently dying 
π
anyway ig I can take a look if you push
YESSS PLEASE
PUSHING
PUSHED
you didn't zero out the pages you return from alloc after all
I already told you do to that once
nyaux try to listen to advice impossible challenge

IT WORKS
IT FUCKING WORKS
NOT YET
CAUSE THE SLAB ALLOCATOR STILL
IS FUCKING BROKEN BUT WHATEVER
its not even that broken, it works as long as you just zero out the memory properly
yes I just tested
bro
π π π
can you pin this message im about to send
always zero out your fucking pages kids
pin that
im putting that on my wall
im unironically considering making uacpi_kernel_calloc optional
you write the freelist nodes to them and same for the slabs
well like you should zero the memory that you return from the allocator
because it previously contained the slab node so its not zeroed at that point
right
like in here ```rust
match kmalloc_manager.as_mut().unwrap().alloc(layout.size())
{
Some(q) => {
q.write_bytes(0, layout.size());
return q
},
None =>
{
return cur_pagemap
.as_mut()
.unwrap()
.vmm_region_alloc(
layout.size() as u64,
VMMFlags::KTPRESENT.bits() | VMMFlags::KTWRITEALLOWED.bits(),
)
.unwrap();
}
}
well it already has that zero line because I added it
how do u even fuck this up
BRO i dont even know
maybe I should add a write_bytes(0, layout.size()) to the uacpi kernel calloc function in the bindings to work around kernel alloc functions that don't return zeroed memory 
maybe yeah
though then it might be done twice if the kernel actually does it properly
yea
also @surreal path before I forget to mention, your flanterm bindings are broken in release because they pass neither -mno* flags nor -mno-general-regs-only to the compiler when compiling flanterm
oh shit yea
right
could you pr that
ill merge it
idk where the repo even is, I didn't find it anywhere
one sec
I just looked at the source in docs rs
why tho
just change it when you want to build nyaux in release then 
@molten grotto also might wanna have asserts for init level as well,
nyaux is ready for uhhh vfs and tmpfs right
also pass -ffreestanding lol
right
use std::{env, path::PathBuf};
fn main() {
let target = std::env::var("TARGET").expect("Target triple is not set");
let bindings = bindgen::Builder::default()
.clang_arg("-ffreestanding")
.header("wrapper.h")
.use_core()
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings");
let mut cc = cc::Build::new();
cc.include("flanterm");
match target.as_str() {
"x86_64-unknown-none" => cc
.flag("-march=x86-64")
.flag("-mno-80387")
.flag("-mno-mmx")
.flag("-mno-sse")
.flag("-mno-sse2")
.flag("-mno-red-zone")
.flag("-mcmodel=kernel"),
"aarch64-unknown-none" => cc.flag("-mgeneral-regs-only"),
_ => panic!("Unsupported target: {}", target),
};
cc.flag("-ffreestanding")
.flag("-fno-stack-protector")
.flag("-fno-stack-check")
.file("flanterm/flanterm.c")
.file("flanterm/backends/fb.c")
.compile("flanterm");
}
thats what i do in my bindings
you can remove the aarch64 stuff i guess
since u dont need it
idk why i panic on unsupported target, i should probabaly just pass -mgeneral-regs-only for everything !x86
done
published
damn that guys fast
also with -ffreestanding you don't need "gcc-multilib installed for some reason"
:^)
lol
k time to switch out my flanterm_sys for ur bindings
yay
not rlly
also idk if -mgeneral-regs-only is enough for x86
like dont take my word for that
but i think there might be a reason mint passes -mno-sse and all the friends instead of -mgeneral-regs-only
@wicked loom can u explain pls?
.
so i can change it
if target.as_str() == "x86_64-unknown-none" {
cc.flag("-march=x86-64")
.flag("-mno-80387")
.flag("-mno-mmx")
.flag("-mno-sse")
.flag("-mno-sse2")
.flag("-mno-red-zone")
.flag("-mcmodel=kernel");
} else {
cc.flag("-mgeneral-regs-only");
}```
thanks
i do that
basically
well, did
before i rm -rf'd the directory

let target = std::env::var("TARGET").expect("Target triple is not set");
thats how you get the target
also do the -mno-red-zone for all targets
not only for x86 lol
thats my bad
extern crate bindgen;
extern crate cc;
use std::{env, path::PathBuf};
fn main()
{
let target = std::env::var("TARGET").expect("Target triple is not set");
let mut e = cc::Build::new();
e.file("flanterm.c").file("backends/fb.c")
.flag("-fno-stack-protector")
.flag("-fno-stack-check")
.flag("-ffreestanding")
.flag("-mno-red-zone")
.flag("-fno-lto")
.flag("-fPIE");
if target.as_str() == "x86_64-unknown-none" {
e.flag("-march=x86-64")
.flag("-mno-80387")
.flag("-mno-mmx")
.flag("-mno-sse")
.flag("-mno-sse2")
.flag("-mcmodel=kernel");
} else {
e.flag("-mno-red-zone");
e.flag("-mgeneral-regs-only");
}
e.compile("flanterm");
let bindings = bindgen::builder()
.clang_arg("-ffreestanding")
.use_core()
.header("wrapper.h")
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.generate()
.expect("Unable to generate bindings");
let out_path = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}
hows this
@thorn bramble
e
oh
you have one in the else
and one in the thing above
you only need one
and you need it in both cases
right
alr
yay
oh lmao
ooo
what do you think limine does?
lol
does flanterm check height and width of a backgroudn image
image
background*
or does it
no
okay
you give it a "canvas"
which needs to be the same size as framebuffer
and it uses it as background instead of the default background color
why
cause it wont compile otherwise
okay
its probably going to be fine
wasn't supported on gcc until semi-recently
ah so nowadays it's fine to just -mgeneral-regs-only on all platforms?
if you don't care about compat with gcc <=12 (iirc) then yes
nice, ill stick with the split options tho
if i ever do need that
thanks for explanation
np
okay so
imagine
i have a path
/usr/bin/bash
or
usr/bin/bash
is there a function i need to get the 2 back slashes
and get the word inbetween
or smthin
you can have a generic lookup function that takes in a path and then looks it up component by component
for what
for getting the vnode for a specific path
so the function in vnodeops
I mean yeah basically what a path lookup function would do is call the vnode's lookup function for each component and assigning vnode to the result
okay
just go to school
no its 5th year
where problem
you dont understand
i have like
8 subjects
π π
its gonna be rlly hard
and too much homework
just studyβ’οΈ
I never did my homework
im gonna
Same
cry
mathew
wwhat do i do
how do i escape this hell so i can work all day and night on nyaux
The only time I ever had to take some time off to study I tryharded studying for 3 months to pass the entrance exam for my uni
You just design nyaux at school and implement it at home
5head
cause i got delayed a year
big brain
π
You don't
You can't
Just study and the uni will be chill
(except the first year)
(though it probably depends)
My last year of high school was so chill I was either scribling about osdev in my notebook or playing clash {of clans,royale} with my friends during class
And passed with rly good gradea
π π
My last year of school was during covid
When the pandemic started basically
And it was weird af
But like just this tbh
guys does osdev make you big pro
will it give me
extra credit
in school or smthin
like in college
not high schl
Which is gonna get get you a good grade
Because you're invested and motivated
I had a chat with the os professor a few weeks ago and he said we should chat again in two semesters
(assuming you're gonna study computer engineering or something)
woahhh
also uacpi works on nyaux
i forgot to say
tho i cannot get namespace_init or namespace_load working cause some init level shanggains
idfk
(I did it)
im currently working on a generic path lookup like qwinci said
i will have vfs done by 2 hours
then we can work on ustar
and tmpfs
Ok I have to get my disk reading/basic filesystem before you

what do they say
you should first call namespace load then namespace initialize
That means it doesn't work lol
unimplmented
i dont know what its trying to clal
call
what function
well just look what functions you return that status from and add some prints
its calling install interrupt handler
isnt that
optional
well if you don't want any events (like power button press or whatever) then ig you can just make it return success and not do anything
okay
Power button is cool though
(only user input I have atm
)
Just return success?
that isn't too hard to implement properly either
ill just actually implment the function
yea how should it be implmented
well you just need to return something that you can use to access io ports starting at the base that's passed to the io_map function in the read/write functions
you could just return the base itself
right
But you don't even need to do anything in Ring 0 (I think)
I just do that
you don't need to do anything but you need to return something you can use to access the base given the handle in the io_read/io_write functions
yeah
You're missing a division by 100 on line 486
Get ticks expects 100ns increments
Oh
thats weird
high school is supposed to end at 17 in your country?
i got delayed a year
yeah but is it supposed to end when youre 17
4y primary, 4y secondary and 4y high school
and now uni another 4y
what happened
in my country you get a year repeat if your average grade for a subject is below 5 (1-10, 10 is best)
or, well, you get a corrigence test during summer, and if you fail that, you repeat the year
idk if corrigence is a word though i just adapted it from my native language
something
fight in school
i missed a lot of days of school
got held back a year
damn
did u win
should've triple faulted the guy
π
I repeated the last year of high school because I was expelled for "hacking"
(I connected to teachers' WiFi with test/test username/password, shown it to my classmates, and they printed something (with my hint, but that still wasn't me) on school printers and I've gotten all the blame)
And couldn't find another school which would let me continue because the one that expelled me fucked up the documents and admitted me without giving me a certificate for finishing middle school
That is so stupid
your bug
how
idk
wha
so u already fucked something up
no idea
i mean global_lock is a field of the FACS table
maybe u trashed it or soemthing
i did not
no way
Contribute to rayanmargham/NyauxKT development by creating an account on GitHub.
can you look at it pls
i think its with the kernel api
i refuse to believe its another memory bug
try_acquire_global_lock_from_firmware
deref
global lock is 2 @kind root
thats in try acquire?
yea
dump the same thing
right, thats not where i wanted u to break
.
actually i know whyt
why
if (mutex->handle == g_uacpi_rt_ctx.global_lock_mutex) {
uacpi_status ret;
ret = uacpi_acquire_global_lock_from_firmware();
if (uacpi_unlikely_error(ret)) {
UACPI_MUTEX_RELEASE(mutex->handle);
return UACPI_FALSE;
}
}
since u return the same gabage handle for all mutexes
it thinks they all refer to the global lock
so it tries to acquire the global lock multiple times
so what am i supposed to return
doesnt matter
okay
so that handles dont collide
yeah
i wouldnt run this on real hw, half of ur api is stubbed out
how do i fix this
ye
we needa make a move on before school tomorrow
oh fuck
π
why is my lapic not firing
ITS CONFIGURED CORRECTLY AAAAA
the real question is what did you change
wdym
it worked fine yesterday?
yea?
so wtf
my interrupts arent masked
sooooooo ummmmmm
wha
@molten grotto i pushed it so maybe you can look at it
all i changed was kernelapi
for uacpi
they are disabled on the cpu tho lol
removed what?
yes then they aren't enabled
yes
right
sec
okay so @molten grotto
it gets stuck
wtf
i dont think that looks right....
at least when I tried it it didn't get stuck
idk what did you even change to make it stuck
im unsure but now its just stuck
maybe its the fact i updated the bindings or smthin
is it the compile flags?
are they wrong
or smthin
I just added a core::arch::asm!("sti") before the hlt loop in hcf and the thing you pushed worked fine
you get an interrupt while you are holding the print lock and then you try to print "tick" there
this is why you should usually disable interrupts for the duration of holding the spinlock
or raise the ipl or whatever if you use that otherwise
if you'd have your own spinlock struct instead of using one from some crate you could save the irq state and disable irqs within the spinlock lock method and then restore the state in the guard's drop method
you can just not enable interrupts while in kernel
i think i will get 2mb pages working
the loading hhdm is too slow
actually nvm
i just need to focus
lol
you can also separate writing logs into a buffer, and outputting from that buffer (guard this with a try-lock) - lets you keep interrupts enabled and be able to log inside of interrupt handlers.
just disable pre-emption while holding the output lock
i already have a lock on my flanterm term
i disable interrupts when locking
and when finished i renable interrupts
GUYS
GUYS GUYS GUYS
I DID IT
VFS IS DONE
WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
NOW FOR TMPFS
AND USTAR
THEN APIC AND UHHH SCHEDULER THEN USERSPACE THEN MLIBC AND JINX SETUP THEN DEV DEVICES THEN BASH !!!!
you might have bash before I do 
might not cause my motivation might die down cause school and depression so i might be a bit slower this time 
its okay tho im taking my time with nyaux
slow and steady
im not rushing to userspace
well tbh idk how much time would it take for me to make bash working with my kernel either, rn I am just trying to fix my libc enough so its not total garbage (because debugging it on a custom kernel isn't fun)
fair 
I'm planning to work on having bash after implementing working set
(so basically same)
(sorry if I pinged you I forgot to uncheck it)
nah you didn't, though I don't mind as otherwise I may not see the messages
yall can someone motivate me to get to fucking work
why cant i write a single line of code for nyaux
help
imagine being able to self host
maybe im having burnout
idk
do i need a day break
or smthin
or am i just procastinating
what do yall think
i lied i dont have a working vfs cause i dont understand the resolve_path function, i dont understand anything im a fucking failure. i have no idea how to implement this im unsure how to even get tmpfs working i dont know what im supposed to do
i only said that so you guys would have meaningful progress in the thread instead of nothing for the last 3 days
im such a failure
ugh
im sorry
maybe i should drop the project entirely at this point
idfk
its not like anyone is expecting you to work on this full time, just take your time and if you don't feel like working on it then don't
okay so im still having difficulty understand the vfs
the resolve path function
how to even
start at implmenting that
what do i return what am i supposed to do
i dont even have tmpfs either
so like
ig you could take a look at how I do it, maybe then you'd get an idea
in fs/vfs* and iirc fs/tar* for the weird impl on top of tar
i dont know much c++ so i dont know whats going on here
i dont know anything about c++ strings
but ill try to
implment something similar
ill just have the fs implement lookup
wheres your path lookup
no : (
you donβt have any obligations to anyone here
you shouldnβt feel pressured to finish stuff as fast as possible imo
itβs a hobby project, you can always work on other things in the meantime
this is the generic path lookup function that looks up a full path starting at the vfs root
and this is an example of the component lookup function on the vnode https://github.com/Qwinci/crescent/blob/main/src/fs/tar.cpp#L38
is tarfs a read only file system
tarfs is a shitty file system
though it might not be the best example because doing that on a tar is kinda cursed because all tar has is full paths like ```
/
/usr
/usr/bin
/usr/bin/bash
you probably want to unpack a tarball into a vfs
right
okay so will i have the filesystem implment the component lookup
yes
I mean idk how else would you do it
the component lookup kinda depends on the filesystem
and do i need a function that resolves absolute paths yes or no
likely yes but that can be a generic path -> vnode function
(that then uses the component lookup fn on the vnodes)
my vfs_lookup takes in a reference vnode
@molten grotto ?
the root vnode
i just wanna get to a point where i can run doom on nyaux
like i know its gonna be hard lol
I have a vfs_root global but usually its not used
I usually take the process cwd or root
i should probs use it
initally
for booting up the kernel
to like
actually execute the elf
to run in userspace
then ill use whatevers in process
on context switch
that a good design?
@molten grotto ??
as in what is the root inside the process?
vfs
the cwd you mean? though you can also have per-process root like if you chroot
yea per process root
but I don't think you need to concern yourself with that rn
sounds fine
alr cool
You can read mine if you want
Lemme find it
ignore any namecache stuff
actually this might make more sense
cause
i want a populated ramfs
filled with a bunch of files and programs
just to test out
if the vfs is good enough
@wicked loom right?
shell script best build system
π
@wicked loom i need help with jinx configuration

actually yk what
screw jinx
too difficult to configure
lets dooooo uhhhh
xbstrap?
@magic kernel how does xbstrap work?
is no one responding today π
what
didn't you use jinx last time too?
it doesn't change anything
what does Jinx have to do with that
im unsure of how to configure that
just the way you build the kernel
take a look at Andy's kernel, see what he does
he uses jinx?
yes
I see my services are no longer required in this matter? Or do you still want an explainer?
i dont know is xbstrap better then jinx
like i dont understand
Everyone will probably tell you it isnβt so idk. Imho itβs preference over shell vs yaml as biggest difference
ill just use jinx, im following andys config so if that doesnt work then ill use xbstrap
im just tired
im gonna be up all night setting this up i guess
screw school lol
Sounds good
What's nice about xbstrap is docker
works anywhere
You can also work on other things first and come back to it when you feel more confident (?)
What'd you curl
i dont know
i dont know whats its doing
name=base-files
version=0.0
revision=1
source_dir="base-files"
package() {
cp -rpv ${source_dir}/. "${dest_dir}"/
}
my recipe just looks like this
anyone can help please
im so tired
i just want this working
i dont even know what i curl'd
its jinx doing that
its not in the makefile
What's the source url
theres no
source url
there isnt supposed to be
@wicked loom help
i copied everything
modified it for my kernel
its giving me this error
Is source dir even right
Don't you need source_method or something
I think what's happening is it's trying to curl nothing
i dont know
i seriously dont fucking know
im just copying jinx files and recipes from aero
I think aero uses some very old jinx version
@surreal path i am not inclined to help you because your amount of frustration is repulsive and it annoys me, sorry
go use xbstrap and bug dennis about it
using the "i'll go use X instead" as basically bait to try and get me to help you really achieves the opposite result
also i am not inclined to help you because you're likely gonna work on this for a week tops and then go MIA again for 3 months and it just feels like a waste of effort, which in combination with the aforementioned annoyance, really doesn't make me wanna help
i also do not appreciate being pinged over and over about it
i understand
i apologise
im really sorry, i shouldnt have pinged you constantly about that
i wish i wasnt a shitty person to people im sorry
apology accepted
Alright, just to document my progress not asking for help. I am currently still trying to setup a bootstrapper like jinx. might be done soon i think i got it working
hmst
rbrt like robert?
like a guy named robert?

maybe its my jinx config?
uhhhh
nooo?
base-files recipe looks the exact same as vinix
uhhh im unsure
i need to get some work done soo im just gonna make a shell script to make a initramfs and not setup jinx for the time being
i need to prove this os is not going MIA after like a week anyway lmao
alright i need to make an oct 2 bin function
i suppose
i might setup the rust test system
that might make it easier to debug in future
instead of firing up a VM and waiting forever for the kernel to load lmao
wait is that possible
does anyone know
?
nice
assertion `left == right` failed
left: 52
right: 42
well that is nice to know
that the oct2bin function
is shit
inline static uint64_t oct2bin(const char* str, size_t size)
{
uint64_t n = 0;
const char* c = str;
while (size-- > 0)
n = n * 8 + (uint64_t)(*c++ - '0');
return n;
}```
thanks
np
whats the c++ doing
incrementing it?
c += 1
right
and it takes the value of c
gives you the value of c
then increments it
specifically
that's important
okay
what should i pass to size
hmmmmmm
assertion left == right failed
left: 52
right: 5
IM SO CLOSE
π
wheres my 2

assertion left == right failed
left: 52
right: 42
bro
im actually like
why
hmmmm
bro im so stupid
its working correctly
please end my brain
π

running 1 test
test fs::USTAR::test ... ok
π
lol
bruh
bro
how come
initramfs != initramfs
finally
ooooo
38 MB
my kernel uses lol
is that bad
eh
why
π
lmao
it's a project that was only talked about in #staff
# staff
basically TAR but smaller but with more copying involved
as i remember it tmpfs has nodes and dir entries and dirs
u have a dir which contains dir entries, they all contain vnodes to which to lookup on, it could contain another dir or a tmpfs node
yea i believe thats how it works
a directory is a tmpfs node tho
obos is a lot more complex and uses around half of that
right
I boot straight to bash with 30 mb
and it has more bugs 
this thread has almost 18k messages lol
fair
i should rename my tmpfs "node" to tmpfs file
then
im writing the tmpfs in MOSTLY safe rust
for a change
no more spamming unsafe
this time i can get the benefits of rust π
i fixed this jinx bug in 0.3.4
ah okay, might set it up later then
OKAY 2 MORE FUNCTIONS AND IM DONE WITH TMPFS
THEN WE CAN POPULATE IT
WITH THE INITRAMFS :)
tmpfs is done
just creating a vfs create function for vnode
and i shall populate my vfs :)
or tmpfs rather
I LOVE RUST TESTS
well thats why u write tests
vnode { ops: no, flags: FILE, data: 0x77d068000e50 }
hmmm
ops
no
lol
π
what happens if you do cargo miri test?
one sec
hmm
yea ub moment
help: <271825> was created by a SharedReadWrite retag at offsets [0x18..0x38]
--> src/fs/tmpfs/mod.rs:173:48
|
173 | ... *result = Some(&mut o.vnode as *mut vnode);
| ^^^^^^^^^^^^
help: <271825> was later invalidated at offsets [0x0..0x40] by a Unique retag
--> src/fs/tmpfs/mod.rs:174:52
|
174 | ... (*dir).head = Some(o);
| ^
= note: BACKTRACE (of the first span) on thread `fs::vfs::path`:
its telling me something pitust
about my shitty usage of raw pointers that for sure
