adds more functionality

This commit is contained in:
Gregory Kenneth Bowne 2023-10-05 01:27:03 -07:00
parent 2b7ed92a07
commit ef2537720d
30 changed files with 425 additions and 30 deletions

View File

@ -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.

View File

@ -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.

34
.github/bug_report.yml vendored Normal file
View File

@ -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.

14
.github/config.yml vendored Normal file
View File

@ -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

21
.github/feature_request.yml vendored Normal file
View File

@ -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.

View File

@ -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/

85
src/cpu/cpu.c Normal file
View File

@ -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");
}

32
src/cpu/cpu.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef CPU_H
#define CPU_H
#include <stdint.h>
// 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

32
src/drivers/display/vga.c Normal file
View File

@ -0,0 +1,32 @@
#include "vga.h"
#include <stddef.h>
#include <stdint.h>
#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;
}
}

15
src/drivers/display/vga.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef VGA_H
#define VGA_H
#include <stdint.h>
#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

46
src/drivers/io/serial.c Normal file
View File

@ -0,0 +1,46 @@
#include "serial.h"
#include <stddef.h>
#include <stdint.h>
#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);
}

12
src/drivers/io/serial.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef SERIAL_H
#define SERIAL_H
#include <stdint.h>
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

86
src/drivers/mouse/mouse.c Normal file
View File

@ -0,0 +1,86 @@
#include "mouse.h"
#include "ps2.h"
#include "serial.h"
#include "usb.h"
#include <stddef.h>
#include <stdint.h>
#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;
}

16
src/drivers/mouse/mouse.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef MOUSE_H
#define MOUSE_H
#include <stdint.h>
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

View File

View File

3
src/elf.c Normal file
View File

@ -0,0 +1,3 @@
/*
elf functions go here
*/

3
src/elf.h Normal file
View File

@ -0,0 +1,3 @@
/*
elf functions go here
*/

View File

@ -0,0 +1,3 @@
/*
fat16 goes here
*/

View File

@ -0,0 +1,3 @@
/*
fat16 goes here
*/

View File

@ -0,0 +1,3 @@
/*
fat32 goes here
*/

View File

@ -0,0 +1,3 @@
/*
fat32 goes here
*/

3
src/gui/gui.c Normal file
View File

@ -0,0 +1,3 @@
/*
gui goes here
*/

4
src/gui/gui.h Normal file
View File

@ -0,0 +1,4 @@
/*
gui goes here
*/

0
src/kernel/acpi.c Normal file
View File

0
src/kernel/acpi.h Normal file
View File

View File

View File

3
src/kernel/timer.c Normal file
View File

@ -0,0 +1,3 @@
/*
timer functions go here
*/

3
src/kernel/timer.h Normal file
View File

@ -0,0 +1,3 @@
/*
timer functions go here
*/