#Nyaux

1 messages Β· Page 56 of 1

edgy pilot
#

*schedule

flat nymph
#

which is 11 minutes long

surreal path
#

nvm

#

its not working??

#

seems like i need something for virtual

#

for it to actually work

#

it isnt actually doing any of the calls for some reason

#

nvm?

#

seems to be ub caused by not making write virtual

#

oopsie

edgy pilot
surreal path
#

yep

edgy pilot
#

mark them with override in the derived class

#

ret func(args) override

surreal path
#

ret?

edgy pilot
#

your return type bruh

surreal path
#

oh yeah mb

#

okay i set them as override

edgy pilot
#

that doesn't really do anything, it'll just throw an error if you're having skill issues during typing

#

just some good practice

#

I remember it helping me once

flat nymph
edgy pilot
#

it is

flat nymph
#

but that way the compiler is allowed to complain

edgy pilot
#

but if you mark one, you need to mark all of them

flat nymph
#

Bruh, I didn't read the message above

edgy pilot
#

and there needs to be a virtual method with the same type in the base class

flat nymph
#

I need to go to sleep

#

But clang complains if you don't have override

#

At least with my flags

edgy pilot
#

what flags would those be

flat nymph
#

I think GCC is more lenient?

cinder plinth
#

Don't think concepts can be used for thst

#

How I do it is just using a bunch of templates

edgy pilot
flat nymph
#

-Wall -Wextra

edgy pilot
#

clang doesn't complain with that

flat nymph
cinder plinth
flat nymph
#

Maybe

edgy pilot
#

you must have a method marked as override somewhere else

cinder plinth
edgy pilot
#

why not?

surreal path
#

im starting to like c++

#

😭

#

this is bad chat

edgy pilot
#

wow a language is actually good

#

who could have imagined

flat nymph
#

I'm doing this for my IPC

edgy pilot
#

those memes must be true though

cinder plinth
surreal path
#

anyways t-30 minutes for starship launch

#

gonna take a break to watch the stream

edgy pilot
#

*potential starship launch

surreal path
flat nymph
cinder plinth
#

But I don't think I really use them for formatting specifically, I abuse them in other parts tho

flat nymph
#

C++ stl decided to not have specification for that

surreal path
#

@tender gorge hug

flat nymph
tender gorge
#

love you /p

surreal path
#

love you too /p

flat nymph
surreal path
#

seriously

flat nymph
#

It just allows to do a lot of insanity

#

Which is cool I guess

cinder plinth
#

I really like C++ but there's definitely a lot of stuff to know about

flat nymph
#

Yeah, every day you learn something

surreal path
#

i like how easy everything went with classes

cinder plinth
#

There are lengthy wikipedia pages dedicated to very small aspects of the language

surreal path
#

tho there is a lot to learn

cinder plinth
#

Like SFINAE

surreal path
#

ive never done object orintered shit

#

ever

#

so its a little new

flat nymph
cinder plinth
#

Yes

#

It's an example

flat nymph
#

CRTP is cool

cinder plinth
#

Also I still don't really know what && is and what std::forward does

#

I just use it meme

surreal path
#

no idea what yall talking about but oki

flat nymph
cinder plinth
cinder plinth
#

No that's std::move!

edgy pilot
cinder plinth
#

Also don't forget std::launder

edgy pilot
#

that's for telling the compiler to not assume some sane assumptions about modification of data

#

like modifying a const variable

daring juniper
#

Clearly I do not know that much C++ lol, I'm barely understanding any of this

edgy pilot
cinder plinth
#

Even keywords you learn sometimes

#

Like mutable

flat nymph
#

inline is not inline

cinder plinth
#

That one I learned like last year

edgy pilot
flat nymph
#

I use it for my spinlocks

#

But maybe the methods should just be const?

edgy pilot
#

hm?

#

spinlock methods?

flat nymph
#

yeah

edgy pilot
#

well you could

flat nymph
#

like I would have a class, where I have a container and a spinlock

edgy pilot
#

it minimises the need for putting mutable everywhere

flat nymph
#

(or locks in general)

#

Yeah

flat nymph
#

which find things in containers

edgy pilot
#

why would you need a lock in a const method though?

edgy pilot
#

you could just strap an atomic on it

#

or well nvm me

flat nymph
#

it's not that easy

#

I mean you can probably make rust's mutex-like thing in C++ thonk

cinder plinth
#

This is probably the best piece of C++ madness I've written

edgy pilot
#

std::move(*this)

flat nymph
#

It's not that bad

cinder plinth
#

Yes

flat nymph
cinder plinth
edgy pilot
flat nymph
edgy pilot
flat nymph
cinder plinth
#

Yea it has a pretty rust-like interface

flat nymph
#

I'm waiting for pattern matching to be accepted into C++

edgy pilot
flat nymph
# flat nymph

This should maybe be std::forward now that I think of it?

edgy pilot
#

{ operator=(std::move(r)); }

flat nymph
edgy pilot
#

what it does is more clear

cinder plinth
#

std::forward would be used for passing it

edgy pilot
#

hmmm

#

yeah

flat nymph
#

but the operator takes a &&?

edgy pilot
#

std::move returns &&

#

iirc std::forward would return &&&&

#

