#uDRM - a portable Direct Rendering Manager

1 messages · Page 2 of 1

maiden birch
#

good idea

tawdry trench
#

i'm lost

robust abyss
#
#ifndef __UAPI_PCI_H__
#define __UAPI_PCI_H__

#ifndef UAPI_NEEDS_PCI
#error u dont need me
#endif

#endif
#

even tho even tho

#

I guess agragtor header is a bit nicer

#

since you can in your kernel_api.h do the defines and then include

maiden birch
#
#ifndef UAPI_PCI_VERSION
#define UAPI_PCI_VERSION 1
#endif

#if UAPI_PCI_VERSION != 1
#error uAPI headers mismatch, make sure all libraries are using the same version
#endif

@tawdry trench thoughts?

robust abyss
#

ok I talked myself into the agragator header design ngl

maiden birch
maiden birch
#

Marvin did we lose u or

robust abyss
#

just ignore everything I said

tawdry trench
#

uhhhhhhhhhhhhhhhhhhhhhhh

maiden birch
#

Here's a summary:

  1. a u project layout
|- include
    |- udrm
        |- internal
            |- {uAPI module}
        |- kernel_api.h
  1. kernel_api.h header aka the aggregator
$ cat include/udrm/kernel_api.h
#define UAPI_WANTS_MEMORY
#include <udrm/internal/uapi/memory.h>

#define UAPI_WANTS_PCI
#include <udrm/internal/uapi/pci.h>

#define UAPI_WANTS_IRQ
#include <udrm/internal/uapi/irq.h>
  1. an api header
#ifndef UAPI_PCI_VERSION
#define UAPI_PCI_VERSION 1
#endif

#if UAPI_PCI_VERSION != 1
#error uAPI pci.h mismatch, make sure all libraries are using the same version
#endif

#ifndef UAPI_PCI_INCLUDED
#define UAPI_PCI_INCLUDED

#ifndef UAPI_WANTS_PCI
#error pci.h header included but not actually needed
#endif

void pci_idk();

#endif
tawdry trench
#

what's the UAPI_*_INCLUDED for

maiden birch
#

it can be dropped ig

robust abyss
#

I think the kernel_api.h I would make would be more like ```c
#define UAPI_WANTS_MEMORY
#define UAPI_WANTS_PCI
#define UAPI_WANTS_IRQ
#include <udrm/internal/uapi/uapi.h>

maiden birch
#

so one giant header?

robust abyss
#

the included is the include guard no?

maiden birch
#

yeah but we dont need it

#

since duplicate declarations are fine

tawdry trench
#

just use this as include guard

robust abyss
maiden birch
#

fair

robust abyss
#

so you don't need to include all the headers manually

maiden birch
#

do we drop the include guard

robust abyss
#

of the WANTS_PCI?

#

inside the pci.h

#

probably

#

or well

maiden birch
#

UAPI_PCI_INCLUDED

#

this

robust abyss
#

oh that one

#

hmmmm

maiden birch
#

it doesnt hurt i guess but its useless

robust abyss
#

its a bit cleaner to have it seprate

maiden birch
#

what if we have constants or enums or stuff

#

can that also be duplicate

robust abyss
#

structs can't

maiden birch
#

yeah then the guard must be kept nvm

robust abyss
#

yeah you must guard

maiden birch
#

anyway let me redo the summary

#

Here's a summary:

  1. a u project layout
|- include
    |- udrm
        |- internal
            |- {uAPI module}
        |- kernel_api.h
  1. kernel_api.h header aka the aggregator
$ cat include/udrm/kernel_api.h
#define UAPI_WANTS_MEMORY
#define UAPI_WANTS_PCI
#define UAPI_WANTS_IRQ
#include <udrm/internal/uapi/uapi.h>
  1. uapi.h header
#ifdef UAPI_WANTS_MEMORY
#include "memory.h"
#endif

#ifdef UAPI_WANTS_PCI
#include "pci.h"
#endif
...
  1. an api header
#ifndef UAPI_PCI_VERSION
#define UAPI_PCI_VERSION 1
#endif

#if UAPI_PCI_VERSION != 1
#error uAPI pci.h mismatch, make sure all libraries are using the same version
#endif

#ifndef UAPI_PCI_INCLUDED
#define UAPI_PCI_INCLUDED

#ifndef UAPI_WANTS_PCI
#error pci.h header included but not actually needed
#endif

void pci_idk();

#endif
#

do we agree as far as this is concerned

robust abyss
#

looks good

tawdry trench
#

looks good

maiden birch
#

nice

maiden birch
#

now we have the harder job of working on the apis and carefully splitting them into headers

tawdry trench
robust abyss
#

#include "uacpi/kernel_api.h"

#

:^)

maiden birch
#

so im thinking:

  1. malloc.h -> malloc/calloc/free
  2. map.h -> map/unmap
  3. io.h -> pio r/w, raw memory r/w
  4. work_queue.h -> create_workqueue, submit_work, idk
  5. pci.h -> pci r/w
  6. pci_bar.h -> get_bar, map_bar, idk, bus_master shit
  7. irq.h -> irq alloc, affinity
  8. msi.h -> msi related stuff
  9. log.h -> logging
maiden birch
robust abyss
#

whats the need for multiple work queues and not let the kernel manage it?

maiden birch
#

the drm driver needs a lot of those

median yoke
maiden birch
#

and careful low level management for them as well

median yoke
#

*irq

robust abyss
#

like, what is the difference between using one work queue and two work queues?

median yoke
#

One

maiden birch
#

wdym?

#

we need a work queue per gpu device for example

robust abyss
#

what is physically the difference between creating two different work queues and just submitting into one work queue

maiden birch
#

contention

#

imagine having 2 gpus

#

very common

#

and also uacpi work spammed there too for example

robust abyss
#

yeah but you will have contention at the scheduler eventually either way no?

median yoke
# maiden birch wdym?

Like, if a device uses legacy irq pins instead of MSI, how would the u whatever library get an irq

maiden birch
#

multiple can run in parallel

robust abyss
#

so you expect each work queue to essentially be a single thread?

maiden birch
#

yeah

#

it could be implemented entirely in udrm as well

#

but it needs a lot of primitives for that

#

like atomics, linked lists etc

#

tbh maybe just make the header thread.h

robust abyss
#

it feels like a weird abstraction tbh

maiden birch
#

also i forgot about mutex.h and spinlock.h

robust abyss
#

like trying to combine threads and dpcs into one

median yoke
#

We should just make it based off OBOS' api /j

maiden birch
#

well linux bottom halves

#

same thing

robust abyss
#

linux is not really the thing you want to look at for inspiration given they have like 3 mechanisms for bottom halfs lol

maiden birch
#

true

robust abyss
#

threaded irqs, work queues, tasklets

maiden birch
#

maybe just a create_thread api would be enough

agile halo
robust abyss
#

and there are probably more

agile halo
# maiden birch idk yet

what about a pci irq alloc/dealloc/enable api similar to the one I have in uhda? (and its also similar to linux)

maiden birch
#

irq.h

#

then i guess we should do thread.h with low level threading primitives and build whatever we want on top

#

or whatever udrm wants

robust abyss
#

like, it can be fine to create the work queue primitive in uapi, I just feel that its so specific in how it wants to be implemented that it might as well be part of the provided shim

maiden birch
#

we can have shared internal code that builds on top of uapi

#

which is nice

robust abyss
#

yeah

#

the kernel is the one that needs to compile it tho, since otherwise you would have multiple defs of objects

maiden birch
#

yeah ofc

#

it would be a yet another subproject somehow

agile halo
# agile halo what about a pci irq alloc/dealloc/enable api similar to the one I have in uhda?...

or well not exactly the same because the one in uhda is limited to one irq, something like ```c
typedef uapi_handle uapi_pci_device; // idk, it would be nicer to pass a handle instead of an address to these functions (and then you don't necessarily need a way to associate an address with a pci device struct)
typedef uapi_handle uapi_pci_irq;

