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
84dcd0d7
authored
Dec 21, 2015
by
malcolm
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
just some cleanup and minor changes fremma help idk which of your vars to use
parent
99c55ce5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
11 deletions
src/PCB.c
src/PCB.h
src/helloworld.asm
src/idta.asm
src/switch.asm
src/PCB.c
View file @
84dcd0d7
...
@@ -32,7 +32,7 @@ void schedule()
...
@@ -32,7 +32,7 @@ void schedule()
curproc
=
(
curproc
<
NUM_PROCS
-
1
)
?
curproc
+
1
:
0
;
curproc
=
(
curproc
<
NUM_PROCS
-
1
)
?
curproc
+
1
:
0
;
}
}
serial_writestring
(
"about to switch
\n
"
);
serial_writestring
(
"about to switch
\n
"
);
context_switch
(
&
procs
[
old
]
->
ctxt
,
procs
[
curproc
]
->
ctxt
);
//
context_switch(&procs[old]->ctxt, procs[curproc]->ctxt);
serial_writestring
(
"switched
\n
"
);
serial_writestring
(
"switched
\n
"
);
//procs[old]->state=RUNNABLE;
//procs[old]->state=RUNNABLE;
procs
[
curproc
]
->
state
=
RUNNING
;
procs
[
curproc
]
->
state
=
RUNNING
;
...
...
src/PCB.h
View file @
84dcd0d7
...
@@ -47,6 +47,7 @@ typedef struct//all regs in proc
...
@@ -47,6 +47,7 @@ typedef struct//all regs in proc
typedef
struct
//regs needed for context
typedef
struct
//regs needed for context
{
{
uint3t_t
cr3
;
uint32_t
edi
;
uint32_t
edi
;
uint32_t
esi
;
uint32_t
esi
;
uint32_t
ebx
;
uint32_t
ebx
;
...
...
src/helloworld.asm
0 → 100644
View file @
84dcd0d7
;; compile with nasm -felf32 hello.asm
Section
.
text
global
main
main
:
mov
eax
,
4
int
0x80
mov
eax
,
5
int
0x80
src/idta.asm
View file @
84dcd0d7
...
@@ -5,10 +5,10 @@ extern kstack
...
@@ -5,10 +5,10 @@ extern kstack
%macro
error_interrupt
1
%macro
error_interrupt
1
global
interrupt_handler_
%1
global
interrupt_handler_
%1
interrupt_handler_
%1
:
interrupt_handler_
%1
:
push
ebp
;
push ebp
push
esp
;
push esp
mov
ebp
,
kstack
;
mov ebp, kstack
mov
esp
,
kstack
;
mov esp, kstack
push
dword
%1
push
dword
%1
jmp
common_handler
jmp
common_handler
%endmacro
%endmacro
...
@@ -17,10 +17,10 @@ interrupt_handler_%1:
...
@@ -17,10 +17,10 @@ interrupt_handler_%1:
global
interrupt_handler_
%1
global
interrupt_handler_
%1
interrupt_handler_
%1
:
interrupt_handler_
%1
:
push
dword
0
push
dword
0
push
ebp
;
push ebp
push
esp
;
push esp
mov
ebp
,
kstack
;
mov ebp, kstack
mov
esp
,
kstack
;
mov esp, kstack
push
dword
%1
push
dword
%1
jmp
common_handler
jmp
common_handler
%endmacro
%endmacro
...
@@ -39,8 +39,8 @@ common_handler:
...
@@ -39,8 +39,8 @@ common_handler:
pop
dword
ds
pop
dword
ds
add
esp
,
4
add
esp
,
4
pop
esp
;
pop esp
pop
ebp
;
pop ebp
add
esp
,
4
add
esp
,
4
iret
iret
...
...
src/switch.asm
View file @
84dcd0d7
...
@@ -7,10 +7,12 @@ context_switch:
...
@@ -7,10 +7,12 @@ context_switch:
push
ebx
push
ebx
push
esi
push
esi
push
edi
push
edi
push
cr3
mov
[eax],
esp
mov
[eax],
esp
mov
esp
,
edx
mov
esp
,
edx
pop
cr3
pop
edi
pop
edi
pop
esi
pop
esi
pop
ebx
pop
ebx
...
...
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