#The Flopperating System (tfos) - x86 32 bit Hobby OS

1 messages · Page 6 of 1

unborn latch
#

that isnt too much of a meme if youre using rust

#

😔

small hound
#

2mb debug stack

bold grove
#

It’s only 109 😔

#

Funny ass meme

#

I love this meme format

#

I should make an OSdev meme comp

#

Yeah that’s the reason fr

radiant grove
paper cloak
#

Why

small hound
#

you'll never know

#

long gdt init functions bring wealth and prosperity

paper cloak
#

Nah having code to setup the gdt values is useless when you can just hardcode them

bold grove
bold grove
#

Okay guys

#

I’m gonna rewrite my pmm

gentle flicker
#

kill runtime segment desc initialization

#

my gdt implementation is a u64 array

#

my TSS lower descriptor calculation is obscene

prisma magnet
#

@bold grove star4star KEKW couldnt star the actual repo tho im not logged into gh

bold grove
#

No worries

bold grove
#

Should I just statically make it

#

At compile time

#

With some static struct

gentle flicker
#

static u64

bold grove
#

Yeah okay bet

#

I’ll fix that

prisma magnet
bold grove
gentle flicker
#

basically tamsyn but with modern glyphs

prisma magnet
#

best font ever is VGA trl

gentle flicker
#

I hate structs

bold grove
#

Totally agree deadass

#

I used vga text mode for so damn long it’s not even funny

gentle flicker
bold grove
#

I only got Flanterm in April

#

And I created my os in October

#

Damn it’s almost a year old

#

Fuck

#

WAIT

bold grove
prisma magnet
#

donda 3 is gonna drop on floppaOS 1 year anniversary trl

gentle flicker
#

I made meow

#

meowix is new

bold grove
#

Well meow yeah

#

I just saw you’re

#

Your status

#

On disc

gentle flicker
prisma magnet
#

CatK

#

:tlr:

bold grove
#

Are you Turkish

#

Imma add a free Palestine message in my os

bold grove
#

Guys I added pc speaker

#

LMAO

#

i can now play cancer

bold grove
#

If so I’ll like it and you should like mine :)

gentle flicker
gentle flicker
bold grove
#

Okay thank you bro

#

Love you fr

gentle flicker
bold grove
#

I’m super interest

bold grove
gentle flicker
bold grove
#

Yessir

#

20 stars broooo

#

So happy

#

Literally so happy

#

I will redo my GDT tho

#

And statically do it

#

Hard code

gentle flicker
#

fell for the static gdt propaganda

bold grove
#

Yes I’m doing it rn

bold grove
# gentle flicker fell for the static gdt propaganda

#include <stdint.h>
#include "gdt.h"
#include "../lib/logging.h"

static const gdt_descriptor_t our_gdt[] = {
    { 0, 0, 0, 0, 0, 0 },
    { 0xFFFF, 0x0000, 0x00, 0x9A, 0xCF, 0x00 },
    { 0xFFFF, 0x0000, 0x00, 0x92, 0xCF, 0x00 }
};

static const struct __attribute__((packed)) {
    uint16_t limit;
    uint32_t base;
} gdt_reg = {
    sizeof(our_gdt) - 1,
    (uint32_t)our_gdt
};

void gdt_init() {
    log("gdt init - start\n", GREEN);
    __asm__ volatile (
        "lgdt %0\n"
        "mov $0x10, %%ax\n"
        "mov %%ax, %%ds\n"
        "mov %%ax, %%es\n"
        "mov %%ax, %%fs\n"
        "mov %%ax, %%gs\n"
        "mov %%ax, %%ss\n"
        "jmp $0x08, $.flush\n"
        ".flush:\n"
        :
        : "m"(gdt_reg)
        : "eax"
    );
    log("gdt init - ok\n", GREEN);
}
#

So easy

bold grove
#

What do I do to be gigachad

gentle flicker
#

real ones use hard coded 64bit entries in integer format

bold grove
#

Okay bet

#

Ohhhh I see what you mean

#

Just one big int

#

So like

gentle flicker
paper cloak
#

😎

gentle flicker
bold grove
#

Like that

gentle flicker
bold grove
#

It’s 32

#

But

#

Bit

#

It’s a bit different to long mode

gentle flicker
#

oh right

bold grove
#

Okay I got it

#

#include <stdint.h>
#include "gdt.h"
#include "../lib/logging.h"

static const uint64_t our_gdt[] = {
    0x0000000000000000ULL,        
    0x00CF9A000000FFFFULL,
    0x00CF92000000FFFFULL           
};

static const gdtr_t gdt_reg = {
    sizeof(our_gdt) - 1,
    (uint32_t)our_gdt
};

void gdt_init() {
    log("gdt init - start\n", GREEN);
    __asm__ volatile (
        "lgdt %0\n"
        "mov $0x10, %%ax\n"
        "mov %%ax, %%ds\n"
        "mov %%ax, %%es\n"
        "mov %%ax, %%fs\n"
        "mov %%ax, %%gs\n"
        "mov %%ax, %%ss\n"
        "jmp $0x08, $.flush\n"
        ".flush:\n"
        :
        : "m"(gdt_reg)
        : "eax"
    );
    log("gdt init - ok\n", GREEN);
}
gentle flicker
bold grove
#

Yes

#

And works

#

Gdt init works

gentle flicker
#

now you’re chad

bold grove
#

Betttttttttt

#

Pushing that rn

#

This is so fucking clean

bold grove
#

:)

#

@paper cloak

#

I statically did the GDT

paper cloak
#

this is better

#

but why name it our_gdt

gentle flicker
bold grove
bold grove
#

This is so much cleaner holy fuck

bold grove
#

Like

#

It’s so easy

#

I overximplicated it

#

But this is literally 30 lines

#

Okay time to fix my VFS boys

