Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Facundo Javier Lerena
orga2-kernel
Commits
d3f3ff1d
Commit
d3f3ff1d
authored
10 months ago
by
Facundo Javier Lerena
Browse files
Options
Download
Email Patches
Plain Diff
we fixed math
parent
f65f387b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
262 additions
and
12 deletions
+262
-12
kernel/.gdb_history
kernel/.gdb_history
+202
-0
kernel/isr.asm
kernel/isr.asm
+7
-1
kernel/kernel.asm
kernel/kernel.asm
+7
-1
kernel/tareas/taskPong.c
kernel/tareas/taskPong.c
+3
-0
kernel/tareas/taskPongScoreboard.c
kernel/tareas/taskPongScoreboard.c
+42
-9
kernel/tareas/task_prelude.asm
kernel/tareas/task_prelude.asm
+1
-1
No files found.
kernel/.gdb_history
View file @
d3f3ff1d
...
...
@@ -14,3 +14,205 @@ q
kernel reload
q
q
q
q
q
kernel reload
q
kernel reload
q
q
cq
q
q
q
kernel reload
q
kernel reload
make gdb
kernel reload
q
kernel reload
q
kernel reload
q
info gdt
info gdt
info gdt
info tss
info tss
info gdt
q
info gdt
info gdt
info gdt
creg
creg cr3
creg
info creg
info re
info reg
info reg | grep cr0
info reg
b GLOBALCITA
b pong_draw
b pong_draw
r
kernel reload
q
q
break kernel.asm:212
c
n
p (int32_t *)0,
p (int32_t *)0
p *(int32_t *)0
p *(int8_t *)0
c
p *(int8_t *)0
c
p *(int8_t *)0
break *0x8002924
c
break *0x800000
break *0x800002
break *0x800004
break *0x800006
break *0x8000006
break *0x8000004
break *0x8000002
break *0x8000000
c
c
n
c
p *(int8_t *)0
set *(int8_t *)0 = 65
p *(int8_t *)0
break _isr32
c
n
n
n
n
n
n
n
n
n
break _isr32._fin
break _isr32.fin
c
info task
info tss
c
c
info tss
stepi
stepi
stepi
stepi
stepi
stepi
stepi
stepi
stepi
stepi
stepi
stepi
finish
l
stepi
stepi
l
p %eip
p $eip
b *0x8000234
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
b *0x8000234
q
d
b *0x8000234
c
b *0x8000245
c
b *0x800023C
c
x/i 0x0800023C
x/i 0x08000234
x/i 0x08000235
x/i 0x08000236
x/i 0x08000237
x/i 0x08000238
x/i 0x0800023A
x/i 0x0800023B
x/i 0x0800023C
x/i 0x0800023D
x/i 0x0800023D
x/i 0x0800023E
x/i 0x0800023F
x/10i 0x0800023F
x/10i 0x0800023E
x/10i 0x0800023
x/10i 0x08000234
x/i
x/10i 0x08000235
x/10i 0x08000236
x/10i 0x08000237
b *0x800024b
c
p/i
l
x/i %eio
x/i %eip
x/i $eip
p (int8_t*)0x8002000
p *(int8_t*)0x8002000
*(int8_t*)0x8002000 = 42
set *(int8_t*)0x8002000 = 42
p *(int8_t*)0x8002000
c
c
c
x/i 0x800000
x/i 0x8000000
x/2i 0x8000000
x/7b 0x8000000
x/7b 0x8000000
q
kernel reload
q
kernel reload
cq
q
q
q
info tss
info tss
info tss
info tss
info gdy
info gdt
info gdt
info gdt
info gdt
q
q
This diff is collapsed.
Click to expand it.
kernel/isr.asm
View file @
d3f3ff1d
...
...
@@ -116,7 +116,13 @@ _isr%1:
;; Rutina de atención de las EXCEPCIONES
;; -------------------------------------------------------------------------- ;;
ISRNE
0
global
_isr0
_isr0:
;; we did it we fixed math
add
dword
[
esp
],
2
iret
ISRNE
1
ISRNE
2
ISRNE
3
...
...
This diff is collapsed.
Click to expand it.
kernel/kernel.asm
View file @
d3f3ff1d
...
...
@@ -146,6 +146,7 @@ modo_protegido:
mov
fs
,
ax
mov
ss
,
ax
; COMPLETAR - Establecer el tope y la base de la pila
mov
esp
,
stack_top
...
...
@@ -185,7 +186,9 @@ modo_protegido:
mov
eax
,
KERNEL_PAGE_DIR
mov
cr3
,
eax
mov
eax
,
cr0
or
eax
,
0x80
_00_00_00
...
...
@@ -206,6 +209,9 @@ modo_protegido:
out
0x40
,
al
rol
ax
,
8
out
0x40
,
al
mov
byte
[
0x0
],
99
mov
byte
[
0x0
],
42
jmp
GDT_SEL_TASK_IDLE
:
0x0
;; esto hace un sti xq las eflags de la idle tiene 1 << 9
...
...
This diff is collapsed.
Click to expand it.
kernel/tareas/taskPong.c
View file @
d3f3ff1d
...
...
@@ -36,6 +36,7 @@ typedef struct pong {
player
*
saca
;
}
pong
;
int
GLOBALCITA
=
4
;
/**
* Dibuja en la pantalla el estado de la partida
*/
...
...
@@ -54,6 +55,8 @@ void pong_draw(struct pong* pong, screen pantalla) {
// Ponemos la pelota en la pantalla
pantalla
[
pong
->
ball
.
y
][
pong
->
ball
.
x
]
=
(
ca
)
{
.
c
=
0x9
,
.
a
=
C_FG_WHITE
};
// Le pedimos al sistema operativo que muestre nuesta pantalla
task_print_dec
(
pantalla
,
GLOBALCITA
,
2
,
1
,
1
,
C_FG_RED
);
syscall_draw
(
pantalla
);
}
...
...
This diff is collapsed.
Click to expand it.
kernel/tareas/taskPongScoreboard.c
View file @
d3f3ff1d
...
...
@@ -6,23 +6,50 @@
#define SHARED_SCORE_BASE_VADDR (PAGE_ON_DEMAND_BASE_VADDR + 0xF00)
#define CANT_PONGS 3
#define BLANK_LINE " "
void
print_score_task
(
screen
pantalla
,
uint8_t
task_id
,
uint8_t
x
,
uint8_t
y
)
{
uint8_t
cant_digitos
(
uint32_t
n
)
{
uint8_t
i
=
1
;
while
(
n
>=
10
)
{
n
=
n
/
10
;
i
++
;
}
return
i
;
}
void
print_score_task
(
screen
pantalla
,
uint8_t
task_id
,
uint8_t
y
)
{
uint32_t
*
task
=
(
uint32_t
*
)
SHARED_SCORE_BASE_VADDR
+
((
uint32_t
)
task_id
*
sizeof
(
uint32_t
)
*
2
);
uint8_t
x
=
10
;
uint32_t
score1
=
task
[
0
];
uint32_t
score2
=
task
[
1
];
uint8_t
size_1
=
cant_digitos
(
score1
);
uint8_t
size_2
=
cant_digitos
(
score2
);
uint8_t
size_task
=
cant_digitos
(
task_id
);
//task_print(pantalla, BLANK_LINE, x, y, C_BG_BLACK | C_FG_BLACK);
// Task N:
task_print
(
pantalla
,
"Tarea "
,
x
,
y
,
C_FG_CYAN
);
task_print_dec
(
pantalla
,
task_id
,
1
,
x
+
6
,
y
,
C_FG_CYAN
);
task_print
(
pantalla
,
":"
,
x
+
7
,
y
,
C_FG_CYAN
);
x
+=
size_task
;
task_print
(
pantalla
,
":"
,
x
+
6
,
y
,
C_FG_CYAN
);
task_print_dec
(
pantalla
,
task
[
0
],
1
,
x
+
10
,
y
,
C_FG_CYAN
);
task_print
(
pantalla
,
"-"
,
x
+
12
,
y
,
C_FG_CYAN
)
;
task_print_dec
(
pantalla
,
score1
,
size_
1
,
x
+
8
,
y
,
C_FG_CYAN
);
x
+=
size_1
;
task_print
_dec
(
pantalla
,
task
[
1
],
1
,
x
+
14
,
y
,
C_FG_CYAN
);
task_print
(
pantalla
,
"- "
,
x
+
9
,
y
,
C_FG_CYAN
);
task_print_dec
(
pantalla
,
score2
,
size_2
,
x
+
11
,
y
,
C_FG_CYAN
);
}
void
task
(
void
)
{
...
...
@@ -30,11 +57,11 @@ void task(void) {
// ¿Una tarea debe terminar en nuestro sistema?
while
(
true
)
{
task_print
(
pantalla
,
"SCOREBOARD "
,
10
,
8
,
C_FG_MAGENTA
);
task_print
(
pantalla
,
"SCOREBOARD "
,
10
,
7
,
C_FG_MAGENTA
);
print_score_task
(
pantalla
,
0
,
10
,
10
);
print_score_task
(
pantalla
,
1
,
10
,
11
);
print_score_task
(
pantalla
,
2
,
10
,
12
);
print_score_task
(
pantalla
,
0
,
10
);
print_score_task
(
pantalla
,
1
,
11
);
print_score_task
(
pantalla
,
2
,
12
);
...
...
@@ -42,5 +69,11 @@ void task(void) {
// - Pueden definir funciones auxiliares para imprimir en pantalla
// - Pueden usar `task_print`, `task_print_dec`, etc.
syscall_draw
(
pantalla
);
volatile
int
p
=
0
;
volatile
int
q
=
0
;
task_print_dec
(
pantalla
,
p
/
q
,
1
,
11
,
11
,
C_FG_RED
);
}
}
This diff is collapsed.
Click to expand it.
kernel/tareas/task_prelude.asm
View file @
d3f3ff1d
...
...
@@ -8,4 +8,4 @@ extern task
BITS
32
_start:
call
task
jmp
$
jmp
$
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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