Commit 9150f613 by malcolm

switching to trapframes for interrupts to prepare for context switches

parent 5b28ee5a
Showing with 24 additions and 11 deletions
......@@ -27,16 +27,17 @@ typedef struct//all regs in proc
uint32_t trap;
uint32_t err;
uint32_t eip;
uint16_t cs;
uint16_t cspad;
uint32_t eflags;
//uint32_t eip;
//uint16_t cs;
//uint16_t cspad;
//uint32_t eflags;
//ring changing, for user mode stuff. not used yet
uint32_t esp;
uint16_t ss;
uint16_t sspad;
//uint32_t esp;
//uint16_t ss;
//uint16_t sspad;
}__attribute__((packed)) trapframe;
typedef struct//regs needed for context
......
......@@ -43,8 +43,10 @@ void load_error_handlers()
}
}
void default_handler(struct reg_state __attribute__((unused))reg, uint32_t interrupt, uint32_t error, struct stack_state stack)
void default_handler(trapframe reg, /*uint32_t interrupt, uint32_t error,*/ struct stack_state stack)
{
uint32_t interrupt = reg.trap;
uint32_t error = reg.err;
if(interrupt<32)
stack.eip+=2;
//char f[20];
......
#ifndef _IDT_INC
#define _IDT_INC
#include "PCB.h"
#include <stdint.h>
#define MAX_IDT_INT 256
......@@ -24,7 +25,7 @@ typedef struct
}__attribute__((packed)) idt_desc;
struct reg_state
/*struct reg_state
{
uint32_t eax;
uint32_t ecx;
......@@ -34,7 +35,7 @@ struct reg_state
uint32_t ebp;
uint32_t esi;
uint32_t edi;
}__attribute__((packed));
}__attribute__((packed));*/
struct stack_state
{
......@@ -44,7 +45,7 @@ struct stack_state
}__attribute__((packed));
extern void default_handler(struct reg_state reg,uint32_t interrupt, uint32_t error, struct stack_state stack);
extern void default_handler(trapframe reg,/*uint32_t interrupt, uint32_t error,*/ struct stack_state stack);
extern idt_desc* get_ir(uint32_t i);
extern int install_ir(uint32_t i, uint16_t flags, uint16_t code_sel, IRQ_HANDLER);
extern void install_c_ir(uint32_t interrupt, void (*handler) (uint32_t));
......
......@@ -17,9 +17,18 @@ interrupt_handler_%1:
%endmacro
common_handler:
push dword ds
push dword es
push dword fs
push dword gs
pusha
call default_handler
popa
pop dword gs
pop dword fs
pop dword es
pop dword ds
add esp, 8
iret
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment