fixing some issues in my editor. Also adding a utility for working with interrupts and fixing isr.c

This commit is contained in:
Gregory Kenneth Bowne 2023-10-29 19:57:46 -07:00
parent 791af944f7
commit 4a2e72ce2c
4 changed files with 201 additions and 197 deletions

View File

@ -8,9 +8,9 @@
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "c++20",
"intelliSenseMode": "gcc-x64",
"cStandard": "c11",
"cppStandard": "c++11",
"intelliSenseMode": "linux-gcc-x64",
"browse": {
"path": [
"${workspaceFolder}/**",

View File

@ -1,12 +0,0 @@
[
{
"directory": "/path/to/project",
"command": "gcc -c -o file1.o file1.c",
"file": "/path/to/project/file1.c"
},
{
"directory": "/path/to/project",
"command": "g++ -c -o file2.o file2.cpp",
"file": "/path/to/project/file2.cpp"
}
]

View File

@ -0,0 +1,8 @@
#ifndef INTERRUPT_UTILS_H
#define INTERRUPT_UTILS_H
#include <stdint.h>
uint32_t read_interrupt_type(void);
#endif /* INTERRUPT_UTILS_H */

View File

@ -2,6 +2,16 @@
#include "idt.h"
#include <stdint.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include "./interrupt_utils.h"
void invalid_opcode(void);
void general_protection_fault(struct idt_regs *regs);
void page_fault(struct idt_regs *regs);
void system_call(struct idt_regs *regs);
enum
{
@ -17,9 +27,6 @@ void dummy_isr(struct isr_regs *regs)
printf("Timer interrupt occurred!\n");
}
// ISR table
void (*isr_table[256])(struct isr_regs *regs) = {0};
// Register an ISR
extern void isr_register(uint8_t num, void (*handler)(struct isr_regs *regs))
{
@ -141,7 +148,8 @@ void system_call(struct idt_regs *regs)
void timer()
{
// Handle timer interrupt
static int count = 0;
printf ("timer expired %d times\n", ++count);
}
void keyboard()