undo merge mistakes
This commit is contained in:
parent
09c487e6d0
commit
172fdd98db
|
@ -1,2 +1,7 @@
|
|||
bin/
|
||||
obj/
|
||||
# Build artifacts
|
||||
build/
|
||||
include/shade/version.h
|
||||
src/iso/boot/shade.bin
|
||||
*.o
|
||||
*.bin
|
||||
*.iso
|
84
Makefile
84
Makefile
|
@ -1,84 +0,0 @@
|
|||
ASM := nasm
|
||||
|
||||
CC := x86_64-elf-gcc
|
||||
CCFLAGS :=
|
||||
|
||||
LD := x86_64-elf-ld
|
||||
LDFLAGS :=
|
||||
|
||||
INCLUDE := include/
|
||||
|
||||
# Target: kernel, type: C ASM
|
||||
kernel_c_source_files = $(shell find src/kernel/ -type f -name *.c)
|
||||
kernel_c_object_files = $(patsubst src/%.c,obj/%.o,$(kernel_c_source_files))
|
||||
kernel_asm_source_files = $(shell find src/kernel/ -type f -name *.asm)
|
||||
kernel_asm_object_files = $(patsubst src/%.asm,obj/%.o,$(kernel_asm_source_files))
|
||||
kernel_source_files = $(kernel_c_source_files) $(kernel_asm_object_files)
|
||||
kernel_object_files = $(kernel_c_object_files) $(kernel_asm_object_files)
|
||||
|
||||
# Target: libc, type: C ASM
|
||||
libc_c_source_files = $(shell find src/libc/ -type f -name *.c)
|
||||
libc_c_object_files = $(patsubst src/%.c,obj/%.o,$(libc_c_source_files))
|
||||
libc_asm_source_files = $(shell find src/libc/ -type f -name *.asm)
|
||||
libc_asm_object_files = $(patsubst src/%.asm,obj/%.o,$(libc_c_object_files))
|
||||
libc_source_files = $(libc_c_source_files) $(libc_asm_source_files)
|
||||
libc_object_files = $(libc_c_object_files) $(libc_asm_object_files)
|
||||
|
||||
# Target: sboot, type: ASM
|
||||
# Override: 32-bit
|
||||
sboot_asm_source_files = $(shell find src/boot/ -type f -name *.asm)
|
||||
sboot_asm_object_files = $(patsubst src/%.asm,obj/%.o,$(sboot_asm_source_files))
|
||||
sboot_source_files = $(sboot_asm_source_files)
|
||||
sboot_object_files = $(sboot_asm_object_files)
|
||||
|
||||
shade_bin_ldfile = src/linker.ld
|
||||
|
||||
version = 0.1.1-alpha
|
||||
stream = shade-development
|
||||
git_build = $(shell git rev-parse --short HEAD)
|
||||
date = $(shell date)
|
||||
codename = willow
|
||||
|
||||
default: run
|
||||
|
||||
.FORCE:
|
||||
|
||||
bin/shade.iso: bin/shade.bin
|
||||
cp bin/shade.bin src/iso/boot/shade.bin
|
||||
grub-mkrescue src/iso/ -o $@
|
||||
rm src/iso/boot/shade.bin
|
||||
|
||||
bin/shade.bin: $(sboot_object_files) $(kernel_object_files) $(libc_object_files)
|
||||
echo "#ifndef SHADE_VERSION_H" > include/shade/version.h
|
||||
echo "#define SHADE_VERSION_H" >> include/shade/version.h
|
||||
echo "// This file was autogenerated by the shadeOS build system. It should not be modified." >> include/shade/version.h
|
||||
echo "#define SHADE_OS_KERNEL_VERSION \"$(version)\"" >> include/shade/version.h
|
||||
echo "#define SHADE_OS_KERNEL \"$(stream)\"" >> include/shade/version.h
|
||||
echo "#define SHADE_OS_BUILD \"$(git_build)\"" >> include/shade/version.h
|
||||
echo "#define SHADE_OS_COMPILE_DATE \"$(date)\"" >> include/shade/version.h
|
||||
echo "#define SHADE_OS_CODENAME \"$(codename)\"" >> include/shade/version.h
|
||||
echo "#endif" >> include/shade/version.h
|
||||
mkdir -p "$(@D)"
|
||||
$(LD) $(LDFLAGS) -n -T $(shade_bin_ldfile) $^ -o $@
|
||||
grub-file --is-x86-multiboot2 $@
|
||||
|
||||
# Generics
|
||||
# Source file types: C ASM
|
||||
|
||||
# C
|
||||
obj/%.o: src/%.c
|
||||
mkdir -p "$(@D)"
|
||||
$(CC) $(CCFLAGS) -I $(INCLUDE) -ffreestanding -c $< -o $@
|
||||
|
||||
# ASM
|
||||
obj/%.o: src/%.asm
|
||||
mkdir -p "$(@D)"
|
||||
$(ASM) -felf64 $< -o $@
|
||||
|
||||
# Other
|
||||
run: clean bin/shade.iso
|
||||
qemu-system-x86_64 -drive file=bin/shade.iso,index=0,media=disk,format=raw -d int -no-reboot
|
||||
|
||||
clean:
|
||||
rm -rf bin/*
|
||||
rm -rf obj/*
|
BIN
bin/shade.bin
BIN
bin/shade.bin
Binary file not shown.
BIN
bin/shade.iso
BIN
bin/shade.iso
Binary file not shown.
57
bochsrc.txt
57
bochsrc.txt
|
@ -1,57 +0,0 @@
|
|||
# configuration file generated by Bochs
|
||||
plugin_ctrl: unmapped=true, biosdev=true, speaker=true, extfpuirq=true, parallel=true, serial=true, iodebug=true, pcidev=false, usb_uhci=false
|
||||
config_interface: textconfig
|
||||
display_library: x
|
||||
memory: host=32, guest=32
|
||||
romimage: file="/usr/share/bochs/BIOS-bochs-latest", address=0x00000000, options=none
|
||||
vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest"
|
||||
boot: floppy
|
||||
floppy_bootsig_check: disabled=0
|
||||
floppya: type=1_44
|
||||
# no floppyb
|
||||
ata0: enabled=true, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
|
||||
ata0-master: type=disk, path="bin/shade.iso", mode=flat, cylinders=1, heads=1, spt=63, sect_size=512, model="Generic 1234", biosdetect=auto, translation=auto
|
||||
ata0-slave: type=none
|
||||
ata1: enabled=true, ioaddr1=0x170, ioaddr2=0x370, irq=15
|
||||
ata1-master: type=none
|
||||
ata1-slave: type=none
|
||||
ata2: enabled=false
|
||||
ata3: enabled=false
|
||||
optromimage1: file=none
|
||||
optromimage2: file=none
|
||||
optromimage3: file=none
|
||||
optromimage4: file=none
|
||||
optramimage1: file=none
|
||||
optramimage2: file=none
|
||||
optramimage3: file=none
|
||||
optramimage4: file=none
|
||||
pci: enabled=1, chipset=i440fx, slot1=none, slot2=none, slot3=none, slot4=none, slot5=none
|
||||
vga: extension=vbe, update_freq=5, realtime=1, ddc=builtin
|
||||
cpu: count=1:1:1, ips=4000000, quantum=16, model=bx_generic, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0
|
||||
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="AuthenticAMD", brand_string="AMD Athlon(tm) processor"
|
||||
cpuid: mmx=true, apic=xapic, simd=sse2, sse4a=false, misaligned_sse=false, sep=true
|
||||
cpuid: movbe=false, adx=false, aes=false, sha=false, xsave=false, xsaveopt=false, avx_f16c=false
|
||||
cpuid: avx_fma=false, bmi=0, xop=false, fma4=false, tbm=false, x86_64=true, 1g_pages=false
|
||||
cpuid: pcid=false, fsgsbase=false, smep=false, smap=false, mwait=true
|
||||
print_timestamps: enabled=0
|
||||
debugger_log: -
|
||||
magic_break: enabled=0
|
||||
port_e9_hack: enabled=0
|
||||
private_colormap: enabled=0
|
||||
clock: sync=none, time0=local, rtc_sync=0
|
||||
# no cmosimage
|
||||
log: -
|
||||
logprefix: %t%e%d
|
||||
debug: action=ignore
|
||||
info: action=report
|
||||
error: action=report
|
||||
panic: action=ask
|
||||
keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none
|
||||
mouse: type=ps2, enabled=false, toggle=ctrl+mbutton
|
||||
speaker: enabled=true, mode=system
|
||||
parport1: enabled=true, file=none
|
||||
parport2: enabled=false
|
||||
com1: enabled=true, mode=null
|
||||
com2: enabled=false
|
||||
com3: enabled=false
|
||||
com4: enabled=false
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef SHADE_PRINT_H
|
||||
#define SHADE_PRINT_H
|
||||
|
||||
#include <shade/tty.h>
|
||||
|
||||
|
||||
#define REG_SCREEN_CTRL 0x3d4
|
||||
#define REG_SCREEN_DATA 0x3d5
|
||||
|
@ -51,6 +51,5 @@ void kernel_msg_ok(char* msg);
|
|||
|
||||
void init_state();
|
||||
|
||||
tty_driver_t vga_text_mode_get_driver();
|
||||
|
||||
#endif
|
|
@ -1,137 +0,0 @@
|
|||
#ifndef SHADE_TTY_H
|
||||
#define SHADE_TTY_H
|
||||
|
||||
#include <shade/cansid.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* @brief A type to represent a printable char
|
||||
*
|
||||
*/
|
||||
typedef struct tty_ochar_struct {
|
||||
char character;
|
||||
char style;
|
||||
} tty_ochar_t;
|
||||
|
||||
/**
|
||||
* @brief A type to represent a tty driver
|
||||
*
|
||||
*/
|
||||
typedef struct tty_driver_struct {
|
||||
int max_rows;
|
||||
int max_cols;
|
||||
|
||||
void (*putchar) (char c, int x, int y, char style);
|
||||
void (*setcurxy) (int x, int y);
|
||||
} tty_driver_t;
|
||||
|
||||
/**
|
||||
* @brief A type to represent a tty
|
||||
*
|
||||
*/
|
||||
typedef struct tty_struct {
|
||||
// size information
|
||||
int rows;
|
||||
int cols;
|
||||
|
||||
// cursor information
|
||||
int cursor_row;
|
||||
int cursor_col;
|
||||
|
||||
// stateful information
|
||||
cansid_state cansid;
|
||||
|
||||
// buffers
|
||||
tty_ochar_t output_buffer[65536];
|
||||
char input_buffer[1024];
|
||||
|
||||
// driver
|
||||
tty_driver_t driver;
|
||||
|
||||
// flags
|
||||
bool active;
|
||||
} tty_t;
|
||||
|
||||
static tty_t ttys[10];
|
||||
static int active_tty;
|
||||
|
||||
/**
|
||||
* @brief Create a new tty_t with the provided driver
|
||||
*
|
||||
* @param driver
|
||||
* @return tty_t
|
||||
*/
|
||||
tty_t tty_new(tty_driver_t driver);
|
||||
|
||||
/**
|
||||
* @brief Switch the screen to the provided tty - clear screen and flip to that tty
|
||||
*
|
||||
* @param index
|
||||
*/
|
||||
void tty_switch(int index);
|
||||
|
||||
/**
|
||||
* @brief Print the specified char c on the tty tty, at the current cursor location
|
||||
*
|
||||
* @param tty
|
||||
* @param c
|
||||
* @see tty_mvpchar
|
||||
*/
|
||||
void tty_pchar(int tty, char c);
|
||||
/**
|
||||
* @brief Print the specified char t to the tty tty, but move the cursor to x, y first.
|
||||
*
|
||||
* @param tty
|
||||
* @param c
|
||||
* @param x
|
||||
* @param y
|
||||
* @see tty_pchar
|
||||
*/
|
||||
void tty_mvpchar(int tty, char c, int x, int y);
|
||||
|
||||
// tty_pnl family
|
||||
/**
|
||||
* @brief Print a newline at the current cursor location on the tty tty.
|
||||
*
|
||||
* @param tty
|
||||
* @see tty_mvpnl
|
||||
*/
|
||||
void tty_pnl(int tty);
|
||||
/**
|
||||
* @brief Move to the specified cursor location and print a newline.
|
||||
*
|
||||
* @param tty
|
||||
* @param c
|
||||
* @param x
|
||||
* @param y
|
||||
* @see tty_pnl
|
||||
*/
|
||||
void tty_mvpnl(int tty, int x, int y);
|
||||
|
||||
// tty_clr family
|
||||
/**
|
||||
* @brief Clear the entire screen of the specified tty. Uses tty_clrl internally.
|
||||
*
|
||||
* @param tty
|
||||
* @see tty_clrl
|
||||
*/
|
||||
void tty_clr(int tty);
|
||||
/**
|
||||
* @brief Clear the specified line of the specified tty.
|
||||
*
|
||||
* @param tty
|
||||
* @param line
|
||||
* @see tty_clr
|
||||
*/
|
||||
void tty_clrl(int tty, int line);
|
||||
|
||||
/**
|
||||
* @brief Set the cursor position on the specified tty to the specified position.
|
||||
*
|
||||
* @param tty
|
||||
* @param x
|
||||
* @param y
|
||||
*/
|
||||
void tty_setcurxy(int tty, int x, int y);
|
||||
|
||||
#endif
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef SHADE_VERSION_H
|
||||
#define SHADE_VERSION_H
|
||||
// This file was autogenerated by the shadeOS build system. It should not be modified.
|
||||
#define SHADE_OS_KERNEL_VERSION "0.1.1-alpha"
|
||||
#define SHADE_OS_KERNEL "shade-development"
|
||||
#define SHADE_OS_BUILD "531ba0c"
|
||||
#define SHADE_OS_COMPILE_DATE "Tue May 17 10:46:28 AM EDT 2022"
|
||||
#define SHADE_OS_CODENAME "willow"
|
||||
#endif
|
Binary file not shown.
Binary file not shown.
|
@ -119,12 +119,3 @@ void putchar(char c, int x, int y, char style) {
|
|||
};
|
||||
buffer[x + 25 * y] = cr;
|
||||
}
|
||||
|
||||
tty_driver_t vga_text_mode_get_driver() {
|
||||
tty_driver_t ttyd;
|
||||
ttyd.max_cols = 25;
|
||||
ttyd.max_rows = 80;
|
||||
ttyd.putchar = putchar;
|
||||
ttyd.setcurxy = set_cursor_pos;
|
||||
return ttyd;
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
#include <shade/tty.h>
|
||||
#include <shade/cansid.h>
|
||||
|
||||
// Initialize a new tty_t object with the specified driver
|
||||
tty_t tty_new(tty_driver_t driver) {
|
||||
tty_t tty;
|
||||
tty.active = false;
|
||||
tty.cansid = cansid_init();
|
||||
tty.cols = driver.max_cols;
|
||||
tty.cursor_col = 0;
|
||||
tty.cursor_row = 0;
|
||||
tty.driver = driver;
|
||||
tty.rows = driver.max_rows;
|
||||
return tty;
|
||||
}
|
||||
|
||||
void tty_switch(int index);
|
||||
|
||||
// private function: print the contents of a tty's output buffer to the screen
|
||||
void _tty_flip(int tty, bool clear) {
|
||||
// clear the screen if required (used in tty_switch)
|
||||
if (clear) tty_clr(tty);
|
||||
// iterate over every (known) character in the tty output buffer
|
||||
for (int x = 0; x < ttys[tty].cols; x++) {
|
||||
for (int y = 0; y < ttys[tty].rows; y++) {
|
||||
// get the tty_ochar_t
|
||||
tty_ochar_t cr = ttys[tty].output_buffer[x + ttys[tty].cols + y];
|
||||
// and print it with the driver
|
||||
ttys[tty].driver.putchar(cr.character, x, y, cr.style);
|
||||
}
|
||||
}
|
||||
// and update the real cursor position
|
||||
ttys[tty].driver.setcurxy(ttys[tty].cursor_col, ttys[tty].cursor_row);
|
||||
}
|
||||
|
||||
// tty_pchar family
|
||||
void tty_pchar(int tty, char c) {
|
||||
if (c == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (c == '\n') {
|
||||
tty_pnl(tty);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ttys[tty].cursor_col > ttys[tty].cols) {
|
||||
tty_pnl(tty);
|
||||
}
|
||||
|
||||
color_char ccr = cansid_process(&ttys[tty].cansid, c);
|
||||
|
||||
tty_ochar_t cr;
|
||||
cr.character = ccr.ascii;
|
||||
cr.style = ccr.style;
|
||||
ttys[tty].output_buffer[ttys[tty].cursor_col + ttys[tty].cols * ttys[tty].cursor_row] = cr;
|
||||
|
||||
ttys[tty].cursor_col++;
|
||||
tty_setcurxy(tty, ttys[tty].cursor_col, ttys[tty].cursor_row);
|
||||
|
||||
// if tty is selected, flip
|
||||
if (tty == active_tty) _tty_flip(tty, false);
|
||||
}
|
||||
|
||||
void tty_mvpchar(int tty, char c, int x, int y) {
|
||||
tty_setcurxy(tty, x, y);
|
||||
tty_pchar(tty, c);
|
||||
}
|
||||
|
||||
// tty_pnl family
|
||||
void tty_pnl(int tty) {
|
||||
return;
|
||||
}
|
||||
void tty_mvpnl(int tty, int x, int y) {
|
||||
return;
|
||||
}
|
||||
|
||||
// tty_clr family
|
||||
void tty_clr(int tty) {
|
||||
return;
|
||||
}
|
||||
void tty_clrl(int tty, int line) {
|
||||
return;
|
||||
}
|
||||
|
||||
void tty_setcurxy(int tty, int x, int y) {
|
||||
ttys[tty].cursor_col = x;
|
||||
ttys[tty].cursor_row = y;
|
||||
ttys[tty].driver.setcurxy(x, y);
|
||||
}
|
Loading…
Reference in New Issue