yeah

cinder plinth
#

Move is clearer anyway since you're saying "this won't be used anymore"

edgy pilot
#

that's why I though move(*this) was strange lol

cinder plinth
cinder plinth
edgy pilot
#

is it?

cinder plinth
#

Well yea you're moving from the copy

edgy pilot
edgy pilot
cinder plinth
#

Yea but the remove ref would bring it to Right

edgy pilot
#

return type doesn't have remove_reference

cinder plinth
#

So it'd be back to Right&&

edgy pilot
#

huh

#

T = Right&&

cinder plinth
#

Yes

edgy pilot
#

T&& = Right&&&&

cinder plinth
#

std::forward would return right&&

edgy pilot
flat nymph
edgy pilot
#

lol

cinder plinth
edgy pilot
#

dw

#

I sometimes forget if ... goes on the left of && or right

#

Args &&...args

cinder plinth
#

I forgot why I even move(*this) but that isn't an uncommon pattern afaik

edgy pilot
#

you just get an rvalue from a reference

#

but doesn't forward do that

cinder plinth
#

Maybe both are right in this case?

edgy pilot
#

hmm well I believe both would do the same thing

cinder plinth
#

Average c++

edgy pilot
#

lol

surreal path
#

5 minutes launch

flat nymph
#

they're holding it (?)

edgy pilot
#

yes

thorn bramble
#

may i introduce you to managarm/frigg

supple robin
flat nymph
#

The solution to all C++ problems is just reimplementing the world KEKW

thorn bramble
#

the biggest cancer of c++ are the stl streams

#

simple solution, don't use them

#

containers are fine, except for lack of hash of pair/tuple

flat nymph
#

the containers are not fine because they throw

thorn bramble
#

they are okay for userspace programming

#

like if you're writing a regular ass userspace program then they are more than okay

flat nymph
#

I agree

#

But you can't use them in kernel

#

(I mean I had exceptions in my kernel)

#

(but still)

flat nymph
surreal path
#

rip booster

flat nymph
#

Rip ship

thorn bramble
#

i was more so talking about using them for file io

surreal path
#

crazy

#

i was working on fbdev but uhhh now ive been up for 24 hours

#

and i need sleep

#

yet i cannot sleep weirdly?

edgy pilot
#

my coding style was a bit "ew" when I wrote it though

thorn bramble
#

but frigg.. πŸ₯Ί

#

at least it has intrusive data structures :^)

cinder plinth
surreal path
#

what are we talking about

maiden ridge
frigid cliff
#

Felt

surreal path
ebon needle
surreal path
#

no not the info structs

supple robin
#

?

surreal path
#

they are kinda complicated idk how they work very well

supple robin
#

huh

#

they're like super simple

#

what do you have trouble with

surreal path
#

like idk what a pixel clock is or what sync is

supple robin
#

not relevant to you

ebon needle
supple robin
#

you don't have a vga card

#

also linux docs are really good for drm/fbdev

surreal path
#

where are they??

maiden ridge
surreal path
#

found them

surreal path
#

im guessing this explains how the red green and blue bits are formatted?

#

how is the limine framebuffer formatted

#

idrm

supple robin
#

doesn't matter

#

not compatible with linux

surreal path
#

huh?

supple robin
#

what huh

surreal path
#

whats not compatible with linux

supple robin
#

the limine fb struct

surreal path
#

ik

supple robin
#

what do you mean then

surreal path
#

i meant

#

like how are the bits formatted

#

for each pixel

#

ive never really did much framebuffer shit

#

ive slapped flanterm onto nyaux and called it a day

supple robin
surreal path
#

i see

#

what is the color mask shift and size fields for

thorn bramble
#

for masking and shifting the respective color components

supple robin
#

exactly

surreal path
#

okay makes sense

supple robin
#

(pixel & mask) >> shift = red_color

surreal path
#

so if bits were formatted like RRRGGGBBB

it would be

111000000 for red
etc etc

#

and shift would be like 6

thorn bramble
#

sure

surreal path
#

k makes sense

thorn bramble
#

u don't need to worry about these values yourself

#

you just pass them to userspace

#

and xorg does the magic

surreal path
#

okay

thorn bramble
#

or whatever else you're porting

surreal path
#

im porting doom

#

lol

thorn bramble
#

lol fair

#

doom probably doesn't care

median goblet
surreal path
#

atp i might move to kde

#

hyprland is not working with steam

#

thats a deal breaker

maiden ridge
cinder plinth
maiden ridge
#

^

median goblet
#

The code

maiden ridge
#

Iirc

#

I figured out the issue later

#

Neptune was doing some bit manip which returned the incorrect result at times

#

So fixing that it worked

median goblet
#

nice

surreal path
#

using kde is better

#

usable + works

#

and ram usage isnt too crazy

#

6gb with firefox discord and alacritty open and screensharing with audio on walyand

edgy pilot
#

(with no startup programs of course)

ebon needle
surreal path
#

i had a not good day today so im not gonna do anything today

#

maybe later

edgy pilot
#

me everyday:

surreal path
#

cooked fried boiled

#

literarly cannot do shit

#

computer has become so unusable

#

if installing artix no workie

#

going back to windows cant deal with this shit no more chat

quick quiver
#

