Giter Site home page Giter Site logo

byteduck / duckos Goto Github PK

View Code? Open in Web Editor NEW
605.0 16.0 22.0 5.9 MB

An x86 monolithic kernel and operating system written in modern C++. Comes with in-house graphical applications and command line utilities, plus ports of existing software. And yes, it runs DOOM!

License: GNU General Public License v3.0

CMake 1.03% Shell 1.32% C 15.50% Assembly 0.61% C++ 81.48% Python 0.07%
kernel hobby-os os operating-system doom unix unix-like osdev baremetal posix dynamic-linking x86

duckos's Introduction

duckOS

duckOS

A hobby UNIX-like OS with a graphical window manager and applications for x86-based computers.

Try duckOS

A disk image of duckOS can be downloaded from the artifacts of the duckOS GitHub workflow. This can then be virtualized or emulated using QEMU or your software of choice.

Alternatively, thanks to the v86 project by copy, you can try a version of duckOS in your browser. This is a lot slower running it locally, and the build will usually be a bit out-of-date. You can try it here!

Screenshots

Screenshot

What's working

  • Booting off of the primary master IDE (PATA) hard drive on both emulators and real hardware (tested on a Dell Optiplex 320 with a Pentium D)
  • PATA DMA or PIO access (force PIO by using the use_pio grub kernel argument)
  • A virtual filesystem with device files (/dev/hda, /dev/zero, /dev/random, /dev/fb, /dev/tty, etc)
    • The root filesystem is ext2, and is writeable
  • Disk caching
  • Dynamic linking with shared libraries
  • A Bochs/Qemu/VirtualBox/Multiboot video driver (640x480x32bpp)
  • A window manager / compositor called pond
  • Various GUI applications
  • Ports of binutils and gcc
  • More!

Future plans

