#Nyaux

1 messages · Page 30 of 1

edgy pilot
#

inshallah we shall make having a girfriend halal

finite summit
#

huh

edgy pilot
#

-# ||(ˢᵒʳʳʸ)||

elder shoal
#

real osdevs dont have partners

#

for they are mere distractions from the road to success

finite summit
worldly condor
#

real men have no partners

finite summit
#

is this some sorta sigma alpha male bs

#

If you want to be rich, women will only slow you down.
Invest many monies into my company called "BigScamDepressedLosers"

elder shoal
finite summit
#

you did, or infy did?

elder shoal
elder shoal
finite summit
#

soruce-recipes/libtool: fix build

elder shoal
#

it was a jinx script but it was code halfmemeright

worldly condor
elder shoal
finite summit
#

I should add working set and swap to astral

elder shoal
#

nah I wanna tackle that myself some day

finite summit
#

someday, aka never
Mathewnd's routine:

  • wake up
  • factorio
  • go to work
  • factorio (with a side of work)
  • go back home
  • factorio
  • sleep
  • repeat
elder shoal
elder shoal
finite summit
#

where are you right now?

#

the facotyyry must grow

#

?

elder shoal
#

my friend just told me to hop on factorio so yes

finite summit
finite summit
#

(right??)

elder shoal
#

though my physical location is right behind you

#

in your blind spot

finite summit
#

holy

#

SEND HELP

#

ETGHE

#

I live at 123 seasme street

#

someone broke in

#

/j

#

or at least, I hope is a joke

surreal path
#

isnt it not in the quran tbf

#

oh yeah btw i think i figured out the issue with isr_stub 32

#

so

#

😎

finite summit
surreal path
surreal path
#

why arent any of the other lapic timers firing

#

tf????

#

and get lapic id clearly works because well

#

it worked fine in the print logs

#

but when used in an interrupt

#

it shits itself

#

huh?

#

like wtfff

#

anyone know whats going on?

silver yarrow
#

prolly need more context

edgy pilot
surreal path
#

this is what the schedule function looks like

#
void *sched(struct StackFrame *frame) {
  kprintf("CPU %d Says: MY LAPIC TICKED HAHAHAHA\n", get_lapic_id());
  send_eoi();
  return frame;
}
#
void bootstrap(struct limine_smp_info *info) {
  kprintf("bootstrap(): Hello from CPU %d\n", get_lapic_id());
  init_gdt();
  init_idt();
  per_cpu_vmm_init();
  init_lapic();
  hcf();
}
void init_smp() {
  for (uint64_t i = 0; i < smp_request.response->cpu_count; i++) {
    struct limine_smp_info *cpu = smp_request.response->cpus[i];
    cpu->goto_address = bootstrap;
    kprintf("init_smp(): Found CPU %d\n", cpu->lapic_id);
  }
  // stall_with_hpetclk(100);
  // init_lapic();
}
#

nothing gets printed on the other cpus

#

only the bootstrap cpu has it tick???

#

its the exact same function

#

to which i read the msr

#

to get the lapic address per cpu

#

sti is run on all cpus

#

????

#

😭 ???

surreal path
#

everythings on github btw

silver yarrow
#

you might want to invest some time into organization

surreal path
#

huh?

#

whats that

#

also i still cannot figure this out

silver yarrow
#

I gave up trying to figure out what parts of ur code did

flat nymph
#

What do you do with stall_with_hpetclk()?

#

And why?

silver yarrow
#

all the hardcoded & unannotated constants make it very hard to follow without pulling up the spec side by side

flat nymph
#

Oh it's calibration for 10 ms

#

But why...

#

All APICs should in theory work at the same frequency

thorn bramble
#

especially without messing with power management they do + inside qemu

surreal path
#

either way

#

dont get why only ONE lapic

#

wants to work

flat nymph
#

What are you doing with hpet?

surreal path
#

calibration for 10 ms

#

i prefer to use the hpet

#

as its easy

flat nymph
#

How are you doing it I mean

surreal path
#

wdym

flat nymph
#

Do you just look at how much time has elapsed?

surreal path
#

mhm

flat nymph
#

If you're programming it from several cores at the same time it might be a race condition

