summaryrefslogtreecommitdiff
path: root/src/init
diff options
context:
space:
mode:
Diffstat (limited to 'src/init')
-rw-r--r--src/init/linker.ld1
-rw-r--r--src/init/main.c4
-rw-r--r--src/init/syscall.s9
3 files changed, 14 insertions, 0 deletions
diff --git a/src/init/linker.ld b/src/init/linker.ld
index 9f3f4b5..a59308d 100644
--- a/src/init/linker.ld
+++ b/src/init/linker.ld
@@ -6,6 +6,7 @@ SECTIONS
. = 2M;
.text BLOCK(4K) : ALIGN(4K)
{
+ *(.text.startup)
*(.text)
}
.rodata BLOCK(4K) : ALIGN(4K)
diff --git a/src/init/main.c b/src/init/main.c
index ce1600c..cb3fa1d 100644
--- a/src/init/main.c
+++ b/src/init/main.c
@@ -1,6 +1,10 @@
#include <stdint.h>
+void _syscall();
+
int main() {
+ _syscall();
+
// change the colors of VGA text
// doesn't require a lot of code, but still shows that it's working
uint8_t *vga = (void*) 0xB8000;
diff --git a/src/init/syscall.s b/src/init/syscall.s
new file mode 100644
index 0000000..ebd9d0e
--- /dev/null
+++ b/src/init/syscall.s
@@ -0,0 +1,9 @@
+.section .text
+.global _syscall
+.type _syscall, @function
+_syscall:
+ mov %esp, %ecx
+ mov $_syscall_ret, %edx
+ sysenter
+_syscall_ret:
+ ret