uapi_error uapi_pci_alloc_irqs(uapi_pci_device dev, uapi_pci_irq_types preferred_types, u32 min, u32 max, u32 count);
void uapi_pci_free_irqs(uapi_pci_device dev);
uapi_error uapi_pci_get_irq(uapi_pci_device dev, u32 num, uapi_pci_irq
irq);

void uapi_pci_install_irq_handler(uapi_pci_device dev, uapi_pci_irq irq, uapi_irq_handler irq_handler);
void uapi_pci_enable_irq(uapi_pci_device dev, uapi_pci_irq irq, bool enable);

maiden birch
#

i was thinking of a uapi_pci_device_open(address)

#

and then all apis would operate on that handle

median yoke
maiden birch
#

the kernel will likely have an object representing that device

#

@agile halo what was the reason u went with this design initially?

robust abyss
#

yeah handles are better, worst case the kernel will implement it by returning its handle as an address

agile halo
maiden birch
#

yeah there u go

#

u would force the kernel to have an address -> object lookup table

robust abyss
#

also I think I prefer ```c
typedef struct uapi_pci_device {
uapi_handle_t handle;
} uapi_pci_device_t;

#

for type safety

maiden birch
#

yeah maybe

agile halo
maiden birch
#

disregard this

#

its the other way around

#

we will give the kernel the list of properties to match a compatible device

robust abyss
#

just require uacpi and fully use acpi for all object stuff :^)

maiden birch
#

then it will call into e.g. udrm_device_probe

#

and give it the handle

agile halo
#

ah yeah address from handle

robust abyss
#

also rename io.h to generic_address.h and remove all the apis that are included under it :^)

maiden birch
#

lmao

#

#1316457641353936956 message

#

this is the convo

#

so yeah i think it makes sense to make the kernel just pass an opaque handle to udrm_device_probe

#

that can then be used to address the device and do r/w with it

robust abyss
#

given you don't want to design the kernel but just the driver api yeah

maiden birch
#

but we will need raw pci api anyways, because uacpi and aml

#

but thats just read/write

median yoke
#

how do we know that someone won't put a backdoor in one of these libs

maiden birch
#

read the code

robust abyss
#

have it signed by infy

median yoke
robust abyss
maiden birch
#

read it really well

median yoke
#

actually, how do we know infy didn't put a backdoor in uACPI

robust abyss
#

read it after macro expansion

maiden birch
#

uacpi has async https apis to send all info

median yoke
#

xz utils backdoor repeat

robust abyss
#

infy casually checking if uacpi running under obos and finding symbols and shit to have a network backdoor

maiden birch
#

it doesnt have any

agile halo
#

also for the pci irq api I am not sure if passing the device handle to all those functions is necessary, for an example the irq object handle could store the device handle in the kernel impl if its needed for eg. enabling a pci irq (though when the device is passed directly then the handle may be able to be implemented without allocations as eg. a pci irq number for the device)

median yoke
#

actually when uAntiCheat

#

and uCheatEngine

maiden birch
#

we'll have to design it

maiden birch
tawdry trench
vital ibex
#

not very many

#

only ones that attempt to reach posix compatibility

#

there are many that don't fall under that category

coral basalt
#

yeah, ODR is one definition rule, you can declare anything as many times are you want, as long as the decls are the same. You can even declare the same thing differently in some circumstances, if you crave a little a excitement.

#

you can get some crazy bugs too if you somehow get an implicit declaration of a function (the return type defaults to int).

#

granted, your compiler should warn you about that

coral basalt
#

given that memory and io space accesses have map/unmap functions before/after use, it would be nice for pci (and anything else that fits into that category) to follow that style. Imo its a nice hook for the kernel to be able to track resource usage.

tawdry trench
#

alright I'll start creating the virtio headers now

#

can't do any real setup yet because of uapi

maiden birch
#

I added all the stuff we talked about into the readme

#

it's currently a PR

#

Take a look before i start adding new headers as well

#

@tawdry trench

#

I guess we also need a platform/ directory in there

#

similar to this idea from uacpi

tawdry trench
tawdry trench
maiden birch
#

take a look how it works there and if u agree with this idea as well

tawdry trench
#

how does overriding work

#

like defines for renaming?

maiden birch
#
#ifdef UACPI_OVERRIDE_TYPES
#include "uacpi_types.h"
#else
// the actual header
#endif
#

so the host would create a uapi_types.h header

#

and define UAPI_OVERRIDE_TYPES

maiden birch
tawdry trench
#

ah

#

yea this is nice

tawdry trench
#

reviewing the thing now

maiden birch
#

nice

tawdry trench
#

LGTM

maiden birch
#

#error foo.h API version mismatch, make sure all libraries are using the base typo

#

the same

#

and should probably be u-lbiraries

tawdry trench
#

or uDrivers

maiden birch
#

yeah

#

theres already this

#

so how do we spell it

#

u-drivers or uDrivers or u drivers

tawdry trench
#

uDrivers

#

like the repo

maiden birch
#

technically not all u drivers have to live in the org

#

a u-driver is anything that uses uapi

tawdry trench
#

true

#

just drivers

maiden birch
#

use uapi in native drivers too 😡

tawdry trench
maiden birch
#

so uDrivers?

tawdry trench
#

ye

maiden birch
#

fixed

#

one thing that i dont like

#

e.g. in uacpi not a single internal header is propagated into public headers

#

vice versa, sure

#

maybe uapi should be in udrv/

shut sorrel
maiden birch
#

all options suck

#

in uacpi platform/ is a part of public api

#

but since this is one repo we cant split it in halves

tawdry trench
#

hm

#

we're actually approaching UDI territory

#

which is based

maiden birch
#

im not faimiliar with it

tawdry trench
#

it's basically what we're doing but way more abstracted (in a bad way)

#

to the point where it's almost impossible to implement in a hobby kernel

maiden birch
#

lol

#

wdym?

tawdry trench
#

sheer amount of complexity

#

the core spec is 250 pages

#

and that's really just the base

maiden birch
#

damn

robust abyss
#

Better idea

#

Make uapi be UEFI like

maiden birch
#

by uefi-like u mean at least as buggy

robust abyss
#

7000 page spec with protocols a core services table and so on

tawdry trench
#

convert uacpi to use udi clueless

maiden birch
#

please no

#

i will need a corporation to maintain it

shut sorrel
#

OSDev Inc.

robust abyss
#

UCorp

#

uInfy

maiden birch
#

lmao

tawdry trench
#

🥭

robust abyss
#

How does udi looks like anyways

tawdry trench
#

ch4

robust abyss
#

You sure this isn't a kernel spec

maiden birch
#

wtf

robust abyss
#

It's like taking Linux exported functions and saying "hey look at this generic driver interface"

tawdry trench
#

exactly

#

that's why it failed

robust abyss
#

Might as well do WDK at that point

tawdry trench
#

(ignore the fact that the entirety of gnu was against it)

maiden birch
#

driver interface aka random bullshit go

robust abyss
#

I mean, it's clearly not random

#

But it's too much

maiden birch
#
void udi_channel_anchor (
udi_channel_anchor_call_t *callback,
udi_cb_t *gcb,
udi_channel_t channel,
udi_index_t ops_idx,
void *channel_context );
typedef void udi_channel_anchor_call_t (
udi_cb_t *gcb,
udi_channel_t anchored_channel );
#

wtf is it talking about

robust abyss
#

It's fine if the kernel shim does more than just call the entry point on the driver lol

tawdry trench
tawdry trench
#

@maiden birch rest looks good to me

#

wyd now?

maiden birch
#

need to add platform headers

#

but idk how to do it cleanly

#

because of the reasons i mentioned

tawdry trench
#

just come up with anything and we can iron it out

maiden birch
#

lets just put uapi into the root of include then

#

w/e

tawdry trench
#

yes

maiden birch
#

maybe we should also add

#ifndef UAPI_KERNEL_API
#error this header shouldn't be included directly, use kernel_api.h
#endif
#

because otherwise directly including the header will result in "this header is not needed..." etc

#

which may or may not be false

tawdry trench
#

but doesn't that really convolute the headers

maiden birch
#

But they're already convoluted

#

So idk

tawdry trench
#

yea who cares

#

anyways, i'm porting the spec structs now

#

that's the one thing i can do while i wait

maiden birch
#

Ill get basic headers done today a bit later

tawdry trench
#

W

maiden birch
#

But u can stub stuff out atm

#

Like add fake uapi_uX types etc

#

Or uapi_kernel_alloc etc

#

Then you can replace those once I add the headers

#

If that's blocking you

tawdry trench
#

okay sure

#

@maiden birch do we also want to share some helpers?

#

i have this rn

maiden birch
#

Yeah we'll make a union header of those

#

I have a lot in uacpi as well

tawdry trench
#

@maiden birch so do we want to go through with the unity builds idea

#

i have nothing against it

maiden birch
#

As I mentioned I dont control how the project is built and you shouldn't either imo

#

You just provide a list of c files to build

tawdry trench
#

well, i kinda want lsp support bc this is a nontrivial amount of code

maiden birch
#

For that I have my tests/ directory and a test runner

#

And a dedicated cmake

tawdry trench
#

ah

maiden birch
#

So my test runner is like a uacpi host

tawdry trench
#

idk if i can do the same

#

the test runner is standalone?

maiden birch
#

Yup

tawdry trench
#

hm

#

what do you test in uacpi

maiden birch
#

Aml dumps

#

And my own test cases

tawdry trench
#

ig i can do stuff like edid validation

maiden birch
#

You can have a fake config space

#

And emulate a device in userspace

#

Verify that stuff that it submits is expected etc

tawdry trench
#

ah true

agile halo
#

just make sure that the stuff first works on real hw so you don't emulate wrong behaviour meme

maiden birch
#

Virtio GPU is nice for that

maiden birch
tawdry trench
#

"small"

maiden birch
#

That you run in qemu and take screenshots to verify the fb state etc

tawdry trench
#

only needs a fully fledged feature set

maiden birch
#

Can always have no op free etc

#

A lot of edges to cut for testing purposes

livid sentinel
maiden birch
#

@tawdry trench I just realized, u can literally test as part of a Linux module, just unload virtio GPU and load your own instead

tawdry trench
#

uapi linux bindings meme

robust abyss
#

You can maybe use the uACPI-OS as a base, given it already runs uacpi

#

It is missing threads but has other stuff

maiden birch
#

But that doesnt have mesa

tawdry trench
#

uKernel troll2

robust abyss
#

True

#

Speedrun to make a Linux clone any%?

tawdry trench
#

i guess we could try porting to managarm or astral

#

managarm i have to do either way

robust abyss
#

Managarm already has mesa so that would be helpful

tawdry trench
#

yeop

maiden birch
#

True

tawdry trench
#

i'll be in vc if anyone wants to watch me seethe with virtiogpu

#

@maiden birch can we have a common HEADER_START or whatever

#

for c++

tawdry trench
#

cool

maiden birch
#

UAPI_BEGIN_DECLS?

tawdry trench
#

sure

#

and END_

maiden birch
#

Ye

tawdry trench
#

which C standard are we using

#

i say > C11

median yoke
#

Ansi

tawdry trench
#

but _Static_assert

median yoke
#

Jk

robust abyss
#

I say C11

#

Sweet sweet stdatomic.h

livid sentinel
#

C89

robust abyss
#

Just use threads.h :^)

#

Also static assert is nice

tawdry trench
#

ye

hexed flare
#

Why not C23 ultrameme

tawdry trench
#

not everyone uses that iirc

#

(i do)

hexed flare
#

Like if you're writing a hobby os in 2024, why are you using an old compiler ultrameme ultrameme

tawdry trench
#

maybe some weird code generator that can't cope with latest standards

maiden birch
tawdry trench
#

wat

robust abyss
#

hmm?

tawdry trench
#

did you not know about that

robust abyss
#

stdatomic is the best thing since bread

maiden birch
#

Implicit seq cst, overrides default behavior of operators, doesnt work with normal types

#

Absolute crap

robust abyss
#

bruh no

#

it has explicit memory ordering

#

the defaults are seq cst but who cares no one uses the defaults

maiden birch
#

Also u have to use _Atomic and u cant use normal types

robust abyss
#

meh, I never use the operator versions

#

I mean, that is the same in C++, you have to use std::atomic<type>

#

of course operator overloading so lol

maiden birch
#

Yeah

#

In this case its like java with strings and operator ==

#

Secret special case u have to know about

robust abyss
#

but anyone who needs to touch stdatomic.h knows what to do

#

and if he doesn't he failed before even trying

maiden birch
#

Anyway not a fan but to each their own

robust abyss
#

meh, I only take it for the _explicit versions of stuff

#

and I prefer it over using compiler specific variants

tawdry trench
#

cry_glasses currently 4 layers deep into a struct declaration

robust abyss
#

the people who use the operator stuff are the same ones who use __sync_synchronize to tell themselves everything is now atomic

maiden birch
#

Lol

tawdry trench
#

who the fuck made the edid struct

#

how to most inconveniently organize data

#

kill me

#

@maiden birch EDID is done

maiden birch
#

Nice but thats not how I do packed in uACPI

#

For MSVC compatibility

tawdry trench
#

aaaaaaaaaa

maiden birch
#

Also everything inside a packed struct is packed

tawdry trench
#

pls no macro bullshit 😢

tawdry trench
maiden birch
#

Take a look at acpi.h in uacpi

tawdry trench
#

not that bad ig

#

do we also use UAPI_EXPECT_SIZEOF

maiden birch
#

There's also EXPECT_SIZEOF which I recommend u use

maiden birch
tawdry trench
maiden birch
#

To make sure u didnt mess up

tawdry trench
#

i did this

maiden birch
tawdry trench
#

do we typedef or just use struct

#

i'm indifferent really

maiden birch
#

I typedef public structs

#

Internal ones are not

#

Also all public macros and functions with external linkage are prefixed with uacpi

#

Same goes for structs

#

But u already do this ig

tawdry trench
#

@maiden birch

#pragma once

#include "common.h"

UAPI_BEGIN_DECLS

// Extended Display Identification Data
UAPI_PACKED(struct drm_edid {
    uint8_t header[8];      // 00 FF FF FF FF FF FF 00

    // Vendor & Product Identification
    uint16_t mfr_name;
    uint16_t product_id;
    uint32_t serial_id;
    uint8_t model_week;
    uint8_t model_year;

    // EDID Structure Version & Revision
    uint8_t version;
    uint8_t revision;

    // Basic Display Parameters & Features
    uint8_t video_input;
    uint8_t h_screen_cm;
    uint8_t v_screen_cm;
    uint8_t gamma;
    uint8_t features;

    // Color Characteristics
    uint8_t red_green_low;
    uint8_t blue_white_low;
    uint8_t red_x;
    uint8_t red_y;
    uint8_t green_x;
    uint8_t green_y;
    uint8_t blue_x;
    uint8_t blue_y;
    uint8_t white_x;
    uint8_t white_y;

    // Timings
    struct
    {
        uint8_t time_1;
        uint8_t time_2;
        uint8_t time_mfr;
    } established_timings;

    struct
    {
        uint8_t h_resoution;       // (Horizontal addressable pixels ÷ 8) – 31
        uint8_t aspect_and_ref;       // See 3.19
    } standard_timings[8];

    struct
    {
        // Pixel clock frequency divided by 10000.
        // If 0, don't use `data.pixel`.
        uint16_t pix_clock;
        union
        {
            struct
            {
                uint8_t h_video_low;
                uint8_t h_blank_low;
                uint8_t h_video_blank_high;
                uint8_t v_video_low;
                uint8_t v_blank_low;
                uint8_t v_video_blank_high;
                uint8_t h_sync_offset_low;
                uint8_t h_sync_pulse_width_low;
                uint8_t v_sync_offset_pulse_width_low;
                uint8_t bit_definitons;       // High order bits for the previous 4 fields
                uint8_t h_video_mm_low;
                uint8_t v_video_mm_low;
                uint8_t hv_video_mm_high;
                uint8_t h_border;
                uint8_t v_border;
                uint8_t misc;
            } pixel;

            struct
            {
                uint8_t _reserved1;
                uint8_t tag;
                uint8_t _reserved2;
                union
                {
                    char serial_number[13];
                    char alnum_string[13];
                } data;
            } other;
        } data;
    } detailed_timings[4];

    uint8_t extension_block_count;
    uint8_t checksum;
})
UAPI_EXPECT_SIZEOF(struct drm_edid, 0x80);

UAPI_END_DECLS
maiden birch
#

Wrong types but yea

tawdry trench
#

huh

#

oh i thought we said to use stdint

maiden birch
#

Hm?

#

Well I was gonna import a platform/types.h

#

Which creates uapi_uX based on stdinth

tawdry trench
#

.

maiden birch
#

But it doesnt have to be

tawdry trench
#

but sure

#

i don't mind that

maiden birch
#

.

tawdry trench
#

what about big endian fields

#

can we have _be types

maiden birch
#

What would that do

tawdry trench
#

the host can inject some checker macro there

#

like linux does

maiden birch
#

Sure yeah we can add explicit endianness types to types.h

tawdry trench
#

nice

maiden birch
#

uapi_le_u8?

tawdry trench
#

uapi_u8_le

maiden birch
#

Sure

tawdry trench
maiden birch
#

Nice

#

Is this supposed to be a public struct?

tawdry trench
#

yes

#

the host might want to evaluate the EDID

maiden birch
#

Ah ok

#

Btw

#

Can we do include <udrm/common.h>?

tawdry trench
#

yea this is just for testing rn

#

i have some bullshit defines in there

maiden birch
#

Ah

#

I see

tawdry trench
#

if only limine didn't pass a null pointer for the EDID i could see if it worked

maiden birch
#

Wait also

#

Cant we just do uapi_le8?

#

We dont really need signed le

tawdry trench
#

uapi_l8

#

and b8

maiden birch
#

Late

#

Bait

#

Lol

robust abyss
#

Well, the le/be versions are only really needed for packed structs where you assume endianness, the rest could be just uxx

maiden birch
#

Thats the idea

tawdry trench
#

it's more a hint for the user

robust abyss
#

Just don't forget to ntos

tawdry trench
#

and/or compile time checker

maiden birch
#

We wanted to do uapi_le_u8

robust abyss
#

Linux has a checker iirc

tawdry trench
#

yep

maiden birch
#

Im saying we don't need the u part

tawdry trench
#

hm

#

what if you want to convey "this is a signed integer which first has to be converted"

maiden birch
#

U should be doing be_to_cpu etc

robust abyss
#

Yeah

#

And if you do it means you pass it without converting it first

maiden birch
#

As far as conveying it well

#

Idk

tawdry trench
#

how should i be adding the uapi submodule

#

directly into include/?

maiden birch
#

Yes

tawdry trench
#

fatal: 'include' already exists in the index

maiden birch
#

Wut

tawdry trench
#

do i have to do include/uapi????

#

this reeks of gitification

maiden birch
#

What

tawdry trench
#

let me try something

maiden birch
#

Im not sure what youre doing

tawdry trench
#

adding a submodule

maiden birch
#

We agreed on the project structure like yesterday

#

How did u forget already lol

tawdry trench
#

git submodule add https://github.com/uDrivers/uAPI include/

maiden birch
#

Thats not how u uh

tawdry trench
#

really?

maiden birch
#

cd include

#

Got submodule add link uapi

#

The second arg is the name of the new directory

tawdry trench
#

oh

#

well that's what i was asking lol

#

i forgotr

maiden birch
#

Yeah

#

Lowercase pls

tawdry trench
#

yea ofc

maiden birch
#

Yup

#

Wait your git files and the license are in SRC?

tawdry trench
#

no

shut sorrel
#

indentation

maiden birch
tawdry trench
#

why should they be in src

maiden birch
#

Your vscode sure looks like they are lol

tawdry trench
maiden birch
#

Ah lmao

tawdry trench
#

oh i see what's happening

#

i changed my indent width

#

for the subdirs

#

okay so

#

is this right

#

public headers in <udrm/...>

maiden birch
#

Yup

tawdry trench
#

internal ones in <udrm/internal/....>

maiden birch
#

U dont have any public ones right?

tawdry trench
#

well, edid.h at least

maiden birch
#

Your indent is impossible for me to understand

tawdry trench
#

rofl

#

sec

robust abyss
#

Wait edid.h isn't under internal lol

maiden birch
#

Apparently

tawdry trench
#
marvin@pc0 ~/r/u/udrm (master)> tree include
include
├── uapi
│   ├── LICENSE
│   └── README.md
└── udrm
    ├── common.h
    ├── edid.h
    ├── internal
    │   ├── virtio
    │   └── xe
    └── udrm.h

6 directories, 5 files
marvin@pc0 ~/r/u/udrm (master)> 
robust abyss
#

Oh it indents with nothing where the > would go

#

That's a weird thing to do

maiden birch
tawdry trench
#

yep

#

that'll be in uapi

maiden birch
#

Yeye

robust abyss
#

The assumption is that you would -Iudrm/include right? Would would having multiple uapi dirs in the path play out?

robust abyss
#

Oh? So how is the include supposed to work

maiden birch
#

Udrm is the include dir

#

Or rather

#

As if it was inside

robust abyss
#

So in your project you would do <edid.h>?

maiden birch
#

Oh wait

#

Udrm not uapi

tawdry trench
#

i think you two are talking around each other

maiden birch
#

Yes you're right

robust abyss
tawdry trench
robust abyss
#

Well, right now in his path it's under his direct include dir

maiden birch
#

Wait

#

Yeah that's wrong ofc

#

it must be inside udrm

tawdry trench
robust abyss
#

Yeah that's what I remembered

maiden birch
#

Good catch

#

We moved it from internal, but its still inside udrm not literal include root

tawdry trench
#

so move down to include/udrm/uapi?

maiden birch
#

Yup

#

Git mv

tawdry trench
#

done

#
include
└── udrm
    ├── common.h
    ├── connector.h
    ├── crtc.h
    ├── edid.h
    ├── encoder.h
    ├── internal
    │   ├── virtio
    │   └── xe
    ├── plane.h
    └── uapi
        ├── LICENSE
        └── README.md

6 directories, 8 files
maiden birch
#

Correct

tawdry trench
#

i just removed it

#

i'll put it back

maiden birch
#

Ah

tawdry trench
#

misclick

robust abyss
#

Are you going to put all graphic drivers in this repo?

#

At least the drm part

tawdry trench
#

yea

robust abyss
#

Nice

tawdry trench
#

the idea is to have two layers of abstraction

#

one for just the drivers

#

one for the DRM system

#

because i know at least 2 kernels with their own DRM system

median yoke
#

isn't DRM like some sorta syscall thing

tawdry trench
#

so that can plug right into there

median yoke
#

what even is DRM

robust abyss
#

An API

tawdry trench
#

direct rendering manager

#

scheduler and manager for rendering with a gpu

median yoke
#

it's exposed to userspace via ioctl right

tawdry trench
#

yes

maiden birch
robust abyss
#

You are still expected to use a usermode driver like mesa to actually do stuff

#

Given it only manages contexts and memory management of the GPU

median yoke
#

ah ok

maiden birch
#

Yeah it only exposes modeset, scanout, memory management, and command submission

#

The rest is userspace

#

And command submission is a GPU specific ioctl

robust abyss
#

There are a bunch of GPU specific stuff

maiden birch
#

Yeah

median yoke
#

which mesa deals with, right?

maiden birch
#

Yes

#

And xorg or weston

#

They're DRM masters

#

And can submit admin commands

#

Like modeset

livid sentinel
#

on which step are the user programm windows managed?

maiden birch
#

That canvas is then give to GPU for scanout

median yoke
#

what about stuff like running shaders

maiden birch
#

Hm?

median yoke
#

after compiling them or whatever

#

how are they rab

#

*ran

#

on the gpu

#

is that DRM's problem

#

or mesa's

maiden birch
#

All the work your application does for drawing is done into its own anonymous buffer

#

Which may be shared with the window manager

#

If you want it displayed on the screen

#

Thats the idea of dri

#

You talk to the GPU directly and it renders stuff into your own buffers

#

But then you talk to the window manager and ask it to take the buffer and display it

robust abyss
#

Yeah

maiden birch
#

You could also save it as PNG for example

#

Which mesa does for testing

robust abyss
#

Idk about Linux user space but in windows when in full screen mode the idea is that you control the framebuffer of the actual display and why it can reduce latency

tawdry trench
#

that's why tabbing out kills everything trollHD

robust abyss
#

Yeah lol

maiden birch
#

Iirc before it would copy shit

robust abyss
#

I think that's how it always worked in windows

#

When using exclusive full screen mode

maiden birch
#

Oh yeah the new thing is shared surfaces

#

Before it would memcpy into compositor

robust abyss
#

Yeah

maiden birch
#

Mesa provides implementations of those apis

robust abyss
#

Mesa has the shader compiler

maiden birch
#

Glsl to nim to gpu

robust abyss
#

Iirc they even have their entirely own IR and optimizations since they felt llvm wasn't really the best for it

#

Yeah

#

There is some cool blog where they explain why they have their own IR

#

uVulkan when :^)

agile halo
#

its also interesting how you get access to the ir inside gl programs KEKW

maiden birch
agile halo
robust abyss
#

Sadge it's not giving you the direct shader binary meant for the exact gpu :^)

robust abyss
#

For faster loading

maiden birch
#

Ah

agile halo
#

for caching shaders I'd think yeah

maiden birch
#

Doesn't even save that much

static prairie
#

mesa already does shader caching anyway

agile halo
#

I mean it does save the glsl compilation + the nir generation + optimizations that it does in that process

robust abyss
#

^

#

And nothing stops you from technically saving the raw binary

#

Like api wise

static prairie
#

mesa's shader compilation + caching is actually really fast, like when CS2 first came out people were complaining about shader compilation stutters but on mesa it was not perceptible

robust abyss
#

Like saving the raw machine code for the GPU

static prairie
#

even when skipping steam's shader precompilation

robust abyss
#

So many shader cache levels

#

Just use spirv smh

tawdry trench
#

spir v supremacy

#

actually, lets use DXBC

maiden birch
robust abyss
#

The GetProgramBinary could give you that no? If the implementor decided to

agile halo
#

yes

maiden birch
#

Well idk how the spec defines it

median yoke
# maiden birch Well idk how the spec defines it

The format of the program binary written into binary is returned in the variable whose address is given by binaryFormat, and may be implementation dependent. The binary produced by the GL may subsequently be returned to the GL by calling glProgramBinary, with binaryFormat and length set to the values returned by glGetProgramBinary, and passing the returned binary data in the binary parameter.

#

from there

static prairie
robust abyss
#

Damn

static prairie
#

If you link multiple shader objects in the same program, then either all of them must be SPIR-V shaders or none of them may be SPIR-V shaders. You cannot link SPIR-V to non-SPIR-V shaders in a program.
interesting

robust abyss
#

Lmao

maiden birch
#

So makes sense

maiden birch
tawdry trench
#

this says i should have uapi in include/udrm/internal/uapi

#

not include/udrm/uapi

maiden birch
#

Yeah ill change that

tawdry trench
#

oh ok

maiden birch
#

Ill get to this pr in about a few hours

tawdry trench
#

dope

#

lmk when

maiden birch
#

This version is before we agreed on moving out of internal

tawdry trench
#

yea i forgot most things yesterday because i was on like 2h of sleep

maiden birch
#

This was today lol

tawdry trench
#

fml

maiden birch
#

Lmao

maiden birch
#

alright time to add the goddamn headers

tawdry trench
#

lets go

maiden birch
#

updated the readme with all of the things we have talked about today

tawdry trench
#

cool

maiden birch
#

that was a call to re-review

tawdry trench
#

on it

maiden birch
#

lol

maiden birch
#

actually i cant even make it a header guard

#

because there will be multiple kernel_api.h

#

and this #define UAPI_WANTS_MEMORY should also be under ifndef

#

do we agree?

agile halo
#

yeah sounds fine to me

maiden birch
#

for cases like

glue.c:

#include <udrm/kernel_api.h>
#include <uacpi/kernel_api.h>
tawdry trench
#

sounds good

maiden birch
#

@tawdry trench pushed a bunch of base platform headers

tawdry trench
#

👍

robust abyss
#

Petition to drop msvc support so you can use statement expressions in relevant macros 😔

maiden birch
#

i know its tempting but

#

no

#

it would simplify align.h with typeof() as well

robust abyss
#

Like at this point even Microsoft are ditching msvc in favor of clang Smuggy

maiden birch
#

still kinda the defacto default windows compiler

robust abyss
#

Smh

#

I know I am just memeing

maiden birch
#

but yeah im sad about the crappy minmax and align

robust abyss
#

Btw visual studio actually has built in support for clang these days, full drop in replacement (especially with the clang-cl frontend)

#

As simple as a drop-down option in the build options

#

It's pretty cool

maiden birch
#

nice

tawdry trench
#

based

#

yet another clang W

robust abyss
#

Maybe games will finally stop shipping with code that looks like a GCC 4 debug output

maiden birch
#

lmao

robust abyss
#

Like man, msvc got an ssa only in the last couple years

#

And before that it didn't even have a proper ast

#

Optimizations that anyone reading the dragon book could do were missing

#

Anyways im waiting for more uapi headers to look at

maiden birch
#

ill add a few basic ones rn

#

then we can add the more advanced ones tomorrow

robust abyss
#

Are you going to move uacpi to use uapi as well?

maiden birch
#

eventually yes

robust abyss
#

Nice

maiden birch
#

since i have more uprojects planned once i finish it

#

ill have to do that

#

pushed 3 uapi headers

robust abyss
#

Won't the sized frees cause weird collisions if some drivers use one and some the other?

maiden birch
#

its not up to the drivers to decide

#

its a project-wide client configuration

robust abyss
#

Hmmmm I see

#

So it's expected so drivers support both

maiden birch
#

yeah

robust abyss
#

Nice

maiden birch
#

maybe tahts too much we could talk about it

robust abyss
#

I assume the same for formatted logs

maiden birch
#

yup

#

    UAPI_CACHING_WB,
    UAPI_CACHING_WT,
    UAPI_CACHING_WC,
    UAPI_CACHING_UC,
#

how do u cover NgNrE crap with this

agile halo
# maiden birch maybe tahts too much we could talk about it

tbh for most cases it wouldn't be that hard to support both frees (as the size is known either statically or otherwise) so you can just define eg a macro ```c
#ifdef UAPI_SIZED_FREES
#define uhda_free(ptr, size) uapi_kernel_free(ptr, size)
#else
#define uhda_free(ptr, size) uapi_kernel_free(ptr)
#endif