surreal path
#

no cause

#

im just reading the hpet main counter\

#

im not messing anything else

surreal path
#

ik

flat nymph
#

Idk

#

I've had problems with periodic mode a long time ago

surreal path
#

either way this isnt the issue

flat nymph
#

And just gave up and used one shot for everything

surreal path
#

currently

#

just the damn other cores hate me

#

😡

flat nymph
#

Code quality issues spun

surreal path
#

NO

#

growls at you

surreal path
flat nymph
#

If it isn't working then you're probably not doing it right though

surreal path
#

SOOOO

#

it works PARTIALLY???

#

like

#

huh

#

it should work on all cores

flat nymph
#

Doesn't have to?

surreal path
#

i mean its the exact same code lol

flat nymph
#

If you're forgetting to initialize something

surreal path
#

in this case what would i have to initialize, lapic should work out of the box right???

#

js set the vectors and plug in play

#

RIGHT????

#

yeah im debugging this tmrw i need sleep

#

if i cant debug this, ill ask the osdev forums if i cannot figure it out but im sure ill figure it out

#

like im not stupid lmao

#

probs js overlooking something

#

also @silver yarrow maybe ur right about organizing the code

#

i might js comment anything

#

everything*

#

yeah it shows that the code quality sucks but

#

im not rewriting the entire codebase

#

again

#

im js gonna comment things that dont make sense at first glance

flat nymph
surreal path
# flat nymph

wait is the default behavior for the other cores to have the local apic disabled?

flat nymph
#

Idk I don't remember

surreal path
#

*software disabled

flat nymph
#

But I'm setting this bit explicitly

surreal path
#

yeah

flat nymph
#

(call enable_apic() per core)

#

And it seems to have more steps than you

surreal path
#

too lazy to open the SDM

#

rn

#

well not but my ram is like

#

90%

flat nymph
#

Then there's this

surreal path
#

oh bit 11

#

thanks

flat nymph
#

This is what osdev wiki says

surreal path
#

@flat nymph still the same issue

flat nymph
#

Idk

surreal path
#

*sur_interrupt = 34 | (*sur_interrupt & ~0xFF) |
(1 << 11);

flat nymph
#

I was planning to be sleeping one hour ago

surreal path
#

bro sleep

#

😭

#

@flat nymph

#

go to sleep.

#

now.

flat nymph
#

Bit 8

#

Bit 11 is the MSR

surreal path
#

ohhh

#

why'd u give me the msr version 😭

#

i dont use xapic

flat nymph
#

But I'd suppose it would be set

surreal path
#

of

#

or

#

x2apic

flat nymph
#

LAPIC base?

surreal path
#

how do i get my lapic base?

#

reading the msr

#

its solved

#

@flat nymph

#

thank you

flat nymph
surreal path
#

but i use the sur register instead

#

also

#

look guys

surreal path
flat nymph
#

Yeah

surreal path
#

pin this

#

chat

#

this is really cool

#

proper multicore

#

PROPER

#

i didnt get this working on other nyaux rewrites i think

#

so

#

this is rlly cool

kind root
#

Congrats

surreal path
#

hi chat

#

im sorry i got caught up with appointments yesterday

silver yarrow
#

You don't need to apologize, there are no expectations

surreal path
silver yarrow
#

You got all the time in the world 😃

surreal path
#

still caught up with irl stuff

#

we gonna get some work done later today

#

dw

surreal path
#

hi chat my bad, still stuff going on nooo

surreal path
#

GUESS WAHT

#

CHAT

#

ITS TIME

#

okay so

#

we need to

#

how would i like

#

seperate different archictures

#

would i have an arch_init?

#

function

surreal path
#

and some macros to check which architecture it is

cinder plinth
#

that calls into main

surreal path
#

wdym?

surreal path
cinder plinth
#

how is that confusing

#

you have one seperate entry point for every architecture

surreal path
#

oh

#

yea that makes sense

#

but if u booted on lets say an arm archiecture somehow via limine right

#

and i just went into entry point

#

do i check the cpu archiecture?

#

then call into that per architecture entry?

#

@cinder plinth

cinder plinth
#

no

#

the entry point is your architecture specific code

surreal path
#