Just install fedora, debian, ubuntu, whatever

surreal path
#

nothing works

#

arch trolling me

#

so im reinstalling with artix

#

i dont like fedora, debian is debian, ubuntu is ubuntu

daring juniper
#

I wanna try arch at some point

supple robin
#

tumbleweed

tawdry mirage
#

install gentoo

surreal path
#

do not suggest gentoo qookie

#

i swear

#

bro

#

ofc

supple robin
#

bro is doing anything but trying opensuse 😭

surreal path
#

i tried in a vm

supple robin
#

"what is a stable system"

tawdry mirage
supple robin
surreal path
#

wtf

#

lol

#

yo qookie we uhh

#

might wanna cut down on the furry yk

tender gorge
#

to be fair, i used to own racist.monster

surreal path
#

thats crazyyyyy

#

blud is czapek

tawdry mirage
#

i don't own that domain for the record

#

just a gif i have in my gif picker

#

(and inb4 yes the url is a part of the joke)

surreal path
#

marvin just told me

#

symbols have size

#

too

#

so we can make nyaux's stacktrace wayyyy bettterrrr

#

ready to boot into artix

median goblet
surreal path
#

im sick

mossy belfry
surreal path
#

still no audio

#

wrong channel

surreal path
#

better nyaux stacktraces coming ur way

#

thanks to @supple robin for telling me st_size exists

tawdry mirage
edgy pilot
surreal path
#

yep

edgy pilot
surreal path
#

ik

ebon needle
surreal path
#

no

edgy pilot
#

it's not just because they felt like it

#

you can't use many features that depend on it with exten "C"

surreal path
#

i want kitty

edgy pilot
surreal path
#

i want cat

edgy pilot
surreal path
#

crazy

ebon needle
surreal path
#

gregory

#

u need to vent

#

oi lads, back with animations
and today Freddy explains why Gregory will get zero beetches
some sort of a fashion review made by Glamrock Freddy
and Gregory gets ratio, screenshoted, don't care, didn't ask, zero beetches and etc.

Enjoy the video!

make sure to subscribe to my channel and hit a bell button to get the notified about new videos!
...

β–Ά Play video
ebon needle
tawdry mirage
#

is that an alias or does bat drop all the waterworks if output is not a tty

tawdry mirage
#

ah

#

ig that makes sense, not sure why i assumed it wouldn't be

thorn bramble
#

it does drop all the fancy stuff if output isn't a tty too

thorn bramble
#

i don't get it

surreal path
#

play deltarune and youll get it

thorn bramble
#

nah thanks

surreal path
#

missing out

thorn bramble
#

if you say so

surreal path
#

implementing kvm clock for nyaux even tho im sick lesgo

mossy belfry
#

incredible

surreal path
#

no

#

im getting kvm clock

mossy belfry
#

oh

surreal path
#

for better timer shit

mossy belfry
#

oh that boring 😞

surreal path
#

not really

mossy belfry
#

good luck πŸ‘

surreal path
#

is fun meme

#

i like timers

#

they funny

mossy belfry
#

why not use rtc

surreal path
#

ew

mossy belfry
#

😒

surreal path
#

isnt that slow as balls

mossy belfry
supple robin
#

rtc is not a timer

mossy belfry
#

got confuse

supple robin
#

imagine using the rtc for timing

mossy belfry
#

would be wild ngl

surreal path
#

im rewrinting my entire timer stack

#

everything is hard coded so

#

im fixing this

surreal path
#

FINALLY

#

GOT IT WORKING

#

HOLY SHIT

#

IM SUCH AN IDIOT SOMETIMES

#

i lit did (hpet_virt_addr + 0xF0)

#

but it was a fucking uint64_t*

#

so its adding 0xF0 * sizeof(uint64_t)

#

now we have a generic timer thing

#

cool beans

surreal path
#
static inline bool checkkvmvendor() {
  uint32_t ecx, edx, ebx, eax;
  cpuid(0x40000000, 0, &eax, &ebx, &ecx, &edx);
  uint32_t reg[3] = {ebx, edx, ecx};
  uint32_t matching[3] = {0x4b4d564b, 0x4d, 0x564b4d56};
  for (int i = 0; i < 3; i++) {
    kprintf("comparring 0x%x with 0x%x\r\n", balls[i], matching[i]);
    if (reg[i] == matching[i]) {
      continue;
    }
    // else {
    //   return false;
    // }
  }
  return true;
}

does anyonr know why cpuid is returning garbo data?
comparring 0x0 with 0x4b4d564b
comparring 0xffffffff with 0x4d
comparring 0x80035220 with 0x564b4d56

#

im running it in kvm obviously

ebon needle
#

i getting normal values from cpuid

surreal path
#
static inline bool cpuid(uint32_t leaf, uint32_t subleaf, uint32_t *eax,
                         uint32_t *ebx, uint32_t *ecx, uint32_t *edx) {
  uint32_t cpuid_max;
  asm volatile("cpuid"
               : "=a"(cpuid_max)
               : "a"(leaf & 0x80000000)
               : "rbx", "rcx", "rdx");
  if (leaf > cpuid_max) {
    return false;
  }
  asm volatile("cpuid"
               : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
               : "a"(leaf), "c"(subleaf));
  return true;
}

