#Nyaux

1 messages · Page 29 of 1

frigid cliff
#

Rootkit

surreal path
#

china has all my data ngl

kind root
#

idk man i just wanna focus on having good aim instead of ability spam

surreal path
#

im fucked

surreal path
#

just play the game well and ur good

kind root
#

yeah but

#

u have wh abilities and stuff

surreal path
#

also theres lit kayo who disables ablities

frigid cliff
#

Cs and valo are like different genres imo

surreal path
#

with his knife thing

frigid cliff
#

Cs is a normal shooter val is a hero shooter

surreal path
#

done

kind root
#

valorant also wanted me to disable virtualization

#

so im not doing that

surreal path
#

fair point

frigid cliff
#

Yeah valorants ac is picky as fuck

molten grotto
#

I have played cs like once with a friend like 5 years ago and I sucked at it

frigid cliff
#

Ok but cs 2 tho

molten grotto
#

so I just mostly stick to overwatch

frigid cliff
#

Smokes

kind root
#

i used to play ow a lot

surreal path
#

whats ur main

kind root
#

ow is washed these days

#

maybe if they bring 6v6 back and stuff

frigid cliff
#

Fr

surreal path
#

ow2 mains anyone?

#

i main tracer

frigid cliff
#

If ow2 actually had a campaign like they promised

kind root
#

zarya or sigma

surreal path
#

i hate you

#

fucking zarya

kind root
#

ow2 is just ow1 but u have battle pass and overpriced skins instead of loot boxes

surreal path
#

bro zarya mains always follow me

#

and kill me

#

they know im in the backline

frigid cliff
#

I know because blizzard fucking sucks at making games

kind root
#

yeah

frigid cliff
kind root
#

if u wanna keep up with the skins u have to pay way way more

frigid cliff
#

Easy cash grab

kind root
#

in ow1 u could grind all of them but that was making them less money obv

molten grotto
surreal path
#

ROAD

#

hog

kind root
#

roadhog is nice

#

or used to be

surreal path
#

yea he was op

#

before

#

his hook

kind root
#

one shot hook is very enjoyable

surreal path
#

oh man

molten grotto
#

there is also the classic event rn

surreal path
#

real??

molten grotto
#

with the original heroes + abilities

kind root
#

yeah i tried it, but they didnt even bother adding ranked to it lol

surreal path
#

WAIT FR

kind root
#

like whats the point lol

surreal path
#

OH SHITTTT

#

LEMEM HOP ON OW2

#

wait fuck

#

lemme

#

first finish up code with the hpet

#

brb

#

shouldnt take

#

5 minutes

frigid cliff
#

Lmao

kind root
#

but classic def feels like a breath of fresh air

frigid cliff
#

Never make promises like that because you’re going to end up spending the next 2 weeks with sleepless nights trying to finish hpet

kind root
#

its like reading 1 register lol

surreal path
#

bro

#

hpet is so fucking easy

#

how the hel

frigid cliff
#

Not specifically hpet

#

I just have superstition when it comes to saying I’ll complete things in a timely manner

surreal path
#

yea i might get stuck

#

somewhere

#

but its fine

#

it wont be as bad

#

as before

#

im not gonna be making the same mistakes anyway

#

and im working on my own time

kind root
#

for the love of god stop speedrunning it

surreal path
#

i am not speedrunning it

#

how tf am i speedrunning

molten grotto
#

I should make some sort of emulator/virtualizer in crescent so then I can run nyaux inside it troll

frigid cliff
#

It’s a leisurely pace if you ask idfk fast people

kind root
#

anyways if u arent keep at it idk

frigid cliff
#

Like Usain Bolt

surreal path
molten grotto
molten grotto
#

yes and a virtual machine using it

frigid cliff
#

Average weekend project

molten grotto
#

I unironically though about that, then I could run actual apps maybe

kind root
#

u can get that up an running in a few months probably

surreal path
#

inside

#

creasant

molten grotto
#

then inside nyaux bash

kind root
#

creasant 💀

surreal path
#

corssiant

surreal path
#

then inside nyaux

#

crossiant

#

then inside crossiant

#

nyaux

molten grotto
#

idk if the cpu likes that, would probably have to be software virt at that point lol

surreal path
#

infinte vm

#

muhehehe

molten grotto
#

then finally run windows for all the apps

frigid cliff
#

Snaps

kind root
#

nested virt is a thing yeah\

molten grotto
#

to some point yeah but can you arbitrary nest them?

kind root
#

yup

frigid cliff
#

I don’t see why not

kind root
#

each layer would be slower than the previous

surreal path
#

cpu dies

kind root
#

because every vmexit would chain

molten grotto
#

ah nice

#

I though there was some kind of limitation

frigid cliff
#