maiden birch
#

literally what uacpi does

#
#ifdef UACPI_SIZED_FREES
#define uacpi_free(mem, size) uacpi_kernel_free(mem, size)
#else
#define uacpi_free(mem, _) uacpi_kernel_free(mem)
#endif
#

just internally

tawdry trench
#

rofl

agile halo
maiden birch
#

ok so heres what linux does

#

ill just give u a TLDR

#

The default ioremap does nGnRE which will work with most devices

#

but it also has a strong _np version

#

which does nGnRnE

#
 * ioremap_np needs an explicit architecture implementation, as it
 * requests stronger semantics than regular ioremap()
#

ill just add a UAPI_CACHING_MMIO and UAPI_CACHING_MMIO_STRONG

#
typedef enum uapi_caching {
    /*
     * Automatically deduce caching type by inspecting the system memory map.
     * (e.g. if the region happens to reside inside normal RAM, map as WB)
     */
    UAPI_CACHING_AUTO = 0,

    UAPI_CACHING_WB,
    UAPI_CACHING_WT,
    UAPI_CACHING_WC,
    UAPI_CACHING_UC,

    UAPI_CACHING_MMIO,

    /*
     * A stronger version of CACHING_MMIO, with an arch-specific implementation.
     * E.g. for the ARM architecture you may map MMIO as follows:
     * CACHING_MMIO -> nGnRE
     * CACHING_MMIO_STRONG -> nGnRnE
     */
    UAPI_CACHING_MMIO_STRONG,
} uapi_caching;
#