this is what it looks like

ebon needle
#

try this

inline void __cpuid(int code, int code2, uint32_t *a, uint32_t *b, uint32_t *c , uint32_t *d) {
    __asm__ volatile("cpuid":"=a"(*a),"=b"(*b),"=c"(*c),"=d"(*d):"a"(code),"c"(code2));
}
ebon needle
#

why you printing balls[i]

#

when you need to print reg[i]

surreal path
#

i changed it to be

#

more um

#

less stupid varialbe name

#

its not actually that in the code

#

it works???

#

weirdly

#

lol

#

thanks

thorn bramble
#

it only works with with the regular leaves

brisk zenith
#

and because you don't check for failure the code goes ahead with the garbage that was in the uninitialized locals

crystal scarab
#

cant you just use the __get_cpuid from cpuid.h?

brisk zenith
#

that has the same issue

edgy pilot
ebon needle
#

when nyaux hyfetch port galaxybrain

thorn bramble
edgy pilot
#

because I have very similar code and it seems to work

#

I think (about the similarity) (because it definitely works)

thorn bramble
#

i believe kvm, hyperv and others use that for identification and hypervisor specific stuff

#

and his code work wont because he calls cpuid with eax=0x4000’0000&0x8000’0000

#

i actually dont know what that returns exactly

edgy pilot
#

ah
I just do 0x8000etc for max leaf check

thorn bramble
#

but its definitely not right

#

ah lol

ebon needle
#

real sigmas don't do checks and blame userspace for all errors

edgy pilot
ebon needle
surreal path
#

hi i woke uo

gray hill
#

i feel like i'm in an oven

#

lol

surreal path
#

working on pvclock for nyaux

#

which is just kvmclock v2

#

lol

#

whats crazy is that pmm init isnt taking forever suddenly

#

nyaux boots in like 3 seconds??? from kernel to userspace????

#

wtf????????????

#

idk what i did but

#

nice

#

im still sick

#

so

#

yea

#

:c

surreal path
ebon needle
#

what is your cpu

surreal path
#

its the same its always been

#

i7 13700h

surreal path
#

question about pvclock

#

do i have to shifit the physical address

#

or do i not

surreal path
#

thats stupid whoops

#

uacpi: time source backwards drift detected, this may cause problems?????

#

oh wait im opid

#

okay somethings wrong

#

my code

#
pvclock::pvclock() {
  // as pvclock is a x86_64 only feature we can assume shit here so its fine :3
  // verify we actually HAVE tsc
  uint32_t eax, edx, ebx, ecx;
  cpuid(1, 0, &eax, &ebx, &ecx, &edx);
  if (!(edx & (1 << 4))) {
    panic("okay so no tsc = die");
  }
  // pvclock is per cpu :c
  struct per_cpu_data *vcpu = arch_get_per_cpu_data();
  // listen, kvm wants a full page. because of the way it handles it. so heres
  // what we do, directly call pmm alloc
  uint64_t addr_of_page = (uint64_t)pmm_alloc();
  memset((void *)(addr_of_page), 0, 4096);
  vcpu->arch_data.pvclock = (struct pvclock_vcpu_time_info *)(addr_of_page);

  wrmsr(0x4b564d01,
        ((addr_of_page - (uint64_t)hhdm_request.response->offset) | 1));
  kprintf_log(TRACE, "pvclock has now inited lol\r\n");
  kprintf_log(TRACE, "pvclock version %u\r\n",
              vcpu->arch_data.pvclock->version);
}
size_t pvclock::get_ns() {
  struct per_cpu_data *vcpu = arch_get_per_cpu_data();
  struct pvclock_vcpu_time_info *info = vcpu->arch_data.pvclock;
  size_t time = rdtsc() - info->tsc_timestamp;
  if (info->tsc_shift >= 0) {
    time = time << info->tsc_shift;
  } else {
    time = time >> -info->tsc_shift;
  }
  time = (time * info->tsc_to_system_mul) >> 32;
  time = time + info->system_time;
  return time;
}
size_t pvclock::get_us() { return get_ns() / 1000; }
int pvclock::stall_poll_ms(size_t ms) {
  size_t nanosecondsrnlol = get_ns();
  kprintf_log(TRACE, "nanoseconds lol %lu\r\n", nanosecondsrnlol);
  return -1;
}
brisk zenith
#

looks good to me, the only thing i can think of is that the info is getting updated in the middle of a read and because you don't check version you're using stale values

#

reading the values and the rdtsc is all supposed to be done in a seqlock on version

surreal path
#

check version?

#

huh?

#

im big stupid

brisk zenith
#

this is what i do

surreal path
#

what is info here

#

oh right

#

whats with the atomic load tho

#

for version

brisk zenith
#

if you don't use atomics things can get reordered out of the seqlock

#

or theoretically the new_version load can get reordered before the version load

#

like the docs don't describe it as such but this is essentially a lock and you have to treat it like one

surreal path
#

is that what u mean?

brisk zenith
#

or the processor itself but yes

surreal path
#

makes sense

brisk zenith
#

(and also without atomics the compiler will assume the check is always true as nothing in between writes to version)

surreal path
#

cooked

brisk zenith
#