#

Tmpfs is okay

#

I feel like this function is over complicated

#

In tmpfs

#

static int tmpfs_write(struct vfs_node* node, unsigned char* buffer, unsigned long size) {
    if (!node || !node->data_pointer) return -1;
    tmpfs_handle_t* h = (tmpfs_handle_t*)node->data_pointer;
    tmpfs_inode_t* f = h->inode;

    spinlock(&f->lock);
    if (f->type != VFS_FILE) {
        spinlock_unlock(&f->lock, true);
        return -1;
    }

    size_t endpos = h->pos + size;

    size_t need_pages = tmpfs_ceil_div(endpos, TMPFS_PAGE_SIZE);
    if (need_pages > f->page_count) {
        if (tmpfs_resize_pages(f, need_pages) != 0) return -1;
    }

    if (h->pos > f->size) {
        size_t z = f->size;
        while (z < h->pos) {
            size_t pg_idx = z / TMPFS_PAGE_SIZE;
            size_t pg_off = z % TMPFS_PAGE_SIZE;
            size_t chunk = TMPFS_PAGE_SIZE - pg_off;
            size_t left = h->pos - z;
            if (chunk > left) chunk = left;
            if (pg_idx < f->page_count && f->pages[pg_idx]) {
                flop_memset((uint8_t*)f->pages[pg_idx] + pg_off, 0, chunk);
            }
            z += chunk;
        }
    }

    /* perform the write across pages */
    size_t off = h->pos;
    size_t done = 0;
    while (done < size) {
        size_t pg_idx = off / TMPFS_PAGE_SIZE;
        size_t pg_off = off % TMPFS_PAGE_SIZE;
        size_t chunk = TMPFS_PAGE_SIZE - pg_off;
        size_t left = size - done;
        if (chunk > left) chunk = left;

        if (pg_idx >= f->page_count || !f->pages[pg_idx]) {
            /* allocate missing page, shouldn't happen after resize, but always use protection :^) */
            if (tmpfs_resize_pages(f, pg_idx + 1) != 0) return -1;
        }

        flop_memcpy((uint8_t*)f->pages[pg_idx] + pg_off, (uint8_t*)buffer + done, chunk);

        done += chunk;
        off  += chunk;
    }

    h->pos += size;
    if (f->size < h->pos) f->size = h->pos;

    spinlock_unlock(&f->lock, true);
    return (int)size;
}
bold grove
#

My fav type

#

I completely forgot I put “always use protection” in that

#

LMAOOO

bold grove
#

Okay boys

#

Here’s the agenda

#
  1. Pmm rewrite
  2. Vfs rewrite
  3. Heap rewrite
bold grove
#

well

#

that went great

#

fuck

#

@gentle flicker this is what imeant by bullshit verbose logs

radiant grove
bold grove
#

YES

#

LETS GO

bold grove
#

NEW PMM WORKS

radiant grove
#

congrats !!!!!!!!!

#

im trying to make mine a buddy allocator as well

#

also this is a shit ton of verbose info

bold grove
#

yeah i know

#

its mainly for debugging

radiant grove
#

i figured

bold grove
#

i mainly changed how im initializing the pmm

#

because was

#

shtting pages out

#

for no reason

radiant grove
#

rip

bold grove
#

GIYS

#

IM LOCKED IN

#

HUGE SOURCE UPDAYE TONIGHT

radiant grove
#

holy shit

bold grove
#

I’ve rewritten so much

small hound
#

+40000
-0

"Nothing works. Big commit though"

bold grove
#

Wdym 😔

small hound
bold grove
#

I tested all of it

#

I always test my code

radiant grove
#

good practice tho

small hound
#

real

bold grove
#

Testing is good

#

I reduced my GDT to 30 lines

#

Earlier

#

Redid pmm init

#

Redoing vfs

#

Redoing vfs

#

@small hound where did you read up to implement mutexes

small hound
#

nowhere my mutexes suck and have nothing to show for

I read freebsd and solaris a while back to start implementing priority inheriting turnstile backed mutexes and then I got lazy and disinterested

#

low aura activities

#

you should do priority inheriting turnstile backed mutexes like freebsd and solaris

#

dont listen to linus' hate on it

bold grove
#

Oh okay

small hound
#

wasn't a fan

#

this also seemed more intuitive

bold grove
small hound
#

yes

#

they suck don't look at them

#

they work but they suck

bold grove
#

Okay

#

Any other decent impls

small hound
#

in fact don't look at any of my code you're cooked if you do

small hound
bold grove
#

I mean I looked at your spinlock

small hound
#

linux rt mutex is interesting but probably not what you wanna do

bold grove
#

That was the only thing I’ve looked at

small hound
#

will be like that for a while

bold grove
#

Mine is getting better

bold grove
#

okay so

#

i realized im stupuid

#

and that my vmm functions are extremely complicated

#

i reread the intel sdm

#

for page durectories

#

and tables

#

and im extremely stupid

#
int map_page(uint32_t vaddr, uint32_t paddr, uint32_t attrs) {
    uint32_t pt_index = (uint32_t)(0xFF000000 >> 12) / 1024;
    if (pg_dir[pt_index] == 0) {
        pg_dir[pt_index] = (uint32_t) pmm_alloc_page() | PAGE_PRESENT | PAGE_RW; 
        flop_memset((uint32_t*)pg_dir[pt_index], 0, PAGE_DIRECTORY_SIZE);
    } 
    pg_tbls[vaddr / 1024] = (paddr & 0xFFF00000) | attrs;
    return 0;
}

int unmap_page(uintptr_t vaddr) {
    pg_tbls[vaddr / 1024] = 0;
    __asm__ volatile("invlpg (%0)" :: "a"(vaddr));
    return 0;
}
#

this is it

#

this is literally it

#

@radiant grove

#

Look

bold grove
#

@viscid zephyr sorry for ping but

#

I rewrote my page mapping stuff

#

And I realized

#

That simplicity

#

Is so much better

#

Obviously I have lots to rewrute

viscid zephyr
bold grove
#

This is kinda just the logic for the mapping itself

#

I’ll do shit to prevent race now lol

viscid zephyr
bold grove
#

Which

#

I need to research lol

bold grove
#

also quick question

#

why are all the file extensions jkl

viscid zephyr
small hound
#

#osdev-misc-0 message

"I've extensively studied the vmm of mintia"

#

is this old mintia

#

how did you even read dragonfruit

#

dragonfruit is a deviously unreadable language

bold grove
#

bruh im stupid

#

i was mapping the userspace

#

in my new vmm

#

and i kept page faulting

#

maybe because i didnt mark the pages as fucking present

#

fucking stupid retard

#

💀

small hound
# bold grove its not that bad lmao
fn MmAllocWithTag { bytes tag flags -- ptr ok }
    if (DEBUGCHECKS)
        if (MiInited@ ~~)
            "MmAllocWithTag: used before MmInit called\n" KeCrash
        end

        if (KeIPLCurrentGet IPLDPC >)
            "MmAllocWithTag: ipl > IPLDPC\n" KeCrash
        end

        if (bytes@ ~~)
            "MmAllocWithTag: request of 0 bytes\n" KeCrash
        end
    end

    if (flags@ 0 ==)
        // can't block, so give this nonpaged allocation a small leg up

        POOLALLOC flags!
    end elseif (ExBootFlags@ OSBOOTFLAG_NONPAGEDPOOL &)
        PAGED ~ flags &=
    end

    // round up to nearest long
    bytes@ 3 + 3 ~ & bytes!

    if (bytes@ MiAllocatedHeapBlock_SIZEOF + PAGESIZE 2 / >=)
        if (flags@ PAGED &)
            bytes@ // bytes
            tag@ // tag
            flags@ // flags
            MiPagedPoolAllocPages ok! ptr!
        end else
            bytes@ // bytes
            tag@ // tag
            flags@ // flags
            MiNonpagedPoolAllocPages ok! ptr! drop
        end

        if (DEBUGCHECKS)
            if (ok@)
                if (flags@ CANBLOCK &)
                    "MmAllocWithTag: page-aligned CANBLOCK allocation failed\n" KeCrash
                end
            end
        end

        return
    end

    bytes@ // bytes
    tag@ // tag
    flags@ // flags
    MiHeapAlloc ok! ptr!

    if (DEBUGCHECKS)
        if (ok@)
            if (flags@ CANBLOCK &)
                "MmAllocWithTag: CANBLOCK allocation failed\n" KeCrash
            end
        end
    end
end``` how does this work
#

i can't understanda lot of the ~ and @ and ~~

#

whimsical symbols

bold grove
prisma magnet
bold grove
bold grove
prisma magnet
viscid zephyr
#

When i was 16 i had a phase for like 4 months where i had a Turkish flag pfp and I pretended to be a Turkish ultranationalist

bold grove
#

I think it’s the autism

viscid zephyr
#

Mine was ironic

bold grove
#

I swear everyone here is autistic

#

Oh mine too

#

I was a Indonesian nationalist for a while LMAO

viscid zephyr
#

I was satirizing a Turkish friend i had who was obsessed with the Ottoman Empire and shit

#

I would send him this a lot and he'd get really mad

bold grove
small hound
viscid zephyr
bold grove
#

Having patriotic symbols in general is so cringe

#

I find it hilarious when people mock bosnian patriotic symbols

prisma magnet
bold grove
#

Nice

#

I went to Egypt in 2019

#

Nice place

#

Cairo is a clusterfuck tho

#

Most crowded city ever

#

Deadass

prisma magnet
#

50 egp for a bottle of water

bold grove
#

Nah I speak Arabic so

prisma magnet
bold grove
#

And I look dark as fuck

#

I speak like Saudi Arabic

#

From when I took Quran classes

#

When I was younger

bold grove
prisma magnet
#

Ok I'll now take a look at the github

bold grove
#

Oh fuck

prisma magnet
#

because I haven't done that already

bold grove
#

Just look here lol

#

I made a clean GDT

#

@prisma magnet I saw your thread and

#

Did you do the GDT yet

#

Wait nvm

prisma magnet
#

@bold grove OUR gdt

static const uint64_t our_gdt[] = {
    0x0000000000000000ULL,        
    0x00CF9A000000FFFFULL,
    0x00CF92000000FFFFULL           
};
#

Questionable naming

small hound
#

why is the gdt such an overblown topic of discussion here

#

it's like the most useless pointless meaningless thing to discuss about

#

it feels like it's just for the meme but then the discussions are legitimate questions and inquiry regarding it

prisma magnet
bold grove
#

It’s kinda like paging

#

It’s the “first mindfuck” out of them all

small hound
#

crazy

bold grove
#

Well

#

It’s kinda hard to bullshit your way through those you know

bold grove
prisma magnet
bold grove
#

FloppaOS boots on real hardware

bold grove
#

Okay so

#

I completely rewrote the vmm

prisma magnet
#

Why

#

.

bold grove
#

Because my shit was shit

prisma magnet
#

Duh

#

It's shit

#

Shits shit

bold grove
#

Yeah true

#

I’m just

bold grove
prisma magnet
bold grove
#

Yup

prisma magnet
bold grove
gentle flicker
radiant grove
bold grove
#

Okay boys

#

We’re boutta have a big commit

gentle flicker
#

+10 -50000?

radiant grove
#

to comit or no to comic thonk

bold grove
bold grove
#

okay gang

#

were getting somewhwere

#

so much work

#

syscalls deadass

#

work

bold grove
#

or should i just do my own thing

bold grove
#

oh lord

#

i have a syscall handler now

bold grove
paper cloak
bold grove
#

true true

#

so can i just create a posix_syscall

#

file

paper cloak
#

wha

bold grove
#

that uses my syscalls to the posix spec?

paper cloak
#

i meant in userspace

#

because now you're just adding syscalls

bold grove
#

ohhhh

paper cloak
#

tho that could work

bold grove
#

i see what you mean

paper cloak
#

like freebsd's linuxulator

bold grove
#

i mean i know that wsl1 existed and kinda did the same thing

paper cloak
#

why do you need a paper on this

bold grove
#

to create a posix layer?

paper cloak
#

yes

#

why

bold grove
#

because i dont know where to start

paper cloak
#

you have some syscalls

#

then you have a user program

#

that takes in IPC requests for posix calls

#

and does the proper system calls

#

and returns the result

bold grove
#

i see

#

so its like ipc req -> my syscalls -> results

paper cloak
#

where you basically hook another syscall table when the elf's OS is linux

#

its cool but less cool than doing it in userspace

bold grove
#

okay ill just do it in userspace

#

but ill create my own syscall table first

#

i already made a handler

bold grove
paper cloak
#

you can also just not care and just have posix syscalls directly

#

it's faster and more convenient but you lose in flexibility

bold grove
#

sorry

#

ket me explain better

bold grove
#

okay im not that retarded

#

i just havent

#

read up on them in a while lol

prisma magnet
#

um

#

is that allowed

bold grove
#

shit

#

ive used it hella

#

and im actually like

#

diagnosed

#

autism spectrum disorder

#

so

#

i feel like if im autistic i should be able to use a word like that

bold grove
#

my FUCKING MAKEFILES

#

lol hes funny

#

hes always in these memes 💀

prisma magnet
#

MY MAKEFILES. MY. FUCKING. MAKEFILES.

radiant grove
bold grove
#

yeah youre right

#

or maybe im just dogshit

#

this is gonna be a huge ass commit fuck

radiant grove
#

ngl i wanted to do something like that for nullium

#

i have 0x45 for everything normal and then maybe 0x80 is gonna be unix stuff

bold grove
#
static void init_local_apic() { 
    uint32_t tmp;
    lapic_write(LOCAL_APIC_LDR_REG, 0x0);
    tmp = (1 >> smp_fetch_cpu());
    tmp = tmp << 24;
    lapic_write(LOCAL_APIC_LDR_REG, 0xffffffff);
    tmp = lapic_read(LOCAL_APIC_SPURIOUS_REG);
    tmp = tmp | (1 << 8);
    lapic_write(LOCAL_APIC_SPURIOUS_REG, tmp);
}
#

@small hound smp rewrite under way

paper cloak
#

syscall is faster btw

small hound
#

crazy

bold grove
#

because i have no fucking life

#

and i own a physical copy of the intel sdm

#

a recipe for disaster

small hound
#

what does that have to do with this tho

#

💥

bold grove
#

well im just saying

#

i have lots of time

#

and all the resrouces in the world

#

im literally

#

consatntly programming

#

i have so many things open

#

50 github tabs

#

20 seperate pages of ostep

#

like

#

so many things

#

the life i had is gone

#

all the people who cared for me before stopped

#

s o

#

i have this project

#

to care about

#

without this im nothing

#

parents dont like me, freinds are mad

#

my girlfriend is furious with me

#

just

bold grove
#

kinda depressing now that i think about it

#

but its fine

bold grove
#

i should probably create a set of locks to protect a process's pagemap @small hound

#

so i just did this

#
typedef struct proc_pagemap_locks {
    spinlock_t pg_tbls_lock;
    spinlock_t special_pgs_lock;
    spinlock_t free_kstack_pgs_lock;
} proc_pagemap_locks_t;
small hound
#

💥 👍

bold grove
#

fucking

#

macros

#
#define SHARED_PG_TBLS 32;
#define VMM_COMMON_SIZE ((SHARED_PG_TBLS*PAGE_SIZE*PAGE_TABLE_SIZE))
#define HIGH_MEM_START_ADDR 0x100000
#define THEORETICAL_MAX_PGS ((0xffffffff / PAGE_SIZE))
#define USER_CODE_SEG_START (0x40000000)
#define FETCH_PAGE_OF_ADDR(addr) (((addr) / PAGE_SIZE))
#define FETCH_PG_START(p) (((p) * PAGE_SIZE))
#define FETCH_PG_END(p) (( (p) + 1 ) * PAGE_SIZE - 1)
#define FETCH_4mb_AREA_OF_ADDR(addr) (((addr) / (PAGE_SIZE * PAGE_TABLE_SIZE)))
#define ALIGN_ADDR_TO_NEXT_PG_BOUND(addr) (FETCH_PG_END(FETCH_PAGE_OF_ADDR(addr)) + 1) 
#define MMIO_PTS 1
#define MMIO_SIZE ((MMIO_PTS*PAGE_SIZE*PAGE_TABLE_SIZE))
#define MMIO_START ((SHARED_PG_TBLS - MMIO_PTS) * PAGE_SIZE * PAGE_TABLE_SIZE)
#define MMIO_END (VMM_COMMON_SIZE - 1)
small hound
bold grove
#

i will

#

im just redoing some other stuff before i get to that

small hound
bold grove
# small hound
typedef struct stack_alloc {
    uint32_t thread_id;
    uint32_t pid;
    uint32_t is_entry_valid;
    uint32_t low_pg;
    uint32_t high_pg;
    struct stack_alloc* next;
    struct stack_alloc* prev;
} stack_alloc_t;

typedef struct address_space {
    uint32_t id;
    uint32_t is_table_slot_valid;
    uint32_t brk; // program break
    uint32_t last_byte;
    spinlock_t lock;
    struct stack_alloc* next;
    struct stack_alloc* prev;
} address_space_t;
#

😎

small hound
#

bogos binted

#

i thought we weren't typedefing structs anymore

bold grove
#

nah here i am

#

because im treating address spaces as types

#

like on purpose

#

same with the stack allocator

#

@radiant grove

#

holy fucking macros

radiant grove
#

insane macros

bold grove
#

maybe thats the issue

#

none of these macros are that insane though

#

its mainly old linux stuff

radiant grove
bold grove
#

i kinda have an issue with weed/alc

radiant grove
#

good thing

#

for some reason i cant detect memory maps

#

wonky

bold grove
#

how are you looking through mem maps

radiant grove
#

nvm i cant detect anything??

#

did my itoa break?

#

its always at 0

radiant grove
#

horse init... ok

bold grove
#

hopes and prayers init - ok

radiant grove
#

the problem is that i think it detects

#

but im not sure

#

itoa be goofy

#

ima repair it

#

it should work

bold grove
#

sorry but

#

what does itoa

#

have to do with memory maps

radiant grove
#

im printing the amount of memory map entries found

#

for testing and stuff

#

the variable is always 0 somehow

bold grove
#

which variable

#

how are you passing in multiboot magic and info to your kmain()

radiant grove
#

the same way the spec does

#

magic number and addr to structs

bold grove
#

show me kmain()

#

or whatever equivalent you have

#

and show me your entry assembly file

#

i have a hunch youre doing something wrong there

radiant grove
#

they're on the github they're basically the same except the mmap tag

#

literally nothing else

#

lemme send link

#

ok done

bold grove
#

; behold: the ultimate fuckshit implementation

gentle flicker
#

you won't need most of it

#

and you can split some in enums

radiant grove
bold grove
#

i mean

#

my entry asm file is funi too

radiant grove
#

truly

bold grove
#

also

#

why do yiou have so many sections and labels

radiant grove
#

multiboot2 stuff

#

gnu's spec has that stuff too

#

they're like config tags that tell the bootloader what to do on boot

gentle flicker
radiant grove
#

i need to add // WE BREAK USERSPACE - Evil Linus Torvalds [1642]

bold grove
#

"nvidia, fuck you"

radiant grove
#

nvidia is evil

#

i fixed my variable

bold grove
radiant grove
#

ok i will now crash out in the wrong thread

bold grove
#

its okat

radiant grove
#

i put my memory tag in the fucking framebuffer tag

bold grove
#

this is a crashout safe space

radiant grove
#

😭

bold grove
#

its okay

#

if ity makes you feel better

radiant grove
#

i can just copy paste it but its the most stupid mistake ever lmfao

bold grove
#

i was passing the mb magic and info

#

via standard c argv argc

#

for the longest time

radiant grove
#

fair

bold grove
#

so

#

my ass is much stupider for that lol

#

shiot i can even try to find that message in here

#

it was like

#

in january

radiant grove
#

january

#

ok my funny tag things work now

#

i can add a bootloader name fetch apparently

bold grove
#
uint32_t tmp_atch_pg(uint32_t phys) {
    uint32_t first_reserved = VIRTUAL_USTACK_TOP + 1;
    pte_t* ptd = (pte_t*) get_proc_ptd (get_pid());
    pte_t* pt;
    uint32_t p;
    uint32_t used_p;
    spinlock_t* special_lock;
    // lock special pages to make sure 
    // we dont get fucked by another thread within the same process
    special_lock = &(locks[get_pid()].special_pgs_lock);
    spinlock(special_lock);


    pt = get_ptaddr(ptd, RESOLVE_PTD_OFFSET(first_reserved), 1);
    // walk pt to find first free page  
    for (p = RESOLVE_PT_OFFSET(first_reserved); p < RESOLVE_PT_OFFSET(first_reserved) + RESERVED_PGS; p++) {
        if (pt[p].p == 0) {
            used_p = (p - RESOLVE_PT_OFFSET(first_reserved)) * PAGE_SIZE + first_reserved;
            break;
        }
    }
    if (used_p == 0) {
        log("no reserve pg found\n", RED);
        spinlock_unlock(special_lock, true);
        return 0;
    }
    
    // map used_p by adding new entry to pt
    pt[RESOLVE_PT_OFFSET(used_p)] = pte_new(VMM_PROC_RW, SUPERVISOR_PG, 0, phys);
    __asm__ volatile("invlpg (%0)" :: "a"(used_p));

    spinlock_unlock(special_lock, true);
    return used_p;
}
radiant grove
#

AAAA SPINLOCKS

#

/j

bold grove
#

i made my new mapping primitive @small hound

small hound
#

pte_t* ptd = (pte_t*) get_proc_ptd (get_pid());?

#

ngl ur code often ends up looking kinda disastorous

#

no offense

#

it's just all over the place

#

💥

radiant grove
small hound
#

accuraetr

bold grove
#

what is so unclear here

#

get_pid just gives the current process id

radiant grove
#

you're supposed to pull the number out of your ass not fetch it with a function

bold grove
#

valid

#

i mean it works and fits the ia32 sdm

#

ive tested it

bold grove
small hound
#

spinlock_unlock(special_lock, true); why true?

pte_t* ptd = (pte_t*) get_proc_ptd (get_pid()); what? why does the mapping logic care?

special_lock = &(locks[get_pid()].special_pgs_lock); what's this?

__asm__ volatile("invlpg (%0)" :: "a"(used_p)); why are we doing inline asm (wrap it in a function)? where is the tlb shootdown?

tmp_atch_pg what does this mean?

uint32_t first_reserved = VIRTUAL_USTACK_TOP + 1; what is happening here?

pt[RESOLVE_PT_OFFSET(used_p)] = pte_new(VMM_PROC_RW, SUPERVISOR_PG, 0, phys); I can take a guess as to what this is doing

bold grove
#

and the mapping logic cares because it knows what virtual address to map to based off of the current process

#

thats just how im doing it

small hound
#

why not say bool iflag = spin_lock(thing)

small hound
#

this is so odd

#

why are we bump allocating virtual addresses here?

#

it takes like 50 lines of code to write a primitive virtual address space allocator since you already have a red black tree

bold grove
#

whats the issue with bumping them

small hound
#

you run out of addresses

#

very fast on 32 bit

#

64 bit is less bad but you shouldn't be doing it anyways

bold grove
#

the function attaches a page to the virtual address space of the current process and returns the virtual address

small hound
#

ok.... no...... that's not how you're supposed to do this at all

#

you don't just mash together this logic, you have one thing to allocate virtual address regions, another thing to attach them to address spaces, and then you attach an address space to your process

#

for example a very primitive way of doing this...

struct vas_range {
    struct rbt_node node;
    vaddr_t start;
    size_t length;
};

struct vas_space {
    struct spinlock lock;
    struct rbt *tree;
    vaddr_t base;
    vaddr_t limit;
};```
bold grove
#

