diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index baf9618..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: Bug report -about: Create a bug report to help us improve 88os -title: '' -labels: '' -assignees: '' - ---- - -If you found a bug in 88os, please provide: - -1) A clear and concise description of what the bug is: what happened and what you expected to happen. -2) Steps to reproduce the bug. Ideally, you would provide a small code example triggering the bug and the exact command line used to run KLEE. Please make sure the bug is still present in the mainline. -3) The warnings and error messages issued by KLEE -4) Any relevant information about your platform: the output of `klee --version`, OS version, environment variables, directory in which KLEE is run, etc. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index de16c2b..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -name: Feature request -about: Suggest a feature in 88os -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. E.g., I find it difficult to use KLEE when [...]; I would find it very useful for 88os to [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. diff --git a/.github/bug_report.yml b/.github/bug_report.yml new file mode 100644 index 0000000..efb0c2e --- /dev/null +++ b/.github/bug_report.yml @@ -0,0 +1,34 @@ +name: Bug Report +about: Create a report to help us improve +title: "[BUG] " +labels: + - bug +assignees: + - username1 + - username2 + +description: | + **Describe the bug** + A clear and concise description of what the bug is. + + **To Reproduce** + Steps to reproduce the behavior: + + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + + **Expected behavior** + A clear and concise description of what you expected to happen. + + **Screenshots** + If applicable, add screenshots to help explain your problem. + + **Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + + **Additional context** + Add any other context about the problem here. diff --git a/.github/config.yml b/.github/config.yml new file mode 100644 index 0000000..56401ab --- /dev/null +++ b/.github/config.yml @@ -0,0 +1,14 @@ +issue_template_config: + # Default labels for all issues + labels: + - bug + - enhancement + - help wanted + # Default assignees for all issues + assignees: + - username1 + - username2 + # Default projects for all issues + projects: + - owner/repo/project1 + - owner/repo/project2 \ No newline at end of file diff --git a/.github/feature_request.yml b/.github/feature_request.yml new file mode 100644 index 0000000..b037e7f --- /dev/null +++ b/.github/feature_request.yml @@ -0,0 +1,21 @@ +name: Feature Request +about: Suggest an idea for this project +title: "[FEATURE REQUEST] " +labels: + - enhancement +assignees: + - username1 + - username2 + +description: | + **Is your feature request related to a problem? Please describe.** + A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + + **Describe the solution you'd like** + A clear and concise description of what you want to happen. + + **Describe alternatives you've considered** + A clear and concise description of any alternative solutions or features you've considered. + + **Additional context** + Add any other context or screenshots about the feature request here. diff --git a/ask.txt b/ask.txt index 78bbbd2..c98c80c 100644 --- a/ask.txt +++ b/ask.txt @@ -1,4 +1,4 @@ -I am making an x86 32 bit IA32 Operating System in Visual Studio Code 1.81 for Debian Linux. It's not a linux based OS. The system I am developing on has a Intel i7-3770k and is an x86_64 bit and runs Debian 10 Buster Linux with Linux Kernel version 4.19.0-25-amd64 (supports UNIX 98 PTY)and Bash 5.0.3 and the drive has an ext4 partition and a tempfs partition. I have the extension ms-vscode.cpptools installed on VSCode. I also have both gcc 8.3.0 and clang 7.0.1-8+deb10u2 installed. All of my compilers, debuggers, linkers are in /usr/bin. I have Coreutils 8.30, Binutils 2.31.1, Bison 3.3.2, Diffutils 3.7, Findutils 4.6.0.225, Gawk 4.2.1, Grep 3.3, Gzip 1.9, M4 1.4.18, Make 4.2.1, Patch 2.7.6, Perl 5.28.1, Python 3.7.3, Sed 4.7, Tar 1.30, Texinfo 6.5, Xz 5.2.4. +I am making an x86 32 bit IA32 Operating System in Visual Studio Code 1.81 for Debian Linux. This will not a linux based OS. The system I am developing on has a Intel i7-3770k and is an x86_64 bit and runs Debian 10 Buster Linux with Linux Kernel version 4.19.0-25-amd64 (supports UNIX 98 PTY) and Bash 5.0.3 and the drive has an ext4 partition and a tempfs partition. I have the extension ms-vscode.cpptools installed on VSCode. I also have both gcc 8.3.0 and clang 7.0.1-8+deb10u2 installed. All of my compilers, debuggers, linkers are in /usr/bin. I have Coreutils 8.30, Binutils 2.31.1, Bison 3.3.2, Diffutils 3.7, Findutils 4.6.0.225, Gawk 4.2.1, Grep 3.3, Gzip 1.9, M4 1.4.18, Make 4.2.1, Patch 2.7.6, Perl 5.28.1, Python 3.7.3, Sed 4.7, Tar 1.30, Texinfo 6.5, Xz 5.2.4. The operating system would run on any system that has a 386 CPU up to a 2.8GHz Pentium 4. ClassicOS/ ├── .github/ diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c new file mode 100644 index 0000000..fc11e28 --- /dev/null +++ b/src/cpu/cpu.c @@ -0,0 +1,85 @@ +#include "cpu.h" + +// Function to read a 32-bit value from a CPU register +uint32_t read_register(uint8_t reg) +{ + uint32_t value; + __asm__ volatile("mov %0, %%" + reg : "=r"(value)); + return value; +} + +// Function to write a 32-bit value to a CPU register +void write_register(uint8_t reg, uint32_t value) +{ + __asm__ volatile("mov %0, %%" + reg : : "r"(value)); +} + +// Function to read the value of the CR0 register +uint32_t read_cr0() +{ + uint32_t value; + __asm__ volatile("mov %%cr0, %0" : "=r"(value)); + return value; +} + +// Function to write a value to the CR0 register +void write_cr0(uint32_t value) +{ + __asm__ volatile("mov %0, %%cr0" : : "r"(value)); +} + +// Function to switch from real mode to protected mode +void switch_to_protected_mode() +{ + uint32_t cr0 = read_cr0(); + cr0 |= 0x1; // Set the PE bit to switch to protected mode + write_cr0(cr0); +} + +// Write a byte to a port +void outb(uint16_t port, uint8_t value) +{ + __asm__ volatile ("outb %0, %1" : : "a"(value), "Nd"(port)); +} + +// Read a byte from a port +uint8_t inb(uint16_t port) +{ + uint8_t value; + __asm__ volatile ("inb %1, %0" : "=a"(value) : "Nd"(port)); + return value; +} + +// Write a word to a port +void outw(uint16_t port, uint16_t value) +{ + __asm__ volatile ("outw %0, %1" : : "a"(value), "Nd"(port)); +} + +// Read a word from a port +uint16_t inw(uint16_t port) +{ + uint16_t value; + __asm__ volatile ("inw %1, %0" : "=a"(value) : "Nd"(port)); + return value; +} + +// Write a double word to a port +void outl(uint16_t port, uint32_t value) +{ + __asm__ volatile ("outl %0, %1" : : "a"(value), "Nd"(port)); +} + +// Read a double word from a port +uint32_t inl(uint16_t port) +{ + uint32_t value; + __asm__ volatile ("inl %1, %0" : "=a"(value) : "Nd"(port)); + return value; +} + +// Execute the CPUID instruction +void cpuid(uint32_t code, uint32_t *a, uint32_t *d) +{ + __asm__ volatile ("cpuid" : "=a"(*a), "=d"(*d) : "a"(code) : "ecx", "ebx"); +} \ No newline at end of file diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h new file mode 100644 index 0000000..c6801e0 --- /dev/null +++ b/src/cpu/cpu.h @@ -0,0 +1,32 @@ +#ifndef CPU_H +#define CPU_H + +#include + +// Function to read a 32-bit value from a CPU register +uint32_t read_register(uint8_t reg); + +// Function to write a 32-bit value to a CPU register +void write_register(uint8_t reg, uint32_t value); + +// Function to read the value of the CR0 register +uint32_t read_cr0(); + +// Function to write a value to the CR0 register +void write_cr0(uint32_t value); + +// Function to switch from real mode to protected mode +void switch_to_protected_mode(); + +void outb(uint16_t port, uint8_t value); +uint8_t inb(uint16_t port); + +void outw(uint16_t port, uint16_t value); +uint16_t inw(uint16_t port); + +void outl(uint16_t port, uint32_t value); +uint32_t inl(uint16_t port); + +void cpuid(uint32_t code, uint32_t *a, uint32_t *d); + +#endif \ No newline at end of file diff --git a/src/drivers/display/vga.c b/src/drivers/display/vga.c new file mode 100644 index 0000000..53417f9 --- /dev/null +++ b/src/drivers/display/vga.c @@ -0,0 +1,32 @@ +#include "vga.h" +#include +#include + +#define VGA_MEMORY_ADDRESS 0xA0000 +#define VGA_MEMORY_SIZE 0x60000 + +static uint8_t* vga_memory = (uint8_t*) VGA_MEMORY_ADDRESS; +static uint16_t vga_width = VGA_WIDTH; +static uint16_t vga_height = VGA_HEIGHT; +static uint8_t vga_depth = VGA_DEPTH; + +void vga_init() { + // Initialize VGA driver here +} + +void vga_set_resolution(uint16_t width, uint16_t height, uint8_t depth) { + // Set VGA resolution here +} + +void vga_draw_pixel(uint16_t x, uint16_t y, uint8_t color) { + // Draw a pixel on the screen at (x, y) with the given color + uint32_t offset = y * vga_width + x; + vga_memory[offset] = color; +} + +void vga_clear_screen(uint8_t color) { + // Clear the screen with the given color + for (uint32_t i = 0; i < vga_width * vga_height; i++) { + vga_memory[i] = color; + } +} \ No newline at end of file diff --git a/src/drivers/display/vga.h b/src/drivers/display/vga.h new file mode 100644 index 0000000..a86e62c --- /dev/null +++ b/src/drivers/display/vga.h @@ -0,0 +1,15 @@ +#ifndef VGA_H +#define VGA_H + +#include + +#define VGA_WIDTH 640 +#define VGA_HEIGHT 480 +#define VGA_DEPTH 8 + +void vga_init(); +void vga_set_resolution(uint16_t width, uint16_t height, uint8_t depth); +void vga_draw_pixel(uint16_t x, uint16_t y, uint8_t color); +void vga_clear_screen(uint8_t color); + +#endif \ No newline at end of file diff --git a/src/drivers/io/serial.c b/src/drivers/io/serial.c new file mode 100644 index 0000000..021be05 --- /dev/null +++ b/src/drivers/io/serial.c @@ -0,0 +1,46 @@ +#include "serial.h" + +#include +#include + +#define PORT_BASE 0x3F8 + +void init_serial(uint16_t com) { + uint16_t port = PORT_BASE + 8 * (com - 1); + + outb(port + 1, 0x00); // Disable all interrupts + outb(port + 3, 0x80); // Enable DLAB (set baud rate divisor) + outb(port + 0, 0x03); // Set divisor to 3 (lo byte) 38400 baud + outb(port + 1, 0x00); // (hi byte) + outb(port + 3, 0x03); // 8 bits, no parity, one stop bit + outb(port + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold + outb(port + 4, 0x0B); // IRQs enabled, RTS/DSR set +} + +int serial_received(uint16_t com) { + uint16_t port = PORT_BASE + 8 * (com - 1); + + return inb(port + 5) & 1; +} + +char read_serial(uint16_t com) { + uint16_t port = PORT_BASE + 8 * (com - 1); + + while (serial_received(com) == 0); + + return inb(port); +} + +int is_transmit_empty(uint16_t com) { + uint16_t port = PORT_BASE + 8 * (com - 1); + + return inb(port + 5) & 0x20; +} + +void write_serial(uint16_t com, char a) { + uint16_t port = PORT_BASE + 8 * (com - 1); + + while (is_transmit_empty(com) == 0); + + outb(port, a); +} \ No newline at end of file diff --git a/src/drivers/io/serial.h b/src/drivers/io/serial.h new file mode 100644 index 0000000..0e85626 --- /dev/null +++ b/src/drivers/io/serial.h @@ -0,0 +1,12 @@ +#ifndef SERIAL_H +#define SERIAL_H + +#include + +void init_serial(uint16_t com); +int serial_received(uint16_t com); +char read_serial(uint16_t com); +int is_transmit_empty(uint16_t com); +void write_serial(uint16_t com, char a); + +#endif diff --git a/src/drivers/mouse/mouse.c b/src/drivers/mouse/mouse.c new file mode 100644 index 0000000..d4213dd --- /dev/null +++ b/src/drivers/mouse/mouse.c @@ -0,0 +1,86 @@ +#include "mouse.h" +#include "ps2.h" +#include "serial.h" +#include "usb.h" + +#include +#include + +#define MOUSE_COM 1 + +void init_mouse(uint16_t com) +{ + if (usb_mouse_detected()) + { + init_usb(); + } + else if (ps2_mouse_detected()) + { + init_ps2(); + } + else + { + init_serial(com); + } +} + +int mouse_received(uint16_t com) +{ + if (usb_mouse_detected()) + { + return usb_mouse_received(); + } + else if (ps2_mouse_detected()) + { + return ps2_mouse_received(); + } + else + { + return serial_received(com); + } +} + +mouse_data_t read_mouse(uint16_t com) +{ + mouse_data_t data; + + if (usb_mouse_detected()) + { + data = usb_read_mouse(); + } + else if (ps2_mouse_detected()) + { + data = ps2_read_mouse(); + } + else + { + data.x = 0; + data.y = 0; + data.buttons = 0; + + while (mouse_received(com) == 0) + ; + + uint8_t status = inb(PORT_BASE + 8 * (com - 1) + 5); + + if (status & 0x01) + { + data.buttons |= 0x01; + } + + if (status & 0x02) + { + data.buttons |= 0x02; + } + + if (status & 0x04) + { + data.buttons |= 0x04; + } + + data.x = inb(PORT_BASE + 8 * (com - 1)); + data.y = inb(PORT_BASE + 8 * (com - 1) + 1); + } + + return data; +} \ No newline at end of file diff --git a/src/drivers/mouse/mouse.h b/src/drivers/mouse/mouse.h new file mode 100644 index 0000000..08d9e9b --- /dev/null +++ b/src/drivers/mouse/mouse.h @@ -0,0 +1,16 @@ +#ifndef MOUSE_H +#define MOUSE_H + +#include + +typedef struct { + int16_t x; + int16_t y; + uint8_t buttons; +} mouse_data_t; + +void init_mouse(uint16_t com); +int mouse_received(uint16_t com); +mouse_data_t read_mouse(uint16_t com); + +#endif diff --git a/src/drivers/screen/console.c b/src/drivers/screen/console.c new file mode 100644 index 0000000..e69de29 diff --git a/src/drivers/screen/console.h b/src/drivers/screen/console.h new file mode 100644 index 0000000..e69de29 diff --git a/src/elf.c b/src/elf.c new file mode 100644 index 0000000..990281d --- /dev/null +++ b/src/elf.c @@ -0,0 +1,3 @@ +/* +elf functions go here +*/ \ No newline at end of file diff --git a/src/elf.h b/src/elf.h new file mode 100644 index 0000000..990281d --- /dev/null +++ b/src/elf.h @@ -0,0 +1,3 @@ +/* +elf functions go here +*/ \ No newline at end of file diff --git a/src/filesystem/fat16/fat16.c b/src/filesystem/fat16/fat16.c new file mode 100644 index 0000000..18750d7 --- /dev/null +++ b/src/filesystem/fat16/fat16.c @@ -0,0 +1,3 @@ +/* +fat16 goes here +*/ \ No newline at end of file diff --git a/src/filesystem/fat16/fat16.h b/src/filesystem/fat16/fat16.h new file mode 100644 index 0000000..18750d7 --- /dev/null +++ b/src/filesystem/fat16/fat16.h @@ -0,0 +1,3 @@ +/* +fat16 goes here +*/ \ No newline at end of file diff --git a/src/filesystem/fat32/fat32.c b/src/filesystem/fat32/fat32.c new file mode 100644 index 0000000..ad61cec --- /dev/null +++ b/src/filesystem/fat32/fat32.c @@ -0,0 +1,3 @@ +/* +fat32 goes here +*/ \ No newline at end of file diff --git a/src/filesystem/fat32/fat32.h b/src/filesystem/fat32/fat32.h new file mode 100644 index 0000000..ad61cec --- /dev/null +++ b/src/filesystem/fat32/fat32.h @@ -0,0 +1,3 @@ +/* +fat32 goes here +*/ \ No newline at end of file diff --git a/src/gui/gui.c b/src/gui/gui.c new file mode 100644 index 0000000..093410f --- /dev/null +++ b/src/gui/gui.c @@ -0,0 +1,3 @@ +/* +gui goes here +*/ \ No newline at end of file diff --git a/src/gui/gui.h b/src/gui/gui.h new file mode 100644 index 0000000..1b9d700 --- /dev/null +++ b/src/gui/gui.h @@ -0,0 +1,4 @@ +/* +gui goes here + +*/ \ No newline at end of file diff --git a/src/kernel/acpi.c b/src/kernel/acpi.c new file mode 100644 index 0000000..e69de29 diff --git a/src/kernel/acpi.h b/src/kernel/acpi.h new file mode 100644 index 0000000..e69de29 diff --git a/src/kernel/malloc/kmalloc.c b/src/kernel/malloc/kmalloc.c new file mode 100644 index 0000000..e69de29 diff --git a/src/kernel/malloc/kmalloc.h b/src/kernel/malloc/kmalloc.h new file mode 100644 index 0000000..e69de29 diff --git a/src/kernel/timer.c b/src/kernel/timer.c new file mode 100644 index 0000000..246aae4 --- /dev/null +++ b/src/kernel/timer.c @@ -0,0 +1,3 @@ +/* +timer functions go here +*/ \ No newline at end of file diff --git a/src/kernel/timer.h b/src/kernel/timer.h new file mode 100644 index 0000000..246aae4 --- /dev/null +++ b/src/kernel/timer.h @@ -0,0 +1,3 @@ +/* +timer functions go here +*/ \ No newline at end of file