diff options
author | dzwdz | 2022-07-21 15:25:33 +0200 |
---|---|---|
committer | dzwdz | 2022-07-21 15:25:33 +0200 |
commit | 6cd59ad0124d8a22e8cbb77f87e8f0aa20633c59 (patch) | |
tree | dc1942a47f1c9ca96e9724a8b7ab69d6afd9025b /src | |
parent | bc49ea97bb61bbe55af3e847a88a649d04a93777 (diff) |
fix type-related compiler warnings
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/arch/amd64/driver/fsroot.c | 2 | ||||
-rw-r--r-- | src/kernel/arch/amd64/pagedir.c | 2 | ||||
-rw-r--r-- | src/usertestelf.c | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/kernel/arch/amd64/driver/fsroot.c b/src/kernel/arch/amd64/driver/fsroot.c index 5e48638..d6e943f 100644 --- a/src/kernel/arch/amd64/driver/fsroot.c +++ b/src/kernel/arch/amd64/driver/fsroot.c @@ -56,7 +56,7 @@ static int req_readcopy(struct vfs_request *req, const void *buf, size_t len) { static int handle(struct vfs_request *req) { assert(req->caller); - int id = (int)(long)req->id; + int id = (int)(long __force)req->id; switch (req->type) { case VFSOP_OPEN: if (exacteq(req, "/")) return HANDLE_ROOT; diff --git a/src/kernel/arch/amd64/pagedir.c b/src/kernel/arch/amd64/pagedir.c index f4fbc09..75c9746 100644 --- a/src/kernel/arch/amd64/pagedir.c +++ b/src/kernel/arch/amd64/pagedir.c @@ -23,7 +23,7 @@ static bool addr_canonical(const __user void *addr) { /* the types here are idiotic because C is idiotic */ static __user void *addr_canonize(const __user void *addr) { - union virt_addr v = {.full = (void __force*)addr}; + union virt_addr v = {.full = (void __user*)addr}; v.sign = (((uintptr_t)addr >> 47) & 1) * 0xFFFF; assert(addr_canonical(addr)); return v.full; diff --git a/src/usertestelf.c b/src/usertestelf.c index 54a397c..218f684 100644 --- a/src/usertestelf.c +++ b/src/usertestelf.c @@ -8,7 +8,7 @@ __attribute__((visibility("hidden"))) extern struct Elf64_Dyn _DYNAMIC[]; __attribute__((visibility("hidden"))) -extern char _image_base; +extern char _image_base[]; static void printf_backend(void *arg, const char *buf, size_t len) { (void)arg; @@ -45,12 +45,12 @@ static void reloc(void) { size_t relasz = dyn_gettag(DT_RELASZ)->d_val; size_t relaent = dyn_gettag(DT_RELAENT)->d_val; for (size_t o = 0; o < relasz; o += relaent) { - struct Elf64_Rela *r = &_image_base + rela_tag->d_ptr + o; - uintptr_t *target = &_image_base + r->r_offset; + struct Elf64_Rela *r = (void*)_image_base + rela_tag->d_ptr + o; + uintptr_t *target = (void*)_image_base + r->r_offset; switch (ELF64_R_TYPE(r->r_info)) { case R_X86_64_RELATIVE: - *target = &_image_base + r->r_addend; + *target = (uintptr_t)&_image_base + r->r_addend; break; default: printf("elf: unsupported relocation type\n"); |