maybe i should just go back to the vm_region_t thing i was doing

#

whch is kinda like what you are describing

#

i thought it would be better to do that within the mapping function itself

#

but

small hound
#

💥

bold grove
#

yeah

small hound
#

or that's their struct definition

radiant grove
#

.h

small hound
#

💥

radiant grove
paper cloak
#

alcohol is poison

#

weed is too but its better meme

bold grove
#

100%

small hound
bold grove
#

alcohol has brought me so many issues

#

weed hasnt done shit besides making me eat doritos

paper cloak
#

alcohol sucks to ingest, has lots of calories and makes you feel like shit the next day

radiant grove
bold grove
#

but yes

paper cloak
#

no

bold grove
#

weed is much more pleasant experience

paper cloak
#

it still sucks to ingest

#

because it tastes like shit

bold grove
#

yeah shit sucks

#

and ruins your morning

paper cloak
#

i only drink strong alcohol

#

and i hate it

bold grove
#

same.. and even when i do its diabolical

viscid zephyr
bold grove
#

a few nights ago i blacked out on fucking jim bean peaech

paper cloak
#

beer is not strong

viscid zephyr
#

Idk what ppl complain about

bold grove
#

beer is good

radiant grove
#

beer isnt strong

bold grove
#

but yeah not very strong

#

also to get drunk on beer you need to consume 3000 calories

#

which is

paper cloak
#

alcohol inherently has a lot of calories

bold grove
#

yeah

#

by nature of how calories work

#

like

#

heat

#

alcohol is flammable

#

so it has a fuck ton lol

paper cloak
#

what

#

i dont think that's why

#

I just think naturally the process from which alcohol is made takes a lot of glucose which cannot be removed without removing alcohol

bold grove
#

oh yeah alcohol is just fermented sugar lol

paper cloak
#

yea

bold grove
#

but yeah alcohol is poison compared to weed

#

it just makes me hungry

radiant grove
#

i wanna know why weed isnt legalized in some places then

#

if alcohol is worse then why isnt it banned

#

oh

#

wait

#

shit that already ahppened

bold grove
#

because that would make too much sense

radiant grove
#

the prohibition laws happened

bold grove
#

alcohol is integral in many cultures

#

and kinda very forced in some cultures

viscid zephyr
radiant grove
viscid zephyr
#

Lots of ppl complain it's nasty

bold grove
paper cloak
#

ah ethanol is turned into acetylaldehyde then acetate which is linked to acetyl-coa

viscid zephyr
#

I think they're stupid

bold grove
radiant grove
#

not even old enough to drink that but banning an integral part of many cultures is quite crazy

paper cloak
#

yes

#

no

bold grove
#

banning anything like alc or weed is giong to end up bad

paper cloak
#

alcohol def should be re-evaluated

bold grove
#

alc is 100 times worse than weed

radiant grove
#

alcohol should be more restricted

bold grove
#

easily

paper cloak
#

it's a very bad drug but it is socially accepted

bold grove
#

yeah

#

its worse than most drugs we considwer "street drugs"

radiant grove
#

its also quite shit

bold grove
#

not even a drug

paper cloak
#

tobacco is not a drug

radiant grove
#

oh

#

damn

paper cloak
#

and its less accepted nowadays

#

nicotine is the drug

bold grove
#

nicotine is like caffeine but slightly more

radiant grove
#

oh

#

right i forgot

#

why isnt nicotine as banned

bold grove
#

i smoked cigarettes for a long time and switched to nicotine pouches

paper cloak
#

because

#

money

bold grove
#

money, big tobacco

radiant grove
#

ah yes corporations as usual

paper cloak
#

pouches are probably better for you because no smoke and no shitton of chemicals

bold grove
#

yeah pouches have improved my health

paper cloak
#

but nicotine is getting less and less popular

bold grove
#

i buy these ones that are locally made

#

in my city

radiant grove
bold grove
#

with natural ingredients

paper cloak
bold grove
#

nicotine itself isnt harmful... its just addictive

radiant grove
#

true

paper cloak
#

the problem is addiction

bold grove
#

the main health issues associated with tobacco is the cancerous shit inside

#

tobacco

radiant grove
#

tobacco

bold grove
#

every single toxic chemical you can think of

#

i smoked cigs for 3 years

#

shit is not for the light hearted

paper cloak
#

anyway pot in edibles is probably barely harmful for you and should be the #1 recreational drug imo

bold grove
#

yeah edibles are lit

#

i just hate waiting

#

so i just do the little weed pens

paper cloak
#

yea

radiant grove
#

i remembered a trend in eastern european countries i never saw it happen but it def did happen tho

younger teenagers were buying chewing tobacco and i do not even know why/how they got bored or smth

bold grove
#

chewing tobacco is addicting

#

thats why

#

it feels like heaven when you start

paper cloak
#

its probably edible > vaporiser > bong <=> pen > joint in terms of safety

#

bong may be better

bold grove
#

bong isnt so bad

paper cloak
#

than pen

bold grove
#

bong is def better than pen

paper cloak
#

pens are full of chemicals

bold grove
#

pens are the ultimate convenience though

paper cloak
#

true

#

so its edible > vaporiser > bong > pen > joint

bold grove
#

yeah

#

i do like me a joint

paper cloak
#

pen only better than joint because you have no ashes

bold grove
#

yeah, i like the buzz off a good pen too

paper cloak
#

from a health pov

#

doesnt smell either

bold grove
#

thats my fav part

#

you can hit a pen in a church and no one would know

#

(or so im told....)

#

totally never did that in my life

prisma magnet
#

This should probably be in #lounge-0

bold grove
#

its my progress report

#

and this relates to me

#

and interests me

paper cloak
bold grove
prisma magnet
#

yeah..... but talking about pens ain't reporting progress............ anyways I bought this really cool pen today

bold grove
#

yeah?

#

what strain

#

ive reported plenty of progress today lol

prisma magnet
#

I didn't buy a pen today

paper cloak
#

I dont personally smoke or drink much but my friends do so thats why I know a bit about it

prisma magnet
#

Or did i

small hound
#

most sober member of osdev discord

radiant grove
#

i also have a pen

it has black ink in it and it writes stuff very clearly its like really cool

bold grove
#

im def the least sober out of all the people with kernels here

paper cloak
#

last time I drank too much and puked so now I'm kinda conditioned to have a gag reflex whenever I smell alcohol meme

bold grove
#

i would love me an alcoholic kernel dev boyfriend

prisma magnet
radiant grove
#

im probably the most sober out of here

bold grove
#

i got hammered off jim bean peach and my dad got peaches today and i literally almost threw up

radiant grove
#

yall are just deadass smoking drugs here

bold grove
#

nah not many tbh

#

its only like

#

a few people in my age gruop

radiant grove
#

Ok Fair

paper cloak
#

because toothpaste has alcohol slightly

#

💀

bold grove
#

I KNOW

#

LIKE THE 0.1

#

ALC

#

is enough

prisma magnet
#

I eat dirt

bold grove
#

and im super crazu about brushing my teeth

#

i do it like 3 times a day

bold grove
paper cloak
#

will probably do again instead of drinking

bold grove
#

yeah

#

weed is much better

radiant grove
#

id honestly prefer not getting addicted at all

bold grove
#

and lowkey feels better

#

i mean

paper cloak
#

is weed even addictive

radiant grove
bold grove
#

not physically

#

like alcohol

#

but it can be mentally addicting

#

ive definitely struggled

#

but the thing is

prisma magnet
bold grove
#

i can quit weed for weeks at a time and be fine

#

but whenever im super into alc

#

quitting seems impossible

#

like whenever i go on vacations

#

i quit weed

#

no issues

prisma magnet
#

What are the effects of FloppaOS on camembert cheese

radiant grove
paper cloak
#

I'm probably in the top 1% in terms of sobriety in my age group so I think im fine meme

bold grove
bold grove
prisma magnet
bold grove
#

been to rehab many times

bold grove
prisma magnet
radiant grove
paper cloak
bold grove
#

stoners are the best

#

never had an issue with them

#

its just the heavy drinkers and party drug people that are bad

#

like

#

i was staying with these peoplefor a few weeks

prisma magnet
#

It apparently affects the growing speed of sweet corn

paper cloak
#

yeah I guess if you're staying with them its worse

bold grove
#

and i found out they were lacing my morning coffee with MDMA

#

like some pink floyd syd shit

paper cloak
#

nah he did lsd

bold grove
#

ik but his rommates laced his coffee with lsd

#

and my roommates did too just with MDMA

paper cloak
#

a better music reference would be the beatles' dentist who laced the beatles' tea with lsd

bold grove
#

W

#

thankfully im not there anymore

#

for now im sober

#

i dont ave weed or alc

paper cloak
#

LSD is practically harmless unless you're predisposed to schizophrenia

#

which is nice

bold grove
#

dnt really have a desire to get any

#

lsd is dope

#

i just had too many bad times on it

paper cloak
#

unironically LSD and shrooms and other psychedelics are like the safest drugs

#

and can even be beneficial

bold grove
#

oh yeah, psychs are much safer than anything

#

there is therapeudic qualities of psychs

#

and mdma

#

ive heard arguments for ketamine bu

#

that fool elon musk uses it

#

and i dont wanna end up like him

paper cloak
#

ketamine is addictive

#

its an opioid

#

no nvm

#

its not

bold grove
#

isnt it a dissociative

paper cloak
#

idk what it is

prisma magnet
#

Sun Microsystems supports eradication of wheat crops in Inner Mongolia and Manchuria

bold grove
paper cloak
#

I have been on ketamine in the past

prisma magnet
paper cloak
#

(surgery meme)

bold grove
#

i did it recreationally one time

#

and holy fucking shit

#

i cannot see any

#

medical benefits from that

#

it was literally a trance state

#

i was in a true state of stupor

#

i couldnt speak, see, hear, feel ,

#

anything besides what i was tripping

paper cloak
#

idk i was like 4 years old I dont remember

bold grove
#

tripping balls at 4

#

lit

paper cloak
#

i had a surgery

#

so

bold grove
#

yeah

#

man speaking of that

#

there was one time i started waking up from a surgery

#

and for some reason the anaesthesiologist didnt notice for like 2 min

#

i had to literally scream at the top of my lungs to get a slight sound out of my mouth

