#Nyaux

1 messages Β· Page 7 of 1

kind root
#

Google hpet spec

thorn bramble
#

very old

#

but i couldn't find anything else lol

thorn bramble
#

you are interested in the main counter register

surreal path
#

my eyes

surreal path
#

thats offset addr + 0x0f0

#

ok

#

acpi_gas?

thorn bramble
#

yes, hpet can technically be used over port io

surreal path
#

what

thorn bramble
#

address is not the address itself

#

its a structure

surreal path
#

oh

thorn bramble
#

that tells you how to address it

#

it contains the address_space_id

#

which you should probably assert that its memory mapped io

#

because fuck you if your hpet isnt memory mapped

surreal path
thorn bramble
#

and then just get the address field from it

#

and use that as the base address

surreal path
#

what is address_space_id

#

what does that mean

thorn bramble
#

LOOK

#

I SENT

surreal path
#

IM READING

#

😭

thorn bramble
#

GOOD

surreal path
#

yea i see its a structure but what is address_space_id supposed to represent

thorn bramble
#
acpi_hpet *hpet = table;
kassert(hpet->address.address_space_id == ACPI_AS_ID_SYS_MEM);
uintptr_t hpet_base_addr = hpet->address.address;```
thorn bramble
#

in which the hpet "operates"

#

i guess

#

it can be port io

#

memory mapped io

#

pci config space

surreal path
#

oh get u

thorn bramble
#

if you read the code you would have realized

#

lol

#

there is literally defines right above that tell you all that

surreal path
#

i may be big stupid

thorn bramble
#

its ok as long as u learn something along the way

surreal path
#

bruh 😠

#

time to do some casting shanngains

#

ok cool

thorn bramble
#

dont forget it should be a volatile uint64_t read

#

also you should try and print the hpet address, make sure it's present and valid

surreal path
surreal path
#

and checked if it is memory mapped io or not

#
HPET BASE IN PHYS: FED00000
HPET MAIN COUNTER RN: 0
#
uint64_t hpet_base = hpet->address.address;
volatile uint64_t poll = *(volatile uint64_t*)(hpet_base + hhdm_request.response->offset + 0x0f0);
    serial_print("HPET MAIN COUNTER RN: ");
    serial_print(itoa(wow, poll));
    serial_print("\n");
    asm("cli"); // disable interrupts
        for (;;)
        {
            asm ("hlt");
        }
#

this is what i do

#

is the main counter register not ticking or somthin?

#

??

rigid fable
#

as other people said already, why don't you implement printf?

#

and then use some trick to redirect either to terminal or "serial" at will

#

like a debug define ifdef

rigid fable
#

and if you pass the base to itoa you can easily print hex, dec and binary or whatever you want

surreal path
#

its not that big of a deal to me even tho i have nanoprintf and i could just use it, i just prefer using itoa like a cursed manic

kind root
#

Read the spec or osdev

surreal path
#

spec says the register is 64 bits

thorn bramble
#

it can be a 32 bit hpet though

#

but i dont remember having issues with qemu

kind root
#

Ye

rigid fable
thorn bramble
#

omg do not halt in this loop

surreal path
thorn bramble
#

wait

#

sorry

rigid fable
#

eh

thorn bramble
#

right he just didnt want it to run out of this function

#

nvm

#

i thought it was supposed to be the busy loop for calibration

surreal path
#

hpet->address.register_bit_width?

#

for checking if the hpet is 32 bit or 64?

kind root
#

No

surreal path
#

oh

kind root
#

Read the wiki page

surreal path
#

doesnt tell me what register bit width is used for

kind root
#

Scroll ffs lol

surreal path
#

oh lmao

#

counter size is right there

kind root
#

Scroll further

#

It tells u the capabilities

surreal path
#

oh

kind root
#

There's also a config register

surreal path
#

yea i see

kind root
#

That u must check

surreal path
#

yea 64 bit

#

and i see that the config register PROBS has the main counter hlt'd rn

#

i will check

#

yea hpet counter is not running

#

its halted

#

i will enable and see

#

WOWIE!!!

#

thats a timer!!!

#

it goes VERY fast btw

#

the main counter

#

lol

kind root
#

Yes

surreal path
#

okay so i have the START of the hpet counter

#

set the lapic timer to divide by 2

#

set the inital count to 0xffffffff

#

do i just do a while loop until lapic timer counter is 0?

thorn bramble
#

no

#

you have to wait for a certain amount of time

#

as i said

surreal path
#

okay how do i do that

thorn bramble
#

use the hpet to figure out if the time has already passed or not

surreal path
thorn bramble
#

lets say you wait for 10ms

#

make the hpet wait for 10ms

#

then you know how many lapic timer ticks are in 10ms

#

lol

surreal path
#

how do u make the hpet wait for 10 ms 😭

thorn bramble
#

read the wiki

#

im sure there is something

kind root
#

Think

#

You have the counter

#

You have the amount of time it takes to increase by 1

thorn bramble
#

the capabilities register tells you how much time passed every time it ticks

surreal path
thorn bramble
#

that is some

#

cursed

kind root
#

Wtf

thorn bramble
#

bit math

#

lmao

#

i dont think that works

#

even if it did it would be wrong

#

shift the register value right by 32 and then mask it

surreal path
thorn bramble
#

no LMAO

surreal path
#

oh wait

#

NO LOL

#

SORRY IM STUPID

#

😭

thorn bramble
#

(x >> 32) & 0xffffffff

#

is what you wanna do

surreal path
#

this better

#

wait no

thorn bramble
#

no

surreal path
#

WHOOPS

#

wrong way

#

okay blablah >> 32 & 0xFFFFFFFF

#

correct?

thorn bramble
#

yes that is what i said

surreal path
#

kk

thorn bramble
#

dont forget the parenthesis

#

parentheses

#

whatever

surreal path
#

TIME PER TICK: 10000000

thorn bramble
#

10ns

surreal path
#

yep

thorn bramble
#

you can use that to measure time now lol

surreal path
#

now im gonna activate the two brain cells in my brain to figure out how to use this galaxybrain

thorn bramble
#

figure out how much you want to wait

surreal path
#

probs 10ms

thorn bramble
#

so you can convert both to nanoseconds

#

1ms is 10000000ns

#

10 * that

surreal path
#

okay

thorn bramble
#

loop while (current hpet - start hpet) * period_in_ns < 10 * that

#

lol

#

congratulations your kernel is now 10ms slower

kind root
#

Tbh if we keep spoonfeeding him like that its not gonna get him very far

thorn bramble
#

true

surreal path
#

let my two brain cells activate

thorn bramble
#

ok i mute thread i go try and understand vmem.pdf

surreal path
kind root
#

And jm gonna sleep

surreal path
thorn bramble
#

good night

kind root
#

Thank you

surreal path
#

npp

#

i figured out how to do it without any help

#

now my kernel can successfully wait 10ms

#

😎

thorn bramble
#

you're waiting 100ms

surreal path
thorn bramble
#

10*10000000

surreal path
#

oh

thorn bramble
#

10(ms)*10000000(10ms in ns)

surreal path
#

☠️

thorn bramble
#

one zero too much

surreal path
#

yes

#

😎

thorn bramble
#

you might want to put a pause in that loop body

thorn bramble
#

or actually you might not

#

might mess with the calibration process on real hw

#

idk how the lapic timer frequency changes with power state changes

surreal path
#

which is VERY weird

thorn bramble
#

what lol

surreal path
#

wait no

#

even without the puase

thorn bramble
#

you probably didn't mask it

surreal path
#
NOT RUNNING ENABLING HPET COUNTER...
TICK!
FINISHED WAITING 10MS

wtf

#

😠

thorn bramble
#

but in that case

#

increase the divisor

#

and fix lapic timer masking lol

surreal path
#

ok fixed masking

#

lol

#

accidentally did wrong bitmask

surreal path
#

also

thorn bramble
#

you had it set to 1???

#

that is way too fast

surreal path
#

now its 2 tho

thorn bramble
#

you should use 4 or 8

surreal path
#

ok sure

thorn bramble
#

also mask is bit 16

#

not 15

#

bit 15 is reserved

#

bits 18..17 are the timer mode (one shot, periodic, tsc deadline)

surreal path
#

how did u know that was the issue

#

is bro in my pc

thorn bramble
#

that it wasnt masked?

#

i remember that you set bit 15 instead of 16

surreal path
#

as in, you knew the exact bitmask mistake i did

#

ohhhh

#

from the pastebin

thorn bramble
#

you sent the code earlier

tawdry mirage
thorn bramble
#

honestly idk, it just feels like it meme

#

i love spreading misinformation

#

but clearly it timed out sometimes, so it is too low

surreal path
#

what is blud on about ☠️

#

anyways

tawdry mirage
#

volatile vs non-volatile

#

why are you marking it volatil

#

e

surreal path
#

think thats correct?

#

does that look correct?

#

this is divide by 4

thorn bramble
#

how would any of us know

surreal path
#

maybe yall have magic eyes 😱

#

idk

thorn bramble
#

try setting up a periodic timer with that interval * 10 or something

#

see if you get an interrupt every 100ms

surreal path
#

alr sure

thorn bramble
#

its pretty easy to eyeball 100ms imho

surreal path
#

YEA IT FEELS LIKE 100ms!

#

!!!!

#

like it feels RIGHT on that dot

#

wowie!

#

lets tick every uhh

#

1 second

surreal path
#

i actually dont know

#

i need a stopwatch lmao

#

yea its doing every second

#

bruh

#

oh i calibrated wrong

#

okay i THINK thats 100ms now

#

okay it is

#

cool trl

#

ok what do i do now that i have a timer trl

#

and a "functioning" apic driver

#

ig

surreal path
tawdry mirage
#

i meant time as a verb but that works too

surreal path
#

wouldnt that be a funny!

tawdry mirage
#

well yeah you probably want to use the timer to drive the scheduler

surreal path
#

okay

#

ill make a kernel thread so i can continue executing whatever kernel init code i still need to do

#

or smthin

#

wait what else do i need again

#

i have an interrupt controller now

#

APIC "driver" (i dont even do anything with the ioapic atm lol)

#

gdt done, idt done, pmm done, vmm done, acpi tables parsed, not starting up other cpus as im not doing smp FOR THE MOMENT, lapic timer setup, i have a scheduler

#

a vfs now?

#

like rn???

#

have i been doing that much already?

#

i can go onto a vfs rn????????

#

what do yall think i should do???

#

cause i dont know where to go next?

thorn bramble
#

make a printf

surreal path
#

bruh

surreal path
#

im gonna make a sleep function using the hpet

#

also gonna implement some functions for uacpi ig

#

difference between stall and sleep is just the format ig?

tawdry mirage
#

stall is supposed to be tighter ig

thorn bramble
#

sleeping might involve rescheduling? idk

tawdry mirage
#

as in, won't potentially take longer

#
void uacpi_kernel_stall(uacpi_u8 usec) {
    auto now = systemClockSource()->currentNanos();
    auto deadline = now + usec * 1000;

    while (systemClockSource()->currentNanos() < deadline);
}

void uacpi_kernel_sleep(uacpi_u64 msec) {
    KernelFiber::asyncBlockCurrent(
        generalTimerEngine()->sleepFor(msec * 1000 * 1000)
    );
}
thorn bramble
#

it might be a long lasting sleep

#

like 30 seconds

#

you dont want to be stuck doing nothing when that happens

surreal path
#

i mean

#

my lapic timer will be ticking every 10ms

#

no matter what so

#

it wont be STUck there

#

but i mean wasted cpu cycles so early reschedule ig?

thorn bramble
#

something like that i guess

surreal path
#

okay made some ksleep function for uacpi and friends

#

that uses the main counter of the hpet

#

to like sleep

kind root
#

sleep -> actually go to sleep, can be up to a second

surreal path
#

spin for very few microseconds

kind root
#

Its at least soo

#

Spin for as little as possible

surreal path
surreal path
kind root
#

That's not sleep

#

That's busy spin

surreal path
#

if thats not sleep

kind root
#

Block the thread

#

Aka it doesn't run at all

surreal path
#

for x ms

#

so i would have to get my scheduler to like

#

block a thread

kind root
#

Yup

surreal path
# kind root Yup

which means checking if the thread has reached its amount of time in ms, assuming a quantum of 10ms (which is what i do), every time the scheduler ticks and switches to the next thread. if the next thread has reached its amount of time its unblocked

#

correct?

kind root
#

Yes

surreal path
#

okay simple then, just store a structure about the thread state. if its blocked the ms its blocked for will be in the structure and stuff

surreal path
# kind root Yes

something like

struct thread_state_t
{
  int state; // 0 - ready, 1 - blocked
  int ms_if_blocked; // ms its blocked for if blocked
}
#

is this correct?

desert haven
#

you may want to store the time to wake the thread

#

rather than than how long its going to sleep for, because then you'd also need to know when it went to sleep

surreal path
#

in what unit

#

??

desert haven
#

your kernel your units

#

milliseconds and nanoseconds are common

#

or use a type to represent time in some unit-less way

surreal path
#

able to be unblocked or not

#

correct r4?

desert haven
#

there's no single correct way to do this, but this is one way that will work πŸ™‚

surreal path
#

i just wanna make sure im doing it in like a way that isnt stupid 😭

desert haven
#

haha yeah fair, nah this sounds fine

surreal path
#

will use hpet counter (again) to get the current time in ns, im just gonna use hpet counter for everything 😎

#

man i love the hpet

#

so easy

#

didnt even have to touch the yucky pic

surreal path
#

?

surreal path
#

im unsure if thats correct, ALSO i wanna like make a ps2 keyboard driver or smthin. im guessing i need to read the madt for the ISOs. and then configure the ioapic

shut laurel
surreal path
#

wanna make a ps2 keyboard driver of some kind

#

i believe irq 1 is the ps2 keyboard

#

should be gsi 1

#

cause i think ioapic has the legacy irqs identity mapped unless otherwise specified in a interrupt source override?

#

guessing im gonna need to keep track of the irqs?

#

like a table

#

or smthin?

#

how should i do this?

shut laurel
#

Like you want to

surreal path
thorn bramble
#

i mean that's what programming is all about

#

lol

surreal path
#

lol

#

I THINK THE FIRST THING ILL DO IS

#

MAKE A PRINTF

#

😱

thorn bramble
#

what did i tell you

#

bro finally taking advice

surreal path
surreal path
#

😱

#

GUYS THIS IS A BIG ACHIEVEMENT

#

WOWIE !

#

PRINTF????

#

NO MORE CURSED ITOA??

#

isnt that crazy !

#

now yall cant mock this os anymore for not having printf cause we finally have a kprintf 😀

tawdry mirage
#

i assume you're using nanoprintf for it?

surreal path
tawdry mirage
#

good, i don't want to think what a hand-written nyaux printf would look like halfmemeright

surreal path
#

uhhhhhh

#

o yeah i wanted to start ACTUALLY setting up the ioapic

#

which is lit not rlly much all i rlly need to do is create a kind of global struct that shows which irq goes to which gsi, initing using the interrupt source overrides, then whenever i want to install a irq handler for that i just lookup this struct table thingy to get the gsi and shit

#

i think thats how im gonna design it

ionic jetty
#

You could just directly read the ISO too

#

I dont think it’s necessary to have a seperate table for it

surreal path
#

its fineee

surreal path
ionic jetty
#

Just keep a pointer to the iso

#

Instead of rescanning

surreal path
ionic jetty
#

Yeah

#

You can make the table too for sure it just seems unnecessary

#

Whats the general outline of your todo list atm

#

What will be the next things you implement

#

(Btw, I think you have the most comments on any thread πŸ˜‚)

surreal path
#

😭

finite summit
#

Mintia

#

still has more

#

(not for long)

ionic jetty
#

Oh yeah I see

#

400 msgs to go

surreal path
ionic jetty
#

Thats a good one yeah

surreal path
#

they said vfs next

#

so maybe after the ps2 kbd driver i will learn what the fuck a vfs is and how to implement one

#

unless yall got better suggestions on what to do next

ionic jetty
#

Bro wtf

void kthread_poop(){}

#

Why

surreal path
#

😭

ionic jetty
#

There are like 20 poop related names

#

In these two functions

#

Youre a psycho

surreal path
#

😰

ionic jetty
#

You cannot be calling your function poopXYangr

surreal path
#

im GUESSING that after i init everything, there is no need for a kthread at all or smthin. we just start scheduling and executing processes and then when we syscall thats the only time we go back to the kernel (or if its from an interrupt like a irq handler or smthin)

surreal path
#

think this is correct

#

also just fixed some scheduler bugs

unkempt relic
#

you can see the kernel as being like a library that coexists in every process

#

and the usual pattern on most kernels is that most threads are in userspace and only make occasional excursions into the kernel

#

interrupts make a slight mess of this analogy but still

surreal path
unkempt relic
#

but that's the general principle usually

surreal path
unkempt relic
surreal path
#

been fixing some of my scheduler code

#

now happening via the lapic timer

#

😎

#

each thread has a quantum of 10ms cause yea

#

works rlly well

#

currently my scheduler is just some simple round robin thing

#

each thread holds a pointer to the next, if theres no next go back to start of queue

#

that sort of thing

#

currently my scheduler treats everything as a separate thread

#

which was okay but i probs need to change that now for user mode soon

#

or actually

#

not

#

i should treat everything as separate threads

#

if for some use case i wanted to find what threads belonged to which "processes", i can simply store a process id in each thread

#

anyways im actually gonna make a proper kpanic

#

to make debugging easier

#

print out every register and everything instead of just printing the rip

#

then ill work on the ps2 driver

surreal path
#

😎

#

thats a lot of gsis

#

is that common?

#

for an ioapic to handle that many gsis or smth

#

i think so

tawdry mirage
#

not really

#

usually it's 24 or 32 pins

surreal path
tawdry mirage
#

run info ioapic

surreal path
#

kk

tawdry mirage
#

er sorry, info pic

surreal path
#

umm

tawdry mirage
#

24 pin

#

s

surreal path
#

seems like smthin weird is going on

#

then

tawdry mirage
#

how are you getting the number of pins

surreal path
#

reading the ioapic version register

tawdry mirage
#

what does | 0xff do

surreal path
surreal path
#

☠️

#

WHOOPS

#

should've been and

#

okay cool 😎

#

one thing im rlly getting annoyed at is how long it takes for the pmm to init

#

yea i get it, im storing a freelist node into every fkn page

#

thats gonna take cycles

#

but comeon

#

it takes a whole 3 seconds

#

3-6

#

for a 3G

#

idk how to make this faster

#

not rlly much i can do

cinder plinth
#

here's what I do

#

works just fine

#

I do a freelist on a per-region basis

#

instead of every page

surreal path
cinder plinth
#

no

#

how

surreal path
#

wait no

#

nvm

cinder plinth
#

allocation is as easy

surreal path
#

pmm is integrated too deep with the kernel for me to change it, so if i want to do a pmm region freelist kinda thing, i cant rlly cause it'd take too long to refactor everything

#

but i can see how that would be better overrall

#

wish i had did that πŸ˜”

surreal path
#

also why region + region->size?

cinder plinth
tawdry mirage
# cinder plinth

does add_region merge adjecent free regions or will you eventually end up with only 1 page long regions

cinder plinth
#

it just adds it to the freelist

#

so the latter yes

surreal path
#

yea eventually it'd just be

#

1 page regions

#

thats an issue

cinder plinth
#

not from a functionality standpoint

#

actually not even from a performance standpoint

#

doesnt matter at all

#

just means the head switches more often

surreal path
#

okay well it does at least solve the boot time problem, maybe once i finish this ioapic stuff and before i do a vfs ill refactor my pmm to be like this

#

cause i really hate waiting 3 seconds everytime i boot a nyaux vm under qemu

cinder plinth
#

3 seconds even with kvm?

#

that's slow as balls

surreal path
#

yea

surreal path
#

vm with 3G

cinder plinth
#

should be faster on kvm

finite summit
#

does Nyaux work on real hardware in any way?

#

or is that untested

surreal path
#

actually

#

rn

tawdry mirage
surreal path
surreal path
#

everything else is speed tho

surreal path
#

and try writing the iso to it

finite summit
#

make sure you use the right drive

#

triple check

surreal path
finite summit
#

I've accidentally wiped my sda drive while trying to dd too many times

surreal path
#

ok gonna try booting it

#

brb

#

It’s hanging at vmm init

#

this is why I needed to make a kpanic function

#

I’m gonna try and get nyaux to run real hardware

#

most likely hanged somewhere here

#

probs page faulted cause

#

my display is 1440p

#

and the background is a 1080p file

#

yea thats most likely the reason

#

i need to somehow "resize it"

#

to fit whatever framebuffer

#

i have no idea how to do that lmao

kind root
#

You cant

surreal path
#

at all?

kind root
#

Write a graphics driver

surreal path
#

bruh

#

☠️

tawdry mirage
#

just don't set a background image 4head

surreal path
#

but it looks nice !

#

i need a splash image!!!

#

!!!!!

#

what if i just made a really big res image

#

would there be a way to downsize it

#

or no

tawdry mirage
#

also i'm pretty sure flanterm will just pad the image with black on all the sides if it's too small?

surreal path
#

it doesnt

#

sadly

#

wish it did

kind root
surreal path
kind root
#

On useless stuff

surreal path
#

yea fair

#

lemme at least see if nyaux can run on real hardware

#

tho

#

at the very least

#

ill disable splash images

kind root
wicked loom
tawdry mirage
#

ah my bad

wicked loom
#

Limine otoh does it, the thing of adding a backdrop

#

but that's Limine, not flanterm

kind root
wicked loom
#

the user is kind of expected to do all paddings, stretching, shrinking, whatever, on the canvas before passing it to flanterm

#

if you want fancy stuff like this you're probably going to have better luck using ilobilo's port

#

of the Limine logic that does this, to be freestanding

surreal path
#

i think i just dd'd my drive....

finite summit
#

I told ya

surreal path
#

like bro

#

I thought I typed /dev/sda

finite summit
#

you at least had the code committed and pushed, right?

surreal path
#

yea

#

Thankfully

finite summit
#

now it's time for you to reinstall gentoo

surreal path
surreal path
#

no wait i got it working

#

i didnt dd i just

#

messed up my boot partition

#

fixed now

#

😎

#

anyways nyaux page faults here on real hardware for some reason?

#

that is so weird

#

im gonna make a stack trace

#

thing

#

for debugging

#

so i can figure this out more

#

cant gdb step real hardware ☠️

tawdry mirage
#

if you have special equipment you can debug real hardware :^)

surreal path
#

now we have a nice stack trace

surreal path
#

all i need is me and my stack trace

#

😎 😎

surreal path
#

this isnt a pro gamer address

#

wrong image

#

uhhhh oh right i know why

#

no still

#

my brain

#

πŸ’₯

#

is gone

#

i dont think thats a valid rbp

#

to be fair

#

or maybe it is

tawdry mirage
#

did you pass -fno-omit-frame-pointer to the compiler

surreal path
#

Ok got the stack trace to work

#

Gonna debug this now

#

So I can figure out why it’s doing that on real hardware

#

okay so line 1040 its faulting

#

at this line

#

why hmmmm

surreal path
surreal path
#

seems like hardware doesnt play well with uhhh printing to serial cause anytime i do a printf using serial it page faults?

#

if i printf with flanterm ctx

#

it works fine

#

on real hardware

#

(i think)

#

ill test that rq

#

Very interesting

#

why does my pc not like this thing

#

it hates it for some reason

#

it page faults with this macro enabled

#

if i dont have the macro enabled some of the printfs look weird

#

this thing off

#

lemme see if the real hardware boots with it off at leasttt

#

doesnt boot even with it off

#

still faulting

#

faulting here

#

when it calls uacpi_error

#

its doing it whenever copying the string, most likely unknown_path is something funky

#

whatever uacpi has set absolute path to

#

its doing smthin funky

#

i believe this is more an issue with uacpi itself

#

probs doesnt work well with my hardware (this laptop is pretty difficult to support, even for linux)

surreal path
#

if someone can try and run nyaux os on their hardware

#

that would be greatly appreciated

desert haven
#

im just going to say that its unlikely uacpi or nanoprintf that are the real cause of the bugs here

#

for npf you at least only have so many inputs to worry about

desert haven
kind root
#

Run managarm on that hardware

#

If it boots its your skill issue

surreal path
surreal path
surreal path
#

That’s different to debug

surreal path
#

Tf is going on

kind root
#

who knows, a lot of things about your kernel could be broken

surreal path
#

it’s only happening on real hardware and ONLY whenever uacpi tries to print or smth

kind root
#

and

surreal path
#

I’ll disable tracing and see if it solves

kind root
#

this just means the bug is not reproducable on the simple blob that qemu provides

#

dump the blob with acpidump -b and feed to the ./test_runner <blob>

#

or just run managarm

surreal path
#

Alr

kind root
#

last successful build from yesterday

surreal path
#

downloading

#

this my dsdt.dat (if u can feed it into test runner on ur system that would be quite epic gamer)

#

im gonna reboot into managarm and test

surreal path
kind root
#

-acpitable file=...

surreal path
#

ill try feeding it to nyaux

surreal path
kind root
#

yeah

surreal path
#

kk

kind root
#

but i doubt it will work

#

because its called DSDT

#

rename it to SSDT at least

surreal path
#

what difference does it make?

kind root
#

DSDT is only one and is pointed to by FADT

#

SSDTs are infinite amount

#

also it wont necessarily work and might crash qemu because it does arbitrary MMIO

#

that is not present in qemu chipset

surreal path
#

"too big"

kind root
#

thats not what i meant by rename

#

bruh

surreal path
#

oh

kind root
#

it has a hex header

surreal path
kind root
#

yeah i guess nothing u can do there

#

but idk why thats the limit in qemu

surreal path
#

how tf am i supposed to actually debug this then nooo

kind root
#

just like everything else

#

use print statements

#

track down where it goes wrong

surreal path
kind root
#

why does it take long?

#

dont u have a script to produce an iso?

surreal path
#

yea but i have to reflash the usb everytime with dd and reset the partition

#

and it takes forever to reboot

kind root
#

why reset the partition

#

just dd is enough

surreal path
#

im gonna dd managarm's image.xz and try it

kind root
#

image.xz is xz compressed

#

decompress it

surreal path
#

time to emerge another program!

#

man i love using gentoo!!!!

#

...

kind root
#

wtf

tawdry mirage
surreal path
#

fkn hell

surreal path
#

gentoo crys

tawdry mirage
surreal path
#

yea genbyebye fuck this im switching distros

tawdry mirage
#

i think thats what it was called

kind root
#

its called

#

windows 11

surreal path
#

no

#

why

#

ew

kind root
surreal path
#

i think i will switch tooooooo arch or smthin

surreal path
#

ok on arch now

#

so now no more issues

#

time to flash managarm

surreal path
wicked loom
#

just use arch lmao

surreal path
#

fuck gentoo

#

all my homies hate gentoo

#

😀

wicked loom
#

fr ong

surreal path
#

!!!!

#

😀 😀

#

anyways gonna boot into managarm and see how it fairs with my hardware, i just hope it also page faults so i know its an issue with my hardware and NOT with the kernel 😀

#

Managarm panics on my hardware too

#

It’s 10000% a hardware issue

#

To verify if this is correct can someone test nyaux on their hardware

#

If no blue screen it’s def this laptop being so weird

#

anyone got the time to do so?

#

please??

#

i have no other device on my other then this laptop 😭

thorn bramble
surreal path
#

also i dont think managarm has uacpi tracing everything

thorn bramble
#

no but it prints the basic stuff

#

just do the same

surreal path
#

yea and i have mine to tracing everything

thorn bramble
#

disable trace logs

surreal path
#

so thats most likely the issue

surreal path
thorn bramble
#

it could be your allocator being shit, you running out of stack, you not mapping things correctly

#

many things to consider

surreal path
#
  • already had my oberrow hell
thorn bramble
#

the real hardware has a much more advanced aml to parse

#

than the one in qemu

#

parse + execute, sorry

surreal path
#

yea but heres the thing

#

in this stack trace

#

one second

#

im gonna get addr2line

#

just lemme fix my compiler (cause this is a new system)

thorn bramble
#

where is the cr2

surreal path
#

oh yeah i probs should print cr2

#

fair

thorn bramble
#

lol

surreal path
#

lol

thorn bramble
#

lmao

surreal path
thorn bramble
#

and print more registers

#

all that you can

surreal path
#

im gonna try 2 things

#

im gonna disable uacpi tracing full

#

and im gonna

#

print out the cr2 in the page fault

#

if that still happens

kind root
kind root
#

This is just some userspace driver bug

thorn bramble
#

also your dsdt works fine in the userspace runner

kind root
#

Both userspace and real hw apparently

surreal path
#

if this is another allocator issue i swear

#

at least be an issue with printf or smthin simple and not my allocator

kind root
#

Could be anything

surreal path
#

okay my page fault screen prints cr2 now

#

how do i make the stack trace print the line number and c file name of the faulting instruction

#

i know some stack traces do that

#

would make it 1 billion times easier to debug real hardware

kind root
#

Write a dwarf parser

surreal path
#

dwarf parser?

kind root
#

Elf debug info format

surreal path
#

is that difficult to implement, a dwarf parser?

#

or is it worth using a freestanding library for that

#

?

surreal path
surreal path
#

okay this is difficult to get working

#

this damn libdwarf shi

#

ugh all i wanna do is just get the functions names from the instruction pointer, like addr2line does

rigid fable
# surreal path

unless that is also part of the dwalf parser, add a sinple disassembler library to have a disassembly on the panic screen

#

and write out all the general purpose registers

rigid fable
# surreal path

here you probably made two screnshots one afyer eachother, since you can still see the transation effect

surreal path
#

im doing something very cursed but i have an idea thanks to this perl script i found

#

in #resources

#

well not rlly surprised

#

time to keep working on that linker script !!!! even tho i never write linker scripts and have zero idea what im doing !!!!

#

now that doesnt look very epic gamer thonk

#

looking fresh

#

LOOKOKKKK

#

OH MY GOD

#

THIS IS BIG BRAIN

kind root
#

are you using libdwarf or?

finite summit
kind root
#

wtf

surreal path
kind root
#

this won't tell u the line number

surreal path
#

i no need

kind root
#

only the function and byte offset

surreal path
#

im too dumb to get libdwarf working anyway

thorn bramble
thorn bramble
#

use the rodata phdr

surreal path
#

i removed it anyway after figuring out that was dumb

surreal path
thorn bramble
#

good

surreal path
#

this is very cursed what im doing

#

seems to be working well tho

kind root
#

bro never heard of binary search

surreal path
#

i havent

#

the problem is that the rip is pointing the the line number not the beginning of the function

finite summit
#

This post has more than mintia

#

*more messages

surreal path
#

wow

#

tf

#

...

finite summit
#

it's because you spam it

surreal path
#

i mean to be fair i kinda do

finite summit
#

pretty sure there's 1000 messages per one thing you implement

surreal path
#

yea hey at least i implement things !

#

at least im understanding what im doing, instead of not understanding and just copying code or smthin like i used to do back in 2020 when i was stupid

ionic jetty
#

and i thought omars thread was active

#

this is on a whole other level

surreal path
#

im not doing this, this is a waste of time

#

for the time i've been spending trying to get debugging symbols

#

i probs would have just fixed the issue happening

#

πŸ’€

#

and what i was doing was rlly cursed and dumb

#

boohoo i have to restart

#

so what

#

okay first part of stack trace is this line

#

second is this?

#

uh huh

#

next part

#

very weird

surreal path
surreal path
# surreal path

when trying to put the absolute path thing into the string

#

cr2 is 0 when this happens

#

okay so absolute path is never init'd to something so its not pointing to anywhere

#

when uacpi_error tries to print out absolute_path

#

it faults because absolute_path doesnt point to anywhere at all

#

and this is VERY weird cause clearly <unknown> is there

surreal path
kind root
#

this is unrelated to aml or uacpi

#

its a bug in your code

#

corrupting something into oblivion

surreal path
#

with the memory is that what ur saying

kind root
#

yeah, even the fact that this gets called

surreal path
#

okay

kind root
#

could be your kernel_api impl fucking something up

surreal path
kind root
#

how would this be affected by anything

surreal path
#

is there any emulators that have large blobs or anything for uacpi to parse or is their absolutely NOTHING i can do

#

?

kind root
#

try vmware

#

or vbox

surreal path
#

i actually dont know what to fucking do anymore, i stepped through vbox trying to figure it out but i just couldnt

#

why is my allocator always the problem, why is my code always shitty why cant i just write good fucking code for once in my life

wicked loom
finite summit
#

You can write the code that's simple

#

while I do all the work

kind root
#

It doesn't have that

surreal path
#

It’s my fucking allocator as always

#

my allocator isn’t even that complex yet it ALWAYS has bugs

#

I just

wicked loom
kind root
#

Maybe its not

surreal path
#

It is

#

What else would be the problem

wicked loom
#

mb

thorn bramble
#

replace it with a bump

wicked loom
#

yeah do that

#

that's a good idea

kind root
#

^

surreal path
thorn bramble
#

alloc(size):
result = base
base += size
return result

wicked loom
#

yeah it's stupid simple

thorn bramble
#

align size to 8 beforehand tho or smth

#

so you dont hand out unaligned pointers

#

free doesnt exist

#

or well, if ptr + size == base then base = ptr, else you cant free meme

#

but there is no point in implementing free for bump

finite summit
#

Mine was posted around august of 2023 I believe

#

and has 6300 messages

thorn bramble
#

hes just really invested halfmemeright

finite summit
#

I've also put progress in that thread for my kernel over all rewrites but the first

surreal path
#

It makes me really happy seeing me do things like creating a kernel and seeing it actually work

#

brings me a lot of joy

#

I don’t rlly have a life outside of school lmao

#

I hope people can look over this thread one day and perhaps learn from my mistakes and from all the great advice everyone here has given to make nyaux actually possible

#

for their os

wicked loom
#

the grinder

surreal path
#

Yep! 😎πŸ’ͺπŸ”₯

worldly condor
#

ok