Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
triazo
/
kernel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
3
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9150f613
authored
Nov 30, 2015
by
malcolm
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
switching to trapframes for interrupts to prepare for context switches
parent
5b28ee5a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
11 deletions
src/PCB.h
src/idt.c
src/idt.h
src/idta.asm
src/PCB.h
View file @
9150f613
...
...
@@ -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 eip;
//uint16_t cs;
//uint16_t cspad;
uint32_t
eflags
;
//
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
...
...
src/idt.c
View file @
9150f613
...
...
@@ -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];
...
...
src/idt.h
View file @
9150f613
#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
));
...
...
src/idta.asm
View file @
9150f613
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment