aboutsummaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
authorMarvin Borner2020-04-29 13:19:32 +0200
committerMarvin Borner2020-04-29 13:19:32 +0200
commit4f3c75d23188bd480739d6d1514543c95cfe3399 (patch)
treed7306d1e5496becadee6514e3e50bdfc2e37f3e0 /src/kernel
parent50858d043cbd6f61cc091c6772f981ca2d6cca6b (diff)
Started libgui implementation
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/fs/elf.c2
-rw-r--r--src/kernel/fs/elf.h2
-rw-r--r--src/kernel/fs/ext2.c2
-rw-r--r--src/kernel/fs/ext2.h2
-rw-r--r--src/kernel/graphics/vesa.c14
-rw-r--r--src/kernel/graphics/vesa.h4
-rw-r--r--src/kernel/kernel.c4
-rw-r--r--src/kernel/syscall/actions/sys_exec.c2
-rw-r--r--src/kernel/syscall/actions/sys_getch.c2
-rw-r--r--src/kernel/syscall/actions/sys_pointers.c18
-rw-r--r--src/kernel/syscall/syscall.c5
-rw-r--r--src/kernel/syscall/syscall.h4
-rw-r--r--src/kernel/tasks/process.c3
-rw-r--r--src/kernel/tasks/process.h2
14 files changed, 43 insertions, 23 deletions
diff --git a/src/kernel/fs/elf.c b/src/kernel/fs/elf.c
index a4c78ba..37cc606 100644
--- a/src/kernel/fs/elf.c
+++ b/src/kernel/fs/elf.c
@@ -71,4 +71,4 @@ struct process *elf_load(char *path)
paging_switch_directory(paging_root_directory);
return proc;
-}
+} \ No newline at end of file
diff --git a/src/kernel/fs/elf.h b/src/kernel/fs/elf.h
index 0fe435b..8c7d38a 100644
--- a/src/kernel/fs/elf.h
+++ b/src/kernel/fs/elf.h
@@ -76,4 +76,4 @@ struct elf_program_header {
int is_elf(struct elf_header *header);
struct process *elf_load(char *path);
-#endif
+#endif \ No newline at end of file
diff --git a/src/kernel/fs/ext2.c b/src/kernel/fs/ext2.c
index 4e4f617..5fb0158 100644
--- a/src/kernel/fs/ext2.c
+++ b/src/kernel/fs/ext2.c
@@ -251,4 +251,4 @@ uint8_t *read_file(char *path)
warn("File not found");
return NULL;
}
-}
+} \ No newline at end of file
diff --git a/src/kernel/fs/ext2.h b/src/kernel/fs/ext2.h
index 7fbe493..88515a3 100644
--- a/src/kernel/fs/ext2.h
+++ b/src/kernel/fs/ext2.h
@@ -139,4 +139,4 @@ uint32_t ext2_look_up_path(char *path);
uint8_t *read_file(char *path);
-#endif
+#endif \ No newline at end of file
diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c
index 898a0f3..30cda3a 100644
--- a/src/kernel/graphics/vesa.c
+++ b/src/kernel/graphics/vesa.c
@@ -187,9 +187,7 @@ void set_optimal_resolution()
uint32_t fb_size = vbe_width * vbe_height * vbe_bpl;
/* cursor_buffer = kmalloc(fb_size); */
for (uint32_t z = 0; z < fb_size; z += PAGE_S) {
- paging_map(paging_root_directory, (uint32_t)fb + z, (uint32_t)fb + z);
- /* paging_map(paging_root_directory, (uint32_t)cursor_buffer + z, */
- /* (uint32_t)cursor_buffer + z); */
+ paging_map_user(paging_root_directory, (uint32_t)fb + z, (uint32_t)fb + z);
}
if (vbe_height > 1440)
@@ -198,11 +196,11 @@ void set_optimal_resolution()
vesa_set_font(24);
else
vesa_set_font(16);
- vesa_set_color(default_text_color);
- vesa_clear();
+ //vesa_set_color(default_text_color);
+ //vesa_clear();
- vesa_set_color(vesa_blue);
- vesa_set_color(default_text_color);
+ //vesa_set_color(vesa_blue);
+ //vesa_set_color(default_text_color);
info("Successfully switched to video mode!");
@@ -253,7 +251,7 @@ void vesa_convert_color(uint32_t *color_array, uint32_t color)
void vesa_set_pixel(uint16_t x, uint16_t y, const uint32_t color[3])
{
- unsigned pos = (unsigned int)(x * vbe_bpl + y * vbe_pitch);
+ uint8_t pos = (uint8_t)(x * vbe_bpl + y * vbe_pitch);
char *draw = (char *)&fb[pos];
draw[pos] = (char)color[2];
draw[pos + 1] = (char)color[1];
diff --git a/src/kernel/graphics/vesa.h b/src/kernel/graphics/vesa.h
index c45be19..50bf85c 100644
--- a/src/kernel/graphics/vesa.h
+++ b/src/kernel/graphics/vesa.h
@@ -251,8 +251,8 @@ int vbe_bpl;
/**
* The framebuffer interface
*/
-unsigned char *fb;
+uint8_t *fb;
-unsigned char *cursor_buffer;
+uint8_t *cursor_buffer;
#endif \ No newline at end of file
diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c
index 8056055..ffde014 100644
--- a/src/kernel/kernel.c
+++ b/src/kernel/kernel.c
@@ -64,11 +64,11 @@ void kernel_main(uint32_t magic, uint32_t multiboot_address, uint32_t esp)
load_binaries();
set_optimal_resolution();
- printf("Content of /etc/test: %s", read_file("/etc/test"));
+ log("Content of /etc/test: %s", read_file("/etc/test"));
syscalls_install();
kexec("/bin/init");
halt_loop();
// asm ("div %0" :: "r"(0)); // Exception testing x/0
-}
+} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_exec.c b/src/kernel/syscall/actions/sys_exec.c
index dc1e9c6..000d185 100644
--- a/src/kernel/syscall/actions/sys_exec.c
+++ b/src/kernel/syscall/actions/sys_exec.c
@@ -4,4 +4,4 @@
uint32_t sys_exec(char *path)
{
return uexec(path);
-}
+} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_getch.c b/src/kernel/syscall/actions/sys_getch.c
index 91ccda7..3ce1f8c 100644
--- a/src/kernel/syscall/actions/sys_getch.c
+++ b/src/kernel/syscall/actions/sys_getch.c
@@ -8,4 +8,4 @@ uint32_t sys_getch()
uint32_t key = getch();
cli();
return key;
-}
+} \ No newline at end of file
diff --git a/src/kernel/syscall/actions/sys_pointers.c b/src/kernel/syscall/actions/sys_pointers.c
new file mode 100644
index 0000000..1a2d8f7
--- /dev/null
+++ b/src/kernel/syscall/actions/sys_pointers.c
@@ -0,0 +1,18 @@
+#include <stdint.h>
+#include <kernel/graphics/vesa.h>
+#include <kernel/fs/load.h>
+#include <kernel/memory/alloc.h>
+
+struct pointers {
+ uint8_t *fb;
+ struct font *font;
+};
+
+uint32_t sys_pointers()
+{
+ struct pointers *pointers = kmalloc(sizeof(struct pointers));
+ pointers->fb = fb;
+ pointers->font = font;
+
+ return pointers;
+} \ No newline at end of file
diff --git a/src/kernel/syscall/syscall.c b/src/kernel/syscall/syscall.c
index d0b2b96..af59499 100644
--- a/src/kernel/syscall/syscall.c
+++ b/src/kernel/syscall/syscall.c
@@ -12,7 +12,8 @@ uint32_t (*syscalls[])() = { [0] = (uint32_t(*)())halt_loop, // DEBUG!
[2] = (uint32_t(*)())sys_putch,
[3] = sys_getch,
[4] = sys_malloc,
- [5] = sys_free };
+ [5] = sys_free,
+ [6] = sys_pointers };
void syscall_handler(struct regs *r)
{
@@ -36,4 +37,4 @@ void syscall_handler(struct regs *r)
void syscalls_install()
{
isr_install_handler(0x80, syscall_handler);
-}
+} \ No newline at end of file
diff --git a/src/kernel/syscall/syscall.h b/src/kernel/syscall/syscall.h
index 5c21d58..b0a15c4 100644
--- a/src/kernel/syscall/syscall.h
+++ b/src/kernel/syscall/syscall.h
@@ -17,4 +17,6 @@ uint32_t sys_malloc(uint32_t count);
uint32_t sys_free(uint32_t ptr);
-#endif
+uint32_t sys_pointers();
+
+#endif \ No newline at end of file
diff --git a/src/kernel/tasks/process.c b/src/kernel/tasks/process.c
index a4c525a..d45ab50 100644
--- a/src/kernel/tasks/process.c
+++ b/src/kernel/tasks/process.c
@@ -217,6 +217,7 @@ uint32_t kexec(char *path)
proc->stdout = NULL;
proc->stderr = NULL;
process_init(proc);
+ return 0;
}
uint32_t uexec(char *path)
@@ -235,4 +236,4 @@ uint32_t uexec(char *path)
proc->gid = current_proc->pid;
process_spawn(proc);
return 0;
-}
+} \ No newline at end of file
diff --git a/src/kernel/tasks/process.h b/src/kernel/tasks/process.h
index 5230ea4..b138f60 100644
--- a/src/kernel/tasks/process.h
+++ b/src/kernel/tasks/process.h
@@ -74,4 +74,4 @@ extern uint32_t stack_hold;
#define WAIT_ERROR (-1)
#define WAIT_OKAY 0
-#endif
+#endif \ No newline at end of file