A speed limit inevitably but I don’t see why you wouldn’t be able to just have endless chained vms

molten grotto
#

while you are it also make all apps their own vm's (with their own os instance)

kind root
#

u need the previous layer cooperation to propagate vmexits

#

but kvm can do that

frigid cliff
#

Yeah, as long as qemu supports emulating vmexit I don’t see why you wouldn’t be able to endlessly chain them

molten grotto
#

as long as you run out of memory ofc

#

but that would take a while

molten grotto
#

idk what should I seriously make it tho, I though about a crescent moon but idk

#

have to think about it

proceeds to not do it until its too late and I stop developing it

frigid cliff
# molten grotto but that would take a while

I’d like to imagine when sys admins get access to a super computer the first thing they do with them before doing like research or breaking encryption of government adversaries is stupid shit like this

molten grotto
#

it could be a fun experiment yeah

kind root
#

iirc they had something like that

molten grotto
#

oh yeah looks like it does have all kinds of things that contain that word

#

I didn't even know that lol

#

I think I just originally looked at some word list and picked it from there

surreal path
#

oh

#

oh

#

oh

#

it page faults

#

cr2 is 0

#

error code is write to non present page

#

what i called

#

i swear if this is another allocator bug

#

im gonna blow my brains out

kind root
#

this is not how this api works

surreal path
#

oh

kind root
#

hpet_table shouldnt be a pointer

surreal path
#

oh

#

and then i

kind root
#

yes...

surreal path
#

yea i get u

surreal path
#

yea it foudn the hpet

#

okay works now!

#

10 nanoseconds

surreal path
#

got stuck doing the hpet huh

#

lit

#

5 minutes

#

i finished it

#

lool

hexed mango
#

69 20 6C 6F 76 65 20 69 74 61 6E 69 75 6D 2A

surreal path
thorn bramble
#

i mean for the most part it’s just me being bad meme

#

but it’s staying when u predict a tracer blink or whatever that other thing is

#

haven’t played this shit in forever i forgot everything

flat nymph
#

