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
faea7c7a
authored
Sep 28, 2015
by
malcolm
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fixed compile bugs, moved isntall functions to dt.asm
parent
48cb44bf
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
9 deletions
src/dt.asm
src/gdt.c
src/idt.c
src/idt.h
src/dt.asm
0 → 100644
View file @
faea7c7a
section
.
text
global
idt_install
idt_install
:
mov
eax
,
[
esp
+
4
]
lidt
[eax]
ret
global
gdt_install
gdt_install
:
mov
eax
,
[
esp
+
4
]
lgdt
[eax]
ret
src/gdt.c
View file @
faea7c7a
...
...
@@ -8,9 +8,10 @@ typedef struct{
static
gdt_desc
_gdt
[
MAX_GDT_DESC
];
static
gdtr
_gdtr
;
static
void
gdt_install
()
{
asm
volatile
(
"lgdt [%0]"
:
:
"p"
(
&
_gdtr
));
}
/*static void gdt_install () {
asm volatile("lgdt (%0)": : "p"(&_gdtr));
}*/
extern
void
gdt_install
(
gdtr
_gdtr
);
void
gdt_set_desc
(
uint32_t
i
,
uint64_t
base
,
uint64_t
limit
,
uint8_t
access
,
uint8_t
gran
)
{
...
...
@@ -43,6 +44,6 @@ int gdt_init() {
gdt_set_desc
(
1
,
0
,
0xffffffff
,
GDT_RW
|
GDT_EXE
|
GDT_CDT
|
GDT_MEM
,
GDT_GR_PG
|
GDT_GR_32
|
GDT_GR_HI
);
//data
gdt_set_desc
(
2
,
0
,
0xffffffff
,
GDT_RW
|
GDT_CDT
|
GDT_MEM
,
GDT_GR_PG
|
GDT_GR_32
|
GDT_GR_HI
);
gdt_install
();
gdt_install
(
_gdtr
);
return
0
;
}
src/idt.c
View file @
faea7c7a
...
...
@@ -8,10 +8,11 @@ typedef struct{
static
idt_desc
_idt
[
MAX_IDT_INT
];
static
idtr
_idtr
;
static
void
idt_install
()
{
/*
static void idt_install () {
//TODO: VOODOO MAGIC
asm
volatile
(
"lidt [%0]"
:
:
"p"
(
&
_idtr
));
}
asm volatile ("lidt (%0)": : "p"(&(_idtr)));
}*/
extern
void
idt_install
(
idtr
_idtr
);
static
void
default_handler
()
{
//DEBUG OUTPUT MAYBE?
for
(;;);
...
...
@@ -41,6 +42,6 @@ int idt_init (uint16_t code_sel) {
memset
((
void
*
)
&
_idt
[
0
],
0
,
sizeof
(
idt_desc
)
*
MAX_IDT_INT
-
1
);
for
(
int
i
=
0
;
i
<
MAX_IDT_INT
;
i
++
)
install_ir
(
i
,
IDT_PR
|
IDT_32
,
code_sel
,(
IRQ_HANDLER
)
default_handler
);
idt_install
();
idt_install
(
_idtr
);
return
0
;
}
src/idt.h
View file @
faea7c7a
...
...
@@ -20,7 +20,7 @@ typedef struct {
uint8_t
reserved
;
uint8_t
flags
;
uint16_t
high_base
;
}
__att
ibute__
((
packed
))
idt_desc
;
}
__attr
ibute__
((
packed
))
idt_desc
;
extern
idt_desc
*
get_ir
(
uint32_t
i
);
extern
int
install_ir
(
uint32_t
i
,
uint16_t
flags
,
uint16_t
code_sel
,
IRQ_HANDLER
);
...
...
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