aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/drivers/serial.c4
-rw-r--r--kernel/features/mm.c8
-rw-r--r--kernel/features/proc.c7
3 files changed, 12 insertions, 7 deletions
diff --git a/kernel/drivers/serial.c b/kernel/drivers/serial.c
index 6f00ac7..c6172a6 100644
--- a/kernel/drivers/serial.c
+++ b/kernel/drivers/serial.c
@@ -30,6 +30,6 @@ void serial_put(char ch)
void serial_print(const char *data)
{
- for (u32 i = 0; i < strlen(data); i++)
- serial_put(data[i]);
+ for (const char *p = data; p && *p; p++)
+ serial_put(*p);
}
diff --git a/kernel/features/mm.c b/kernel/features/mm.c
index a0ed280..7baa4ea 100644
--- a/kernel/features/mm.c
+++ b/kernel/features/mm.c
@@ -698,9 +698,13 @@ CLEAR void memory_install(struct mem_info *mem_info, struct vid_info *vid_info)
memory_map_identity(&kernel_dir, kernel_ro_memory_range(), MEMORY_READONLY);
memory_map_identity(&kernel_dir, kernel_rw_memory_range(), MEMORY_NONE);
- // Map kernel stack
- memory_map_identity(&kernel_dir, memory_range_around(STACK_START - STACK_SIZE, STACK_SIZE),
+ // Map kernel stack with readonly boundaries (stack grows downwards!)
+ memory_map_identity(&kernel_dir, memory_range(STACK_START - STACK_SIZE, STACK_SIZE),
MEMORY_NONE);
+ memory_map_identity(&kernel_dir,
+ memory_range(STACK_START - STACK_SIZE - PAGE_SIZE, PAGE_SIZE),
+ MEMORY_READONLY);
+ memory_map_identity(&kernel_dir, memory_range(STACK_START, PAGE_SIZE), MEMORY_READONLY);
// Map framebuffer
memory_map_identity(&kernel_dir, memory_range_around((u32)vid_info->vbe, 0x1000),
diff --git a/kernel/features/proc.c b/kernel/features/proc.c
index 0cca50f..f547193 100644
--- a/kernel/features/proc.c
+++ b/kernel/features/proc.c
@@ -65,13 +65,13 @@ void proc_print(void)
struct node *node = proc_list_running->head;
struct proc *proc = NULL;
- printf("--- PROCESSES ---\n");
+ print("--- PROCESSES ---\n");
while (node && (proc = node->data)) {
printf("Process %d: %s [%s]\n", proc->pid, proc->name,
proc->state == PROC_RUNNING ? "RUNNING" : "SLEEPING");
node = node->next;
}
- printf("\n");
+ print("\n");
}
struct proc *proc_current(void)
@@ -355,6 +355,8 @@ struct procfs_message {
static res procfs_write(const char *path, void *buf, u32 offset, u32 count, struct device *dev)
{
+ UNUSED(offset);
+
u32 pid = 0;
procfs_parse_path(&path, &pid);
if (pid) {
@@ -395,7 +397,6 @@ static res procfs_write(const char *path, void *buf, u32 offset, u32 count, stru
}
}
- printf("ERR: %s - off: %d, cnt: %d, buf: %x, dev %x\n", path, offset, count, buf, dev);
return -ENOENT;
}