(and without atomics the compiler is allowed to use split loads, i.e. load part of the value in one instruction and another part in another)

#

i use __attribute__((packed, aligned(8))) for my kvmclock_info_t

surreal path
#

makes sense

#

that works

#

lets see if this works now

#

still not working

#
size_t pvclock::get_ns() {
  struct per_cpu_data *vcpu = arch_get_per_cpu_data();
  struct pvclock_vcpu_time_info *info = vcpu->arch_data.pvclock;
  uint32_t version = __atomic_load_n(&info->version, __ATOMIC_ACQUIRE);
  uint64_t tsc_value, tsc_timestamp, system_time;
  uint32_t tsc_to_system_mul;
  int8_t shift;
  for (;;) {
    if ((version & 1) == 0) {
      tsc_timestamp = info->tsc_timestamp;
      system_time = info->system_time;
      tsc_to_system_mul = info->tsc_to_system_mul;
      shift = info->tsc_shift;
      tsc_value = rdtsc();
    }
    uint32_t new_version = __atomic_load_n(&info->version, __ATOMIC_ACQUIRE);
    if (((version & 1) == 0) && new_version == version) {
      break;
    }
    version = new_version;
  }
  size_t time = tsc_value - tsc_timestamp;
  if (shift >= 0) {
    time = time << shift;
  } else {
    time = time >> -shift;
  }
  time = (time * tsc_to_system_mul) >> 32;
  time = time + system_time;
  return time;
}

all i changed

brisk zenith
#

what does your rdtsc() look like?

surreal path
#
static inline size_t rdtsc() {
    uint32_t low = 0;
    uint32_t hi = 0;
    __asm__ volatile("rdtsc" : "=a"(hi), "=d"(low));
    __asm__ volatile("lfence"); // wait until rdtsc completed
    // explained by sdm go read the manual lol
    return (size_t)((uint64_t)hi << 32);
  }
#

wait

#

LMAO???

#

😭

brisk zenith
#

ah yes, rax:rdx

#

instead of rdx:rax

#

oh and ignoring low

surreal path
#

THE SPEED INCREASE IS CRAZY

#

THATS

#

1MILLION RIGHT?

#

yea 1.1 m ops

#

@kind root

#

1.3m ops now

#

its consisently getting 1.3-1.4m ops

#

lesgooo

#

anyways cool kvmclock is implemented

ebon needle
#

it

surreal path
#

kvmclock

ebon needle
#

and where you used it

surreal path
#

huh?

#

its not on the git yet

#

i didnt push

ebon needle
surreal path
#

its cpu host

ebon needle
#

this is the highest ops per second for your cpu ?

surreal path
#

on my kernel? yes

#

i used to get 900k

ebon needle
surreal path
#

k hold on lemme build it for u

ebon needle
surreal path
#

is uploading

#

git are u fucking braindead

#

it was too big to upload here

#

make sure u run with -M q35

#

and -m 512M at least

desert haven
#

lol I see limewire has rebranded

surreal path
#

the initramfs needs some memory to be loaded in

ebon needle
#

nothin

surreal path
#

turns out having a sysroot is huge

#

try this

ebon needle
#

443 mb

#

πŸ’€

surreal path
#

yea

ebon needle
surreal path
#

guessing ur cpu is slower

ebon needle
#

ryzen 5 3600 chad

surreal path
#

oh yeah input is via serial

surreal path
ebon needle
#

yeah

surreal path
#

even my intel laptop cpu can beat it

ebon needle
surreal path
#

yogurt

#

gurt: yo

#

git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: .clang-format
modified: kernel/src/acpi/acpi.c
modified: kernel/src/acpi/kernelapi.c
modified: kernel/src/arch/arch.c
modified: kernel/src/arch/arch.h
modified: kernel/src/arch/x86_64/cpu/lapic.c
modified: kernel/src/arch/x86_64/cpu/structures.h
modified: kernel/src/arch/x86_64/instructions/instructions.h
modified: kernel/src/term/term.c
modified: kernel/src/term/term.h
modified: kernel/src/timers/hpet.cpp
modified: kernel/src/timers/hpet.hpp
new file: kernel/src/timers/pvclock.cpp
new file: kernel/src/timers/pvclock.hpp
modified: kernel/src/timers/timer.cpp
modified: kernel/src/timers/timer.hpp
modified: kernel/src/utils/basic.h

❯ git push
Enter passphrase for key '/home/anon/.ssh/id_rsa':
Everything up-to-date

#

blud

#

ok works now

kind root
ebon needle
edgy pilot
tender gorge
edgy pilot
#

(sometimes)

tender gorge
#

managarm be like:

edgy pilot
#

