#Nyaux
1 messages · Page 16 of 1
Yeah we'll work that out
Well I have the UltraOS
Those were supposed to be part of that
i already do this for several things so one more isn't a big deal
oh yeah, i remember it now
We could make a limine->hyper Abi for providing a predefined config
https://github.com/UltraOS/UltraLegacy/blob/master/Kernel/ACPI/ACPI.cpp uACPI has certainly grown
Lmao
as i mentioned above, i was thinking of just having hyper scan the efi vars for a predefined config
and Limine would construct the config and put it into an efivar on the fly based on the Limine config options
Oh yeah
Yup
Makes sense
i do wonder though
Well the protocol is ultra
So idk
You could just boot into hyper directly for hyper protocol
it would be nice to also pass the kernel and modules or whatever directly (as in, have Limine itself load them into memory)
so they can also be loaded off of ext4 or whatever else Limine supports, using Limine style paths
yeah
i readded it a while back
i thought you quit ext
It was brought back but experimental™️
^
zfs next in line
Why is that?
the puppy linux creator bitched enough to make me wanna add it back
Same thing but something else instead of efi vars
then we could use the same method on both
True
I don't think efi vars are that great for potentially large temporary one-boot data anyway if its stored to some flash (unless there is a way to have non-persistent variables)
Anyways we'll work out the details but the idea overall sounds pretty interesting
a missed opportunity with EFI's design in general:
amiga's rigid disk block allowed you to embed filesystem drivers with your partitions
no one would hate and everyone would love pluggable FS drivers for EFI
that's true
yeah! i like this
Interesting
amiga was just insanely based in many respects in general
a toast to object oriented design: you can install a DataType module for WebP into your Amiga running AmigaOS from the early 90s and basically all amiga programs that deal with graphics can instantly work with WebPs
Njce, too ahead of its time ig
i was able to find a terminal emulator on an iphone i was gifted, unfortunately however that was a long time ago and i forgor 💀
with that, you might be able to set up sshd on your home computer then ssh in on your phone when you need/want to
don't forget flanterm :^)
ish?
good mornin
to all
i still havent figured out the nasm crate yet
but im tryinggggg
I don’t know how macros work with gas syntax and it looks really weird and confusing
also on the plane will be home to Ireland in like 3-4 hours
actually, yeah, it was,
https://ish.app
yea its kinda ass
Just use rust macros™️
i mean its ok if you just want to have access to a normal ssh with no features paywalled like the ssh clients on the appstore have
iOS is annoying for SSH because of Apple's background apps' limitations
Android doesn't have those
(Although I think they might've also started doing that)
Like you could have an ssh session going for days
Whereas on iOS it would get closed if the app is running in background
iirc the ish thingie let you access the location in background (something like cat /dev/location > /dev/null&) and if you did that it ran in the background with no problem at all
Though idk I've never used ish myself nor iPhone
You can just ssh into your machine at home
Here's my source for the command btw
I think you even get easy to configure tunnels through VS Code
Or you can use darknets
(if you can't open ports)
What's the issue at hand?
Keep in mind that the error code only gets pushed for some exceptions
i know
cool
now i need to just make an array of function pointers that global or whatevs
or maybe
i can just store the interrupt number
and have a global function that dispatches the
crap towards which function
yea maybe that'd work
I have some GAS assembly macros in my OS which create an array of functions that push interrupt number
hm?
they use assembler macros to generate isr stubs that set up an interrupt frame with a consistent layout so a generic interrupt handler can be invoked
exactly what you wanted to do
im working on it dw
having trouble getting a variable using gas syntax
or even using my macros
.extern function_handlers
.macro interrupterror num
.endm
.global stubs
stubs:
.long interrupterror
this doesnt work i do not know why
keeps saying undefined symbol
so define the symbol
and you marked it with pub and extern "C" + #[no_mangle]?
Now I did
But now I’m getting macro problems
Fun
(plus this https://gitlab.com/mishakov/pmos/-/blob/main/kernel/arch/x86_64/interrupts/asm_helpers.S?ref_type=heads)
(plus some more macros)
You don’t need and to do interrupts with rust, or really anything as long as it has inline asm and naked functions
I can’t remove the embed because I’m on mobile 
The x86-interrupt ABI is unstable, but with rust it can be helpful for this stuff
what about returning
where do u
pop everything out
in your inline asm
i do not see
nvm im blind
It’s somewhere in x86_64/mod.rs but I’m kinda bad about dealing with registers so I’m not sure if I do 😅
u have a function called syscall, what does sym mean? what are u trying to do in your syscall handler
what is a virtual pointer ive never seen something like that
(i come from C so beware)
syscall is the function I pass into the 0x80 interrupt (it’s kinda garbage tho so it can be ignored if you want) sym passes a function to an asm block as a pointer iirc
sym gives the symbol name of the thing you give to it (meaning the mangled name if its a mangled symbol and the plain name otherwise)
i see
VirtualPtr is a *mut _ wrapper that lets me know if it’s a pointer that’s mapped or not
Yes, pretty much
also what are you doing here
Ah yes, that cluster fuck of a macro
I’m generally using it to give an error code to my exception handler (should be just above that), I should probably rework that so it calls panic or something but it’s a little bit of a mess
Rdi is the register that rust uses for the first argument so when I push the number onto the stack, I’m taking the stack pointer which now points to that number and moving it into rdi since it now points to the interrupt number I passed to the macro and so the exception function knows what exception happened
I think I stole it from Felix lol
im sorry i dont do things the rust way 💀
i should maybe learn rust macros more
but anyways
Nyaux needs to be worked on
It’s changed since I stole it but it’s pretty similar to their implementation
Macros are annoying, but you get used to them once you are eventually forced to use them because rust doesn’t have a stable way to pass variadic arguments to a function without a macro
rust macros are pretty nice in comparison to c's lol
Oh yes 100000%
i would know
also that push_gprs function seems a bit weird, as like the compiler can save some stuff to the stack on the entry to there and then its supposed to restore it at the end but then you pushed some random stuff to there and told the compiler that you didn't use the stack
Yeah, my handling of registers is kinda terrible and I knew that xd
and push_gprs might be called too late after the compiler already used some of the registers for something
is there a way to make the compiler not do anything
make the handler entry fn naked and then instead of push_gprs being a function either just inline the asm there manually or make it a macro
#[naked]
Can I see the whole macro?
yep
macro_rules! exception_function {
($code:expr, $handler:ident) => {
#[inline(always)]
#[naked]
extern "C" fn $handler() {
unsafe {
core::arch::asm!(
"push rax",
"push rbx",
"push rcx",
"push rdx",
"push rsi",
"push rdi",
"push rbp",
"push r8",
"push r9",
"push r10",
"push r11",
"push r12",
"push r13",
"push r14",
"push r15",
"push {0:r}",
"mov rdi, rsp",
"call {1}",
"pop {0:r}",
"mov rsp, rdi",
"pop r15",
"pop r14",
"pop r13",
"pop r12",
"pop r11",
"pop r10",
"pop r9",
"pop r8",
"pop rbp",
"pop rdi",
"pop rsi",
"pop rdx",
"pop rcx",
"pop rbx",
"pop rax",
in(reg) $code,
sym exception_handler,
options(noreturn)
);
};
loop {
}
}
};
}
And what’s the error it says??
only const and sym operands are supported in naked functions
Oh yeah
wait i solved it by using const
In main.rs/lib.rs?
yep
yep
you can use <> around links I think
double fault sadly :c

This is good to know, thanks
i'm pretty sure if you put angled brackets around a link, it removes the embed :)
<https://www.youtube.com/watch?v=dQw4w9WgXcQ>
oh 💀
not the rick roll link xd
i mean, it's the perfect use case
get well soon man dw about it
actually i will get some work done, just a bit sick so not a lot but ill try my best to get something done
Don't pressure yourself, that's the important part
Do only what you feel like doing if you feel like doing it
general protection fault over here
yea i agree
but i wanna work on it
on this line for some odd reason
not when initing the idt
but when using it
manually interrupting the cpu
even tho
the IDTR
looks correct
this is very odd
it looks valid
further debugging doesnt show much
other then the fact that its general protection faults when an interrupt ever occurs
and the backtrace shows that its happening when an interrupt occurs
general protection error code is 0 so nothing segment related
not fun
size is 4096
which is expected, 16 bytes * 256 is 4096
more or less a single page
very odd
banging my head againist the wall trying to figure this out lol
idt looks very odd
thats not valid
I should say this to my boss
but the base address is totally wrong
?
limit is the highest usable byte of the table (same goes for gdt)
right
so 0 -> 0xFFF is 0x1000 bytes
did you fix the base address?
the bass address looks correct in the IDTR
what about in qemu?
still completely stupid
are you packing the idtr struct?
I dont know rust, but I imagine its inserting some padding after the limit field
ah yeah, it would be then
oh lol
😎
also ordered some kfc
😎 😎
everythings works nicely
even the saving of the registers
nice
now we have an IDT
whats nextttt uhhhh
uacpi integration now??? hmmm
no
i have a heap allocator, pmm, vmm as well
i can allocate virtual addresses and shi
same implmentation from old nyaux
got the lapic address
Almost! You forgot to mask out some flag bits in the msr
@desert haven out of curiosity
can kernel software simply assume the lapic lives at 0xfee00000
I mean I wouldnt advise it, but I have have seen kernels that assert that and carry on assuming it to be true
I see
but then again its really not that much more work to do it properly and get the address from the msr - and that covers you in case you end up on a system where they've been moved.
i was about to cite performance problems but i realise you can cache the msr's value somewhere and use it
now is correct
osdev on speedrun.com when
bash any%
for a second I thought he had bash
and I was gonna be like
"how tf does he have bash in < 2 weeks, and I've been at osdev for a year and still haven't ported mlibc once in 5 revisions of the kernel"
i had a vfs and a few syscalls the first night of osdev in zig
safe to say it was shit lol
but was it quick? yeah
porting (m)libc is boring
ik, as I have tried to once
(as in I'm rolling my own libc)
Blasphemy!
Thanks to sickness not speedrunning this
I’m too sick
😭😭
help me
hi i saw u type fadanoid
hii
@kind root does uacpi have rust bindings i kinda need to use it
to get a bunch of tables
i need
Ok take it easy then
Unless you like pain
Then go on
trying to get uacpi integeration
using the uacpi-rs bindings by @silk wind
few problems tho
What problems do you get?
Also I took over the development after the previous owner stopped maintaining it and I haven't found time to rework it
error[E0432]: unresolved import `alloc::boxed`
--> src/acpi/mod.rs:3:12
|
3 | use alloc::boxed::Box;
| ^^^^^ could not find `boxed` in `alloc`
the trait asks for boxed
i dont have
box
for some reason alloc doesnt define it
even tho i have a global allocator
that works
you could use C :^)
and marked it with #[global_allocator]
lol
never too late to rewrite
3rd rewrite when 
the compiler tells you what you need to do
extern crate alloc;
now it works
The rust analyzer in vsc doesn't give you the same level of help as rustc does
i know
is the address in rsdp request limine gives virtual or physical
virtual
and im guessing uacpi expects a physical address so
i gotta unadd the hhdm offset from it
still page faultsss
:c
page faults here not matter what i do
:ccc
even tho i add the hhdm offset to it
add or subtract
add when using the map function
i give uacpi the physical rsdp
i let it call the kernel api map
which adds the hhdm offset to it
and returns it
What's the page fault error code
0
should be tho i went over the entire memory map and mapped everything
i dont think its my map function cause its the same implmentation from old nyaux
bit 0 not being set means page isn't present
there is something i dont do i do in old nyaux
for (uint64_t i = 0; i < 0x100000000; i += 0x1000)
{
map((uint64_t*)((uint64_t)kernel_pagemap.pml4 + hhdm_request.response->offset), (hhdm_request.response->offset + i), i, NYA_OS_VMM_PRESENT | NYA_OS_VMM_RW);
hhdm_pages += 0x1000;
}
this line
i dont understand why i do this
in old nyaux
that seems to map first 4 gb to hhdm
in your rust rewrite where do you map the memmap entries
to their hhdm virtual addresses
to map the hhdm
no I mean in which file and line
try actually mapping in your uacpi map function
wdm?
I'm confucius
The fault address here is way below
how are u so sure
Cr2?
you don't have a virtual address to map it to?
yea i know
im gonna solve that
cause vmm_region_alloc gives memory
just get a random one away from the ram and map it to there
allocated and mapped contingous memory
you can get top of the memory from memmap entries
I mean clearly this is broken
Because memory below 1mb is not mapped
add a few gigs and done
its finene i mean it worked
What does Info mem say
Yeah u don't map any of reserved memory
What worked
nvm
seems like uacpi over here is giving me a status error
out of memory
lovely
so im not gonna map the reversed regions then
cause it causes that
how much ram are you giving to qemu
2g
you shouldn't run out of memory by mapping reserved regions
i know
Its a bug in your mapping code
Fix it
doesnt matter if i do the same thing
while i != 0x100000000
{
q.map(
HDDM_OFFSET.get_response().unwrap().offset() + i,
i,
VMMFlags::KTPRESENT.bits() | VMMFlags::KTWRITEALLOWED.bits()
).unwrap();
i += 0x1000;
hhdm_pages += 0x1000;
}
as in old nyaux
i have no idea whats going on ughh
wrong
I think
maybe
lemme check
nvm it's phys
okay i may take a break for an hour my brain hurts debugging this
maybe ill have an idea on why when i come back from the break
Zig
No.
But like what else
C
Ada?
shhhh, you'll wake streaksu
C is obnoxious
A language without templates is painful
skill issue ngl
Just macro so hard you reinvent c++
I've never had much problems with macros
Also no RAII
skill issue
just free your memory
I rather use 22M of memory in my kernel, or leak that much
but who cares, they invented swap for a reason
It's not a skill issue, it's an old language
it's a skill issue
My kernel doesn't count how much is used so I'm gonna assume it's very little 
Someone in Discord linked to this tweet and I figured I'd take a stab at singing it in my totally not awful fake accent: https://twitter.com/bhilburn/status/971019559095427075/photo/1
Download:
WAV: https://kaslai.com/files/program_in_c.wav
MP3: https://kaslai.com/files/program_in_c.mp3
Also no SFINAE 
Although somehow the majority of my OS is still written in it so...
but im DEF adding rust interop
rust is cancer
don't use rust
or associate yourself with it
I will be met with large backlash saying that
which is why I will have this thread muted for a day
no im gonna take the existing project
and im gonna have both rust components and some componets written in C
and that decesion you must respect
wine about it like a baba 
or actually no
im gonna have it written in rust and im just gonna go fix my allocator bug
okay
thats it
i already made progress
im not stopping
@kind root do you know anything about when uacpi throws a out of memory status?
when you just init it
when u return a null
from anything that allocates
Idk, I'm almost finished with reading the Rust book, and the language just feels like C++ without exceptions and with fancier names for its features
O
OHHHH
OHHHHHH
wait
its my slab allocator
so my slab allocator is returning 0?
hmm
u tell me
wtf
rewrite in c#
NO
yes
ill check dealloc then
check e.g. mutex_alloc
okay
it worked!
literarly ONE Number
ONE FUCKING NUMBER
😭
well now that works its time to actually
create the namespace
init level mismatch?
what does that mean
huh???
does anyone know what that means orrr
i have no clue
what kind of error that it
yes
incorrect order of initialization or api usage
okay i used it the right way now
memory error
of course
wait wrong screenshot
this one
and i know vmm_region_alloc panics BEFORE it returns the NONE value so
this is something else
why is the current pagemap none
btw if u just need the tables u dont have to load the namespace
just uacpi_initialize is enough
i got so far to this
wrong image sorry
yeah thats the beginning of namespace_load
💀
obos curse
so hard to think
so sleep
i want to get this out of the way first thooo
if (on_sleep_tablet)
Sleep();```
writing code while tired has caused me the weirdest bugs
that were because I added schizophrenic code
I don't think I've taken much caffiene in my life
i never tried a redbull
enlightened: never program before a bottle of beer
what does it taste like
thats why u have bugs 💀
maybe i should try one
infy you're a fucking genius
lol
PAGE FAULT OF COURSE
page fault non present bit
now lets see the rip
also why tf is the rip at 0
/home/rayan/.cargo/git/checkouts/uacpi-rs-859d27ced179e937/4960769/uacpi-sys/vendor/source/interpreter.c:292 (discriminator 1)
[rayan@linux NyauxKT]$```
lovellllly
nyauxmaster 5.0 name leaked
I already knew it
on this line
wdym his name is not nyauxmaster?
no it def it
RAHHHHh
i had a crash on this line in Astral but that was because his memcpy was bugged
could it be
that the memcpy this uacpi-rs
i dont feel like its my allocator
because if it couldnt allocate
i would get unwrap or result errors
it could be anything else
because i do the rust error checking
i have no idea then
i have no idea how im gonna debug this
I start staring at the disassembled code in these situations
expand the macro in that code
see which actual line it dies at
it wont let me expand it
only the non impl
CR2=ffff80010008203d
this is what cr2 looks like
does that look valid
no
what does that look like
but not too far off from the hhdm
ummmm so why is it wanting that address
wha?
make sure you don't go over the hhdm limit
when mapping physical pages
or well
putting phys. pages in the hhdm
or getting their address rather
i dont tho
i doubt its anything super complex
just u doing a rarted thing somewhere
is your calloc ok?
maybe the rust bindings are fucked somewhere
they're untested for hte most part
and also outdated
unsafe fn alloc(&self, layout: core::alloc::Layout) -> *mut u8 {
MemoryManager.alloc(layout)
}
unsafe fn dealloc(&self, ptr: *mut u8, layout: core::alloc::Layout) {
MemoryManager.dealloc(ptr, layout);
}
yea
so i dont know what to do then
inspect them
#[no_mangle]
pub(crate) unsafe extern "C" fn uacpi_kernel_calloc(count: usize, size: usize) -> *mut c_void {
get_kernel_api()
.alloc(Layout::from_size_align(count * size, 8).unwrap())
.cast()
}
it does this
for calloc
no idea if that zeroes anything
zero it then lol
okay lmao ill just zero all my memory then
tbh
debian linux has that config option on
absolutely any memory allocated anywhere is always zeroed
thats actually really cool
oh for the big memory allocations
i forgot to memzero them
but no i do
it faults when it trys to vmm region allocate
nvm
now we are page faults
with an error code of 2
[rayan@linux NyauxKT]$ addr2line -e kernel/kernel ffffffff8004f75d --demangle
/rust/deps/compiler_builtins-0.1.121/src/mem/x86_64.rs:117
[rayan@linux NyauxKT]$
what???
why here
nvm
back to the same issue
@kind root is namespace init needed for getting tables
or no
cause this is clearly some weird issue with some old version of uacpi
im not wanting to debug
probs something that happened before
nah its not
its ur skill issue pretty confident 
no
only uacpi_initialize
nuh uh
oh wait
if its using old uacpi
it probably depends on those libc helpers that these bindings ship
those probably suck
as theyre untested
so idk
just update uacpi lol
im not making rust bindings for it
F
i have an OS to work on to be fair
yeah thats why i mentioned earlier just forget about namespace for now
uacpi_initialize is enough
yea
back to work
i think i shall use a different acpi aml parser
cause the rust bindings for uacpi are incomplete
There is a rust aml parser but idk how feature complete it is
let me see
ill use it for NOW
nonono
it doesnt support half the opcodes, its recursive, and other other half of opcodes are implemented incorrectly
u can try but i just wouldnt use any
lol yes
thats toally easier than unfucking the current rust bindings 
maybe there are acpica binding for rust
but probably not
Rewrite in C
remove the ~~
yeah idk man rust for nyaux wasnt a very good choice i think
Or have it as a userapace server (written in C)
yup
It basically just needs a bit of POSIX and mapping of physical memory
look i dont have good rust bindings yet for uacpi
ill use the shitty rust version
and then switch to the new uacpi rust bindings when thats ready
that sound good?
i need to get a move on with the project
i plan to make everything modular
so
i will be able to rewrite the acpi part of the kernel just fine
i mean its your project lol
yea lol
im simply warning you that the rust ACPI crate is not very good
might just use the lai bindings at this point
yea i saw its shit
thats a thing?
i mean sure lol
lai doesnt do table parsing for u tho
lol
C
i cant do this bro notihing works it keeps page faulting
debugging the memory manager
seems like theres an issue
with the slab allocator
:c
let obj_amount = (4096 - size_of::<slab_header>()) / size;
i feel as if this is wrong
for i in 1..obj_amount
{
let mut new = (start as u64 + (i as u64 * size as u64)) as *mut KTNode;
println!("node: {:#?}", new);
(*prev).next = Some(new);
prev = new;
}
(*prev).next = None;
i cannot know whats causing some of the nodes to point to 0x1
i cant figure it out
😭
wtf is this formatting
copy pasting from vscode is funky
true
At least its not pointing to 0x2
^
sometimes it points to 0x0
@molten grotto i need your help im dying i cannot figure out the bug in my slab allocator code
Didn't you have one that was relatively good
Maybe u fucked up because of rust semantics
i dont think so i did everything correctly
i read the documentation
write_bytes does count * size of T
maybe theres something i dont know
I mean I dont see any other possibilities
yea
nyauxkt/kernel/src/mem/phys/mod.rs
this code
is giving me
multiple aneurysms
i can feel blood vessels popping in my brain
ik but it should work
😭
lol
i know im writing like its C
jesus man idk how you read this
no
you are writing it
then compiling
compiler tells you something
and you do the complete opposite
(probably)
idk how you actually come up with this code
😭
but comparing booleans to booleans is criminal
idk why people do it in ANY language
like a bool is already a bool
why compare it to another bool
'outer: while h.is_none() == false
like here
i know
yea ikik
or even better!!!
while let Some(h) = h {}
rust has structured bindings and pattern matching!!!
you dont need to unwrap everything!!!
you can just do that Lol
but yeah this is hard to read sorry
im not too sure why stuff is borrken
i understand
yea me too
im trying too
That's an average C++ experience
i know im writing like its C
not really because the c++ compiler does not give you actual tips on how to fix errors
while the rust compiler does :^)
at least for the easy stuff
clang does
since when lol
I was surprised
maybe VERY simple stuff like "oh you forgot a deref"
or "there is a similarly named type/function/whatever"
but other than that i just splurges out a million template instantiations and tells u to fuck yourself
"Can't find the variable. Did you mean this: X?"
Or something
It's better than GCC though
at the cost of compile times, i guess
at least thats my experience with llvm in general
Can you make a binding to proven C version?
rather not
kill me
wtf
why is it some 0x0
i said
None
(*new).next = None;
its supposed to be none
wtf
@thorn bramble u know anything about this
Isn't something like this UB?
how
if new doesn't contain an object previously written to there then yes
but i wrote to it
@molten grotto
for i in 1..obj_amount
{
let mut new = (start as u64 + (i as u64 * size as u64)) as *mut KTNode;
new.write_bytes(0, 1);
(*new).next = None;
(*prev).next = Some(new);
println!("info about this new node new: {:?} prev: {:?}", (*new), (*prev));
let mut e = 0;
for c in 0..800000
{
e += 1;
}
prev = new;
}
here
new.write_bytes(0,1);
^^^
yeah that should be fine then assuming that all zeros is a valid representation of KTNode
(which it most likely is)
do you know?
im really stuck
😭
im banging my head againist ze wall
I mean you can try to .write to there instead of write_bytes but I doubt that makes a difference
didnt solve it
nothings working qwinci 😭
Try a different compiler
no
tried setting up rust santizer didnt even help
wtf
no errors???
bro
yall know this shit?
@molten grotto do you know about rust santiziers? i did -Z santizer=kcfi
still no errors
that's for control flow integrity anyway, not for ub
error: undefined symbol: __asan_register_globals when with -Z santizer=kernel-address
what does that mean
asan needs quite a bit of work to get working
how do i get it working
it would be very helpful to have
well you need a shadow space where those functions that it asks for mark specific regions of memory as accessible or poisoned
oh
like I said its not the easiest thing ever to implement
im not doing that then
i guess im stuck for the time being with this issue of Some(0x0)
😃
if you push it I can take a look again
okay second
pushed
the problem is that the size of KTNode is 16 because Option must be able to hold both Some(nullptr) and None as separate values and your slab size is 8
so either make the min slab size 16 or use Option<NonNull<KTNode>> instead of Option<*mut KTNode>
(NonNull is just a wrapper type over a pointer that can't be nullptr so then Option<NonNull<T>> can have the same size as the pointer itself as null can represent None)
why is my slab size 8
oh right
im idiot
NonNull?
So i dont need an Option?
well it depends on how you want to do it
if you want KTNode to have a size of 8 then you either use the raw pointer without option checking for null instead of None or use Option<NonNull<T>>
Ill just use nonnull then
nonnull is of size 8 right?
@molten grotto ?
yes it has the same size as the pointer itself as its just a wrapper over a pointer
and Option<NonNull<T>> has the same size as a pointer too
right
or you know what
ill just not have sizes of 8
it works now thanks qwinci!
nvm @molten grotto having a page fault when using the acpi crate in here
/rustc/9c01301c52df5d2d7b6fe337707a74e011d68d6f/library/core/src/array/equality.rs:150
:c
the problem is that you don't map the whole hhdm, you only map the usable regions there
so i need to map the reversed regions too?
if you use the hhdm to access them then yes
also do note that they might not be page aligned
it works now tho
so you want to first align down base to page size and then use that (and add base % page size) to the length before you align the length up)
okay done
it works
sadly
the interrupt handler keeps showing rip at 0x0
i cannot figure it out
😔
hmmm
ill just use gdb and see
is there a way to trigger an interrupt with gdb
or run an asm instruction
manually
idk
yea somethings corrupting the stack
okay
reading the disassmebly
something funking is happening
ffffffff80004140 <NyauxKT::idt::page_fault>:
push %rax
push %rbx
ffffffff80004142: push %rcx
ffffffff80004143: push %rdx
ffffffff80004144: push %rsi
ffffffff80004145: push %rdi
ffffffff80004146: push %rbp
ffffffff80004147: push %r8
ffffffff80004149: push %r9
ffffffff8000414b: push %r10
ffffffff8000414d: push %r11
ffffffff8000414f: push %r12
ffffffff80004151: push %r13
ffffffff80004153: push %r14
ffffffff80004155: push %r15
ffffffff80004157: push $0xe
ffffffff80004159: mov %rsp,%rdi
ffffffff8000415c: call ffffffff80003c70 <NyauxKT::idt::exception_handler>
ffffffff80004161: add $0x8,%rsp
ffffffff80004165: mov %rdi,%rsp
ffffffff80004168: pop %r15
ffffffff8000416a: pop %r14
ffffffff8000416c: pop %r13
ffffffff8000416e: pop %r12
ffffffff80004170: pop %r11
ffffffff80004172: pop %r10
ffffffff80004174: pop %r9
ffffffff80004176: pop %r8
ffffffff80004178: pop %rbp
ffffffff80004179: pop %rdi
ffffffff8000417a: pop %rsi
ffffffff8000417b: pop %rdx
ffffffff8000417c: pop %rcx
ffffffff8000417d: pop %rbx
ffffffff8000417e: pop %rax
ffffffff8000417f: ud2
ffffffff80004181: int3
ffffffff80004182: int3
ffffffff80004183: int3
ffffffff80004184: int3
ffffffff80004185: int3
ffffffff80004186: int3
ffffffff80004187: int3
ffffffff80004188: int3
ffffffff80004189: int3
ffffffff8000418a: int3
ffffffff8000418b: int3
ffffffff8000418c: int3
ffffffff8000418d: int3
ffffffff8000418e: int3
ffffffff8000418f: int3
wtf
wheres my iretq
fuck i didnt push the rip
my bad
wait no
the sdm states
that the rip should be on the stack wtf
btw here is a slightly unfucked uacpi-rs https://github.com/Qwinci/uacpi-rs
well I didn't add all the functions, mostly it just has eval and reboot/sleep functions
and documented the kernel api https://qwinci.github.io/uacpi-rs/uacpi/kernel_api/trait.KernelApi.html (though its ofc documented within uacpi itself too)
API documentation for the Rust KernelApi trait in crate uacpi.
finally
but still
im trying to figure out my
interrupt handler
why its broken lol
why is rip 0x0
am i doing everything right?
like huh
where does it get to rip 0
when it calls the handler
the page fault handler?
no the exception handler
i dont understasnd why rip is 0
wtf
running it in gdb it solves the problem
it works now?
wtf
how do you trigger the exception
and what specific interrupt number if with the int instruction
int 0xe
asm!("int 0xe");
then your int stub expects an error code to be on the stack no?
ohhhhhhhhhh
so then because int 0xe doesn't push it (because its not a cpu triggered pagefault) the registers aren't saved in the same places
try triggering a real pagefault
eg. with (8usize as *mut i32).write_volatile(0);
well actually looks like you don't take the error code into account in your registers struct or the idt register pushing code at all, it would be between rax and rip if its there (and if its not then you likely want to push a dumb zero to that place)
yea i should
Damn nice, any way u can pr those into the official ™️ repo
yeah ig I can, its missing a lot of the functions rn tho
like the event stuff, namespace node discovery stuff etc
I mean yeah at least it compiles with the latest uacpi
and has some basic eval stuff but to use that you'd have to know the path ofc
Nice
