diff --git a/Lilu/Headers/kern_util.hpp b/Lilu/Headers/kern_util.hpp index cbc21819..4e9f18d5 100644 --- a/Lilu/Headers/kern_util.hpp +++ b/Lilu/Headers/kern_util.hpp @@ -263,7 +263,7 @@ extern proc_t kernproc; * * @param format formatted string */ -EXPORT extern "C" void lilu_os_log(const char *format, ...); +EXPORT extern "C" void lilu_os_log(const char *format, ...) __printflike(1, 2); /** * Two-way substring search diff --git a/Lilu/Sources/kern_compression.cpp b/Lilu/Sources/kern_compression.cpp index 0a66c0e7..4cc85331 100644 --- a/Lilu/Sources/kern_compression.cpp +++ b/Lilu/Sources/kern_compression.cpp @@ -417,7 +417,7 @@ static uint8_t *decompressInternal(uint32_t compression, uint32_t *dstlen, const if (!buffer) Buffer::deleter(decompressedBuf); } else { - SYSLOG("comp", "failed to allocate memory for decompression buffer of %u", dstlen); + SYSLOG("comp", "failed to allocate memory for decompression buffer of %u", *dstlen); } return 0; diff --git a/Lilu/Sources/kern_mach.cpp b/Lilu/Sources/kern_mach.cpp index 621161c9..74c65aaa 100644 --- a/Lilu/Sources/kern_mach.cpp +++ b/Lilu/Sources/kern_mach.cpp @@ -362,7 +362,7 @@ mach_vm_address_t MachInfo::solveSymbol(const char *symbol) { // find if symbol matches if (reinterpret_cast(symbolStr + symlen) <= endaddr && (nlist->n_type & N_STAB) == 0 && !strncmp(symbol, symbolStr, symlen)) { DBGLOG("mach", "found symbol %s at 0x%llx (non-aslr 0x%llx), type %x, sect %x, desc %x", symbol, nlist->n_value + kaslr_slide, - nlist->n_value, nlist->n_type, nlist->n_sect, nlist->n_desc); + (uint64_t)nlist->n_value, nlist->n_type, nlist->n_sect, nlist->n_desc); // the symbol values are without kernel ASLR so we need to add it return nlist->n_value + kaslr_slide; } @@ -482,7 +482,7 @@ kern_return_t MachInfo::readSymbols(vnode_t vnode, vfs_context_t ctxt) { // on 32-bit MH_OBJECT, symbols are not contained within a segment sym_buf = Buffer::create(sym_size); if (!sym_buf) { - SYSLOG("mach", "Could not allocate enough memory (%lld) for symbols", sym_size); + SYSLOG("mach", "Could not allocate enough memory (%zu) for symbols", sym_size); return KERN_FAILURE; } @@ -492,7 +492,7 @@ kern_return_t MachInfo::readSymbols(vnode_t vnode, vfs_context_t ctxt) { lilu_os_memcpy(sym_buf, file_buf + sym_fileoff, sym_size); return KERN_SUCCESS; } - SYSLOG("mach", "requested linkedit (%llu %llu) exceeds file buf size (%u)", sym_fileoff, sym_size, file_buf_size); + SYSLOG("mach", "requested linkedit (%llu %zu) exceeds file buf size (%u)", sym_fileoff, sym_size, file_buf_size); } else #endif /* LILU_COMPRESSION_SUPPORT */ { @@ -593,14 +593,14 @@ void MachInfo::findSectionBounds(void *ptr, size_t sourceSize, vm_address_t &vms if (!strncmp(sect->sectname, sectionName, sizeof(sect->sectname))) { auto sptr = static_cast(ptr) + sect->offset; if (sptr + sect->size > endaddr) { - SYSLOG("mach", "found section %s size %u in segment %lu is invalid", sectionName, sno, vmsegment); + SYSLOG("mach", "found section %s size %u in segment %llu is invalid", sectionName, sno, (uint64_t)vmsegment); return; } vmsegment = scmd->vmaddr; vmsection = sect->addr; sectionptr = sptr; sectionSize = static_cast(sect->size); - DBGLOG("mach", "found section %s size %u in segment %lu", sectionName, sno, vmsegment); + DBGLOG("mach", "found section %s size %u in segment %llu", sectionName, sno, (uint64_t)vmsegment); return; } @@ -622,14 +622,14 @@ void MachInfo::findSectionBounds(void *ptr, size_t sourceSize, vm_address_t &vms if (!strncmp(sect->sectname, sectionName, sizeof(sect->sectname))) { auto sptr = static_cast(ptr) + sect->offset; if (sptr + sect->size > endaddr) { - SYSLOG("mach", "found section %s size %u in segment %lu is invalid", sectionName, sno, vmsegment); + SYSLOG("mach", "found section %s size %u in segment %llu is invalid", sectionName, sno, (uint64_t)vmsegment); return; } vmsegment = (vm_address_t)scmd->vmaddr; vmsection = (vm_address_t)sect->addr; sectionptr = sptr; sectionSize = static_cast(sect->size); - DBGLOG("mach", "found section %s size %u in segment %lu", sectionName, sno, vmsegment); + DBGLOG("mach", "found section %s size %u in segment %llu", sectionName, sno, (uint64_t)vmsegment); return; } diff --git a/Lilu/Sources/kern_user.cpp b/Lilu/Sources/kern_user.cpp index 58eea8a4..695b9f1f 100644 --- a/Lilu/Sources/kern_user.cpp +++ b/Lilu/Sources/kern_user.cpp @@ -651,7 +651,7 @@ void UserPatcher::patchSharedCache(vm_map_t taskPort, uint32_t slide, cpu_type_t } if (modStart && modEnd && offNum && patch.cpu == cpu) { - DBGLOG("user", "patch for %s in %lX %lX", mod->path, modStart, modEnd); + DBGLOG("user", "patch for %s in %llX %llX", mod->path, (uint64_t)modStart, (uint64_t)modEnd); auto tmp = Buffer::create(patch.size); if (tmp) { for (size_t k = 0; k < offNum; k++) { @@ -860,7 +860,7 @@ bool UserPatcher::loadFilesForPatching() { MachInfo::findSectionBounds(buf, fileSize, vmsegment, vmsection, sectionptr, size, fileSegments[patch.segment], fileSections[patch.segment], patch.cpu); - DBGLOG("user", "findSectionBounds returned vmsegment %lX vmsection %lX sectionptr %p size %lu", vmsegment, vmsection, sectionptr, size); + DBGLOG("user", "findSectionBounds returned vmsegment %llX vmsection %llX sectionptr %p size %lu", (uint64_t)vmsegment, (uint64_t)vmsection, sectionptr, size); if (size) { uint8_t *start = reinterpret_cast(sectionptr); @@ -881,7 +881,7 @@ bool UserPatcher::loadFilesForPatching() { off_t valueOff = reinterpret_cast(start - pageOff - reinterpret_cast(sectionptr)); off_t segOff = vmsection-vmsegment+sectOff; - DBGLOG("user", "using it off %llX pageOff %llX new %lX segOff %llX", sectOff, pageOff, vmpage, segOff); + DBGLOG("user", "using it off %llX pageOff %llX new %llX segOff %llX", sectOff, (uint64_t)pageOff, (uint64_t)vmpage, segOff); // We need binary entry, i.e. the page our patch belong to LookupStorage *entry = nullptr;