thoughts?

#

anyway pushed to pr

tawdry trench
#

i am indifferent

maiden birch
#

@tawdry trench any other headers u desperately need now that are blocking you?

tawdry trench
#

well only IRQ and PCI are really missing

maiden birch
#

yeah these ones are non-trivial

agile halo
#
  • phys mem alloc
maiden birch
#

we'll have to design how we want to approach that

tawdry trench
maiden birch
#

phys mem i can add right now

#
/*
 * Allocate 2^'order' physical pages with an alignment of 'align'.
 * 'max_phys_addr' specifies the maximum acceptible address of the
 * end of the last allocated page.
 */
uapi_phys_addr uapi_allocate_pages(
    uapi_size order, uapi_size align, uapi_phys_addr max_phys_addr
);
#ifndef UAPI_SIZED_FREES
void uapi_free_pages(uapi_phys_addr);
#else
void uapi_free_pages(uapi_phys_addr, uapi_size order_hint);
#endif

Do we agree with this api

#

maybe order -> plain count

tawdry trench
#

what about hinting for huge pages

maiden birch
#

align?

tawdry trench
#

true

agile halo
maiden birch
#

what if i need like 3 pages tho

#

why guarantee a power of 2?

agile halo
#

well yeah ig it can be removed and be up to the kernel