yea but this entry point is gonna be the entry point all cpus will go into tho..

cinder plinth
#

so?

#

you need a per-cpu initialization anyway

surreal path
#
void entryallcpusgointo() {
  // wtf do i do?
  #ifdef __x86_64__
  // do stuff here
  #else ifdef yadada
  // do stuff here
  #endif
}
#

something like this?

#

@cinder plinth

cinder plinth
#

no

#

use your build system

#

have a per-architecture entry file

surreal path
#

i use make

#

files

cinder plinth
#

should be easy then

surreal path
#

😭 😭

#

im just gonna have an arch_init() function in main

#

and do my shit yada

#

hi fadanoid!!!

#

nice to see you lurking nyaux's thread

#

lol

surreal path
#

okay im working on it

kind root
#

Update uacpi for new fun printouts

surreal path
#

i dont know if its properly updated

#

but the kernel api looks the same to yk

kind root
#

Does it print out the installed tables

surreal path
#

i didnt even run it 😭

kind root
#

Run it then

surreal path
#

i still have to make a generic abstraction

#

for the arch

#
// heres what im thinking
void output_to_port(uint64_t data, uint8_t bit_width) {
#if defined(__x86_64__)
  // check for the correct instruction for the bit width
  outb()
#else defined(riscv or whatever tf)
  // idfk there instructions
#endif
}
kind root
#

Substitute x86 with current arch

#

Have x86 main call generic_main once its done with arch stuff

surreal path
#

i already figured out an abstraction

#

so im doing that currently

#

okay nearly done

#

i just need to make the generic interface now

#

fixed all the errors

molten grotto
surreal path
cinder plinth
#

you only use port io in x86 code

molten grotto
#

^

cinder plinth
#

or you have some linux iomem kind of thing

surreal path
#

what do u do on other archiectures

kind root
surreal path
cinder plinth
#

you use mmio maybe?

kind root
#

Yes its not port io but same abstraction applies

cinder plinth
#

idk arm

surreal path
#

okay then

#

ill do mmio in this function otherwise

#

if its another archiecture

#

idfk arm either

cinder plinth
#

Macros can get messy

surreal path
#

its fine

cinder plinth
#

Just implement it in an arch file

surreal path
#

ima take a break for 2 hours

#

cause im tired

#

so im gonna nap a little bit

#

maybe eat

#

cause i havent eaten yet lol

flat nymph
surreal path
#

my

#

god

#

after seperating the archiecture through an abstraction

#

this happens?

#

wth

#

null deref anyway

#

seems to be happening here

#

but its going so fast

#

i cannout

#

find it

#

the root cause

#

oh right

#

im stupid

#

@kind root wheres the cool tables u promised

#

beautiful isnt it

edgy pilot
#

the ops per second thingie

surreal path
#

idk

plush hearth
#

I remember having issues in the past related to that

surreal path
plush hearth
#

i remember having to go into the directory and do git pull

kind root
#

hes just still on old revision

surreal path
#

damn

plush hearth
surreal path
#

theres no .git in uacpi?

#

tf

plush hearth
#

empty the directory and reclone it?

surreal path
#

yep

#

time to do that

#

fun

finite summit
#

*booy

surreal path
#

how tf do i get that

finite summit
#

**boot

finite summit
#

For uacpi

#

You just ask your timekeeper for that

surreal path
#

ill js give it whatever the hpet main counter is

#

🤷

plush hearth
#

HPET counter is femtoseconds iirc

surreal path
#

ik

finite summit
#

Afaik

finite summit
#

Ops/s counter

#

Which is the only reason why you are implementing it

surreal path
finite summit
#

Kk

plush hearth
#

is the hpet main counter time since boot or could it have been reset?

surreal path
#

actually i cant

#

cause i use uacpi to scan for the table

plush hearth
#

iirc it maps them in uacpi_init

surreal path
plush hearth
#

so you just have to init uacpi in 2 stages

cinder plinth
#

i think

#

or else just use limine's time at boot feature

#

nah not really that isnt good for timekeeping

surreal path
#

to turn fentoseconds into nanoseconds

#

whats the math again

#

i forgot

edgy pilot
kind root
#

they dont have to be literally since boot lol

#