Stuff that may happen soon™.

  • Revamp virtual memory system so it's not as error-prone and easier to debug (named regions, fix race conditions, faster allocation, etc.) Done!
  • Revamp kernel IPC system to be more efficient (Replace SocketFS with something like Mach or MINIX's grant-based IPC)
  • Better font rendering (Vector fonts, different sizes, etc.)
  • Finish porting GCC, self-host
  • More s t a b i l i t y and s p e e d
  • A better filesystem cache implementation that can free memory when needed and periodically flushes writes
  • More kernel & userspace unit tests
  • Better documentation of kernel, libraries, and applications
  • Some more kernel & userspace debugging tools so I don't have to spend hours knee-deep in the qemu debugger whenever a segfault happens due to a simple bug that could've been avoided with some extra coffee in my system

Lofty goals

Maybe someday.

  • Multiprocessor (multicore) support
  • x64 / ARM support (?)
  • Slowly transition various modules from the kernel to userspace (ie microkernel)
  • Add Rust into the mix (?)
  • Network support

Services

The code for these can be found in services.

  • Init (/bin/init): The init system for duckOS.
  • Pond (/bin/pond): The window manager / compositor for duckOS.
  • Quack (/bin/quack): The sound server for duckOS.

GUI Programs

The code for these can be found in programs

  • Calculator (/apps/calculator.app): A basic calculator.
  • Terminal (/apps/terminal.app): A libui-based terminal application.
  • System Monitor (/apps/monitor.app): A basic system monitor showing memory and CPU utilization.
  • 4 In a Row (/apps/4inarow.app): A basic four-in-a-row game. Play with two players or against the computer.
  • Sandbar (/bin/sandbar): A basic "taskbar" that displays a row of buttons at the bottom of the screen to launch applications.
  • Files (/apps/files.app): A rudimentary file explorer application.
  • Viewer (apps/viewer.app): A basic image viewer.
  • Lib3d Demo (apps/3demo.app): A demo for the lib3d library. Displays a cube by default; can be used to view obj files.
  • Editor (/apps/editor.app): A basic app to edit text files.

CLI Programs

The code for these can be found in programs.

  • ls (/bin/ls): Lists the entries in the current or given directory.
  • cat (/bin/cat): Writes the contents of a file to stdout.
  • cp (/bin/cp): Copies a file.
  • mv (/bin/mv): Moves a file.
  • pwd (/bin/pwd): Prints the current working directory.
  • mkdir (/bin/mkdir): Creates a new directory.
  • echo (/bin/echo): Prints the arguments given to it separated by spaces to stdout.
  • rm (/bin/rm): Removes a file.
  • ln (/bin/ln): Creates a hard or symbolic link to a file or directory.
  • rmdir (/bin/rmdir): Removes a directory.
  • touch (/bin/touch): Updates the access/modification times of a file or creates it if it doesn't exist.
  • truncate (/bin/truncate): Resizes a file.
  • chmod (/bin/chmod): Changes the mode of a file.
  • chown (/bin/chown): Changes the owner of a file.
  • free (/bin/free): Shows the amount of total, used, and free memory (use the -h flag for human-readable numbers).
  • ps (/bin/ps): Shows the currently running processes.
  • dsh (/bin/dsh): A basic userspace shell with support for pipes (|) and redirections (>/>>).
    • There is only support for one redirection at a time right now.
  • open (/bin/open): A utility to open files and applications from the command line.
  • play (/bin/play): Plays audio files.
  • profile (/bin/profile): Profiles a running application and outputs a FlameGraph / SpeedScope compatible file.
    • You can run scripts/debugd.py on the host (with speedscope installed) and pass the -r parameter to profile to send the output directly to the host via networking and open it in speedscope.

Programs that take arguments will provide you with the correct usage when you run them without arguments.

Libraries

  • libc: The standard C library.
  • libm: The math portion of the standard C library.
  • libpond: The library used for interfacing with the pond window manager / compositor.
  • libgraphics: A library which provides a few utilities for working with graphics such as image format loading.
  • libui: A UI framework for applications.
  • libterm: A framework for handling terminals.
  • libduck: A library containing commonly used classes and utilities, such as argument and configuration file parsing.
  • libriver: An IPC library not dissimilar to D-Bus, which provides a framework for remote function calls and data passing.
  • libapp: A library providing methods to retrieve information about installed and running applications.
  • libsys: Provides higher-level C++ abstractions for retrieving system information, namely from procFS.
  • libsound: Provides a framework for audio applications and interfacing with the sound server, Quack.
  • lib3d: Provides basic software 3D rendering functionality.
  • libmatrix: Provides matrix math utilities.
  • libexec: Provides ELF support.
  • libdebug: Provides debugging functionality.

Ports

Ports can be installed by running ports.sh supplied with the desired port as an argument. The required dependencies will also be built and installed.

Building / Running

Contributing

Credits

License

duckos's People

Contributors

byteduck avatar marcocicognani avatar pawlos avatar pf94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

duckos's Issues

[BUG] Plug up those kernel memory leaks

There are unidentified memory leaks somewhere in the kernel that need to be addressed. This is evidenced by the fact that if you repeatedly create and destroy processes, the memory usage slowly increases. I have no clue what's causing these leaks yet, but will update this issue once it's been identified.

[TODO] Graceful kernel stack overflow handling

The Problem

As it stands, kernel stacks have absolutely no protection whatsoever and will just trample whatever happens to be adjacent in memory when they overflow. Obviously, this is a problem.

The fix

The obvious fix is to add sentinel pages on either side of each kernel stack so that a fault occurs when the stack overflows (assuming there's no malice involved). However, as we handle page faults currently, this means that we triple-fault; if the stack pointer is in an unusable area of virtual memory, then we properly proceed with the ISR in the first place.

So, we need to change how we handle page faults. We'll probably need to use a task gate in the descriptor table for the page fault ISR, so that we can have a known safe stack to use for it. And I'll have to learn how hardware tasks work. :)

[SUGGESTION] Web browser?

Suggestion

I know it's a bit too early due to a lack of networking, but maybe a primitive web browser that opens local HTML files could be possible? It doesn't have to be fancy for now, just supporting HTML2.

VGA driver works in an inconsistent way outside of QEMU/Bochs?

image

�[90m[kinit] [DEBUG] BIOS boot disk: 0x8�[39;49m
�[90m[MemoryManager] [DEBUG] Adding memory region from 0x0 -> 0x9efff (Unused, Unreserved)�[39;49m
�[90m[MemoryManager] [DEBUG] Ignoring too-small memory region at 0x9fc00�[39;49m
�[90m[MemoryManager] [DEBUG] Adding memory region from 0xf0000 -> 0xfffff (Used, Reserved)�[39;49m
�[90m[MemoryManager] [DEBUG] Adding memory region from 0x100000 -> 0x1ffeffff (Unused, Unreserved)�[39;49m
�[90m[MemoryManager] [DEBUG] Adding memory region from 0x1fff0000 -> 0x1fffffff (Used, Unreserved)�[39;49m
�[90m[MemoryManager] [DEBUG] Adding memory region from 0xfec00000 -> 0xfec00fff (Used, Reserved)�[39;49m
�[90m[MemoryManager] [DEBUG] Adding memory region from 0xfee00000 -> 0xfee00fff (Used, Reserved)�[39;49m
�[90m[MemoryManager] [DEBUG] Adding memory region from 0xfffc0000 -> 0xffffffff (Used, Reserved)�[39;49m
�[90m[Device] [DEBUG] Device 1,5 registered�[39;49m
�[90m[Device] [DEBUG] Device 1,8 registered�[39;49m
�[90m[Device] [DEBUG] Device 1,3 registered�[39;49m
�[90m[I8042] [DEBUG] Attempting to initialize...�[39;49m
�[90m[I8042] [DEBUG] Found dual-channel controller�[39;49m
�[90m[I8042] [DEBUG] Keyboard available�[39;49m
�[90m[I8042] [DEBUG] Mouse available�[39;49m
�[93m[I8042] [WARN] Read timed out...�[39;49m
�[91m[I8042] [ERROR] Error enabling keyboard�[39;49m
�[93m[I8042] [WARN] Read timed out...�[39;49m
�[91m[I8042] [ERROR] Error enabling mouse�[39;49m
�[90m[Device] [DEBUG] Device 5,2 registered�[39;49m
�[90m[Device] [DEBUG] Device 1,16 registered�[39;49m
�[94m[CommandLine] [INFO] Command line options: ''�[39;49m
�[90m[Device] [DEBUG] Device 29,0 registered�[39;49m
�[94m[VGA] [INFO] Found a bochs-compatible VGA device at 0:2.0�[39;49m
�[90m[VGA] [DEBUG] virtual framebuffer mapped from 0xe0000000 to 0xc0261000�[39;49m
�[94m[kinit] [INFO] Debug mode is enabled.�[39;49m
�[90m[kinit] [DEBUG] First stage complete.�[39;49m
�[90m[TaskManager] [DEBUG] Initializing tasking...�[39;49m
�[90m[kinit] [DEBUG] Tasking initialized.�[39;49m
�[90m[Device] [DEBUG] Device 4,0 registered�[39;49m
****

qemu execution error

i successed kernel build and made disk image.
but i can not execute kernel.

build enviornment : wsl2, ubuntu 20.04 LTS

i think qemu shell script have problem.
so i executed manually.

qemu-system-x86_64.exe -s kernel kernel/duckk32 -drive file=duckOS.img,cache=directsync,format=raw,id=disk,if=ide -m 512M -serial stdio

ERROR:/home/stefan/src/qemu/repo.or.cz/qemu/ar7/block.c:1323:bdrv_open_driver: assertion failed: (is_power_of_2(bs->bl.request_alignment))

can you suggest resolution?
thanks!!

[BUG] Cant open apps on web demo

Information

Whenever I attempt to open an app, the app wont open and the console will report Tried queuing blocked thread!

Logs

This is the serial console. Whatever you type or paste here will be sent to COM1pond(3) [INFO] Client b42755 disconnected
[TaskManager] [WARN] Tried queuing blocked thread!
pond(3) [INFO] New client connected: c129480a```

Environment

WASM, Chrome, Windows

To Reproduce

  • Open Duck Os demo
  • Close about
  • open program list
  • click any program

Add any other context about the bug here. If you made any additional changes to the default environment, such as adding kernel parameters or using a different toolchain, add that here.

[BUG] kstd::map implementation is incorrect

Information

The kernel's kstd::map implementation is incorrect, and does not work properly.

It currently fails unit tests - namely, it can call the destructor for an object multiple times. This results in incorrect behavior throughout the kernel.

[BUG] Closing a window seems to produce 'illegal memory access' errors

Information

When I close a window the system hangs and logs millions of illegal memory access errors.

Logs

$ ./qemu.sh
C:\Program Files\qemu\qemu-system-x86_64.exe: multiboot knows VBE. we don't
dsound: Could not initialize DirectSoundCapture
dsound: Reason: No sound driver is available for use, or the given GUID is not a valid DirectSound device ID
dsound: Attempt to initialize voice without DirectSoundCapture object
dsound: Attempt to initialize voice without DirectSoundCapture object
audio: Failed to create voice `ac97.pi'
dsound: Attempt to initialize voice without DirectSoundCapture object
dsound: Attempt to initialize voice without DirectSoundCapture object
audio: Failed to create voice `ac97.mc'
dsound: Attempt to initialize voice without DirectSoundCapture object
dsound: Attempt to initialize voice without DirectSoundCapture object
audio: Failed to create voice `ac97.pi'
dsound: Attempt to initialize voice without DirectSoundCapture object
dsound: Attempt to initialize voice without DirectSoundCapture object
audio: Failed to create voice `ac97.mc'
[0.0000000] [kinit] [INFO] Starting duckOS...
[0.0000000] [CommandLine] [INFO] Command line options: 'kernel/duckk32 '
[0.0000000] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0000976] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0001952] [I8042] [WARN] Read timed out...
[0.0002928] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0003904] [I8042] [WARN] Read timed out...
[0.0003904] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0004880] [I8042] [WARN] Read timed out...
[0.0005856] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0007808] [I8042] [WARN] Read timed out...
[0.0007808] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0008784] [I8042] [WARN] Read timed out...
[0.0009760] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0010736] [I8042] [WARN] Read timed out...
[0.0011712] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0012688] [I8042] [WARN] Read timed out...
[0.0012688] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0013664] [I8042] [WARN] Read timed out...
[0.0014640] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0014640] [I8042] [WARN] Read timed out...
[0.0015616] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0016592] [I8042] [WARN] Received mouse buffer data, but no mouse device is present!
[0.0017568] [I8042] [WARN] Read timed out...
[0.0017568] [I8042] [WARN] Read timed out...
[0.0020496] [VGA] [INFO] Found a bochs-compatible VGA device at 0:2.0
[0.0029280] [PATA] [INFO] Setup disk QEMU HARDDISK using DMA (297016 blocks)
[0.0046848] [AC97] [INFO] Found AC97 sound card at 0:4.0
dsound: Attempt to initialize voice without DirectSoundCapture object
dsound: Attempt to initialize voice without DirectSoundCapture object
audio: Failed to create voice `ac97.pi'
dsound: Attempt to initialize voice without DirectSoundCapture object
dsound: Attempt to initialize voice without DirectSoundCapture object
audio: Failed to create voice `ac97.mc'
[0.0477264] init(1) [SUCCESS] Welcome to duckOS!
[0.0508496] init(1) [INFO] Starting service Pond...
[0.0516304] init(1) [INFO] Starting service Quack...
[1.0489952] pond(3) [INFO] Display opened and mapped (640 x 480)
[2.0591456] pond(3) [SUCCESS] Pond started!
[3.0652944] pond(3) [INFO] New client connected: 4b5d8bf6
[8.0277184] pond(3) [INFO] New client connected: b8292fba
[49.0300608] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0301584] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0302560] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0303536] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0304512] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0305488] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0306464] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0307440] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0308416] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0309392] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0310368] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0311344] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0312320] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0313296] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0314272] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0315248] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0316224] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0317200] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[49.0318176] [Thread] [WARN] PID 7 thread 1 made illegal memory access at 0x0 (eip: 0x0)
[..........] About a million more of the same line ...
[55.0181536] [Thread] [WARN] PID 7 thread 1 made illegal memory access

Screenshot

If applicable, insert a screenshot here.

Environment

  • Host Operating System or Machine:
    Two machines: one for building, one for running QEMU
Build Machine Run Machine
Type Raspberry Pi 4 Just a normal PC
OS RaspberryPi Os Lite 64 bit Windows 10
  • QEMU or Virtualization Software Version:
$ qemu-system-x86_64 --version
QEMU emulator version 6.1.93 (v6.2.0-rc3-11887-g72bf95f5bd-dirty)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers

Only used on run machine

To Reproduce

Steps to reproduce the bug, if possible:

  1. Open any app (so far I tired the "About", "System monitor" and "Viewer" apps)
  2. Close the window
  3. The system hangs and a million lines per second are printed in the debug output.

Additional context

How I run the thing
The Raspberry Pi (build machine) is used build duckOs. The image is built successfully, even with Grub!
The kernel and duckOs.img are copied from the build machine to the run machine. (Actually, done with a Samba share on the Pi and the kernel directory is soft symbolic linked in the correct place. Then the img file is copied manually).
The same qemu.sh is placed in the directory with the disk image and kernel folder and executed like ./qemu.sh

[BUG] GCC port compiles, but does not run

Information

The GCC port compiles, but does not run. Instead, it segfaults before giving any output.

I believe this is due to some missing stack unwinding-related symbols that GCC expects from libgcc, which aren't included for some reason. So, the PLT entries resolve to 0x0 resulting in a segfault (I think).

[BUG] DOOM port no longer works

Information

Opening the Doom port causes the system to no longer be responsive.

Logs

If applicable, insert relevant log contents here.

pond(3) [INFO] New client connected: 55c3692b
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device
pond(3) [ERROR] [River] Error writing packet: No space left on device

Screenshot

image

Environment

Describe what you were doing when the crash or bug occurred. Additionally, provide information about the environment (if you aren't sure, don't worry if you need to leave something blank):

  • Host Operating System or Machine: Ubuntu 20.04 (KDE Neon, ironic because I switched to Trinity)
  • QEMU or Virtualization Software Version: 7.1.0

To Reproduce

Steps to reproduce the bug, if possible:

  1. Boot
  2. Open Doom

[BUG] Kernel: `PageDirectory::used_vmem()` is less than `PageDirectory::used_pmem()`

Information

Not in every case but, as written in the title, PageDirectory::used_vmem() returns a value that is less than PageDirectory::used_pmem().

I don't reviewed your virtual memory system in deep, then I don't know if it uses demand paging or not, but theorically they, at least, should be the same value.

Screenshot

image

Environment

  • Manjaro GNOME Linux Latest
  • QEMU 7.1.0

To Reproduce

I modified:

  • ~/programs/applications/monitor/ProcessListWidget.h
diff --git a/programs/applications/monitor/ProcessListWidget.h b/programs/applications/monitor/ProcessListWidget.h
index 6a8c5f1..ee17311 100644
--- a/programs/applications/monitor/ProcessListWidget.h
+++ b/programs/applications/monitor/ProcessListWidget.h
@@ -41,6 +41,6 @@ protected:
 private:
        ProcessListWidget();
        std::vector<Sys::Process> _processes;
-       Duck::Ptr<UI::TableView> _table_view = UI::TableView::make(5);
+       Duck::Ptr<UI::TableView> _table_view = UI::TableView::make(7);
 };
  • ~/programs/applications/monitor/ProcessListWidget.cpp
diff --git a/programs/applications/monitor/ProcessListWidget.cpp b/programs/applications/monitor/ProcessListWidget.cpp
index 61dbe92..62dc5d7 100644
--- a/programs/applications/monitor/ProcessListWidget.cpp
+++ b/programs/applications/monitor/ProcessListWidget.cpp
@@ -67,7 +67,13 @@ Duck::Ptr<UI::Widget> ProcessListWidget::tv_create_entry(int row, int col) {
        case 3: // Memory
                return UI::Label::make(proc.physical_mem().readable(), UI::BEGINNING);
 
-       case 4: // State
+       case 4: // Virt Memory
+               return UI::Label::make(proc.virtual_mem().readable(), UI::BEGINNING);
+
+       case 5: // Shared Memory
+               return UI::Label::make(proc.shared_mem().readable(), UI::BEGINNING);
+
+       case 6: // State
                return UI::Label::make(proc.state_name(), UI::BEGINNING);
        }
 
@@ -83,8 +89,12 @@ std::string ProcessListWidget::tv_column_name(int col) {
                case 2:
                        return "Name";
                case 3:
-                       return "Memory";
+                       return "PhysMem";
                case 4:
+                       return "VirtMem";
+               case 5:
+                       return "ShmMem";
+               case 6:
                        return "State";
        }
        return "";
@@ -107,8 +117,10 @@ int ProcessListWidget::tv_column_width(int col) {
                case 2:
                        return -1;
                case 3:
-                       return 75;
                case 4:
+               case 5:
+                       return 75;
+               case 6:
                        return 60;
        }
        return 0;

[SUGGESTION] Port system

Suggestion

Hello. I discovered that you are using CMake. However, the port system uses sh scripts. Have you thought about using CMake with the convenient ExternalProject instead?

Bochs: MSDOS compatibility FPU exception

00248059642i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00248059645i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00248059646i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00248059651i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00248059652i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00248059653i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00248059656i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00248059657i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00248059658i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00353638642i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00353638644i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00353638650i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00353638651i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00353638744i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00353638746i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00353638752i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00353638753i[CPU0  ] math_abort: MSDOS compatibility FPU exception
00369645001i[CPU0  ] math_abort: MSDOS compatibility FPU exception

This seems to occur everytime when Task manager warns with "Tried queuing blocked thread". I don't know if this is an issue or not considering it locks Pond up.

[SUGGESTION] Docs - We need 'em

Suggestion

duckOS as a whole needs more documentation about how the kernel works, libraries, utilities, etc. I'm intimately familiar with how the whole thing works, but in order to make it easier on new contributors, it's probably a good idea for me to write some docs.

[make image] Cannot mount /dev/loop0p1 on Arch

I ditched Ubuntu 20.04 in favor of Arch due to problems with installing Wine and now I can't make the image file for duckOS via make image. Searching everywhere yields irrelevant results regarding things like Ubuntu installation and partitioning. I know this is not the right place but I am not comfortable with trying to ask this on the Arch forums.

[INFO] Using existing image...
[INFO] Making loopback device...
[INFO] Loopback device mounted at /dev/loop0
[INFO] Mounting filesystem on /dev/loop0p1 to mnt ...
mount: /home/grkb/duckOS/cmake-build/mnt: special device /dev/loop0p1 does not exist.
       dmesg(1) may have more information after failed mount system call.
[ERROR] Couldn't mount.
[INFO] Cleaning up...
make[3]: *** [CMakeFiles/image.dir/build.make:70: CMakeFiles/image] Error 1
make[2]: *** [CMakeFiles/Makefile2:695: CMakeFiles/image.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:702: CMakeFiles/image.dir/rule] Error 2
make: *** [Makefile:169: image] Error 2
[grkb@archlinux cmake-build]$                                                                                

Fdisk claims that this is an "Inappropriate ioctl for device", which I can't find any fixes for on Google that isn't related to Perl/Bash scripts.

[BUG] Error if exit in terminal and then close it

Logs

If I open Terminal, enter exit and then close the terminal, then following error on red screen appears:

Whoops! Something terrible happened.
If you weren't expecting this, please open an issue on GitHub to report it.
Here are the details:
Assertion failed: _state == ALIVE || _state == STOPPED
In pid: 14 (terminal) tid: 14
/home/runner/work/duckOS/duckOS/kernel/tasking/Process.cpp at line 249

Screenshot

error

Environment

Host OS is Windows 10.
Virtualization Software is QEMU 8.2.0.
qemu-system-x86_64 is used.

To Reproduce

  1. Wait until OS is ready to work
  2. Open Terminal
  3. Enter exit
  4. Close Terminal

An ISO please!

would you please put an ready ISO file in repository release section??

maybe someone doesn't want/can to build it??

[BUG] Terminal does not accept input after CTRL-C

Information

Terminal is not responding to keyboard input after sending CTRL-C the running program.

Logs

N/A

Screenshot

N/A

Environment

  • WSL2
  • QEMU 7.0.0

To Reproduce

  1. Run the terminal
  2. Execute cat (w/o any arguments)
  3. Type some text + Enter -> text is displayed back
  4. CTRL-C
  5. Try typing another command on the terminal - no output visible

Additional context

I think the problem is that the terminal STDIN/OUT are not mapped back when the program is abruptly closed with CTRL-C. Tried to follow the code, but not been able to track the exact bug location.

[SUGGESTION] “duckfetch”

Suggestion

duckOS should have an application that works similarly to Neofetch (which is unfortunately bash-based). This might need code to figure out what GPU/CPU is installed along with the motherboard’s name. Heck, maybe there should be a fancy ASCII logo to the left of the information.

[BUG] Problem with keyboard support

Information

I've noticed that at the time the app starts the keyboard events are not passed to the application. It requires to click on the app (I guess to give it a "focus") and only then the key events are being delivered.

Logs

N/A

Screenshot

N/A

Environment

  • Win10/WSL2
  • Qemu 7.0.0

To Reproduce

  1. Open Terminal
  2. Type ls -> nothing appears, cursor is blinking
  3. Click on the terminal window
  4. Type ls again - now, the letters appear

Additional context

N/A

[Documentation] Making an OS guide

Hello! I was wondering what guides you used to make an os. I am trying to make one myself but don't know where to start and how to add GUIs and a proper bootloader.

Thank you!

[Ports] Can't use configure in a git cloned repository?

image
image

I'm assuming it's trying to look for [duckos trunk]/ports/build/bash/bash/configure, since i could get configure working if i instead specified https://ftp.gnu.org/gnu/bash/bash-5.2.15.tar.gz. However, I'm trying to use a git repository for this potential bash port instead of a tarball because I'm not experienced in patch files.

export DOWNLOAD_FILE="../bash" seems to fix the problem, but it feels hacky.

[BUG] RSOD/Crash when kernel writes to userspace memory marked CoW

Information

Crash when closing the Viewer for the 2nd time (that's right - the first time nothing unexpected happens) non-image file in Viewer.

Logs

Whoops! Something terrible happened.
If you weren't expecting this, please open an issue on GitHub to report it.
Here are the details:
SYSCALL_PAGEFAULT
A page fault occurred in the kernel (pid: 7, tid: 7, ptr: 0xc1737ffc, ip: 0xc0131c35).

Screenshot

image

Environment

Describe what you were doing when the crash or bug occurred. Additionally, provide information about the environment (if you aren't sure, don't worry if you need to leave something blank):

  • Win10
  • Qemu 6.2.0

To Reproduce

Steps to reproduce:

  • open Viewer and select a binary file (non-image I guess)
  • Viewer will report correctly that this image is not an image
  • Close the Viewer
  • Open the Viewer for the second time
  • select again the binary file
  • Viewer will report correctly that this image is not an image
  • Close the Viewer -> RSOD

Additional context

N/A

PNG format question

I'm making a new settings app but the new 16x16.png I've made in paint.net is displaying the missing icon instead. What png settings do I need in paint.net?

The image below is the problem, it is correctly named, and in the app's icon directory
16x16

How to start pond?

When I do a full clean build, QEMU greets me with a black screen that I can type in and that's it. How to start pond?

image.sh: line 111: type: grub2-install: not found

Seems like the comparison for grub2 vs grub is a big wrong

111: if ! type "$GRUB_COMMAND" > /dev/null; then

should be

111: if ! type "$GRUB_COMMAND" &> /dev/null; then

Started to occur since your latest commit, the only reason the previous worked was that the disk image already had grub so it just skipped it. You should try it with a fresh blank disk image.

[TODO] Overhaul scheduling and thread / process lifecycle

The current way that threads and processes are managed is unsafe and breaks easily. Thread, Process, and TaskManager contain some of the oldest code in the entire kernel, and I've learned a lot since writing most of it. In no particular order, here is a list of things that needs to be done:

  • Manage the deallocation / destruction of processes using reference counting.
  • Overhaul thread blocking - blockers should unblock a thread on-demand instead of needing to iterate over every blocked thread on every preemption to check if theyr'e ready to be unblocked.
  • Replace the current round-robin scheduling with something better that allows for different thread priorities.
  • Keep track of locks held by threads and the order in which they were acquired to prevent deadlocks.
  • Make exec work in-place instead of creating a new Process and setting the old one's pid to -1.
  • Reduce preemption overhead by as much as possible.

I'm sure there's more I'm forgetting, and I'll add to this list as I think of things.

KStdLib: Class move constructors

Hi man!
I really like your work, and It's a really nice source of inspiration for my project.

Anyway this is not an issue, instead a clarification request:
Why
kstd::vector::vector(vector&&)
kstd::circular_queue::circular_queue(circular_queue&&)
kstd::queue::queue(queue&&)
they allocate new memory (using kcalloc()) instead of simply perform a [k]std::exchange() of the internal fields?

This could improve performances and reduce OOM errors.

[SUGGESTION] WSL 1 Might not work

Suggestion

Ive noticed in your docs that you say using WSL 1 is an option, however the build script uses loop devices which is not supported in WSL 1 as far as I know

Had the same issue with my os, thought I would let you know.

[QUESTION/BUG] Can it run doom?

Information

Base on the README, I know that it can but I'm unable to do it. Not sure where the .wad file shall be located - I put it inside the doom.app folder alongside with app.conf, doomgeneric. Running Doom, freezes the whole duckOS.

Logs

[0.0000000] [kinit] [INFO] Starting duckOS...
[0.0000000] [CommandLine] [INFO] Command line options: 'kernel/duckk32 '
[0.0000000] [VGA] [INFO] Found a bochs-compatible VGA device at 0:2.0
[0.0001952] [PATA] [INFO] Setup disk QEMU HARDDISK using DMA (296960 blocks)
[0.0007808] [AC97] [INFO] Found AC97 sound card at 0:4.0
[0.0238144] init(1) [SUCCESS] Welcome to duckOS!
[0.0241072] init(1) [INFO] Starting service Pond...
[0.0243024] init(1) [INFO] Starting service Quack...
[0.0668560] pond(3) [INFO] Display opened and mapped (1080 x 720)
[0.0705648] pond(3) [SUCCESS] Pond started!
[1.0095648] pond(3) [INFO] New client connected: 63b5bb0a
[3.0944768] pond(3) [INFO] New client connected: 23a3dc88
[28.0637328] pond(3) [INFO] New client connected: aeaa9655

Screenshot

image

Environment

  • Win10/WSL2
  • Qemu 7.0.0

To Reproduce

  1. run ./ports.sh doom
  2. Put wad file with rest of the files (in my case doom2.wad)
  3. build duckOS
  4. run doom (in my case from the duck menu)
  5. black window & OS freezes

Additional context

Is it possible to enable more logs in duckOS to provide extra info about this situation?

[TODO] `mmap()` file mapping & shared [file] mapping

Suggestion

Hi Aaron,
Good to see you still working on the VM subsystem.

I put this issue as a memo for the missing features of the mmap() implementation.
I hope you are already at work on it.

Keep going man!

[BUG] Window resize issue

Information

When window is resized to possible minimum (1x1?) it's difficult and a bit unintuitive to resize it back.

Logs

N/A

Screenshot

N/A

Environment

  • WSL2/Win10
  • Qemu 7.0.0

To Reproduce

  1. Open Calculator
  2. Resize to minimal possible size -> window is almost invisible
  3. Try to resize back (resizing in down-right direction)
  4. This is not possible and window (still being small) is moved instead

Additional context

The problem is that in such small window rect, the code that detect resize direction will evaluate always to NORTHWEST (the first possible value. This plus the fact that the cursor for NORTHWEST and SOUTHEAST looks the same, it's confusing that the only allowed resize direction is NORTHWEST and if user will try to resize down-right direction (SOUTHEAST), the window is moved instead of resizing (still being super hard to see).

The possible solution would be to limit the minimal window rectangle to WINDOW_RESIZE_BORDER*2 to allow some room for determining which direction the resize will go. Other would be in such limited window size, determine the direction based on the mouse movement and not the position of the mouse in relation to the window's border.

[SUGGESTION] User accounts

User Accounts

Instead of having just the "root" user why not allow us to have many different users. These would work in the same way as they do in Linux / Unix (halve way there already as there are "uids"). There would be a graphical and CLI ways for creating, deleting, ... operations on users.

In the future should there be Active Directory login?

Maybe there could be different authentication modules which could be created dynamically (like PAM in Linux)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.