static prairie
#

contiguous that is

maiden birch
#

round up internally?

#

or do we want to make the library responsible for rounding up

agile halo
#

idk if that's really necessary, imo the kernel can do that if it only supports that kind of sizes

maiden birch
#

like your average osdever uses a bitmap

#

so they will be happy with an exact amount

static prairie
#

btw will uapi be the new kernel api for uacpi too?

maiden birch
#

ill add it as an optional mode at some point

#

if uapi gains traction

static prairie
#

ah

maiden birch
#

or maybe sooner since i have plans for more uprojects

#

and integrating two into one kernel will be annoying

#

btw we're gonna have an acpi.h header as well probably for evaluation of acpi methods

#

but optionally i guess

#

i know igpus use acpi extensively for various gpu/screen related events

agile halo
#

would it be specific to uacpi or a generic interface?

maiden birch
#

nah generic ofc

#

my ego is not that big lol

agile halo
#

that could also be nice for abstracting other kernel acpi usage though it kinda depends on how much it would support in terms of eg. node discovery or whatever

maiden birch
#

yeah it would be an interesting excercise

#

alright i pushed page allocation as well

#

pci.h and irq.h we'll solve tomorrow since that's very non-trivial

#

@tawdry trench feel free to add extra helpers or w/e while u work on your stuff, and drop as a pr

