#Nyaux
1 messages ยท Page 38 of 1
i just told you
nvm saw the cr2
That's not how that works
When you enter the kernel you set rbp to 0 after saving it
I think
Idr
It's too late
But stack frames make a linked list
youโll just set it to 0, after that entry function returns it would be 0 as functions just push rbp
so i guess it should work like that
yea so
why isnt it working
because i have a check in my stack tracing code
if its 0
stop
wait no, I zero rbp, then push rbp
oh so after saving rbp i must set it to 0 yes?
in the asm code?
like this
or no
Yes
oh yeah
Also make sure the stack is aligned
To 16 bytes
That's what I do
No
So the stack frame is constructed
Ideally you push all the reggisters, then you set %rbp to 0 and push it
(I'm pushing it twice because of alignment)
Then you do ```x86asm
pushq %rbp
movq %rsp, %rbp
thats my stackframe
As function prelude
Doen't matter
is it aligned to 16 bytes at least
always has good alignment so its fine
okay
Unless you're saving SSE stuff
so make rbp 0 then push it then at function preload make the rbp rsp
Idk read system v spec
That's what I do, but I don't remember why and maybe it's brokern
No
This will override rbp and break userspace in weird ways
oh
And kernelspace as well
bru
isnt that generated when u call a c func
yea im finding nothing in spec useful
Idk I haven't read it and don't know if it's any good but this is the first link from google https://textbook.cs161.org/memory-safety/x86.html
Online textbook for CS 161: Computer Security at UC Berkeley.
Yeah it's just a linked list
I wouln't be surprised if it is, but it's probably not
here
Are you doing this?
nyauxsymbol h = find_from_rip(frame->rip);
uint64_t* base_ptr = 0;
uint64_t temp = 0;
temp = frame->rbp;
kprintf_symbol(h);
base_ptr = (uint64_t*)temp;
while (base_ptr != 0)
{
uint64_t ret_addr = *(uint64_t*)((uint64_t)base_ptr + 8);
if (ret_addr != 0)
{
h = find_from_rip(ret_addr);
kprintf_symbol(h);
}
else
{
kprintf("-> Function: none -- 0x0\n");
}
base_ptr = (uint64_t*)*(uint64_t*)(base_ptr);
}
No
wdym no
searches my symbol array
yes
Why are you doing if (ret_addr != 0)
Does some magic function at the last virtual address make a function call?
what
yea i dont think its the stacktrace code
The code is ok
If you're still using its stack
Sorry
why are you apologising
I'm being very arrogant
its fine even then, at least ur trying to help
which im grateful for
๐
i think u should go to sleep
I'm trying to study

still cant figure it out chat
looking at the code back and fourth
dont get why its having this 

Have you tried politely asking the code to work?
we are running limine stack
we get first timer interrupt, push stackframe
disregard this stackframe cause old thread is NULL initially
run do_savekstackandloadkstack
push kernel registers rbx - r15
load kstack from thread
call change rsp0
pop those k registers
ret into return_from_kernel_in_new_thread
pop userspace regs
iretq into thread
get timer interrupt
push stackframe
run do_saveksatckandloadkstack
push k registers
save old userspace regs into thread
load new userspace regs from thread
call change_rsp0
pop k registers
ret into return_from_kernel_in_new_thread
pop userspace regs
iretq into thread
yea no idea
i made this keeping track of the stack
i see no area where stack would get corrupted

call change_rsp0
how
What does it do
that
You create a new thread inside the timer interrupt, right?
no
Then why do you have ret into return_from_kernel_in_new_thread
because that is setup by create_kentry
before we go into the timer interrupt
And
After you call do_savekstackandloadkstack, you return to there on the next call
If you're not calling create_kentry
Which you're hopefully not doing
im not
So you create two threads
Then what are you switching to inside the timer interrupt
hold on ill explain this
schedd
the new thread
What does it switch to
Where does it pagefault?
stacktrace
Still, after you pop k registers, you don't return to ret into return_from_kernel_in_new_thread
You only do that when you enter userspace for the first time in a new thread
am i supposed to do that everytiem
It's just that this isn't what's really happening
What calls your timer interrupt?
Yes, which function do you put in idt and where is it in your code
which file is it defined in?
idt.c
That's not how you're supposed to be doing that
You need to be saving all registers
Why are you doing cli and sti?
maybe a timer interrupt happens while im executing this code
Yeah
You're not setting rbp to 0 in isr stub
well yeah because you take the rbp from the frame (also zeroing rbp there would make the whole backtrace useless)
Your struct StackFrame is in wrong order I think
it's rbp field first then rip
if this is
like stack trace
you just have to somehow make rbp be zero at kentry
look
Your intnum is on the top
thats a dummy error code
error_code
Yeah
wrong reply
so what the hell am i supposed to do
where do you switch to kentry?
where do you call that from
Also, you can just try halting the kernel, and looking at the trace with GDB
yes i did before
look
^
ignore the ubsan
but still
and btw @flat nymph i had forgot to add a send eoi before switching into the thread
and an sti
but even that doesnt solve anything ofc
i dont know how to fix this
Are you sure it's stack corruption?
Like you can place 2 breakpoints inside the isr stub
And check that the registers are the same on entry and on exit
no
your stack trace is broken and tries to get the rip of the first frame with rbp 0
which ends up accessing out of bounds of the thread's stack
so break if rbp is 0 instantly?
guess what
solves nothing lol
you did it in the wrong place
you need to have smth like ```c
uint64_t* next = (uint64_t*) (uint64_t) (base_ptr);
if (!next) {
break;
}
nope
you need to load it from the base_ptr not check base_ptr itself...
the while already checks base_ptr
that?
solved it??
so there was no bug?
it was just my stacktrace
being stupid?????????????????????????????
yes
a good advise for debugging: don't use macros for large pieces of code like that
I said there was no stack corruption
it makes debugging harder for no reason, just make it a normal function you can step through line by line
thanks for that advice
@molten grotto how do i get 8 hours of my life back
by speedrunning whatever the next thing you wanted to do on nyaux was 

bash when
you are likely going to get it before I at least 

unless I am going to speedrun a new unix-like kernel
then tmpfs, devfs, ustar parsing
syscalls
xsave and friends
elf loading
and um
tty
I kinda actually want to try making an unix-like kernel, I just don't think I want to do it with crescent tho
if bro speedruns a unix like kernel faster then i write the vfs
im cooked
anyways im kinda thinking of givings threads like
tids
so like a thread could have tid 0 or 1 or wtv tf
pid exists too
maybe giving threads names too 
i think linux does that too
as well as tids
does linux give threads names
yes
looks like it has been 15 at some point at least
wdym some point
did they change it?
you don't want thread names that are 128 chars long
is 256kib for a kernel stack TOO much
i choose that number cause limine defaults to giving 256kib stacks
My thread names have no limit in length 
kernel stacks are usually 4-16k
kb or kib
whats the difference
ima give nyaux 16kib kstacks
are u going to make them exactly 4000 bytes if i tell u its kb
yes
nah
on linux pid == tid for main thread
nyaux running on 16kib kstack (page fault is intentionally forgot to remove it)
so if u had pid 16
it would be tid 16 for the main thread
some other thread being 17
yes
then 18 etc etc
yes
fair
wanna change the flanterm font ngl
u have better things to do
but looks
/j
yes i have better things to do ur right tho
gotta work on ioapic
then
vfs and etcetc
EC ๐ก
flanterm font: not important
ec driver: very important
im in your walls

important to get priorities straight
he'll end up having some bug with his driver bricking his PC
lmao
I thought you were in my walls ๐ฅบ
sure
i have a patch for psf fonts if u want
oops wrong message
anyway
for fonts
Also interrupt allocation 
i have that but its not per cpu 
no per cpu idt 
cry abt it i have 256 vectors 
"division by 0"
minus the exceptions ofc
me neither 
this is genuinely so cringe
i want to work on nyaux but
the loneliness of not having a relationship anymore
fucking hell why i always get these feelings
๐ก
t'is natural
What happened
happened like a week ago didnt wanna say anything
teenage girls are really mean
like
REALLY
Be an ai
lol
program until you transcend feeling
until it's all you think about
get a tumor in your amygdala
teenagers in general aren't that great tbf
Hope you feel better soon
Yep
fr
i napped and now its 2am
uh oh
You haven't had university entrance exams yet
(and university in general if you're gonna do that)
The joy of spending 5h30m in one day and 5h the other day doing an exam
Although maybe I had the best sleep after that
I remember being knocked out for 3 days after them
With no memory of them
anyone have a throwaway ec laptop
my only laptop has EC
but
i dont want to brick it
im not taking the risk
@kind root do u know anyone with a throwaway ec laptop
also do u have resources on EC
Dw
Unless you do something stupid
(which now if you come to think of it could totally happen in nyaux)
bro rip
Nothing bad should happen 
i hope.
yes.
it probs would
but
ill have to take the risk with my laptop
if i brick it tho
no more osdev for a long time, ill have to save up for a new computer
and ill only have a phone

ill ask more abt this after i finish my route irq function
Dw girls are temporary NYAUX IS FOREVER ๐ช
YESSS
dont worry u wont corrupt it to an extent where its not bootable
worst case you'll have to pull out the battery
i dont have a removable battery laptop
no hole at the bottom or anything?
my laptop has a tiny hole and a button under it
I think that laptops should have the same thing as phones, where if you hold a power button for a long time it should disconnect the board from power
no
mine does
it takes like a minute
You can just use MSI
hold on lemme js test nyaux on my laptop rq
no i mean
for the ioapic
route irq function for the ioapic that is all
then its EC
i have lost my usb.
fuck
sooo
anyone willing to flash and test nyaux on real hw rq.
i have lost my usb.
i want to check something with systems with multiple ioapics
Maybe tomorrow

hold on
we maybe be saved
i found a usb sd card reader
and i have an sd card in my drone

we are saved
nyaux development continues
nvm
we are not saved
my only sd card reader just broke apart
like the entire shell.
broke
pcb came off the usb connector too
JUST MY FUCKING LUCK
๐ญ
soooo chatttt
i not only need a person with a usb drive
i need a person whos willing to test nyaux on real hw a billion times
not just for the ioapic
but for even EC
@rigid fable mr duck i need ur help
how
the actual fuck
am i going to work on nyaux
now
cant u pickup another usb
i dont have another usb
I meant buy one
how did u lose the usb had in the first placea
no idea
just disappeared
lol
anyways i found a victim friend to help me test it
some random guy who has a usb and a recent computer

who ping
mr duck are u still alive
i have a favor
to ask you
flash this on a usb or smth and test it on real hw please
this is a shot in the dark but do u have a rooted android phone by any chance?
rip, couldve used that as a bootable drive
I am scared
lol
please just trust me its a normal iso
view it under 7zip or smt
straight outta the makefile
i am beggin
๐ญ
Nyaux automated testing pipeline: Nyauxmaster -> discord -> ๐ฆ -> discord
yes
๐
i'll test it on 2 pc
okay
it supports only uefi
no?
Huh?
it supports both?
putting iso in filesystems is safer
i recommend implementing the entire kernel api, especially pci io before running on real hw
i dont have pci yet
lol
i am just testing something
you will end up with half initialized firmware
i know but im still gonna write the EC driver
what is EC
and why this is extists
embeeded controlerl
and why it exists
i mean yeah
Limine doesn't need to support Ventoy
Ventoy needs to support Limine
it support uefi
๐
probably only bigger servers/workstations do
my laptop does
to which i cant test it
well that's cool
do you have
i lost it
external drives
no
what is your bootloader
you can
And boot from there
and chainload efi file
how so
wdym
load iso to ram and chainload it
You just reserve a few gigs
grub can do it
And dd your iso there
windows ๐ก
why are you hating ventoy
Ventoy is a hack, he is right in that
but there is no way to make something like what Ventoy wants to achieve without being a hack that barely works
fair
๐ญ
AMD PCs seem to have it
ventoy is convenient though
for what it is, it's a miracle it works as well as it does, yes
amd machines usually have 2 ioapics
fine i'll test nyaux on my desktop
that's interesting, now that it was mentioned, i kind of remember that being the case
on my laptop: ```
[ 0.035718] IOAPIC[0]: apic_id 7, version 33, address 0xfec00000, GSI 0-23
[ 0.035722] IOAPIC[1]: apic_id 8, version 33, address 0xfec01000, GSI 24-55
i needed this thanks qookie
ur a life saver
thank you
i think it's instantly tripple faulting
That PC has a serial port so I can share the logs if you write them there
at least it doesnt brick it
FUCK
share the logs
please
read from com1
theres no ec yet
in nyaux
just share the logs @flat nymph please
we may have another nyaux bug

no im assuming its my code
it prob is
some weird obsecure bug that only happens on hardware like his because of one device maybe idfk
I'm booting the second PC
okay
pmOS works on so it can't be 
Even the framebuffer
/s
(another secretly fucked os)
yep 
cant get enough of these bugs
i swear
It takes like half an hour to boot though
wtf why
im gonna 
why is it theres always a new bug in nyaux
ugh
Because it was dying
So it's reading at 10MB/s
With seek times of seconds
But Linux boots on it so that's fine 
Ryzen 9 5900X
wait ram shoulnt matter
64GB ram
maybe thats the problem?
no
it would have just said it faulted
i install an idt immeditely after boot
idfk
can u try booting nyaux
What's your com port parameters
Wdym
literarly just write chars
That's not how that works
i dont even init it
Lol
it works on qemu 
Yeah no
what bug are u having
:)\
nyaux triple faults on his pc
i tried nyaux just minutes ago on my laptop
i got lucky
found a usb
that kinda works
its shitty tho
and sometimes just refuses to work
but it ran nyaux fine
no issues
no triple fault or any nonsense
and i learned my laptop does not have 2 ioapics
lmao
nyaux triple faulting is a feature confirmed
@flat nymph are u sure u flashed the iso
and are not using an older version of nyaux
Wdym am I sure
i just want to make sure
I've been testing pmOS previously
understandable
im gonna actually crt
cry*
@flat nymph did nayaux boot yet on that pc
nyaux*
then there's no serial port
fun
hold on while i properly init the serial port
ill write some quick code
im actually just going to yoink this init code from the wiki
i need to see this now
You also need to be waiting for the port to be empty when writing
yea
stole code for that too
from the wiki
try this please
@flat nymph
baud rate is 38400
it's headless
dd it
๏ฟฝz๏ฟฝ๏ฟฝ2c๏ฟฝ๏ฟฝ๏ฟฝY๏ฟฝd๏ฟฝ)2๏ฟฝ8QY๏ฟฝ
im going to kill myself

cant even fucking debug it
im going to actually go into tears
now we have a bug thats not even debugable
@flat nymph i dont know what to do anymore
Do you do this?
yes
I'm gonna try pmOS just to make sure the PC is sane
Since I've gotten a new motherboard recently
did you set the baud rate to 38400?
yes its lit copied osdev wiki code
that's what the code nyaux copied sets it to
i didnt even bother to write it myself
literary after init temr
?
i dont print anything before init term
and im actually starting to cry because i thought i was so done with these bugs and now we have a huge bug thats probs gonna be undebuggable because even the fucking serial port doesnt work
it doesnt matter
nyaux is bugged
i have no way of testing it
i want to bang my head againist the wall
i dont know what to do
@flat nymph any ideas at all?
it doesnt work on his machine
ah the triple fault
find another machine it doesnt work on that u have access to
didnt it also crash in vbox?
Another PC which is mine
very old bug
that was solved a while ago
yeah if mishakov is fine with it then you can just start by commenting out everything
sorry, but why cant u just get serial logs?
then comment back in one thing
map regFF2000 - 0xC13CCmory map region 14: 0xC1 0xC16CC region 0xFEDD658: 0xFF 59: 0x1mory map - 0x102C000 - 0000, type 6
Memory map region 2F1DD000 - 0x102F23F000,mory map2F2A5000F300000,0000 - 0x1030000000, typ region 00000000
Found tst memor at 0x100000000,F2EA60000
Initializing region 00xA20E0000000
Sp PMM re020000 -PMM region 0xC1600
80000007 6799000 - 0xC327E00ng up PMM regionzing interrupts
[Info: TSant bit lizing pidle tasinit
Moline: inclaimablC1C000 -ng bootle
CPU 1e
CPU 1PU 1B enryspsaca4C5P)U 1Fte r(i6s5e5r0.de)r
spa/idle
CPU 1 enteDerbsupsyscall failed)
and put a for(;;) asm volatile ("hlt")
most stable nyaux driver
which were working before
I'm blaming the power supply
his serial port is ass
.
.
k
do this until you find the thing that crashes
will do
ah
if you narrow it down like that it will be easier to find the bug yourself
because eventually you find the function that leads to the crash
and you can audit it yourself
even without logs it should be easy to find what's going on
unless it's some sort of scheduler bug then that won't work
dont flash him twf
๐
first a comment about fucking nyaux now this โ ๏ธ
ban him

.!naenae @surreal path being inappropriate
Permission Error
You must have BAN_MEMBERS to execute this command.
yea?
yea but its def fnot the aml
Tripple fault
๏ฟฝ๏ฟฝ๏ฟฝY๏ฟฝd๏ฟฝ)๏ฟฝz๏ฟฝ๏ฟฝ2c๏ฟฝ๏ฟฝ๏ฟฝY๏ฟฝd๏ฟฝ)8Q
most stable entrypoint
At least it's consistent
are u sure u recompiled it
what limine base revision are you using
2
why
It probably is
well take a guess?
lol
unless limine uncoditionally makes the framebuffer
even if >4G
Fuck why does it boot into windows all the time
try commenting out the flanterm init
k
and ofc every usage of the flanterm context
because if u use it while its uninitialized you will crash
duh
what
bruh
limine only maps first 4G of memory for you
think harder
if the framebuffer is above 4G you will page fault
and without an idt you crash
lol
UNLESS
Does it not map all memory?
as i said
forgot
limine maps the framebuffer
which I DONT KNOW if it does
i think it maps all usable entries + 0x1000-4G unconditionally
tripple fault
if the other iso crashed, try this. no flanterm init here
okay so not even my code
no, it is your code
bro
Can you comment everything?
i did
you are calling flanterm_fb_init 
kmain() { hlt(); }
i did
by that logic uacpi crashing because of a broken allocator would also not be your code 
flanterm fb init not my code

is mints
not mine
i dont own flanterm
what
It's not, though it does probably have some weirdness with framebuffers
Since it has 2 4K screens
that's not weird
check for fb response before dereferencing anything
i do
With one of them, it sets it to 4K
at least its not a 2004 laptop that barely knows what a vbe is
framebuffer_request.response
before
Ah
Framebuffer does work in pmOS though
<--- Blind ass mf
But I throw away Limine's hhdm very early on

