:: commit 1b80c8ca90443dc7e36f3dd4a83347779e2426b2

mintsuki <mintsuki@protonmail.com> — 2020-03-25 04:19

parents: f762a0c7a3

Misc stuff

diff --git a/src/fs/echfs.c b/src/fs/echfs.c
index 95758a09..99f719f6 100644
--- a/src/fs/echfs.c
+++ b/src/fs/echfs.c
@@ -16,7 +16,7 @@ struct echfs_identity_table {
 #define END_OF_CHAIN (~((uint64_t)0))
 #define FILE_TYPE    0
 
-#define CACHE_ADDR   ((uint8_t *)(0x1000000))
+#define CACHE_ADDR   ((uint8_t *)(0x20000))
 
 static int cache_block(struct echfs_file_handle *file, uint64_t block) {
     // Load the file.
diff --git a/src/lib/elf.c b/src/lib/elf.c
index f2f47ed3..89e388b9 100644
--- a/src/lib/elf.c
+++ b/src/lib/elf.c
@@ -1,6 +1,5 @@
 #include <stdint.h>
 #include <stddef.h>
-#include <stdbool.h>
 #include <lib/blib.h>
 #include <lib/libc.h>
 #include <lib/elf.h>
@@ -50,8 +49,6 @@ struct elf_phdr {
 #define FIXED_HIGHER_HALF_OFFSET ((uint64_t)0xffffffff80000000)
 
 int elf_load(struct echfs_file_handle *fd) {
-    bool elf_higher_half = false;
-
     struct elf_hdr hdr;
     echfs_read(fd, &hdr, 0, sizeof(struct elf_hdr));
 
@@ -78,11 +75,8 @@ int elf_load(struct echfs_file_handle *fd) {
         if (phdr.p_type != PT_LOAD)
             continue;
 
-        if (phdr.p_vaddr & (1ull << 63)) {
-            print("elf: This is a higher half kernel!\n");
-            elf_higher_half = true;
+        if (phdr.p_vaddr & (1ull << 63))
             phdr.p_vaddr -= FIXED_HIGHER_HALF_OFFSET;
-        }
 
         echfs_read(fd, (void *)(uint32_t)phdr.p_vaddr,
                    phdr.p_offset, phdr.p_filesz);
diff --git a/test/test.asm b/test/test.asm
index 68ce5412..e51b3611 100644
--- a/test/test.asm
+++ b/test/test.asm
@@ -9,5 +9,10 @@ section .text
 
 global _start
 _start:
-    mov rax, 0xcafebabedeadbeef
+    mov rax, 'h e l l '
+    mov rbx, 'o   w o '
+    mov rcx, 'r l d   '
+    mov [0xb8000], rax
+    mov [0xb8008], rbx
+    mov [0xb8010], rcx
     jmp $
tab: 248 wrap: offon