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
97fa5ad9
authored
Sep 28, 2015
by
malcolm
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fixed up IDT files
parent
ab42a3e9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
src/idt.c
src/idt.h
src/idt.c
View file @
97fa5ad9
#include "idt.h"
struct
idtr
{
#include <string.h>
typedef
struct
{
uint16_t
limit
;
uint32_t
base
;
};
}
idtr
;
static
struct
idt_desc
_idt
[
MAX_IDT_INT
];
static
struct
idtr
_idtr
;
static
idt_desc
_idt
[
MAX_IDT_INT
];
static
idtr
_idtr
;
static
void
idt_install
()
{
//TODO: VOODOO MAGIC
}
static
void
_cdecl
default_handler
()
{
static
void
default_handler
()
{
//DEBUG OUTPUT MAYBE?
for
(;;);
}
idt_desc
riptor
*
get_ir
(
uint32_t
i
)
{
idt_desc
*
get_ir
(
uint32_t
i
)
{
if
(
i
>
MAX_IDT_INT
)
return
0
;
return
&
_idt
[
i
];
}
int
install_ir
(
uint32_t
i
,
uint16_t
flags
,
uint16_t
sel
,
IRQ_HANDLER
irq
)
{
int
install_ir
(
uint32_t
i
,
uint16_t
flags
,
uint16_t
code_
sel
,
IRQ_HANDLER
irq
)
{
if
(
i
>
MAX_IDT_INT
)
return
0
;
if
(
!
irq
)
return
0
;
uint64_t
uiBase
=
(
uint64_t
)
&
(
*
irq
);
_idt
[
i
].
low_base
=
uint16_t
(
uiBase
&
0xffff
);
_idt
[
i
].
high_base
=
uint16_t
((
uiBase
>>
16
)
&
0xffff
);
_idt
[
i
].
low_base
=
(
uint16_t
)
(
uiBase
&
0xffff
);
_idt
[
i
].
high_base
=
(
uint16_t
)
((
uiBase
>>
16
)
&
0xffff
);
_idt
[
i
].
reserved
=
0
;
_idt
[
i
].
flags
=
uint8_t
(
flags
);
_idt
[
i
].
code_sel
=
sel
;
_idt
[
i
].
flags
=
(
uint8_t
)
(
flags
);
_idt
[
i
].
code_sel
=
code_
sel
;
return
0
;
}
int
idt_init
(
uint16_t
code_sel
)
{
_idtr
.
limit
=
sizeof
(
struct
idt_desc
)
*
MAX_IDT_INT
-
1
;
_idtr
.
limit
=
sizeof
(
idt_desc
)
*
MAX_IDT_INT
-
1
;
_idtr
.
base
=
(
uint32_t
)
&
_idt
[
0
];
memset
((
void
*
)
&
_idt
[
0
],
0
,
sizeof
(
idt_desc
)
*
MAX_IDT_INT
-
1
);
for
(
int
i
=
0
;
i
<
MAX_IDT_INT
;
i
++
)
...
...
src/idt.h
View file @
97fa5ad9
...
...
@@ -13,18 +13,18 @@
#define IDT_PR 0x80
//voodoo magic. find out what it does.
typedef
void
(
_cdecl
*
IRQ_HANDLER
)(
void
);
typedef
void
(
*
IRQ_HANDLER
)(
void
);
struct
idt_desc
{
typedef
struct
{
uint16_t
low_base
;
uint16_t
code_sel
;
uint8_t
reserved
;
uint8_t
flags
;
uint16_t
high_base
;
};
}
idt_desc
;
extern
idt_desc
*
get_ir
(
uint32_t
i
);
extern
int
install_ir
(
uint32_t
i
,
uint16_t
flags
,
uint16_
c
code_sel
,
IRQ_HANDLER
);
extern
int
install_ir
(
uint32_t
i
,
uint16_t
flags
,
uint16_
t
code_sel
,
IRQ_HANDLER
);
extern
int
idt_init
(
uint16_t
code_sel
);
#endif
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