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
3214743a
authored
Oct 19, 2015
by
malcolm
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add support for c-level interrupt handlers
parent
266aaed0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
src/idt.c
src/idt.c
View file @
3214743a
...
@@ -13,6 +13,8 @@ idt_desc _idt [MAX_IDT_INT];
...
@@ -13,6 +13,8 @@ idt_desc _idt [MAX_IDT_INT];
uint16_t
_code_sel
;
uint16_t
_code_sel
;
void
(
*
handlers
[
256
])
(
uint32_t
interrupt
,
uint32_t
error
);
void
idt_install
()
void
idt_install
()
{
{
struct
struct
...
@@ -37,6 +39,10 @@ void default_handler(struct reg_state reg, uint32_t interrupt, uint32_t error, s
...
@@ -37,6 +39,10 @@ void default_handler(struct reg_state reg, uint32_t interrupt, uint32_t error, s
serial_val
(
stack
.
cd
);
serial_val
(
stack
.
cd
);
serial_val
(
stack
.
eflags
);
serial_val
(
stack
.
eflags
);
serial_writestring
(
"
\n
"
);
serial_writestring
(
"
\n
"
);
if
(
handlers
[
interrupt
]
!=
NULL
)
{
handlers
[
interrupt
](
interrupt
,
error
);
}
return
;
return
;
}
}
...
@@ -78,10 +84,11 @@ int idt_init(uint16_t code_sel)
...
@@ -78,10 +84,11 @@ int idt_init(uint16_t code_sel)
idt_limit
=
sizeof
(
idt_desc
)
*
MAX_IDT_INT
-
1
;
idt_limit
=
sizeof
(
idt_desc
)
*
MAX_IDT_INT
-
1
;
idt_base
=
(
uint32_t
)
&
_idt
[
0
];
idt_base
=
(
uint32_t
)
&
_idt
[
0
];
memset
((
void
*
)
&
_idt
[
0
],
0
,
sizeof
(
idt_desc
)
*
MAX_IDT_INT
-
1
);
memset
((
void
*
)
&
_idt
[
0
],
0
,
sizeof
(
idt_desc
)
*
MAX_IDT_INT
-
1
);
//
for (int i=0; i<MAX_IDT_INT; i++)
for
(
int
i
=
0
;
i
<
MAX_IDT_INT
;
i
++
)
//
{
{
// install_ir (i, IDT_PR|IDT_32, code_sel, (IRQ_HANDLER)default_handler);
// install_ir (i, IDT_PR|IDT_32, code_sel, (IRQ_HANDLER)default_handler);
//}
handlers
[
i
]
=
NULL
;
}
_code_sel
=
code_sel
;
_code_sel
=
code_sel
;
idtsetup
();
idtsetup
();
idt_install
();
idt_install
();
...
...
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