In pmOS, I have a map of { GSI, {CPU ID, Vector} }, which I allocate to a random CPU on first use, or reuse if it's already configured, which should work with interrupt line sharing
(if I bothered to add multiple IRQ per vector in kernel, which shouldn't be difficult...)

thorn bramble
#

satisfying* whoops

#

typing with one eye closed and 2nd half open doesn't work that well

surreal path
#

hi chatji

#

im having a deep think

#

about if i should start designing the kernel around smp

#

or if i should just assume one core for now til bash and then redo everything for smp later

molten grotto
# surreal path im having a deep think

"So our so-called Lord Nyaux is a three-meter human male, possibly a Jedi, certainly a Force user, wandering around in a world where it probably doesn't understand anything."

#

/jk

surreal path
molten grotto
#

yeah its good to design with it in mind to start with

surreal path
#

im guessing i store anything cpu related in gs

molten grotto
molten grotto
#

ofc not with nyaux but with nyax

finite summit
surreal path
finite summit
#

If you need help

#

Use the message history of this thread

surreal path
#

@finite summit i think i understand, store a ptr to cpu local shit in gs base

finite summit
#

Use the search feature

surreal path
#

i am looking at the history

finite summit
#

#1230349543623757845 message

surreal path
finite summit
#

Look through those couple hours

surreal path
#

but i understand this

#

???

#

why do i need to look at this a couple of hours if i understand this

#

😭

finite summit
#

Then you're good

#

If you understand

surreal path
#

yep

#

write to gs base a ptr to cpu local struct, different for each cpu. im gonna store shit i need for my interrupt shit in there as well

#

cause yes

surreal path
#

some stuff that is per cpu spefici

#

i need

#

to store in it

finite summit
#

Interrupt part

#

Elaborate

surreal path
#

this garbage, storing ptrs for uacpi handlers and stuff

#

and also

#

making this per cpu

finite summit
surreal path
#

wait

#

nvm

#

forget about what i said

molten grotto
#

you are unlikely to have so many devices that you'd actually need per-cpu idt

surreal path
#

okay

finite summit
#

?

#

obos just gives uacpi a pointer to a struct irq

#

Which handles everything

surreal path
#

ehhh idrk how to abstract it well

surreal path
molten grotto
#

my irq abstraction is ```cpp
struct IrqHandler {
DoubleListHook hook {};
kstd::small_function<bool(IrqFrame* frame)> fn {};
bool can_be_shared {};
};

void register_irq_handler(u32 num, IrqHandler* handler);
void deregister_irq_handler(u32 num, IrqHandler* handler);

finite summit
surreal path
molten grotto
#

yes ```cpp
static DoubleList<IrqHandler, &IrqHandler::hook> IRQ_HANDLERS[256] {};

surreal path
#

what i do

#

wrap func is basically this

molten grotto
#

nyaux on phones when

#

or obos

surreal path
#

(real information)

finite summit
#

Just wait until I have the willpower to port to aarch64

molten grotto
edgy pilot
edgy pilot
#

nyaux itanium port when

hexed mango
#

Soon, I pray

tawdry mirage
molten grotto
#

and even if it would happen you could still share irqs at the cost of performance

tawdry mirage
#

well sharing msis doesn't really work since they're edge triggered no?

#

you could just scale down the amount of queues

molten grotto
finite summit
edgy pilot
#

why

tawdry mirage
#

what do you store there?

finite summit
unkempt relic
#

(i considered this, opted against it for now, might change my mind)

tawdry mirage
unkempt relic
#

the main reason i opted against it for now, it's hard to design a cross-platform abstraction for this, because some other platforms don't permit something like this

finite summit
finite summit
edgy pilot
#

I might have misunderstood

tawdry mirage
#

ah well i thought it was obvious that it's a pointer to the struct

finite summit
#

I store a pointer to a struct lol

tawdry mirage
#

how do you get the pointer

#

rdmsr?

finite summit
tawdry mirage
#

lol

finite summit
#

I wonder what kinda speed increase I could get if I had a self pointer

edgy pilot
#

I do wrmsr and mov gs:[0]

unkempt relic
#

advantage is on most arches you can do a cpu-local-data-register + offset to something important (curthread for instance) load in one instruction

molten grotto
#

I also though that it might be a good idea to have something actually resembling tls too along with the per cpu struct because it gets kinda messy when you stuff everything including random pools into the cpu struct

edgy pilot
unkempt relic
molten grotto
#

yeah its certainly useful for generic stuff but there are some misc things that could just be better being on their own

#

or well putting literally everything inside the struct would work too ofc but it might not be the most cleanest solution

unkempt relic
#

dynamic per cpu allocation useful too (i forgot the use case but i had one in mind)

molten grotto
#

especially with drivers and stuff

unkempt relic
#

that's a good one

#

the other option is allocate an array of as many as there are CPUs but that's slightly more tedious

surreal path
#

hi sorry i didnt do any work today

#

got caught up with hw

spice yarrow
#

No need to be sorry

flat nymph
hexed mango
kind root
#

i just woke up and was like

#

what kind of hardware was he catching up with

hexed mango
#

Oh I read hw as homework

kind root
#

thats probably correct

plush hearth
flat nymph
#

CPU got too mad with Nyaux

molten grotto
#

and battery if using a laptop lol

#

tbh it's actually true with basically all hobby os's, they use a lot of power because of no power management of any kind

finite summit
#

OBOS

#

Has power management

kind root
#

well obos doesnt have fan or power zone management

molten grotto
#

also cpu power management meme

kind root
#

or thermal zone

finite summit
#

Infy

#

I am in a desert

kind root
#

Thats one way to call UAE

finite summit
#

*camel

kind root
#

Nice

frigid cliff
#

Interesting

flat nymph
kind root
#

u can configure the state the cpu enters on halt

#

there are many of them

finite summit
#

Isn't there also stuff like mwait and monitor on x86

frigid cliff
#

I mean hlt isn’t like deep sleep

kind root
kind root
frigid cliff
#

Interesting

kind root
#

up to like hundreds of milliseconds i think

#

look up CPU P/C states

finite summit
kind root
#

nah its unrelated

#

but iirc u use ACPI to tell the firmware u support that

#

via _OSC

#

and it then dynamically loads extra cpu methods

#

i dont remmeber how these two are related

#

this stuff

surreal path
#

i might need to

#

wait

#

because

#

other cpus are gonna be modifying this

#

which is like

#

wait

molten grotto
#

you just have a lock?

surreal path
#

no but

#

like this is only suposed to be for one cpu

#

and like

#

if that

#

represents one cpus vector space

#

and then

#

another cpu modifies that

#

for something else

#

things can get fucking weird

#

😭

molten grotto
#

how

surreal path
#

lemme pull up vscode

kind root
#

i even found what it does

#

If set, OSPM is capable of independent C1, P state and T state support for each processor for multi-processor configurations.

#

etc etc

surreal path
# molten grotto how

well im not worried for that because this is gonna be happening on the bootstrap cpu anyway

#

for whatever uacpi does

#

butttttt

#

this will get modified

molten grotto
#

yes?

surreal path
#

by another cpu

#

wont that effect bootstrap

molten grotto
#

if you have some kind of driver there then yes

surreal path
#

cpu

molten grotto
#

if it's shared then yeah but why would that matter?

#

the irq is still only going to be triggered on whatever cpu you configure the io-apic/msi to send it to

surreal path
#

so like one cpu

#

even if theres multiple

molten grotto
#

yes that's true

surreal path
#

thats stupid

molten grotto
#

but unless you are planning on running on eg. servers its very likely a non-issue

surreal path
#

still

#

i think its stupid

#

is there a way

molten grotto
#

then do it the per cpu idt way meme

surreal path
#

i can make it so

surreal path
#

in gs

#

base

#

funny

molten grotto
#

yes

surreal path
#

i need a scheduler like now

#

so um

#

let me

#

wait i need lapic timer

#

shouldnt be hard

#

brb

#

i found a bug

#

yea wtf

#

why am i putting 0

#

in ea

#

xx

#

bro wtf is this

#

sil

#

lol

finite summit
#

Rsi but one byte

surreal path
#

ohhhhhhh

#

dumbname

finite summit
#

Fr

tawdry mirage
#

sil ly

surreal path
#

idk what to do now

#

i cant exactly return

#

as ill only return edx

#

why does readmsr divide edx and eax

molten grotto
#

you can just combine them tho

surreal path
molten grotto
#

yes

surreal path
#

kk

tawdry mirage
#

edx << 32 | eax

surreal path
#

time to read sdm some more for bitwise operations

tawdry mirage
#

you could just write it using inline assembly

#

then do the math in c

surreal path
#

oki

surreal path
#

sir

#

mr

#

how tf am i supposed to do it then

#
static inline uint32_t rdmsr(uint32_t msr) {
  uint32_t low = 0;
  uint32_t hi = 0;
  __asm__ volatile ("rdmsr" : "=a"(low), "=d"(hi) : "c" (msr));
  uint32_t combined = (low << 32)|hi;
  
}
thorn bramble
#

how do you expect

#

to shift a 32 bit integer

#

byu 32

surreal path
#

ik srry

thorn bramble
#

the return type

#

should be a 64 bit integer

kind root
#

uint32_t combined 💀

surreal path
#

okay

thorn bramble
#

yeah that isnt gonna work

surreal path
#

sorry i fixed it

#
static inline uint64_t rdmsr(uint32_t msr) {
  uint32_t low = 0;
  uint32_t hi = 0;
  __asm__ volatile ("rdmsr" : "=a"(low), "=d"(hi) : "c" (msr));
  uint64_t combined = ((uint64_t)low << 32)|hi;
  return combined;

}
#

better now

thorn bramble
#

no reason to apologize

surreal path
#

okay

thorn bramble
#

yeah looks alright

#

although

surreal path
#

alright

thorn bramble
#

im fucking tired a

#

s fuck

#

so i cant tell

#

xd

surreal path
#

BRO GO TO SLEEP 😭

thorn bramble
#

n ah

#

well soon

surreal path
#

u better

thorn bramble
#

onjly been up fr abtou 12 hroujss

surreal path
#

all done

static inline uint64_t rdmsr(uint32_t msr) {
  uint32_t low = 0;
  uint32_t hi = 0;
  __asm__ volatile("rdmsr" : "=a"(low), "=d"(hi) : "c"(msr));
  uint64_t combined = ((uint64_t)low << 32) | hi;
  return combined;
}
static inline uint64_t wrmsr(uint32_t msr, uint64_t value) {
  uint32_t low = (uint32_t)value;
  uint32_t hi = (uint32_t)(value >> 32);
  __asm__ volatile("rdmsr" : : "a"(low), "d"(hi), "c"(msr));
}
#

:)

thorn bramble
#

gioiod

#

good

surreal path
#

now lapic timer

kind root
#

wrmsr
rdmsr

surreal path
#

whats wrong with the names

#

OHHHH

#

yea solved it

thorn bramble
#

i dont get it

cinder plinth
#

!!

surreal path
#
static inline uint64_t rdmsr(uint32_t msr) {
  uint32_t low = 0;
  uint32_t hi = 0;
  __asm__ volatile("rdmsr" : "=a"(low), "=d"(hi) : "c"(msr));
  uint64_t combined = ((uint64_t)low << 32) | hi;
  return combined;
}
static inline uint64_t wrmsr(uint32_t msr, uint64_t value) {
  uint32_t low = (uint32_t)value;
  uint32_t hi = (uint32_t)(value >> 32);
  __asm__ volatile("wrmsr" : : "a"(low), "d"(hi), "c"(msr));
}
surreal path
#

i already have a github

thorn bramble
#

oh

cinder plinth
#

no my github is rdmsr

surreal path
#

OHHHHHHHHH

#

yae

thorn bramble
#

iretq

#

iretq

#

omg

#

i veb een mentioined

surreal path
#

OMGGG

#

!!!!

thorn bramble
#

hi hguyyhzz

#

im irertq

cinder plinth
#

based

#

I too got an instruction named after me

thorn bramble
#

i can barely hit ny keys

#

man im tred lol

#

gondmight

#

good night

surreal path
#

goodnighttttt

#

because i no have scheduler im just gonna do

struct per_cpu_data {
  void (*idt_handlers[256])(struct StackFrame *frame);
}
struct per_cpu_data *data = kmalloc(sizeof(per_cpu_data));
wrmsr(GS_BASE,  data);

FOR NOW

#

and i am going to change a LOT of things now with ze idt

#

and

#

wait

#

ill leave the bootstrap cpu alone in how it handles its idt shit

#

but ill make operations u can perform on this per cpu idt

#

the idt.c file is just for bootstrap cpu only

steady flume
surreal path
steady flume
#

i dunno i'm just lurking in this server in the hopes to passively scrape up enough knowledge to help me when i eventually have enough time and have a strong want to write my own OS

surreal path
#

hi chat not feeling up to do much today

#

but i got some smp working ig

#

which was cool

#

im taking my time afterall so no need to speedrun lol

surreal path
#

wtf

#

lollllll

#

bro

#

wtf

#

page fault 0x10???????

#

HOWWWW

#

all i hecking do

#

HOWWWW

#

wtf

#

dont tell me its MORE vmm shit

#

i swear to god

#

i have a lock on my

#

fucking flanterm term

#

RIP IS 0

#

BTW

#

RIP IS FUCKING ZERO

plush hearth
surreal path
#

limine is providing the stack sooooo

#

shouldnt be from that

#

limine is providing the stack

#

im using

#

goto address

plush hearth
#

its 64KiB minimum

#

so it should be fine

surreal path
#

yea

plush hearth
#

are you doing any assembly which might push more than what is popped?

surreal path
#

no

#

the code i posted

#

is the code

plush hearth
#

interrupts?

surreal path
#

im not even installing any interrupts in the bootstrap function

#

i didnt do anything

#

no interrupt is firing

plush hearth
#

oh wait, are you starting other cpus?

surreal path
#

yes

plush hearth
#

oh I see

surreal path
#

yep

#

pushed on github if u wanna check it out urself

plush hearth
surreal path
#

one second

#

no its not safe

plush hearth
#

maybe mark it as noreturn so the compiler complains at you if you forget again

surreal path
#
init_smp(): Found CPU 0
init_smp(): Found CPU 1
init_smp(): Found CPU 2
init_smp(): Found CPU 3
init_smp(): Found CPU 4
init_smp(): Found CPU 5
bootstrap(): Hello from CPU bootstrap(): Hello from CPU 2
bootstrap(): Hello from CPU 6
bootstrap(): Hello from CPbootstrap(): Hello from CPU 3
U 51
bootstrap(): Hello from CPU 4
init_smp(): Found CPU 6
init_smp(): Found CPU 7
init_smpbootstrap(): Hello from CPU 8
(): Found CPU 8
init_smp(): Found CPU 9
init_smp(): Found CPU 10
init_smp(): Found CPU 11
init_smp(): Found CPU 12
init_smp(): Found CPU 13
init_smp(): Found CPU bootstrap(): Hello from CPU 14
bootstrap(): Hello from CPU 13
bootstrap(): Hello from CPU 11
bootstrap(): Hello from CPU 7
14
init_smp(): Found CPU 15
init_smp(): Found CPU 16
init_smp(): Found CPU 17
init_smp(): Found CPU 18
init_smp(): Found CPU 19
bootstrap(): Hello from CPU 1bootstrap(): Hello from CPU 19
bootstrap(): Hello from CPU 12
bootstrap(): Hello fr
bootstrap()5
om CPU : Hello from CPbootstrap(): Hello from CPU 9
bootstrap(): Hello from CPU 17
U 10
NYAUX Panic! Reason: 16
bootstrap(): Hello from CPU 18
#

why is this happening

#

i have a lock

#

on my terminal

plush hearth
#

how does the lock work?

#

does it lock printing a single character

surreal path
#

yep

#

yea

#
init_smp(): Found CPU 0
init_smp(): Found CPU 1
init_smp(): Found CPU 2
init_smp(): Found CPU 3
init_smp(): Found CPU 4
init_smp(): Found CPU 5
bootstrap(): Hello from CPU 2
init_smp(): Found CPU 6
init_smp(): Found CPU 7
init_smp(): Found CPU 8
init_smp(): Found CPU 9
init_smp(): Found CPU 10
bootstrap(): Hello from CPU 7
bootstrap(): Hello from CPU 1
init_smp(): Found CPU 11
init_smp(): Found CPU 12
init_smp(): Found CPU 13
init_smp(): Found CPU 14
init_smp(): Found CPU 15
init_smp(): Found CPU 16
init_smp(): Found CPU 17
init_smp(): Found CPU 18
init_smp(): Found CPU 19
bootstrap(): Hello from CPU 17
bootstrap(): Hello from CPU 15
bootstrap(): Hello from CPU 13
NYAUX Panic! Reason: Uhhh yeah wssup
bootstrap(): Hello from CPU 18
bootstrap(): Hello from CPU 8
bootstrap(): Hello from CPU 3
bootstrap(): Hello from CPU 14
bootstrap(): Hello from CPU 10
bootstrap(): Hello from CPU 16
bootstrap(): Hello from CPU 4
bootstrap(): Hello from CPU 9
oopsie uwu :3
bootstrap(): Hello from CPU 11
bootstrap(): Hello from CPU 5
bootstrap(): Hello from CPU 12
bootstrap(): Hello from CPU 19
bootstrap(): Hello from CPU 6
#