tawdry trench
#

ok

maiden birch
#

Are u still reviewing my pr?

agile halo
#

theres also the other misc api like spinlocks, mutexes, events, sleeps/stalls that you had in the draft

maiden birch
#

yeah ill add those in later, those need a uapi_status which i still havent added

tawdry trench
maiden birch
#

ah

tawdry trench
#

i cant comment on the caching stuff but rest lgtm

maiden birch
#

since our map callback is ioremap + normal map we kinda have to do this i think

maiden birch
#

I made a ruleset

#

that requires linear history and prevents force pushes

tawdry trench
#

lmao

maiden birch
#

aight merged

#

udrm is officially the first project to use uapi

maiden birch
#

lmao

#

switching uacpi to use this will be fun

tawdry trench
#

(removing the c everywhere)

maiden birch
#

Well I want to support both versions

#

So I dont break people's osses

#

Mfw last repo update 3 days ago

agile halo
#

meanwhile last uhda update: 1 month ago

maiden birch
#

Btw you old URL correctly redirects to the org now

#

Which is nice

maiden birch
tawdry trench
#

move uhda to udrivers meme

maiden birch
#

That too

agile halo
tawdry trench
#

i can add you as an admin

tawdry trench
#

pog

main crow
tawdry trench
#

💀

#

just call it abi break

main crow
#

that would be the boring thing

#

also does uapi support iommus?

agile halo
#

that's up to the kernel?

#

or well idk what do you even mean by that lol

main crow
#

kinda isnt no

#

i mean you need to deal with the fact that the device phys addr != host phys addr

#

etc

maiden birch
#

We haven't designed that yet

#

But it should

maiden birch
#

So yeah

main crow
maiden birch
#

Some callbacks are more generic now

main crow
#

also your kernel api is kinda shit for binding authors

maiden birch
#

Or hear me out

#

Attribute alias

maiden birch
main crow
maiden birch
#

Which context

tawdry trench
#

what context

agile halo
#

are you talking about uacpi?

main crow
maiden birch
#

Huh why would anyone need that

main crow
#

its super common in almost all libraries to pass around data

main crow
maiden birch
#

Which global state

tawdry trench
#

yea

main crow
#

any of it

maiden birch
#

Callbacks pass around a user pointer

main crow
#

uapi_free_pages does not

#

and neither does uapi_allocate_pages

#

none of the log things do

maiden birch
#

Why in the world would that need context

main crow
#

like, think about how youd write an e.g. rust binding for that

maiden birch
#

So u sacrifice performance and add useless parameters to everything to satisfy rust binding authors?

main crow
#

