#junix

1 messages · Page 1 of 1 (latest)

wintry cloud
#

simple unix clone in ~9000 lines (goal is about 15kloc), with distant aim of multi arch

for x86 (primary target)
i literally just need

  1. the execv syscall
  2. vfs fat wrapping (create nodes on mount, destroy on unmount)
  3. (and maybe rewrite the elf loader slightly)

I'm like ~400 lines away! (famous last words)
and it will (hopefully) just work! (still insecure ring0, but)

(i have cpu-hal, pci, rtc, pit, ide, sys_noop, sys_exit, sys_fork (shallow copy), sys_read, sys_write, sys_open, sys_close, framebuffer, idt, gdt, pde (kinda), multi tasking, panic (duh), basic mm allocators, vfs, ramfs, custom fs (kinda, not done))

update will be within days or sum like that

there isn't much to show... because the graphics aren't used yet (just backend stuff has been worked on, and its not that much)

// current core/kmain.c
#include <libk.h>
#include <cpu/cpu.h>
#include <drivers/kprint.h>
#include <sched/core.h>

// not the first function actually,
// init is ran first (architecture specific)
// e.g. here its `src/arch/x86/init.c`
// lol using syscalls from the kernel (just a test)
// no paging tho
// like 9000 lines have to work if this works, and it does :fire: 
void kmain(void)
{
        cpu_ei();
        // fd is dynamic array, this is fd0 (stdin, hmm)
        int fd = open("/dev/serial", 0); // just works! no flags or mode yet tho
        if (fd < 0)
                panic(PANIC_TODO);
        write(fd, "Hello, World!\r\n", 15);
        close(fd);
        while(1)
                cpu_pause();
}

(its prints first 512 bytes of ide0 because i was debugging.. and forgot to remove oops)

buoyant delta
#

As per rule 6 do you have a source code repository available? Also how did you end up with all these syscalls staying in ring0 😭

wintry cloud
# buoyant delta As per rule 6 do you have a source code repository available? Also how did you e...

no ring3 yet, the way i see it there's no issue because there's no way to run shit yet floshed
once that is done i will add ring3
also yes there is a repo (pretty bad code because its a derivative of a derivative of a derivative of a derivative of a derivative (mostly my code* ofc))

https://github.com/JoshuaTheThe/JUnix

GitHub

Contribute to JoshuaTheThe/JUnix development by creating an account on GitHub.

wintry cloud
buoyant delta
#

eg sys_fork only needs to work for userspace anyways

wintry cloud
#

i mean yeah, i just wanted it so i can run basic shi (like idk sh so it can be usable quicker)

#

also as i said, fork is currently shallow copy (💀)
so its basically just clone the task structure