(I've encountered the issue before)

tender gorge
#

uint64_t * uint64_t time

#

(crashes every 7 hours)

edgy pilot
#

:P

edgy pilot
brisk zenith
#

so i do that calculation using u128 arithmetic

gray hill
edgy pilot
#

593 πŸ’€

gray hill
#

lol

edgy pilot
#

@surreal path you should probably be pinged about this

surreal path
#

oh wait

#

that image

#

lol

surreal path
edgy pilot
#

fair?

surreal path
#

meaning yes i should

ebon needle
#

gray is ugly

thorn bramble
#

white is for bold text

ebon needle
surreal path
#

im dying

#

from the sickness

edgy pilot
#

I am sick too death

ebon needle
ebon needle
#

why all my minecraft hardcore targets is sick

snow wolf
surreal path
#

plus i dont plan to support 64 bit

#

and size_t just seems nice

#

it just feels right

edgy pilot
surreal path
#

yes

#

wait

#

what did i just say

#

πŸ’€

#

I MEANT 32 bit

kind root
#

at least make it a uint64_t

surreal path
#

nah

#

make me

edgy pilot
surreal path
median goblet
#

your file offsets are also size_t

surreal path
#

yes

#

i think

edgy pilot
#

no off_t?

median goblet
#

just make it uint64_t

surreal path
#

amazing commit message

#

yes ive comfirmed it

#

files have uint64_t offset

#

or well

#

file descriptor

#

handles

#

yk what i mean

broken depot
#

you ci fail reminds me that I also need to fix my ci fail lol

broken depot
edgy pilot
#

you guys have ci?

surreal path
#

i have shitty ci

#

that only builds the kernel

#

thats it

#

no sysroot

#

im too lazy to get jinx working

edgy pilot
#

probably for the best

surreal path
#

and i do not wanna bother mint to get it working lol

edgy pilot
#

you'll just waste free minutes

surreal path
#

^

#

waste precious time working on nyaux

edgy pilot
#

not your time

#

github time

surreal path
#

if it builds for my machine it should build for you memedown

edgy pilot
#

workflows aren't unlimited

surreal path
#

morin

#

still sick as shit

edgy pilot
#

same

edgy pilot
#

real

surreal path
#

hi guys

#

im feeling better

#

we should get back to nyaux dev soon

ebon needle
surreal path
#

fbdev

#

and then signals

#

and then sockets

#

and then xorg

edgy pilot
surreal path
#

yea

#

didnt finish it lol

edgy pilot
#

it's just a struct

surreal path
#

ik

ebon needle
surreal path
#

no

ebon needle
surreal path
#

no idea how that works :c

#

that is gonna be pain to implement

ebon needle
#

nah just map file content to process ram

#

or your fb address

surreal path
#

i had a dream

#

where a guy bought nyaux source code for 5$

crystal scarab
#

Lmfao

tawdry mirage
#

best i can do is three fiddy

ebon needle
mossy belfry
#

we got xorg before disk drivers πŸ’₯

elder shoal
#

how is nyaux nyaxuing

surreal path
#

just got out of being sick

#

so

#

nyaux will be nyauxing today

elder shoal
surreal path
#

no trl

#

make me like furries and gay somehow then maybe

elder shoal
broken depot
surreal path
#

bro made me into czzpek

broken depot
#

I have no idea what "czzpek" is πŸ‘

surreal path
thorn bramble
#

😭

surreal path
surreal path
#

alright lets cook

#

lets start by getting frigg to link againist nyaux

glossy walrus
ebon needle
glossy walrus
#

when nvidia modeset support

ebon needle
surreal path
#

what

supple robin
#

nyaux needs a job

surreal path
#

thats crazy

maiden ridge
rich trellis
surreal path
#

okay so

#

why does bash die

#

when launching doomgeneric

#

ive implemented fbdev

#

do u guys know whats going on with that??

#

like the bash process doesnt die

#

but it doesnt show a prompt nor accept input anymore

#

ill dbg this tmrw i feel sick in my stomach rn

coral dove
surreal path
coral dove
#

Okay well see what the instruction pointer is in that state

#

Addr2line?

surreal path
#

im triyng to

#

right so doomgeneric spawns another thread of itself

#

it does stuff

#

kills that thread

#

kills itself

#

but bash still runs

#

now how it somehow made bash stop working is crazy

#

no it did not kill serial put input

#

yea i have no idea whats going on nooo

#

atexit is not calling the function cleanup somehow

#

thats the issue

#

anyways back to eeping

ebon needle
surreal path
#

its not working

#

weirdly

ebon needle
surreal path
#

because doom doesnt retore the original tty state

#

meaning the tty is probs in non interactive mode or some shit

#

whatver doom configured it to

ebon needle
#

maybe restore state in syscall exit ?

surreal path
#

i do ofc?

#

thats not the issue here

#

the issue is that atexit doesnt call the callback function

#

now i dont know how that works in the internals of mlibc but im sure that is related to a missing sysdep or some kind of bug in my kernel

#

does atexit work for orange @ebon needle u can test this by writing a small program that uses it

ebon needle
#

how

surreal path
#

you can just make a recipe for ur own program

#

that gets compiled then installed into ur sysroot

#

see ttytest recipe in nyaux

ebon needle
surreal path
#

honestly

#

just give it the function name

ebon needle
#

i cant compile my os because codeberg is died

#

@surreal path it doesnt works too 😭

#
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <termios.h>

struct termios orig_termios;

void disableRawMode() {
    printf("got atexit\n");
    tcsetattr(STDIN_FILENO,TCSAFLUSH,&orig_termios);
}

void enableRawMode() {
    tcgetattr(STDIN_FILENO, &orig_termios);
    atexit(disableRawMode);
    struct termios raw = orig_termios;
    raw.c_lflag &= ~(ICANON);
    raw.c_cc[VMIN] = 1;
    tcsetattr(STDIN_FILENO,TCSAFLUSH,&raw);
}

int main() {
    enableRawMode();
    printf("enter any key to continue\n");
    char key;
    read(STDIN_FILENO,&key,1);
}
surreal path
#

yea so this may be a think that mlibc wants

#

like some sysdep

#

or something

#

now i couldnt verify this but maybe someone more knowledgable in mlibc internals could

#

im also gonna verify that doomgeneric actually REACHES exit

thorn bramble
#

atexit is not a sysdep

#

it should in fact already work

#

so if it doesn't go figure out why

#

__mlibc_do_finalize is implemented in options/lsb/generic/dso_exit.cpp and it's called from exit in options/ansi/generic/stdlib.cpp

#

the code is really simple and, as i said, it should just work as is

surreal path
#

i think its not actually reaching exit

#

it may be stuck somewhere

surreal path
#

its not nyaux's fault it seems

#

in I_Error()

surreal path
#

i patched doomgeneric to just properly exit if nyaux is defined

#

works fine now

median goblet
surreal path
#

weird issue hm

surreal path
#

epic

tawdry mirage
#

chex.wad

surreal path
#

chex.wad

#

hacx.wad

tawdry mirage
#

i wonder if doom-generic actually has support for chex quest

#

since iirc it has custom things

surreal path
#

random question

#

i might just throw it in nyaux

#

for shits and giggles

median goblet
#

they probably assume exit doesnt exist

tawdry mirage
surreal path
surreal path
#

SO CLOSE

surreal path
#

the pixels doomgeneric are sending in are RGBA

#

this is hard coded

#

for some fucking reason

#

and i have no idea how to convert the pixels on the fly in a reasonably and non slow way

#

doomgeneric should respect the format i tell it but no

#

like genuinely why even print the framebuffer shit when its all fucking hard coded

#

even the bpp is hard coded

#

☠️

#

also i dont know why it didnt choose the top of the screen but

#

idfk

#

i may need help with this cause i do not know how to do this reasonably so anyone who has ported doomgeneric please tell me what i should do that wouldnt be a shit and slow as balls solution

quick quiver
#

you can also port qookie's mini-lspci but that requires sysfs ;D

brisk zenith
#

ah in I_InitGraphics

#

honestly i'd just patch it to not hard code it

surreal path
#

doomgeneric just

#

doesnt care

#

😭

brisk zenith
#

then i don't think that's the issue

surreal path
#

i dont think theres much of an issue with the implementation of nyaux's fbdev either, because ive checked the values it gives to userspace and they do look sane

brisk zenith
#

what are those values?

surreal path
#

hold on ill add back prints to show

#

thats the values @brisk zenith

brisk zenith
#

that does look sane yeah but it also matches what doom's printing

#

and besides the pattern isn't really what i would expect from those parameters being wrong

surreal path
#

yea

#

for more context this is what my write and read functions for fbdev look like

size_t read(thefunny) override {
    size_t end = epicfb->pitch * epicfb->height;
    if (offset >= end) {
      *res = EINVAL;
      return -1;
    }
    if (size + offset > end) {
      size = end - offset;
    }
    void *calculated_dest = reinterpret_cast<void *>(
        reinterpret_cast<uint64_t>(buffer) + static_cast<uint64_t>(offset));
    memcpy(
        reinterpret_cast<void *>(reinterpret_cast<uint64_t>(calculated_dest) +
                                 reinterpret_cast<uint64_t>(offset)),
        epicfb->address, size);
        *res = 0;
    return size;
  }
  size_t write(thefunny) override {
    size_t end = epicfb->pitch * epicfb->height;
    if (offset >= end) {
      *res = EINVAL;
      return -1;
    }

    if (size + offset > end) {
      size = end - offset;
    }
    void *calculated_dest = reinterpret_cast<void *>(
        reinterpret_cast<uint64_t>(buffer) + static_cast<uint64_t>(offset));
    memcpy(
        reinterpret_cast<void *>((static_cast<char*>(epicfb->address)) +
                                 static_cast<uint64_t>(offset)),
        calculated_dest, size);
        
        *res = 0;
    return size;
  }
  int ioctl(void *data, unsigned long request, void *arg,
            void *result) override {
    switch (request) {
    case FBIOGET_VSCREENINFO: {
      *static_cast<fb_var_screeninfo*>(arg) = variablefbinfo;
      *(void**)result = 0;
      return 0;
      break;
    }
    case FBIOGET_FSCREENINFO: {
      *static_cast<fb_fix_screeninfo*>(arg) = fixedfbinfo;
      *(void**)result = 0;
      return 0;
      break;
    }
    default:
      kprintf_log(ERROR, "fbdev(): unknown ioctl\r\n");
      break;
    }
    return ENOSYS;
  }
#

thefunny is a marco

#

just this

brisk zenith
#

ah you're doing it with read/write not mmap

#

that makes things simpler

#

(also imo read shouldn't be allowed on fbs but that's unrelated)

surreal path
#

astral allows it

brisk zenith
#

WC memory is not architecturally guaranteed to be coherent

#

aka on some cpus this assertion would trip even without any race conditions ```c
*fb = 0xabcdef;
assert(*fb == 0xabcdef);

surreal path
#

i see

brisk zenith
#

this is because wc was originally as implemented as uc with the buffering being completely separate from the regular cache layer

#

so you could get a read to go through to the actual framebuffer memory before the buffered writes are committed

surreal path
#

even after patching the shit to look correct

#

still looks wrong

#

weirdly

brisk zenith
surreal path
#

in read?

brisk zenith
#

in both

surreal path
#

memcpy for nyaux is dest, src

brisk zenith
#

you're doing memcpy(fb->address + offset, buffer + offset, size)

surreal path
#

also good point

brisk zenith
#

it should be memcpy(fb->address + offset, buffer, size)

surreal path
#

yea

#

alright moment of truth

#

that is new

#

interesting

#

well

cinder plinth
surreal path
#

considering thats the entry point that rip looks like garbage @brisk zenith

#

either that or its in the libc

#

it is probs in the libc somewhere

#

looks like /lib/libm.so

cinder plinth
#

What'd you change

surreal path
#

just did the fix monkuous suggested

#

and patched the format to be correct for nyaux

cinder plinth
#

Don't think you need to patch

#

I didn't have to

surreal path
#

lucky ig

brisk zenith
cinder plinth
#

It's not luck I'm just pretty sure it can detect the framebuffer format

surreal path
#

i am checking hold on

surreal path
#

its hard coded lol

brisk zenith
#

it's hard coded in I_InitGraphics

cinder plinth
#

Huh

surreal path
#

found the real rip

#

243E03

#

lets objdump libm

brisk zenith
#

it just matches the format limine uses on qemu and most hardware

cinder plinth
#

Yeah that's what I figured

surreal path
#

wha

#

wtf

#

is lib/libm not real

#

yall know ??

supple robin
surreal path
supple robin
#

it's a dummy

brisk zenith
#

the functions libm needs to provide are provided by libc

surreal path
#

right

brisk zenith
#

libm still needs to exist though so it's just an empty shared lib

cinder plinth
#

It never was real, it's just a bunch of numbers on your computer!

surreal path
#

i will look for the instruction

supple robin
#

what?

surreal path
#

im looking for the instruction it faulted?

supple robin
#

do you know what a relocation is

surreal path
#

well i know it exists

brisk zenith
#

i don't really trust that rip value

surreal path
#

yea idk

#

only shit i can find similar

#

in siginterrupt

cinder plinth
#

Doubt that's what faulted

surreal path
#

yea

cinder plinth
#

You're at the wrong rip

#

You need to relocate manually by adding the base address

surreal path
#

to the rip?

#

??

#

to get the real rip?

#

wha

supple robin
#

libraries are loaded at an offset

#

dynamic ones at least

surreal path
#

yes i know this

#

that is why i subtracted the rip on the address mlibc loaded "libm" at

surreal path
supple robin
#

libm is empty

surreal path
#

right ill check where it loaded libc

#

looks better

#

looks better

#

interesting

#

0000000000043dc0 <_ZN5mlibc11strncasecmpEPKcS1_m>:

#

seems to be in strcasecmp

#

i can try and get the parameters it loads

thorn bramble
#

just look at the source code

surreal path
#

for strncasecmp?

thorn bramble
#

no

#

where it’s called

surreal path
#

good point

thorn bramble
#

also, didn’t it just start happening after you changed stuff in fbdev?

#

lol

surreal path
#

yea

#

interesting? printing cook in R_CheckTextureNumForName doesnt cause it to gpf ???????

#

it just gets stuck here

#

tf is happening

#

i removed it

#

and its still stuck??

#

nvm i know why

#

fixed that

#

printing in R_InitSpriteDefs in doomgeneric doesnt cause the general protection fault but it does the same thing getting stuck with init status bar

#

printing anything at all in R_InitSpriteDefs just gets it stuck

#

i pushed everything to github if anyone wants to also take a look

#

dunno why its commiting .cache even tho i have that in my gitignore but k

surreal path
#

still no clue whats happening

#

I FIXED IT

#

@kind root look at this shit

kind root
surreal path
#

do you know whats crazy

brisk zenith
surreal path
#

i was copying shit to the buffer + offset in write from buffer + offset

#

πŸ’€

#

that was the issue lol

cinder plinth
surreal path
#

no input

#

as i dont have ps2

#

implemented

cinder plinth
#

how do you type commands then

surreal path
#

serial input

cinder plinth
#

well you could just use that

surreal path
#

i could

#

@thorn bramble waiting for u to say "no ps2?"

thorn bramble
#

no ps2?

kind root
surreal path
#

weirdly this happened

#

i cannot seem to get it to be reproducable

#

@brisk zenith could this be related to why one of ur machines couldnt boot nyaux?

brisk zenith
#

no idea

surreal path
#

that is quite weird

#

also ive noticed that when launching doom it doesnt really look like its being animated?

#

i cannot verify this as no input

#

also the rip is a heckin

#

address that isnt code??????

#

no it is

#

nvm

#

and cr2 is memory

#

nvm

#

weird it died checking the us variable ?

surreal path
# surreal path fuck

that looks like a valid address tho?? how did this happen???? did the thread somehow unmap its process structure wtf