and anyway you can make that an ifdef

agile halo
#

also I don't see an issue with the current api for rust bindings?

maiden birch
#

Yeah idk man

agile halo
#

like you are going to be having a global allocator/log anyway

main crow
#

its ugly

#

also its another indirection

maiden birch
#

Why cant the rust implementation call rust_alloc_pages directly

main crow
#

it has to do it through a function pointer

#

because you cant have cycles like that

maiden birch
#

Well what current uacpi bindings do is wrap it in a class

#

And that class obviously has function pointers

main crow
#

so... you add another indirection?

maiden birch
#

Just like u do with context lol

main crow
#

true

#

but at least its not global state with context

#

just pass around context pointers its not like that expensive, and the drivers arent that hot anyway

maiden birch
#

Like I get the idea, but damn making the whole API ugly af and feeling very un-c-like just to make it better for bindings

#

Idk man

#

Like its a c library first and foremost

tawdry trench
#
extern "C" {
    fn uapi_malloc();
}
#

am i missing something

maiden birch
#

What is this?

tawdry trench
#

is this not all you have to do for rust bindings

maiden birch
#

Oh rust

#

Apparently not?

tawdry trench
#

i don't get it

main crow
#

okay so like

agile halo
#

the talk was about a generic abstraction crate and not a raw bindings crate

main crow
#
crate uacpi_bindings {
  fn uacpi_malloc() { /* you cant put anything here to call real_kernel (except a global function pointer which is ugly) */ }
}
crate real_kernel {
  fn stuff() { uacpi_bindings::do_anything() }
}
maiden birch
#

Btw would like uacpi_set_context/get_context work? @main crow

main crow
maiden birch
#

Hm?

main crow
#

the problem isnt that there isn't a way to have global state, because there is

#

the point is that global state bad

#

and you should avoid it if it's trivially possible

maiden birch
#

Its abstracted away from you

#

From your safe rust world

#

Without global state

main crow
#

still has global state inside

#

and therefore ugly

maiden birch
#

The context pointer is the exact same thing lol

#

Just passed through a function

#

How would u set it exactly

#

During uacpi_init?

#

That would save it globally

agile halo
#

well uacpi also has other global state

maiden birch
#

Its fundamentally a global state library

main crow
agile halo
#

for drivers ig it would be saved inside the device

main crow
#

okay tbf for uacpi it makes sense

#

because you only have one

maiden birch
#

Yeah u cant have multiple acpi instances

main crow
#

well

#

yeah in normal cases

maiden birch
#

Even in non normal cases?

main crow
maiden birch
#

Well my test cases are run by python

main crow
#

anyway imo you should not have global state if the user asks you for

maiden birch
#

It can spawn as many runners as it wants

maiden birch
#

Its just pointless work and redundant parameter to every uacpi function that will always have the same value

main crow
maiden birch
maiden birch
#

Its literally every existing uacpi public api

#

Which there's hundreds of functions

agile halo
#
#ifndef UAPI_PASS_CONTEXT
#define UAPI_CONTEXT
#else
#define UAPI_CONTEXT ,void *ctx
#endif

void *uapi_malloc(uapi_size size UAPI_CONTEXT);
main crow
#

yeah that

maiden birch
#

Won't compile

main crow
#

you can put a leading comma on the UAPI_CONTEXT define

agile halo
#

oh yeah the comma needs to be inside there

main crow
#

and that does compile

maiden birch
#

That does

#

Anyway per driver state is fine, but kernel api is global and as such not stateful

#

So I wouldnt go there

#

But we could talk about it later if someone disagrees

hexed flare
hexed flare
robust abyss
#

The only case I can think is maybe if you want a different allocator per driver for whatever reason

#

But any place where the context would be saved globally I think you might as well not have it at all

tawdry trench
#

@maiden birch how should init happen? do we have a central "initialize everything" function, or should there be specific functions to initialize each driver

maiden birch
#

no central init

#

its very driver specific

tawdry trench
#

what about drm_core?

#

that also has its own init fn?

maiden birch
#

yes

tawdry trench
#

ok

maiden birch
#

i'd have a one per driver and one per each device

#

so udrm_init and the udrm_device_probe

#

similar to module_init/module_fini and then per device stuff

tawdry trench
#

are the probe funcs like the linux pci probe callbacks?

maiden birch
#

yes

tawdry trench
#

great

maiden birch
#

its basically: i found a device that matches your list, try to see if you can initialize it and bind to it

tawdry trench
#

yea that's what i thought

#

i'm just going to make up the IRQ/PCI bindings for now until they are finalized

maiden birch
#

yeah

tawdry trench
#

i'll comment them out

maiden birch
#

ill see what edge cases need to be handled in the irq bindings

#

like linux has request_irq with just one number but i know thats not all there is

#

and im not sure how that handles msi

livid sentinel
#

uAPI/vm.h:
void *uapi_kernel_map(
uapi_phys_addr addr, uapi_size len,
uapi_caching, uapi_access_type
);
might not work under certain oses if they deny user setable executable memory

maiden birch
#

sure, return a null

#

none of the current libraries need executable memory, this is more for the future

#

also like "user" setable? this is a kernel level driver

livid sentinel
#

i plan to put it into userspace

#

everything that doesnt have a strong reason for kernel level permissions goes into userspace

maiden birch
#

userspace level drivers should still be considered more priveleged than a normal application

livid sentinel
#

yea they get access to physical hardware but not access to rwx memory the only thing they can do is ask to get a library loaded

maiden birch
#

anyways this is just for the api completeness, no current use cases exist

livid sentinel
#

also if i understand correctly this function requests specific physical memory?