#

and then they fixed it

#

fucking horrifying

prisma magnet
#

Oof

viscid zephyr
# paper cloak I have been on ketamine in the past

they put me on it when i got my wisdom teeth out and i just remember seeing patterns dancing on a beige background and occasionally being able to feel little taps on my jaw (probably the most violent moments of the surgery) and not being able to even think, my self was completely gone i was just passively accepting and recording input

paper cloak
#

damn thats a hard drug for wisdom teeth

bold grove
#

fr

paper cloak
#

I only had partial anesthesia

bold grove
#

its like heroin for a sprained ankle

paper cloak
#

and they didnt put enough so it hurt a shittonmeme

viscid zephyr
#

ketamine isnt an unusual dental anesthetic

bold grove
#

yeah theyve been usin it in recent years

foggy cedar
#

Dude I check this server for a moment at 3am and first thing I see in this thread is discussion about alcohol and weed

bold grove
#

thats the nuke pagemap experience

small hound
bold grove
#

health is overrated

#

you know even outside of drugs

#

the worst drug is adrenaline

#

crazy extreme sports are so addicting

prisma magnet
bold grove
#

oh god

#

trump elon lore

foggy cedar
#

Superior American Texas time zone 😭😭

foggy cedar
#

Mf you're in UTC+3

bold grove
#

yeah

prisma magnet
bold grove
#

its not 4am for you

#

it is 8

paper cloak
#

9pm in eastern timezone (best timezone)

bold grove
#

because i am in pacific

prisma magnet
#

I don't live in texas

bold grove
#

and its 6 for me

#

where do you live

#

oh wait

foggy cedar
bold grove
#

egypt

#

i live in fuckass washington state

#

nothing here but tweakers and trees

prisma magnet
bold grove
#

well i lived in bosnia for many years

#

i grew up there

#

moved here when i was 8

prisma magnet
#

No i meant landmine land by Kursk

#

But ok

bold grove
#

bosnia is known as the landmine land

#

more landmines in bosnia than anywhere else in the world

#

walking in the forest in bosnia is like playing minesweeper

prisma magnet
viscid zephyr
prisma magnet
#

Eye raq

#

amirite?

viscid zephyr
#

maybe its true bosnia has the most landmines specifically. but laos has the most unexploded munitions laying around buried under a few inches of soil

#

like 50 laotian farmers get blown up every year trying to expand their fields

paper cloak
#

yea i knew a guy from laos and he said that

prisma magnet
viscid zephyr
#

during the vietnam war the usa continuously carpet bombed the laotian countryside indiscriminately for over a decade straight

#

they dropped ~60 million bombs i think

#

like 30% of them didnt explode

paper cloak
#

its kind of a shame the damage to laos from the vietnam war is mostly ignored

viscid zephyr
#

and we just never cleaned them up

bold grove
#

djdnt they bomb laos because the viet kong shipped supplies through there

viscid zephyr
#

yeah but like the viet cong were the good guys so that still doesnt excuse it

#

lol

prisma magnet
bold grove
#

doesnt excuse it

prisma magnet
#

And FREEDOM BABY

bold grove
#

the viet kong were the good guys

prisma magnet
#

🇺🇸 🇺🇸

bold grove
#

the facsist ass south leader that was backed by our "democracy" was the bad guy

prisma magnet
#

There's no good guy in war

#

They're all bad guys

bold grove
#

not if youre defneding yourself from western imperialism

#

shit

#

violence IS the answer

#

when it comes to that

#

colonialism

#

can only be refuted with violence

prisma magnet
#

God how did this convo devolve from osdev to drugs to the Vietnam war

viscid zephyr
#

yeah the vietnam war wasnt some inscrutably morally complex conflict it was just invaders vs ppl defending their home

small hound
viscid zephyr
#

it started with a revolutionary war by the viet minh against the french colonists

small hound
#

the cia gotta be my second favorite terrorist organization

bold grove
#

bedause of ComMuNiSm

#

america might be the worst out of the imperialist nations for that shit

#

dont even mention the marshall islands

prisma magnet
#

AMERICA FUCK YEAH !! 🇺🇸 🇺🇸 🇺🇲 WHAT THE FUCK IS THE GENEVA CONVENTION!!

bold grove
#

yeah were gonna nuke your entire homeland but you can live in shitty american row houses for free!

viscid zephyr
viscid zephyr
#

they were promptly re-invaded by france trying to reclaim their colony

#

which sparked the war

bold grove
#

why is it always the french

#

ffs

viscid zephyr
#

we basically got dragged into it by france

bold grove
#

yeah because of their indochina bullshit

viscid zephyr
#

they actually won against the french at bien dien phu and they won so hard they got the stupid fucking colonialist french general to kill himself

#

one of the best things ever to happen

#

the french left after that and then we rolled in

bold grove
#

damn bro thats ultimate defeat

bold grove
#

aka killing both innocent viets and innocent american soldiers who were forced and drafted

#

the whole country was mad at the gov for the vietnam shit

prisma magnet
#

Spread love not napalm

bold grove
#

like imagine one day waking up and being forced into a booby trapped forest in vietnam for fuck knows what reason

#

i cant even imagine that

viscid zephyr
bold grove
#

my friends last name is phu

#

hes from there ironically

bold grove
#

they literally just murdered every european on the island and told them to fuck off

#

and it worked

prisma magnet
viscid zephyr
#

iirc the french set up their colonial hq in a place considered defensible because it was surrounded by mountains and then ho chi minh's army proceeded to just drag artillery up like 70 degree slopes into the mountains and started bombarding the french

#

helicopters were sent to try to evacuate the hq and they were shot down

bold grove
viscid zephyr
#

ultimately the french all surrendered and the general killed himself in his bunker

bold grove
#

good ending

viscid zephyr