works now

plush hearth
#

nice

#

why 20 CPUs

surreal path
#

cause its represents my hardware

#

i have 20 corees

plush hearth
#

oh ok

surreal path
#

(p cores and e cores but yk)

plush hearth
#

ah

surreal path
#

chat my gf is ghosted me WHERE TF IS SHE I WANNA YAP TO HER ABOUT THE FACT I GOT SMP WORKING IN NYAUX

#

😡

hexed mango
hexed mango
worldly condor
#

linuxmaster on his way to getting banned

surreal path
#

😭

surreal path
worldly condor
#

there is no /j

#

there is only /srs

surreal path
#

but im not transphobic

worldly condor
#

(/s /j)

surreal path
#

oooo

#

😭

worldly condor
#

is using tone indicators sarcastically evil?

surreal path
#

i wonder

#

BUT NOW

#

FUCKING

#

SCHEDULER

#

TIME

#

time to read back the thread

#

im gonna make a document designing and how implmentation

#

will work

desert crow
#

please do not fuck the scheduler

surreal path
#

of the nyaux scheduler

surreal path
#

nah im not gonna make it UB

#

or poopy

#

it will be a per cpu queue scheduler

#

load balancing later on

#

if i can learn how that works

edgy pilot
surreal path
#

bru

hexed mango
#

@surreal path what scheduler design do u use atm

surreal path
#

my bad was eepying

tender gorge
surreal path
#

as for today im still writing the scheduler document

#

so nothing rlly much

flat nymph
#

Don't rush it

#

I've made almost 0 progress in the last two months

surreal path
#

💀

flat nymph
#

(interesting life decisions iwannadie )

surreal path
#

i went to school today

tender gorge
#

keep doing that

#

school > nyaux

ripe plinth
flat nymph
#

Can you not bring a laptop to school?

thorn bramble
#

no that's illegal

#

stop giving him ideas

#

let the man focus on school work

haughty kite
#

it may be forbidden by school rules

#

though then again maybe not

surreal path
#

i really have to

#

school work

#

so no work on nyaux for a bit (like until friday or smthin)

spice yarrow
#

sounds like a great plan

surreal path
#

hi sorry

#

been busy with school work

#

not today cause a lot of homework

#

but tmrw def

#

:)

plush hearth
#

You don't need to be sorry

#

School is more important

surreal path
#

okay i js woke up

#

time for nyaux work :333333

finite summit
#

I'm in GMT time zone now

#

In london

#

Doing osdev at 6 30 am is pretty unhealthy

surreal path
#

its fineee

#

but wtf

#

its in the fucking file

#

and i #pragma once every header file

#

wtf is the issue lmao

#

wait nvm have an idea

#

solved it

#

nvm

#

solved it

#

also i decided after a long think

#

im not doing a per cpu idt

#

its too complex and just it'd honestly be a waste of time

#

not rlly complex but

#

im lazy

surreal path
#

its lit

#

0x1b

#

like seriously

#

why isnt my fucking bitmask working

#

it just makes the address 0

#

0x0

#

wtf????

#

bro what

#

help

finite summit
#

Cuz I can be

desert haven
#

yeah, and show the code for rdmsr

finite summit
#

Yes

surreal path
#

okay

surreal path
# desert haven yeah, and show the code for `rdmsr`
static inline uint64_t rdmsr(uint32_t msr) {
  uint32_t low = 0;
  uint32_t hi = 0;
  __asm__ volatile("rdmsr" : "=a"(low), "=d"(hi) : "c"(msr));
  uint64_t combined = ((uint64_t)low << 32) | hi;
  return combined;
}
surreal path
desert haven
#

uh

plush hearth
surreal path
#

okay im just gonna steal someones rdmsr funcction

#

i aint doing this shit

plush hearth
#

swap low and high

#

shift high to the left

surreal path
#

okay that solved everything

plush hearth
#

what time is it for you?

surreal path
#

8am

#

didnt sleep

plush hearth
#

oh I see

surreal path
#

ye

plush hearth
#

