From 0ce1e73a09620e300ef8f8bd9b53a6ab86cc6a3b Mon Sep 17 00:00:00 2001 From: d0p1 Date: Thu, 18 Jul 2024 12:36:43 +0200 Subject: [PATCH] chore: remove build.sh --- build.sh | 200 ----------------------------------------- kernel/dev/at/com.inc | 30 ++++++- kernel/dev/at/ne2k.inc | 1 - kernel/gdt.inc | 5 ++ kernel/idt.inc | 10 ++- kernel/kernel.asm | 5 ++ 6 files changed, 47 insertions(+), 204 deletions(-) delete mode 100755 build.sh diff --git a/build.sh b/build.sh deleted file mode 100755 index f5ca05d..0000000 --- a/build.sh +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/env bash - -# ----------------------------------------------------------------------------- -# log reporting -# ----------------------------------------------------------------------------- -plain() { - local mesg=$1; shift - - # shellcheck disable=SC2059 - printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" -} - -msg() { - local mesg=$1; shift - - # shellcheck disable=SC2059 - printf "${MAGENTA}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" -} - -msg2() { - local mesg=$1; shift - - # shellcheck disable=SC2059 - printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" -} - -error() { - local mesg=$1; shift - - # shellcheck disable=SC2059 - printf "${RED}==> ERROR:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" - exit 1 -} - -warning() { - local mesg=$1; shift - - # shellcheck disable=SC2059 - printf "${YELLOW}==> WARNING:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" -} - -success() { - local mesg=$1; shift - - # shellcheck disable=SC2059 - printf "${GREEN}==> SUCCESS:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" -} - -# ----------------------------------------------------------------------------- -# ----------------------------------------------------------------------------- - -# ----------------------------------------------------------------------------- -# build -# ----------------------------------------------------------------------------- - - -# ----------------------------------------------------------------------------- -# tools -# ----------------------------------------------------------------------------- - -build_tools() { - msg "Builing tools" - plain "tools dir: %s" "${TOOLS_DIR}" - - make tools -} - -# ----------------------------------------------------------------------------- -# doctor - check os dependancies -# ----------------------------------------------------------------------------- -check_tool() { - local tool=$1; shift - - printf "checking for %s " "${tool}" - - tool_path="$(which "${tool}" 2> /dev/null)" - if [ -z "${tool_path}" ]; then - # shellcheck disable=SC2059 - printf "${BOLD}${RED}NO${ALL_OFF}\n" - false; - else - # shellcheck disable=SC2059 - printf "${GREEN}${tool_path}${ALL_OFF}\n" - true; - fi -} - -doctor() { - local err=0 - - check_tool fasm || ((err++)) - check_tool gcc || ((err++)) - check_tool bmake || ((err++)) - check_tool sha256sum || ((err++)) - check_tool python3 || ((err++)) - - if [ $err -gt 0 ]; then error "Some tools are missing"; fi -} - -# ----------------------------------------------------------------------------- -# usage & version -# ----------------------------------------------------------------------------- - -usage() { - local status=$1 - - if [ ${status} -eq 0 ]; then - cat <&2 - fi - - exit ${status} -} - -version() { - VERSION_MAJOR="$(grep VERSION_MAJOR kernel/const.inc | cut -d' ' -f 3)" - VERSION_MINOR="$(grep VERSION_MINOR kernel/const.inc | cut -d' ' -f 3)" - - printf "%s (StupidOS) %d.%d\n" "${prgname}" ${VERSION_MAJOR} ${VERSION_MINOR} - - exit 0 -} - -# ----------------------------------------------------------------------------- -# entry -# ----------------------------------------------------------------------------- -LC_ALL=C -export LC_ALL - -unset INFODIR -unset LESSCHARSET -unset MAKEFLAGS -unset TERMINFO - -unset ALL_OFF BOLD RED GREEN BLUE MAGENTA YELLOW -if [ ! -v NO_COLOR ]; then - ALL_OFF="\e[1;0m" - BOLD="\e[1;1m" - BLUE="${BOLD}\e[1;34m" - GREEN="${BOLD}\e[1;32m" - RED="${BOLD}\e[1;31m" - MAGENTA="${BOLD}\e[1;35m" - YELLOW="${BOLD}\e[1;33m" -fi -readonly ALL_OFF BOLD RED GREEN BLUE MAGENTA YELLOW - -unset topdir prgname build_start -prgname="$(basename $0)" -topdir="$(realpath "$0")" -topdir="$(dirname "${topdir}")" -#build_start="$(date)" -readonly topdir prgname -#build_start - -SRC_DIR="${topdir}" -BUILD_DIR="${topdir}/.build" -TOOLS_DIR="${topdir}/.tools" -TOOLS_PREFIX="stpd-" -export PATH="$PATH:$TOOLS_DIR" - -if [ ! -f Makefile ] || [ ! -f LICENSE ]; then - error "Run this script at StupidOS root" -fi - -if [ $# -eq 0 ]; then - usage 1 -fi - -while [ $# -gt 0 ]; do - op=$1; shift - - case "${op}" in - help | --help | -h) - usage 0 - ;; - --version | -V) - version - ;; - doctor) - doctor - ;; - tools) - build_tools - ;; - *) - usage 1 - ;; - esac -done diff --git a/kernel/dev/at/com.inc b/kernel/dev/at/com.inc index 134ef68..abb1616 100644 --- a/kernel/dev/at/com.inc +++ b/kernel/dev/at/com.inc @@ -1,6 +1,28 @@ ;; File: com.inc + ;; + ;; Usefull links: + ;; - -COM_MAJOR = 1 +COM1 = 0x3F8 +COM2 = 0x2F8 +COM3 = 0x3E8 +COM4 = 0x2E8 + +UART8250_RBR = 0x0 +UART8250_THR = 0x0 + +UART8250_IER = 0x1 +UART8250_IIR = 0x2 +UART8250_FCR = 0x2 +UART8250_LCR = 0x3 +UART8250_MCR = 0x4 +UART8250_LSR = 0x5 +UART8250_MSR = 0x6 +UART8250_SCR = 0x7 + + ; DLAB = 1 +UART8250_DLL = 0x0 +UART8250_DLH = 0x1 com_init: ret @@ -8,9 +30,13 @@ com_init: com_probe: ret -com_irq: +com_irq1: pusha popa iret +com_irq2: + pusha + popa + iret diff --git a/kernel/dev/at/ne2k.inc b/kernel/dev/at/ne2k.inc index b4a2e48..e365e1f 100644 --- a/kernel/dev/at/ne2k.inc +++ b/kernel/dev/at/ne2k.inc @@ -74,7 +74,6 @@ ne2k_init: ne2k_probe: - ret ne2k_irq: diff --git a/kernel/gdt.inc b/kernel/gdt.inc index fc38f54..da505e9 100644 --- a/kernel/gdt.inc +++ b/kernel/gdt.inc @@ -66,3 +66,8 @@ gdt_flush: mov gs, ax mov ss, ax ret + +tss_flush: + mov ax, 0x2B + ltr ax + ret diff --git a/kernel/idt.inc b/kernel/idt.inc index ccecfcc..cf00d0c 100644 --- a/kernel/idt.inc +++ b/kernel/idt.inc @@ -33,14 +33,22 @@ idt_setup: cmp ecx, 0x30 jb @b + mov ecx, 35 + mov eax, com_irq2 + call idt_set_gate + mov ecx, 36 - mov eax, com_irq + mov eax, com_irq1 call idt_set_gate mov ecx, 38 mov eax, floppy_irq call idt_set_gate + mov ecx, 41 + mov eax, ne2k_irq + call idt_set_gate + mov ecx, 0x42 mov eax, isr_syscall call idt_set_gate diff --git a/kernel/kernel.asm b/kernel/kernel.asm index 582b03b..66e99d2 100644 --- a/kernel/kernel.asm +++ b/kernel/kernel.asm @@ -71,6 +71,7 @@ kmain: call gdt_set_tss call gdt_flush + call tss_flush call idt_setup @@ -86,6 +87,8 @@ kmain: ;mov al, 'X' ;call cga_putc + + .halt: hlt jmp $ @@ -96,6 +99,8 @@ kmain: jmp .halt include 'dev/at/cmos.inc' + include 'dev/at/com.inc' + include 'dev/at/ne2k.inc' include 'dev/at/pit.inc' include 'dev/at/kbd.inc' include 'dev/at/cga.inc'