Merge pull request #35 from gbowne1/gbowne1-fixes-interrupts

Fixing interrupts
This commit is contained in:
Gregory Kenneth Bowne 2023-10-30 00:57:11 -07:00 committed by GitHub
commit 5c2e3146a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()