that explains the mistake

#

maybe sleep?

surreal path
#

pretty muchn

#

cant

#

ok but ???

#

and if i dont shift

#

its this shit

surreal path
finite summit
surreal path
surreal path
#

heres what

#

one of the numbers look like

#

all look similar

#

but different

#

so im def accessing the lapic id register of the lapic

#

but i dont understand

#

why im not getting the proper id, even if i bitshift by 24 as per spec from the sdm for xapic even

#

i dont know what im doing wrong

#

anyone know?

kind root
#

where do u shift it

surreal path
#

was sleeping

#

but

#

static inline uint32_t get_lapic_id() {
uint64_t addr = (rdmsr(0x1b) & 0xfffff000);

uint64_t *ptr = (uint64_t *)(addr + hhdm_request.response->offset);
uint32_t val = *(uint64_t *)((uint64_t)ptr + 0x20);

return (val >> 24);
}

#

i do it here

#

which results in all lapic ids being 0

#

mhm

#

im reading 0x1b

#

which is the correct msr

#

for the lapic address

#

yeaaaa

#

clearly

#

not working

flat nymph
#

Don't you need to enable X2APIC to have MSRs?

surreal path
#

i dont have that enabled

flat nymph
#

Also, according to SDM, you're supposed to be reading 0x802

surreal path
#

im not using x2apic

#

😭

flat nymph
#

Then you're supposed to use MMIO instead of MSRs

surreal path
#

thats what im doing

flat nymph
#

Oh

surreal path
#

im using mmio and reading lapic addr + hhdm + 0x20

flat nymph
#

Yeah

#

I can't read

surreal path
#

😭 all good man

flat nymph
#

You're supposed to be reading it as volatile uint32_t *

surreal path
flat nymph
#

You're casting uint64_t * to uint32_t *, which is UB

#

