kbd stuff needs volatile, start structure changes

This commit is contained in:
Rose committed 2024-07-31 21:03:29 -05:00
1 parent 56152c6d20
commit 26fc668d74
21 files changed
+28 -10

No files matched your search

+2
View File
@@ -4,3 +4,5 @@
*.lock *.lock
*.com *.com
bx_enh_dbg.ini bx_enh_dbg.ini
.cache
compile_commands.json
+2 -2
View File
@@ -1,8 +1,8 @@
objects = entry.o kernel.o task.o handler.o interrupt.o v86.o print.o tss.o gdt.o\ objects = entry.o kernel.o task.o handler.o interrupt.o v86.o print.o tss.o gdt.o\
paging.o fault.o tests.o kbd.o helper.o disk.o file.o fs.o dosfs/dosfs.o fs_dos.o\ paging.o fault.o tests.o kbd.o helper.o disk.o file.o fs.o dosfs/dosfs.o fs_dos.o\
progs.o hexedit.o textedit.o progs.o hexedit.o textedit.o
CFLAGS = -target "i686-elf" -m32 -mgeneral-regs-only -ffreestanding\ CFLAGS = -target "i386-elf" -m32 -mgeneral-regs-only -ffreestanding\
-march=i686 -fno-stack-protector -Wno-int-conversion -nostdlib -c -g -march=i386 -fno-stack-protector -Wno-int-conversion -nostdlib -c -Iinclude
LFLAGS = -Wl,--gc-sections -Wl,--print-gc-sections -m32 -nostartfiles -nostdlib LFLAGS = -Wl,--gc-sections -Wl,--print-gc-sections -m32 -nostartfiles -nostdlib
ifeq ($(OUTFILE),) ifeq ($(OUTFILE),)
+3 -2
View File
@@ -1,2 +1,3 @@
# luciaos # ROSE
<https://ceionia.com/resources/v86.html> in progress toy OS
i work on stream at <https://twitch.tv/mcrrox>
+1
View File
@@ -66,6 +66,7 @@ pop ds
pop eax pop eax
iret iret
; from linux 0.0.1
global picInit global picInit
picInit: picInit:
mov al, 0x11 ; initialization sequence mov al, 0x11 ; initialization sequence
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
+1 -1
View File
@@ -15,7 +15,7 @@ __attribute((__no_caller_saved_registers__))
uint16_t get_scancode(); uint16_t get_scancode();
__attribute__ ((interrupt)) __attribute__ ((interrupt))
void keyboardHandler(struct interrupt_frame *frame); void keyboardHandler(struct interrupt_frame volatile *frame);
typedef enum { typedef enum {
KEY_ESCAPE=0x01, KEY_1=0x02, KEY_2=0x03, KEY_ESCAPE=0x01, KEY_1=0x02, KEY_2=0x03,
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
+1
View File
@@ -90,6 +90,7 @@ void IRQ_clear_mask(char IRQline) {
outb(port, value); outb(port, value);
} }
// Mostly from https://web.archive.org/web/20090719085533/http://osdev.berlios.de/v86.html
char v86_if = 0; char v86_if = 0;
extern uint16_t error_screen[80*50]; // defined in kernel.c extern uint16_t error_screen[80*50]; // defined in kernel.c
extern uint16_t IVT[]; extern uint16_t IVT[];
+7 -4
View File
@@ -31,11 +31,13 @@ uint8_t scancodesToAsciiShift[0x3B] =
"\0" // 0x38 "\0" // 0x38
" " // 0x39 " " // 0x39
"\0"; // 0x3A "\0"; // 0x3A
uint8_t _KBDWAIT; volatile uint8_t _KBDWAIT;
uint8_t _KEYCAPS = 0, _KEYSHIFT = 0; volatile uint8_t _KEYCAPS = 0;
uint8_t _LSTKEY_ASCII = 0, _LSTKEY_SCAN = 0; volatile uint8_t _KEYSHIFT = 0;
volatile uint8_t _LSTKEY_ASCII = 0;
volatile uint8_t _LSTKEY_SCAN = 0;
__attribute__ ((interrupt)) __attribute__ ((interrupt))
void keyboardHandler(struct interrupt_frame *frame) { void keyboardHandler(struct interrupt_frame volatile *frame) {
uint16_t old_ds; uint16_t old_ds;
asm volatile( asm volatile(
"mov %%ds, %%bx\n" "mov %%ds, %%bx\n"
@@ -43,6 +45,7 @@ void keyboardHandler(struct interrupt_frame *frame) {
"mov %%ax, %%ds\n" "mov %%ax, %%ds\n"
:"=b"(old_ds)::"%ax" :"=b"(old_ds)::"%ax"
); );
asm volatile("xchg %bx,%bx");
uint8_t key; uint8_t key;
asm volatile("inb $0x60, %%al":"=a"(key)); asm volatile("inb $0x60, %%al":"=a"(key));
if (key == 0x3A) { // caps lock press if (key == 0x3A) { // caps lock press
+1 -1
View File
@@ -504,7 +504,7 @@ extern void triple_fault();
uint32_t kernel_check = 0x12345678; uint32_t kernel_check = 0x12345678;
void start() { void start() {
word *vga_text = (word *)0xb8000; word *vga_text = (word *)0xb8000;
char h[] = "LuciaOS"; char h[] = "ROSE";
for (int i = 0; i < sizeof(h); i++) for (int i = 0; i < sizeof(h); i++)
*(char *)&vga_text[i] = h[i]; *(char *)&vga_text[i] = h[i];
vga_text = &vga_text[80]; vga_text = &vga_text[80];
Executable
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
export CPATH="${DIR}/include:${DIR}/lib/include"