git: kernel: Provide __udivti3() for intermediate 128-bit calculations.

Sascha Wildner swildner at
Mon Sep 21 05:58:38 PDT 2020

commit 85f00d18bcc1ab1d11df7193b597e70a43e0896d
Author: Sascha Wildner <saw at>
Date:   Mon Sep 21 14:58:31 2020 +0200

    kernel: Provide __udivti3() for intermediate 128-bit calculations.
    The recent refactoring of sysclock_t from 32 to 64 bits added -lgcc
    to the kernel for this purpose but this approach has a number of
    * It prevents the kernel from linking with clang that does these
      things differently.
    * We don't generally want to link the kernel against any userspace
      libraries. Even less if these are GPL licensed libraries.
    So the best solution is to provide __udivti3() in the kernel, too.
    The code of the __udivmodti4() function (of which __udivti3() is a
    special case) was taken from an older LLVM/clang C runtime library
    and is MIT licensed. I've added the (dual-)license and list of
    The commit also adds kernel specific _uint128_t and _int128_t
    types. The choice of names is deliberate, in order to avoid
    conflicting with internal types provided by compilers.
    In-discussion-with: zrj

Summary of changes:
 sys/conf/                 |   4 +-
 sys/cpu/x86_64/include/stdint.h      |   6 +
 sys/platform/pc64/conf/files         |   1 +
 sys/platform/pc64/x86_64/__udivti3.c | 318 +++++++++++++++++++++++++++++++++++
 sys/sys/systm.h                      |   9 +-
 5 files changed, 331 insertions(+), 7 deletions(-)
 create mode 100644 sys/platform/pc64/x86_64/__udivti3.c

DragonFly BSD source repository

More information about the Commits mailing list