(I've been bitten by it, gcc just issues noop)

#

I think?

#

May be not

surreal path
#

let me change it

#

static inline uint32_t get_lapic_id() {
uint64_t addr = (rdmsr(0x1b) & 0xfffff000);

volatile uint32_t *ptr = (volatile uint32_t *)(addr + hhdm_request.response->offset);
uint32_t val = *(volatile uint32_t *)((uint64_t)ptr + 0x20);

return (val >> 24);
}

#

changed

#

ill try running it

#

it solved it

#

@flat nymph thank you!

#

can u say always use volatile for mmio

#

so someone can pin it in this thread

#

so i never forget

#

😭

flat nymph
#

I mean I think it depends

desert haven
#

Also yeah the width of an mmio access is important too. The lapic regs are 32bits wide, so you should operate on them in that size (use a volatile uint32_t*)

surreal path
#

anyways hi yall

#

time to work on some lapic init

#

get it to fire on each cpu

#

and then

#

its scheduler

#

the scary

#

very spooky

flat nymph
#

Just don't do UB and you'll be set ok

edgy pilot
#

@surreal path some people are using nyaux as a reference

kind root
edgy pilot
#

I randomly opened it and saw people trying to use uacpi

kind root
#

lol

#

for cosmos?

edgy pilot
#

and they don't understand what "return 100ns increments" means

edgy pilot
kind root
#

its now just nanoseconds

#

so that people dont get confused

edgy pilot
kind root
#

lmao

#

its now just uacpi_kernel_get_nanoseconds_since_boot

#

surely u cant mess this one up

edgy pilot
#

yeah that's better

kind root
#

(well its not merged yet but soon)

kind root
#

which i shouldnt have done

#

because acpica interfaces suck ass

edgy pilot
#

Linux switching to uacpi in a year

kind root
#

imo implementation details must be handled by the library instead of coming up with r-worded interfaces

finite summit
edgy pilot
#

infy about to rewrite uacpi in C#

kind root
#

lol

#

c# has pretty good c interop soo

finite summit
#

When uacpi c# bindings

kind root
#

cosmos acpi impl is like manually doing strcmp on aml looking for _S5

#

so its hell

finite summit
#

Ah yes

#

Acpi interpreter

kind root
#

and its wrong anyway because _S5 can be a method returning a package instead of package directly

#

not to mention _PTS and stuff

molten grotto
#

that method is also detailed somewhere in the osdev forums

kind root
#

yeah thats where they got that from

wicked loom
kind root
#

this leads to stuff like that

kind root
wicked loom
#

i think it checks if it's a package and just fails if it isn't?

#

as in gracefully handled

kind root
#

as graceful as it gets yeah

wicked loom
#

i mean it's better than not checking at all

kind root
#
    outw(facp->PM1a_CNT_BLK, SLP_TYPa | (1 << 13));
    if (facp->PM1b_CNT_BLK)
        outw(facp->PM1b_CNT_BLK, SLP_TYPb | (1 << 13));

This will break on some hw too

#

u cant just write both at the same time since some hw breaks when that happens

#

u have to first write the sleep type, and only then the sleep bit

wicked loom
#

yeah idk

#

tldr do not use this, it's quite fragile

kind root
#

but yeah it does what it says on the tin

#

its a shutdown hack

kind root
wicked loom
#

a proper ACPI implementation is obviously a much better solution lol

kind root
#

for laptops idk, way less

wicked loom
#

i actually tested it on many machines of mine and i couldn't find any on which it didn't work (or appear to work, at least)

#

that said, it's obviously a limited sample

kind root
#

and u tested reboot after this shutdown right?

wicked loom
#

like, starting them up again? if so, yes

kind root
#

yeah, basically

#

its UB so ya know how it goes

#

sometimes it just works ™️

#

didnt even realize it was your project lol

elder shoal
kind root
#

thats the only part u can be confused about yes meme

#

but idk how to name it better

wicked loom
#

it's a literal disembodied hack that @vague mural helped me improve a little

#

not something i'd recommend anyone use

kind root
#

lol

#

nah its fine for casual use

#

like for quick testing or emulators

#

especially if u know it works on your specific hw

edgy pilot
#

@kind root #834060104143208487 message

kind root
#

bruh 💀

edgy pilot
#

yes

finite summit
#

Can you send a screenshot

#

Of le message

edgy pilot
finite summit
#

😭

#

That was me

#

As a joke

frigid cliff
surreal path
#

hi

#

sorry

#

im not in the mood

#

to work on nyaux today

#

a lot of horrible things happened

#

another attempt today happened

#

and i rlly dont feel like doing anything right now for today at least

#

im sorry

#

this keeps happening

#

but

#

yea.

#

its hard to be keeping myself stable anymore

#

its making it difficult to do anything atp

#

i did finish getting lapic working though

#

yesterday i did

#

ill push it later

frigid cliff
#

That’s okay, take a break

#

Also maybe try talking to someone

tender gorge
surreal path
#

hi

#

its been 2 days and i think im ready to come back

#

i feel much better

#

back to what we were doing

#

im gonna start writing the scheduler

#

🤞

tender gorge
surreal path
#

interesting

#

that testing the actual lapic code

#

gives this

#

one sec

#

now its page faulting

#

then 0xdf

#

tf

#

yea this is wheere things get difficult

#

with smp

#

oaky i know whats going on lol

#

47????

#

lollll

#

this makes no sense

#

WHY IS IT 47?

#

doing as asked

#

and oring it

#

should just

#

leave those other bits alone

#

ugh fine ill cast it into a uint8

#

AND IT DOESNT WORK

#

i dont understand?

surreal path
#

solved it

#

*sur_interrupt = 34 | (*sur_interrupt << 8);

#

wait

#

wait

#

wait

#

wait

#

wait

safe spireBOT
#
Anti-spam Message

Possible spam detected for user: linuxmaster2.0. Please contact a moderator to be unmuted.

plush hearth
desert haven
#

Lol

#

Even if it's your own thread, don't spam it

surreal path
#

okay

#

yea thats stupid ik

desert haven
#

Nice to see you back btw, I hope your health has improved since you were sick 🙂

surreal path
#

let me think of something

surreal path
#

yea

#

apic got disabled

#

yk

#

yea

plush hearth
#

you probably should be reading it, anding out the bits you don't need, then oring the vector and APIC enable instead of just writing to it

surreal path
#

solved it

#

lol

plush hearth
#

that's what I was trying to say to do

surreal path
#

i did it before u

#

ahahahaha

#

😎

surreal path
#

having some interrupt memes with isr stub 32

#

fun

#

i forgot my sleep meds

#

fuck

#

GUESS WHO ISNT SLEEPING

#

TIHSUG UYY

tawdry mirage
#

go to sleep

flat nymph
#

Sleep is for the weak (I slept for 3 hours today)

edgy pilot
#

smh amateurs

#

real men sleep no more than an hour a day

orchid dawn
#

even I can't do that, lol

#

I average around 4h

median goblet
#

Nevermind me, sorry

#

You fixed it

errant pawn
#

I need to eep around 10h a day

crystal scarab
#

eep

surreal path
#

AT THE SAME TIME

#

my gf decided she wanted to see

#

other people

#

bro had me crying all night instead

#

im done with girls bro

#

genuinely

#

so intead of useful debugging

#

i just had a puddle of tears

#

damn chat

#

chat i need to make progress

#

obos is making more progres

#

s

#

then im doing in a week

#

:ratge

#

😡

#

this is like

#

mac vs windows

#

obos vs nyaux

#

real

#

nyaux is windows real

finite summit
#

girlfriEND Girlfriends have an end
osdev has NO end