its just a growing nanosecond counter

surreal path
#

yea this is wrong

#

ME WHEN I CANT GET MATH RIGHT

#

😭

#

hpet counter ticks every 10 nanoseconds

#

i have no fucking idea how to convert the counter to nanoseconds ughhhhh

edgy pilot
#

if a single tick is 10 nanoseconds just ticks * 10

surreal path
#

okay so its ticks * ctr_clock_period

#

yet doing that...

#

nvm this is right

edgy pilot
#

12114 ms isn't right

surreal path
#

yeahhh

#

idk why

#

this is correct

kind root
#

maybe thats how long it takes in nyaux

surreal path
#

💀

kind root
#

does it take 12 seconds to boot?

surreal path
#

it did not take 12 seconds

#

more like

#

OH

#

FROM BOOT?

kind root
#

no

#

just that part of uacpi init

surreal path
#

yeah it did take 12 seconds

#

nvm

#

its right

#

💀

#

im running tcg tho

#

tbf

kind root
#

astral gets 40k on TCG

#

how are u two orders of magnitude behind

surreal path
#

idk 😭

#

nested virtualization maybe?

#

im running via wsl

#

wait no that wouldnt

#

nvm

#

idk

kind root
#

bruh

surreal path
#

i mean nyaux has always been slow

#

so eh

#

idrc computers are fast nowadays

#

it runs very fast on kvm/native hardware

edgy pilot
#

this is a little trick for converting ticks to nanoseconds without overflowing that qookie taught me

