aboutsummaryrefslogtreecommitdiff
path: root/include/01.pocetak
diff options
context:
space:
mode:
Diffstat (limited to 'include/01.pocetak')
-rw-r--r--include/01.pocetak/boot.s70
-rw-r--r--include/01.pocetak/boot03.s11
-rw-r--r--include/01.pocetak/deo1 (renamed from include/01.pocetak/boot00.s)0
-rw-r--r--include/01.pocetak/deo105
-rw-r--r--include/01.pocetak/deo1112
-rw-r--r--include/01.pocetak/deo121
-rw-r--r--include/01.pocetak/deo2 (renamed from include/01.pocetak/boot01.s)0
-rw-r--r--include/01.pocetak/deo36
-rw-r--r--include/01.pocetak/deo44
-rw-r--r--include/01.pocetak/deo55
-rw-r--r--include/01.pocetak/deo64
-rw-r--r--include/01.pocetak/deo75
-rw-r--r--include/01.pocetak/deo82
-rw-r--r--include/01.pocetak/deo9 (renamed from include/01.pocetak/boot02.s)0
14 files changed, 114 insertions, 11 deletions
diff --git a/include/01.pocetak/boot.s b/include/01.pocetak/boot.s
new file mode 100644
index 0000000..907cd3c
--- /dev/null
+++ b/include/01.pocetak/boot.s
@@ -0,0 +1,70 @@
+.set ALIGN, 1<<0
+.set MEMINFO, 1<<1
+.set FLAGS, ALIGN | MEMINFO
+.set MAGIC, 0x1BADB002
+.set CHECKSUM, -(MAGIC + FLAGS)
+
+.section .multiboot
+.align 4
+.long MAGIC
+.long FLAGS
+.long CHECKSUM
+
+.global _start
+.global load_gdt
+.global load_idt
+.global enable_interrupts
+.global ioport_in
+.global ioport_out
+
+load_gdt:
+ movl 4(%esp), %edx
+ lgdt (%edx)
+ ret
+
+load_idt:
+ movl 4(%esp), %edx
+ lidt (%edx)
+ sti
+ ret
+
+ioport_in:
+ movl 4(%esp),%edx
+ in %dx,%al
+ ret
+
+ioport_out:
+ movl 4(%esp),%edx
+ movl 8(%esp),%eax
+ outb %al,%dx
+ ret
+
+.set CODE_SEGMENT, 0x08
+.set DATA_SEGMENT, 0x10
+
+.section .bss
+.align 16
+stack_bottom:
+.skip 16384
+stack_top:
+
+.section .text
+.type _start, @function
+_start:
+ call init_gdt_table
+ ljmp $CODE_SEGMENT, $code
+
+code:
+ movw $DATA_SEGMENT, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw %ax, %fs
+ movw %ax, %gs
+ movw %ax, %ss
+ movl $stack_top, %esp
+ cli
+ call _init
+ call kernel_main
+ hlt
+
+.size _start, . - _start
diff --git a/include/01.pocetak/boot03.s b/include/01.pocetak/boot03.s
deleted file mode 100644
index 46a4e7f..0000000
--- a/include/01.pocetak/boot03.s
+++ /dev/null
@@ -1,11 +0,0 @@
-.section .text
-.global _start
-.type _start, @function
-_start:
- mov $stack_top, %esp
- call kernel_main
- cli
-1: hlt
- jmp 1b
-
-.size _start, . - _start
diff --git a/include/01.pocetak/boot00.s b/include/01.pocetak/deo1
index 0e1bfbe..0e1bfbe 100644
--- a/include/01.pocetak/boot00.s
+++ b/include/01.pocetak/deo1
diff --git a/include/01.pocetak/deo10 b/include/01.pocetak/deo10
new file mode 100644
index 0000000..3cd7ea1
--- /dev/null
+++ b/include/01.pocetak/deo10
@@ -0,0 +1,5 @@
+.section .text
+.type _start, @function
+_start:
+ call init_gdt_table
+ ljmp $CODE_SEGMENT, $code
diff --git a/include/01.pocetak/deo11 b/include/01.pocetak/deo11
new file mode 100644
index 0000000..bd0f1da
--- /dev/null
+++ b/include/01.pocetak/deo11
@@ -0,0 +1,12 @@
+code:
+ movw $DATA_SEGMENT, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw %ax, %fs
+ movw %ax, %gs
+ movw %ax, %ss
+ movl $stack_top, %esp
+ cli
+ call _init
+ call kernel_main
+ hlt
diff --git a/include/01.pocetak/deo12 b/include/01.pocetak/deo12
new file mode 100644
index 0000000..d1d8388
--- /dev/null
+++ b/include/01.pocetak/deo12
@@ -0,0 +1 @@
+.size _start, . - _start
diff --git a/include/01.pocetak/boot01.s b/include/01.pocetak/deo2
index cd7b353..cd7b353 100644
--- a/include/01.pocetak/boot01.s
+++ b/include/01.pocetak/deo2
diff --git a/include/01.pocetak/deo3 b/include/01.pocetak/deo3
new file mode 100644
index 0000000..44fcb34
--- /dev/null
+++ b/include/01.pocetak/deo3
@@ -0,0 +1,6 @@
+.global _start
+.global load_gdt
+.global load_idt
+.global enable_interrupts
+.global ioport_in
+.global ioport_out
diff --git a/include/01.pocetak/deo4 b/include/01.pocetak/deo4
new file mode 100644
index 0000000..975ee19
--- /dev/null
+++ b/include/01.pocetak/deo4
@@ -0,0 +1,4 @@
+load_gdt:
+ movl 4(%esp), %edx
+ lgdt (%edx)
+ ret
diff --git a/include/01.pocetak/deo5 b/include/01.pocetak/deo5
new file mode 100644
index 0000000..6f095e9
--- /dev/null
+++ b/include/01.pocetak/deo5
@@ -0,0 +1,5 @@
+load_idt:
+ movl 4(%esp), %edx
+ lidt (%edx)
+ sti
+ ret
diff --git a/include/01.pocetak/deo6 b/include/01.pocetak/deo6
new file mode 100644
index 0000000..3f23d36
--- /dev/null
+++ b/include/01.pocetak/deo6
@@ -0,0 +1,4 @@
+ioport_in:
+ movl 4(%esp),%edx
+ in %dx,%al
+ ret
diff --git a/include/01.pocetak/deo7 b/include/01.pocetak/deo7
new file mode 100644
index 0000000..f441d17
--- /dev/null
+++ b/include/01.pocetak/deo7
@@ -0,0 +1,5 @@
+ioport_out:
+ movl 4(%esp),%edx
+ movl 8(%esp),%eax
+ outb %al,%dx
+ ret
diff --git a/include/01.pocetak/deo8 b/include/01.pocetak/deo8
new file mode 100644
index 0000000..cd3f772
--- /dev/null
+++ b/include/01.pocetak/deo8
@@ -0,0 +1,2 @@
+.set CODE_SEGMENT, 0x08
+.set DATA_SEGMENT, 0x10
diff --git a/include/01.pocetak/boot02.s b/include/01.pocetak/deo9
index a9280a6..a9280a6 100644
--- a/include/01.pocetak/boot02.s
+++ b/include/01.pocetak/deo9