aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNic Gaffney <gaffney_nic@protonmail.com>2023-11-06 02:00:07 -0600
committerNic Gaffney <gaffney_nic@protonmail.com>2023-11-06 02:00:07 -0600
commite14a65df735ce1b00533c73533ce91f8e591ea68 (patch)
tree6105dc57bbbdd88b6c6b1cec5da87e930cdd9dc8 /src
parent036398ab051f2df5b70303e03f4f6506d36cb6eb (diff)
downloadgftos-e14a65df735ce1b00533c73533ce91f8e591ea68.tar.gz
global constructors
Diffstat (limited to 'src')
-rw-r--r--src/header/crti.s12
-rw-r--r--src/header/crtn.s7
-rw-r--r--src/kernel/kernel.c2
-rw-r--r--src/kernel/print.c8
4 files changed, 24 insertions, 5 deletions
diff --git a/src/header/crti.s b/src/header/crti.s
new file mode 100644
index 0000000..91e86fa
--- /dev/null
+++ b/src/header/crti.s
@@ -0,0 +1,12 @@
+.section .init
+.global _init
+.type _init @function
+_init:
+ push %ebp
+ movl %esp, %ebp
+
+.section .fini
+.global _fini
+_fini:
+ push %ebp
+ movl %esp, %ebp
diff --git a/src/header/crtn.s b/src/header/crtn.s
new file mode 100644
index 0000000..4874122
--- /dev/null
+++ b/src/header/crtn.s
@@ -0,0 +1,7 @@
+.section .init
+ popl %ebp
+ ret
+
+.section .fini
+ popl %ebp
+ ret
diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c
index 50da3c6..a47a0a7 100644
--- a/src/kernel/kernel.c
+++ b/src/kernel/kernel.c
@@ -17,5 +17,5 @@ void kernel_main(void) {
print_set_color(PRINT_COLOR_YELLOW, PRINT_COLOR_BLACK);
printf("printf\n\tint: %d\n\tstring: %s\n\tchar: %c\n\tpercent: "
"%%\n\tnothing: %n",
- 1287, "World! ", 't');
+ 99, "World! ", 't');
}
diff --git a/src/kernel/print.c b/src/kernel/print.c
index 35533cd..89f6722 100644
--- a/src/kernel/print.c
+++ b/src/kernel/print.c
@@ -24,8 +24,8 @@ uint8_t color = PRINT_COLOR_WHITE | PRINT_COLOR_BLACK << 4;
void clear_row(size_t row) {
// Define empty character
struct Char empty = (struct Char){
- character : ' ',
- color : color,
+ ' ',
+ color,
};
// For every col in row, set vmem to empty
@@ -82,8 +82,8 @@ void print_char(char character) {
// set video memeory to requested character
buffer[col + NUM_COLS * row] = (struct Char){
- character : (uint8_t)character,
- color : color,
+ (uint8_t)character,
+ color,
};
// iterate col