u64 freq = 10^15 / clk
u64 p = log2(freq)
u64 n = (1'000'000'000ull << p) / freq

// when reading the timer
u64 nanos = (u128(ticks) * n) >> p
surreal path
#

anyways changes pushed ima sleep now

#

night night

kind root
#

did u see the table printout at least?

surreal path
#

mhm

kind root
#

thoughts?

surreal path
#

love it

kind root
#

thanks

surreal path
#

np

kind root
#

good night

surreal path
#

goodnight

surreal path
#

good morning chat

#

so

#

i did some changes and now smp also works with the archiecture abstraction

#

now whats next is well

#

the scheduler itself

#

but we encounter a problem

#

we need a stackframe and different archiectures have different stackframes

#

how exactly do we

#

abstract that

orchid dawn
#
#ifdef ARCH_X86_64
typedef struct {
  /* stuff */
} stackframe;
#elif ARCH_ARM64
typedef struct {
  /* other stuff */
} stackframe;
#elif ARCH_RISCV
/*[etc.....]*/
#endif
plush hearth
surreal path
plush hearth
#

I didn't think it was morning there

#

Isn't it like 10:30pm?

surreal path
#

9:28pm

edgy pilot
#

good morning

plush hearth
#

Ah ok. I'm only asking because its 7:28am here in Australia, so you confused me

surreal path
#

😭

finite summit
#

Good evening

surreal path
#

good evening

surreal path
#

hi chat, no work for today BECAUSE AT 12AM TODAY THERES A RUMOR HALF LIFE 3 WILL BE ANNOUNCED?

#

ive been waiting all day

#

i need

#

this is a need not a want

elder shoal
#

If it gets announced I will write a driver for nyaux

cinder plinth
#

if it gets announced I will write a gpu driver

surreal path
steady flume
#

lol it's 10AM for me

finite summit
#

It's 4 56 pm here

plush hearth
#

It's 8:08am for me

kind root
#

here goes every timezone

cinder plinth
#

it's 25:03 here

elder shoal
#

nothing ever happens

surreal path
#

u were right!!

tender gorge
#

At least Helldivers 2 update is very good

surreal path
tender gorge
#

And the new IP that was announced at the very end also looks sick

#

But still

#

No half life 3

surreal path
tender gorge
#

And no valve deckard

#

🥺

surreal path
#

😔 😔

#

idk what valve is doing chat

#

they setting on they lazy butts

#

just

#

ranking in steam money

kind root
#

they dont have to do anything at this point

#

its just passive money generation

tender gorge
#

Lord gaben knows what is best for us

surreal path
tender gorge
#
    Who art in Valve, Hallowed by thy name.
    Thy Half-Life 3 come, thy puchase will be done,
    Online as it is in offline.
    Give us this day our daily deals,
    and forgive us our guest passes,
    as we forgive those who guest pass against us.
    And lead us not into temptation,
    But deliver us from Origin.
    For thine is the kingdom,
    the power and the glory,
    forever and ever.

    Gaben.```
elder shoal
cinder plinth
#

No gta6 either

surreal path
surreal path
#

welp i just realized one big

#

thing

#

before writing the scheduler

#

THE FUCKING PAGE TABLES ARE NOT ARCHIECTURELLY ABSTRACTED

#

thats fun

#

im js gonna do something rlly stupid

#

do any other architectures have 2mb pages (risc v, arm etc)

#

?

cinder plinth
#

Yea

#

Arm has 64k pages too

#

And bigger ones too

kind root
#

To abstract away paging

molten grotto
unkempt relic
#

or granule as they call it for some reason

molten grotto
#

ah like kernel page size

#

oh wait there are actually different translation granules, I didn't remember that

tawdry mirage
#

yeah aarch64 has 4k, 16k, 64k base page size, and from that you get 512*size and 512^2*size and 512^3*size blocks

#

er, for larger page sizes it's not 512 but you get the point

kind root
#

Yeah arm has some of the more flexible mmu configuration I've seen on any arch

unkempt relic
kind root
#

Lol

unkempt relic
kind root
#

Which are more flexible

kind root
unkempt relic
#

you may configure the number of tables up to 5

kind root
#

Damn

unkempt relic
#

pick your own page table geometry

#

it has large pages as well ("early termination page descriptors") and you can have a PTE point to another PTE to be used instead

hexed mango
surreal path
#

memory issues

hexed mango
surreal path
#

genuinely

#

why is one damn pnode refering to 0xffffffff

#

wtf

kind root
surreal path
hexed mango
#

Wait

#

What are pnodes

surreal path
#

my own type

#

linked list basically

hexed mango
#

Ok, then ya you're def not clearing that field

surreal path
#

i memset before inserting though?

hexed mango
surreal path
#

yep

#

on alloc

#

one sec

#

ill pull it up

surreal path
molten grotto
#

no newlines nooo

hexed mango
#

Could that end up causing this issue?

surreal path
#

lets test

#

nope

hexed mango
#

Hm

#

Not entirely sure then, nothing stuck out to me

surreal path
#

maybe u'd have full context with the entire file

hexed mango
#

I have a party all weekend, so I'll be busy
But if you still have this contact me sunday night and I can try to help

surreal path
#

okay

hexed mango
#

Good luck bestie

surreal path
#

i have a very slight suspection

#

its because of free_unused_slabs

#

im gonna remove the call to it

#

and see what changes

#

never fucking mind

#

okay heres what ill do

#

NVM

#

i have no ideas

#

fucking hell

#

and wheres my fucking stacktrace

#

hold on

#

now we have more context

#

okay i see a calloc

#

i dont see

#

a kernel_free() being called

#

@kind root is the call being called somewhere else?

#

WHY IS MY LAPTOP LAGGING

#

okay

#

um

#
Page Fault! CR2 0xffffffff
RIP is 0xffffffff80006935
-> Function: slabfree() -- 0xffffffff800068e0
-> Function: uacpi_execute_control_method() -- 0xffffffff80011120
-> Function: uacpi_execute_table() -- 0xffffffff800132e0
-> Function: uacpi_table_load_with_cause() -- 0xffffffff8001a1b0
-> Function: uacpi_namespace_load() -- 0xffffffff8001bf50
-> Function: init_acpi() -- 0xffffffff80001000
-> Function: kmain() -- 0xffffffff80005d70
-> Function: none -- 0x0

that is the full stack trace

#

i dont know if uacpi is doing some macro shanngains to expand the macro into calling the kernel free

#

obviously its my code thats at fault here

#

i just dont know why

kind root
surreal path
#

yea i see

#

yea this is a triggy bug

#

TRICKY

#

OMG I CANNOT SPELL

#

😭

surreal path
#

okay we know when it is allocated and deallocated

#

but thats still not the source of the issue

#

because the slab we free ->next field is ferring to 0xffffffff

#

and i tried to impl ksan

#

i couldnt get it working

#

its still in the source code

#

for some reason not working

#

🤷‍♂️

surreal path
#

tried using gdb

#

got nowhere

haughty kite
#

skill issue

#

okay memory debug 101

#

take your free function

#

and replace it with memset(memory ptr, 0xaa, malloc size)

#

then insert memset(memory ptr, 0xcc, malloc size) right at the end of your alloc function

surreal path
#

/j

haughty kite
#

my malloc worked second try

cinder plinth
#

mine worked first try

#

L

#

(no)

orchid dawn
#

wait, you guys actually got memory allocation working? (I gave up before ever actually making it work properly) meme

surreal path
#

and mine is so small

surreal path
#

might ask the forums and irc chat for help cause i rlly cannot figure this out

surreal path
#

well what i found interesting

#

is

#

i do this function after uacpi inited

#

hold on

#

WAIT

#

nvm

#

this is not the problem

#
cur->next = (struct slab *)init_slab(mod->size);
  cur = (slab *)cur->next;
  void *guy = cur->freelist;
  cur->freelist = ((pnode *)cur->freelist)->next;
  memset(guy, 0, mod->size);
  return guy;
surreal path
#

HELP

#

and i tried software watchpoints

#

and it crashed qemu

edgy pilot
#

using a debugger

surreal path
#

💀

edgy pilot
#

cringe

#

just spam printf

surreal path
#

i cant

edgy pilot
#

why not

surreal path
#

i dont know where to put the printfs because i dont know where the memory corruption is happening

edgy pilot
#

shrimple: put it everywhere

surreal path
#

fine ill put it everywhere

#

js to prove u wrong

edgy pilot
#

now that's based

edgy pilot
surreal path
#

im gonna prove thats not gonna help

surreal path
#

bru

surreal path
#

yo is this a valid address

#

wtf

#

he gives me reasonable addresses

#

then this???

#

huh

frigid cliff
#

Me me me me me

surreal path
#

i solved it

#

yea thats a vmm address

#

TURNS OUT IT WASNT MY ALLOCATOR

#

BUT JS

#

some stupid ah

#

shanngains

#

im gonna check what size uacpi gave

#

what lol

#

so lemme get this straight

#

uacpi tells me its 10 bytes

#

gives me a vmm region address

#

gives me garbage sizes

#

too

edgy pilot
#

did the printfs work

surreal path
#

we got closer yea

#

can i ask

#

why for the love of god

#

is uacpi giving me a bunch of gibberish for size

edgy pilot
surreal path
#

that is gibberish

edgy pilot
#

and you call kfree

#

not uacpi

surreal path
edgy pilot
#

yes

#

I don't see any kfree in uacpi source

surreal path
#

im js passing whatever size uacpi gave

#

and therefore

#

uacpi is giving me gibberish

#

look at the stacktrace

edgy pilot
#

what's your io_map

surreal path
surreal path
#

thats all it is

edgy pilot
#

why do you allocate anything there

surreal path
#

why

#

shouldnt i not

edgy pilot
#

do you need it?

#

no

#

then no

#

just put base in out handle

#

copied from obos smh

surreal path
#

no cause i can check

#

anyways thats not the main issue it

#

is*

edgy pilot
edgy pilot
surreal path
surreal path
edgy pilot
surreal path
#

return uacpi_status_invalid_argument

edgy pilot
surreal path
edgy pilot
surreal path
#

in future

edgy pilot
#

worry about someone else's later

surreal path
#

ill change it

finite summit
#

If that's what ur talking about

surreal path
#

still

#

the same

#

didnt solve shit

edgy pilot
#

did you remove the kfree?

surreal path
#

yep

#

i did

edgy pilot
#

trace your stack

surreal path
edgy pilot
#

when the value is garbage

surreal path
#

😭

#

look at the screenshot

edgy pilot
edgy pilot
surreal path
edgy pilot
#

trace the stack

surreal path
#

and im not manually gonna step through every allocation

edgy pilot
#

if kfree is called with a garbage value

surreal path
#

fine

edgy pilot
#

wdym fine I'm trying to help

#

is this against your will?

surreal path
#

no

#

im js

#

rlly tired

#

is all

#

my bad

edgy pilot
#

sleep then

surreal path
#

no thanks

#

garbage

#

trace

edgy pilot
#

there definitely something else between 0 and 1

surreal path
#

wha

edgy pilot
#

are the optimisations off

surreal path
#

no one

#

on*

edgy pilot
#

use your stack tracer

surreal path
#

i already have the stack trace

surreal path
edgy pilot
#

not when the exception happens

surreal path
#

when that happens

#

ill add a stupid check in kfree then manually page fault or some shit

edgy pilot
#

???

surreal path
#

how else am i supposed to do it

#

genuinely

edgy pilot
#

if (size > some_random_garbage_millions) trace_stack()

#

in kfree

#

wait what

#

you don't need to page fault

#

just read rbp smh

surreal path
#

fine

#

its better if i trigger a fault im not gonna spaggathi code a bunch of garbage

#

into that file

#

id have to load symbols early

#

and a bunch of other shit

edgy pilot
surreal path
#

its the same as the gdb stacktrace @edgy pilot

edgy pilot
#

print size in uacpi kernel free

surreal path
#

okay

#

see

#

uacpi_size is just a size_t

edgy pilot
#

what kind of printf do you use

surreal path
#

nanoprintf

edgy pilot
#

sizes are all correct for me

surreal path
#

yea this is very weird

kind root
#

frees of 0 are no op

surreal path
#

yea i ignore those

edgy pilot
#

I totally missed that

kind root
#

well clearly not

haughty kite
#

what is that size as hex

surreal path
kind root
haughty kite
#

which uacpi commit are you in?

edgy pilot
#

looks like an address lol

haughty kite
#

yeah

#

addr2line it

kind root
#

nyaux heap corruption any%

haughty kite
#

which uacpi commit

#

lmfao

#

yes

#

this is why every os should have a hardened heap meme

surreal path
haughty kite
#

which uacpi commit

surreal path
#

i dont know but i just updated it

#

lemme run

haughty kite
#

please run cd third_party/uACPI && git rev-parse HEAD

edgy pilot
#

or something

surreal path
#

still the same

haughty kite
#

what if you remove the entire free path

haughty kite
#

and add 64k to every allocation size

surreal path
#

what

edgy pilot
haughty kite
#

put return; right after that free check

surreal path
#

okay

haughty kite
edgy pilot
#

yes it was a joke

kind root
#

I wonder if u port uacpi to NES will it run faster than 150/s

haughty kite
#

probably lmfao

surreal path
haughty kite
#

as in it just hangs?

surreal path
#

no

#

got here

#

same issue

#

and that address that was given to

#

slabfree

haughty kite
#

i see i see okay

surreal path
#

is a vmm region one

#

which is why it dies

haughty kite
# surreal path

wait how do you get to slabfree if you put a return right after this first check in kfree

#

this is what you should do

#

actually, memset(addr, 0xcc, size) first

surreal path
haughty kite
#

NO

surreal path
#

okay then what should i do

#

😭

surreal path
edgy pilot
#

nyaux rewrite 2^64-1

surreal path
#

im not

#

we are done with rewrites

haughty kite
#
void kfree(void* addr, uint64_t size) {
  if (size >> 63) { kprintf("kfree: memory corruption detected\n"); __builtin_trap(); }
  kprintf("kfree(%p, %#llx)\n", addr, size);
  memset(addr, 0xcc, size);
  return;
}
#

do this

surreal path
haughty kite
#

okay then

#

this is weird

#

very

surreal path
#

i told you

haughty kite
#

can you send the code?

surreal path
#

yep

haughty kite
#

cool

haughty kite
#

holy shit so many errors on clang

#

oh god

#

okay im never going to compile it

surreal path
#

please use

#

gc

#

c

edgy pilot
#

garbage collector compiler

surreal path
haughty kite
#

id need to build gcc

#

and that sounds annoying and cbf

#

ok static analysis it is

edgy pilot
#

what distro are you on

haughty kite
#

fedora

#

on arm

edgy pilot
#

ah

#

aren't there any cross gcc s in repos

haughty kite
#

ah lol

haughty kite
#

okay i think you have way bigger memory corruption issues @surreal path

#

i tried building your shit

#

and it memory corrupts itself to death

surreal path
#

wtf is going on

haughty kite
#

idk it hits this #PF every time for me

surreal path
haughty kite
#

this time it was before uacpi too

surreal path
#

show me entire

#

cr2 is weird

#

wtf

haughty kite
#

cr2=pc=ffff8...117a

surreal path
#

this is fucking weird

haughty kite
#

im on gcc 14.2

surreal path
#

i dont know how to get further

haughty kite
#

this is probably the issue tbh

surreal path
#

the issue is memory corruption obviously

#

but tracking it down?

#

idk

#

this is difficult

haughty kite
#

initially you map this

surreal path
haughty kite
#

and then get_symbols does something

#

and bad shit happens

surreal path
#

i allocate a resource

haughty kite
#

tbh i blame your kmalloc

surreal path
#

obv it is

#

but where the issue is

#

idfk

#

this js makes it even more difficult

edgy pilot
surreal path
#

i already printf'd everything

edgy pilot
#

plus 150 ops/s is very slow

surreal path
#

oh

#

i thouyght u said something else

edgy pilot
#

you need a better allocator

surreal path
#

i was reading the screen from an angle

surreal path
#

slab allocator? idfk

#

im not rewriting

edgy pilot
#

yes

surreal path
#

it wont solve the issue

edgy pilot
surreal path
#

because ill write the same design

edgy pilot
#

rewrite means write something else

surreal path
#

rewrite a slab allocator how

edgy pilot
#

write a better one

#

there are docs on the internet

surreal path
#

i read those docs

#

and impl'd it

edgy pilot
#

read them again, read other ones

surreal path
#

and for some reason its shitting on me

#

🤦‍♂️

edgy pilot
#

-# ||shrimply a krill issue||

surreal path
#

the slab allocator isnt even

#

that much code

#

im geuinely unsure

#

how that little code is somehow corrupting the entire kernel

edgy pilot
#

why not

surreal path
#
  • i have read the code for the slab allocator top to bottom i dont see an issue
edgy pilot
#

I'm sorry but clearly you did something wrong

surreal path
#

like

#

slab alloc is literarly

#
void *slab_alloc(cache *mod) {
  if (mod->slabs == NULL || mod->size == 0) {
    return NULL;
  }
  slab *cur = (slab *)mod->slabs;
  while (true) {
    if (cur->freelist == NULL) {
      if (cur->next != NULL) {
        cur = (slab *)cur->next;
        continue;
      }
      break;
    }
    void *guy = cur->freelist;
    cur->freelist = ((pnode *)cur->freelist)->next;
    memset(guy, 0, mod->size);
    return guy;
  };
  cur->next = (struct slab *)init_slab(mod->size);
  cur = (slab *)cur->next;
  void *guy = cur->freelist;
  cur->freelist = ((pnode *)cur->freelist)->next;
  memset(guy, 0, mod->size);
  return guy;
}
edgy pilot
#

no point in trying to find problems in some other things

surreal path
#

even pitust didnt understand whats going wrong from static analysis

surreal path
edgy pilot
#

what if you don't free anything

surreal path
#

ill run out of memory but sure

#

hold on

edgy pilot
edgy pilot
surreal path
#

no kfree

#

still

edgy pilot
#

I see a kfree in there

haughty kite
#

okay i found the bug @surreal path

surreal path
surreal path
edgy pilot
surreal path
haughty kite
# surreal path WHERE

src/cc-runtime.c:2663 (__mulvXi3_25) and src/cc-runtime.c:2678 (__mulvsi3) are mutually recursive

#

leading to an infinite loop

haughty kite
#

yeah lol

surreal path
#

thats something from mints c template

#

bug?

haughty kite
#

wait really

surreal path
#

yea

#

legit

edgy pilot
edgy pilot
#

unused ram is wasted ram

edgy pilot
surreal path
#

who made the cc-runtime

edgy pilot
#

llvm or gnu

surreal path
#

because that was from the c template

haughty kite
#

mint

#

its repackaged from LLVM

edgy pilot
#

ping the llvm dragon

haughty kite
#

but i 100% bet the llvm people do build config stuff to make sure this isnt a problem