Ticket #6310: 64bit_safe_kernel.patch

File 64bit_safe_kernel.patch, 8.7 KB (added by mmlr, 9 years ago)
  • src/system/kernel/debug/debug.cpp

     
    14051405        "Welcome to syslog debug output!\nHaiku revision: %lu\n",
    14061406        get_haiku_revision());
    14071407    syslog_write(revisionBuffer,
    1408         std::min(length, (ssize_t)sizeof(revisionBuffer) - 1), false);
     1408        std::min((ssize_t)length, (ssize_t)sizeof(revisionBuffer) - 1), false);
    14091409
    14101410    add_debugger_command_etc("syslog", &cmd_dump_syslog,
    14111411        "Dumps the syslog buffer.",
     
    19621962        return B_BAD_ADDRESS;
    19631963
    19641964    // limit size to avoid address overflows
    1965     size_t maxSize = std::min(size,
     1965    size_t maxSize = std::min((addr_t)size,
    19661966        ~(addr_t)0 - std::max((addr_t)from, (addr_t)to) + 1);
    19671967        // NOTE: Since strlcpy() determines the length of \a from, the source
    19681968        // address might still overflow.
  • src/system/kernel/device_manager/IOCache.cpp

     
    242242        off_t lineOffset = (offset >> fLineSizeShift) << fLineSizeShift;
    243243
    244244        // intersection of request and cache line
    245         off_t cacheLineEnd = std::min(lineOffset + fLineSize, fDeviceCapacity);
     245        off_t cacheLineEnd = std::min(lineOffset + (off_t)fLineSize, fDeviceCapacity);
    246246        size_t requestLineLength
    247247            = std::min(cacheLineEnd - offset, (off_t)length);
    248248
  • src/system/kernel/device_manager/legacy_drivers.cpp

     
    13741374            status = add_driver(imagePath.Path(), image->id);
    13751375        if (status != B_OK) {
    13761376            dprintf("legacy_driver_add_preloaded: Failed to add \"%s\": %s\n",
    1377                 image->name, strerror(status));
     1377                (char *)image->name, strerror(status));
    13781378            unload_kernel_add_on(image->id);
    13791379        }
    13801380    }
  • src/system/kernel/lib/kernel_vsprintf.cpp

     
    407407                }
    408408
    409409                outBuffer.PutString("0x", 2);
    410                 number(outBuffer, (uint32)va_arg(args, void *), 16, fieldWidth,
     410                number(outBuffer, (addr_t)va_arg(args, void *), 16, fieldWidth,
    411411                    precision, flags);
    412412                continue;
    413413
  • src/system/kernel/module.cpp

     
    18041804    for (image = args->preloaded_images; image != NULL; image = image->next) {
    18051805        status_t status = register_preloaded_module_image(image);
    18061806        if (status != B_OK && image->is_module) {
    1807             dprintf("Could not register image \"%s\": %s\n", image->name,
     1807            dprintf("Could not register image \"%s\": %s\n", (char *)image->name,
    18081808                strerror(status));
    18091809        }
    18101810    }
  • src/system/kernel/fs/vfs.cpp

     
    320320static void query_free_fd(struct file_descriptor* descriptor);
    321321static status_t query_close(struct file_descriptor* descriptor);
    322322
    323 static status_t common_ioctl(struct file_descriptor* descriptor, uint32 op,
     323static status_t common_ioctl(struct file_descriptor* descriptor, ulong op,
    324324    void* buffer, size_t length);
    325325static status_t common_read_stat(struct file_descriptor* descriptor,
    326326    struct stat* statData);
     
    58375837
    58385838
    58395839static status_t
    5840 common_ioctl(struct file_descriptor* descriptor, uint32 op, void* buffer,
     5840common_ioctl(struct file_descriptor* descriptor, ulong op, void* buffer,
    58415841    size_t length)
    58425842{
    58435843    struct vnode* vnode = descriptor->u.vnode;
  • src/system/kernel/fs/socket.cpp

     
    243243
    244244
    245245static status_t
    246 socket_ioctl(struct file_descriptor *descriptor, uint32 op, void *buffer,
     246socket_ioctl(struct file_descriptor *descriptor, ulong op, void *buffer,
    247247    size_t length)
    248248{
    249249    return sStackInterface->ioctl(descriptor->u.socket, op, buffer, length);
  • src/system/kernel/fs/vfs_request_io.cpp

     
    152152
    153153    // get the next file vecs
    154154    file_io_vec vecs[kMaxSubRequests];
    155     uint32 vecCount = kMaxSubRequests;
     155    size_t vecCount = kMaxSubRequests;
    156156    status_t error = cookie->get_vecs(cookie->cookie, request, requestOffset,
    157157        requestLength, vecs, &vecCount);
    158158    if (error != B_OK && error != B_BUFFER_OVERFLOW)
     
    270270
    271271        while (error == B_OK && vecLength > 0) {
    272272            file_io_vec fileVecs[8];
    273             uint32 fileVecCount = 8;
     273            size_t fileVecCount = 8;
    274274            error = getVecs(cookie, request, offset, vecLength, fileVecs,
    275275                &fileVecCount);
    276276            if (error != B_OK || fileVecCount == 0)
  • src/system/kernel/messaging/KMessage.cpp

     
    5353static inline void*
    5454_Align(void* address, int32 offset = 0)
    5555{
    56     return (void*)(((uint32)address + offset + 3) & ~0x3);
     56    return (void*)(((addr_t)address + (addr_t)offset + 3) & ~0x3);
    5757}
    5858
    5959
  • src/system/kernel/smp.cpp

     
    12421242    cpu_status state = disable_interrupts();
    12431243
    12441244    if (smp_get_num_cpus() > 1) {
    1245         smp_send_broadcast_ici(SMP_MSG_CALL_FUNCTION, (uint32)cookie,
     1245        smp_send_broadcast_ici(SMP_MSG_CALL_FUNCTION, (addr_t)cookie,
    12461246            0, 0, (void *)func, SMP_MSG_FLAG_ASYNC);
    12471247    }
    12481248
     
    12641264    cpu_status state = disable_interrupts();
    12651265
    12661266    if (smp_get_num_cpus() > 1) {
    1267         smp_send_broadcast_ici(SMP_MSG_CALL_FUNCTION, (uint32)cookie,
     1267        smp_send_broadcast_ici(SMP_MSG_CALL_FUNCTION, (addr_t)cookie,
    12681268            0, 0, (void *)func, SMP_MSG_FLAG_SYNC);
    12691269    }
    12701270
  • src/system/kernel/vm/vm.cpp

     
    35093509        // If the address is no kernel address, we just skip it. The
    35103510        // architecture specific code has to deal with it.
    35113511        if (!IS_KERNEL_ADDRESS(address)) {
    3512             dprintf("reserve_boot_loader_ranges(): Skipping range: %p, %lu\n",
     3512            dprintf("reserve_boot_loader_ranges(): Skipping range: %p, %llu\n",
    35133513                address, args->virtual_allocated_range[i].size);
    35143514            continue;
    35153515        }
     
    49384938        return B_BAD_ADDRESS;
    49394939
    49404940    // limit size to avoid address overflows
    4941     size_t maxSize = std::min(size,
     4941    size_t maxSize = std::min((addr_t)size,
    49424942        ~(addr_t)0 - std::max((addr_t)from, (addr_t)to) + 1);
    49434943        // NOTE: Since arch_cpu_user_strlcpy() determines the length of \a from,
    49444944        // the source address might still overflow.
  • src/system/kernel/elf.cpp

     
    7272image_hash(void *_image, const void *_key, uint32 range)
    7373{
    7474    struct elf_image_info *image = (struct elf_image_info *)_image;
    75     image_id id = (image_id)_key;
     75    addr_t id = (addr_t)_key;
    7676
    7777    if (image != NULL)
    7878        return image->id % range;
    7979
    80     return (uint32)id % range;
     80    return (addr_t)id % range;
    8181}
    8282
    8383
     
    8686image_compare(void *_image, const void *_key)
    8787{
    8888    struct elf_image_info *image = (struct elf_image_info *)_image;
    89     image_id id = (image_id)_key;
     89    addr_t id = (addr_t)_key;
    9090
    9191    return id - image->id;
    9292}
     
    18711871
    18721872            // clean garbage brought by mmap (the region behind the file,
    18731873            // at least parts of it are the bss and have to be zeroed)
    1874             uint32 start = (uint32)regionAddress
     1874            addr_t start = (addr_t)regionAddress
    18751875                + (programHeaders[i].p_vaddr % B_PAGE_SIZE)
    18761876                + programHeaders[i].p_filesz;
    18771877            uint32 amount = fileUpperBound