├── .devcontainer ├── Dockerfile ├── devcontainer.json └── setup.sh ├── .editorconfig ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ └── bug.yaml ├── copilot-instructions.md ├── dependabot.yml ├── release.yml └── workflows │ ├── Benchmarks.yml │ ├── CargoAudit.yml │ ├── CargoPublish.yml │ ├── CleanUpReleasesAndPackages.yml │ ├── CreateDevcontainerImage.yml │ ├── CreateRelease.yml │ ├── CreateReleaseBranch.yml │ ├── Fuzzing.yml │ ├── IssueLabelChecker.yml │ ├── PRLabelChecker.yml │ ├── README.md │ ├── ValidatePullRequest.yml │ ├── auto-merge-dependabot.yml │ ├── copilot-setup-steps.yml │ ├── dep_build_guest_binaries.yml │ ├── dep_fuzzing.yml │ └── dep_rust.yml ├── .gitignore ├── .vscode └── settings.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── Justfile ├── LICENSE.txt ├── MAINTAINERS.md ├── NOTICE.txt ├── README.md ├── SECURITY.md ├── SUPPORT.md ├── c.just ├── dev ├── auto-approve-dependabot.sh ├── check-license-headers.sh ├── clean-github-artifacts.sh ├── extract-changelog.sh ├── sync-project-board.sh ├── verify-msrv.sh └── verify-version.sh ├── docs ├── README.md ├── assets │ ├── hyperlight-logo.png │ ├── hyperlight-logo.xcf │ ├── hyperlight_arch.excalidraw │ ├── hyperlight_arch.png │ ├── hyperlight_guest_to_host_boundary.png │ └── linear-address-translation.png ├── benchmarking-hyperlight.md ├── github-labels.md ├── glossary.md ├── how-to-build-a-hyperlight-guest-binary.md ├── how-to-debug-a-hyperlight-guest.md ├── how-to-make-releases.md ├── how-to-use-flatbuffers.md ├── hyperlight-execution-details.md ├── hyperlight-metrics-logs-and-traces.md ├── hyperlight-surrogate-development-notes.md ├── paging-development-notes.md ├── security-guidance-for-developers.md ├── security.md ├── signal-handlers-development-notes.md └── technical-requirements-document.md ├── fuzz ├── .gitignore ├── Cargo.toml ├── README.md ├── doc-assets │ └── image.png └── fuzz_targets │ ├── guest_call.rs │ ├── host_call.rs │ └── host_print.rs ├── hack └── rust-dependabot-patch.Dockerfile ├── proposals ├── 0000-hip-process │ └── README.md ├── NNNN-hip-template │ └── README.md └── README.md ├── rust-toolchain.toml ├── rustfmt.toml ├── src ├── hyperlight_common │ ├── Cargo.toml │ └── src │ │ ├── clippy.toml │ │ ├── flatbuffer_wrappers │ │ ├── function_call.rs │ │ ├── function_types.rs │ │ ├── guest_error.rs │ │ ├── guest_log_data.rs │ │ ├── guest_log_level.rs │ │ ├── mod.rs │ │ └── util.rs │ │ ├── flatbuffers │ │ ├── hyperlight │ │ │ └── generated │ │ │ │ ├── error_code_generated.rs │ │ │ │ ├── function_call_generated.rs │ │ │ │ ├── function_call_result_generated.rs │ │ │ │ ├── function_call_type_generated.rs │ │ │ │ ├── guest_error_generated.rs │ │ │ │ ├── guest_log_data_generated.rs │ │ │ │ ├── hlbool_generated.rs │ │ │ │ ├── hldouble_generated.rs │ │ │ │ ├── hlfloat_generated.rs │ │ │ │ ├── hlint_generated.rs │ │ │ │ ├── hllong_generated.rs │ │ │ │ ├── hlsizeprefixedbuffer_generated.rs │ │ │ │ ├── hlstring_generated.rs │ │ │ │ ├── hluint_generated.rs │ │ │ │ ├── hlulong_generated.rs │ │ │ │ ├── hlvecbytes_generated.rs │ │ │ │ ├── hlvoid_generated.rs │ │ │ │ ├── log_level_generated.rs │ │ │ │ ├── parameter_generated.rs │ │ │ │ ├── parameter_type_generated.rs │ │ │ │ ├── parameter_value_generated.rs │ │ │ │ ├── return_type_generated.rs │ │ │ │ └── return_value_generated.rs │ │ └── mod.rs │ │ ├── lib.rs │ │ ├── mem.rs │ │ ├── outb.rs │ │ └── resource.rs ├── hyperlight_component_macro │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── hyperlight_component_util │ ├── Cargo.toml │ └── src │ │ ├── component.rs │ │ ├── elaborate.rs │ │ ├── emit.rs │ │ ├── etypes.rs │ │ ├── guest.rs │ │ ├── hl.rs │ │ ├── host.rs │ │ ├── lib.rs │ │ ├── resource.rs │ │ ├── rtypes.rs │ │ ├── structure.rs │ │ ├── substitute.rs │ │ ├── subtype.rs │ │ ├── tv.rs │ │ ├── util.rs │ │ └── wf.rs ├── hyperlight_guest │ ├── Cargo.toml │ └── src │ │ ├── error.rs │ │ ├── exit.rs │ │ ├── guest_handle │ │ ├── handle.rs │ │ ├── host_comm.rs │ │ └── io.rs │ │ └── lib.rs ├── hyperlight_guest_bin │ ├── Cargo.toml │ ├── build.rs │ ├── src │ │ ├── exceptions │ │ │ ├── gdt.rs │ │ │ ├── handler.rs │ │ │ ├── idt.rs │ │ │ ├── idtr.rs │ │ │ └── interrupt_entry.rs │ │ ├── guest_err.rs │ │ ├── guest_function │ │ │ ├── call.rs │ │ │ ├── definition.rs │ │ │ └── register.rs │ │ ├── guest_logger.rs │ │ ├── host_comm.rs │ │ ├── lib.rs │ │ └── memory.rs │ └── third_party │ │ ├── README.md │ │ ├── musl │ │ ├── COPYRIGHT │ │ ├── README │ │ ├── arch │ │ │ ├── generic │ │ │ │ ├── bits │ │ │ │ │ └── errno.h │ │ │ │ └── fp_arch.h │ │ │ └── x86_64 │ │ │ │ ├── atomic_arch.h │ │ │ │ ├── bits │ │ │ │ ├── alltypes.h │ │ │ │ ├── fenv.h │ │ │ │ ├── float.h │ │ │ │ ├── io.h │ │ │ │ ├── limits.h │ │ │ │ ├── mman.h │ │ │ │ ├── posix.h │ │ │ │ ├── ptrace.h │ │ │ │ ├── reg.h │ │ │ │ ├── setjmp.h │ │ │ │ └── stdint.h │ │ │ │ └── reloc.h │ │ ├── include │ │ │ ├── alloca.h │ │ │ ├── assert.h │ │ │ ├── byteswap.h │ │ │ ├── complex.h │ │ │ ├── ctype.h │ │ │ ├── endian.h │ │ │ ├── errno.h │ │ │ ├── features.h │ │ │ ├── fenv.h │ │ │ ├── float.h │ │ │ ├── inttypes.h │ │ │ ├── libgen.h │ │ │ ├── limits.h │ │ │ ├── math.h │ │ │ ├── memory.h │ │ │ ├── setjmp.h │ │ │ ├── stdarg.h │ │ │ ├── stdbool.h │ │ │ ├── stddef.h │ │ │ ├── stdint.h │ │ │ ├── stdio.h │ │ │ ├── stdlib.h │ │ │ ├── string.h │ │ │ ├── strings.h │ │ │ ├── sys │ │ │ │ ├── select.h │ │ │ │ ├── time.h │ │ │ │ └── types.h │ │ │ ├── tar.h │ │ │ ├── time.h │ │ │ ├── wchar.h │ │ │ └── wctype.h │ │ └── src │ │ │ ├── complex │ │ │ ├── __cexp.c │ │ │ ├── __cexpf.c │ │ │ ├── cabs.c │ │ │ ├── cabsf.c │ │ │ ├── cabsl.c │ │ │ ├── cacos.c │ │ │ ├── cacosf.c │ │ │ ├── cacosh.c │ │ │ ├── cacoshf.c │ │ │ ├── cacoshl.c │ │ │ ├── cacosl.c │ │ │ ├── carg.c │ │ │ ├── cargf.c │ │ │ ├── cargl.c │ │ │ ├── casin.c │ │ │ ├── casinf.c │ │ │ ├── casinh.c │ │ │ ├── casinhf.c │ │ │ ├── casinhl.c │ │ │ ├── casinl.c │ │ │ ├── catan.c │ │ │ ├── catanf.c │ │ │ ├── catanh.c │ │ │ ├── catanhf.c │ │ │ ├── catanhl.c │ │ │ ├── catanl.c │ │ │ ├── ccos.c │ │ │ ├── ccosf.c │ │ │ ├── ccosh.c │ │ │ ├── ccoshf.c │ │ │ ├── ccoshl.c │ │ │ ├── ccosl.c │ │ │ ├── cexp.c │ │ │ ├── cexpf.c │ │ │ ├── cexpl.c │ │ │ ├── cimag.c │ │ │ ├── cimagf.c │ │ │ ├── cimagl.c │ │ │ ├── clog.c │ │ │ ├── clogf.c │ │ │ ├── clogl.c │ │ │ ├── conj.c │ │ │ ├── conjf.c │ │ │ ├── conjl.c │ │ │ ├── cpow.c │ │ │ ├── cpowf.c │ │ │ ├── cpowl.c │ │ │ ├── cproj.c │ │ │ ├── cprojf.c │ │ │ ├── cprojl.c │ │ │ ├── creal.c │ │ │ ├── crealf.c │ │ │ ├── creall.c │ │ │ ├── csin.c │ │ │ ├── csinf.c │ │ │ ├── csinh.c │ │ │ ├── csinhf.c │ │ │ ├── csinhl.c │ │ │ ├── csinl.c │ │ │ ├── csqrt.c │ │ │ ├── csqrtf.c │ │ │ ├── csqrtl.c │ │ │ ├── ctan.c │ │ │ ├── ctanf.c │ │ │ ├── ctanh.c │ │ │ ├── ctanhf.c │ │ │ ├── ctanhl.c │ │ │ └── ctanl.c │ │ │ ├── ctype │ │ │ ├── isalnum.c │ │ │ ├── isalpha.c │ │ │ ├── isdigit.c │ │ │ ├── isgraph.c │ │ │ ├── islower.c │ │ │ ├── isprint.c │ │ │ ├── isspace.c │ │ │ ├── isupper.c │ │ │ ├── isxdigit.c │ │ │ ├── tolower.c │ │ │ └── toupper.c │ │ │ ├── errno │ │ │ └── __errno_location.c │ │ │ ├── exit │ │ │ └── assert.c │ │ │ ├── fenv │ │ │ ├── __flt_rounds.c │ │ │ ├── fegetexceptflag.c │ │ │ ├── feholdexcept.c │ │ │ ├── fesetexceptflag.c │ │ │ ├── fesetround.c │ │ │ ├── feupdateenv.c │ │ │ └── x86_64 │ │ │ │ └── fenv.s │ │ │ ├── include │ │ │ ├── errno.h │ │ │ ├── features.h │ │ │ ├── stdlib.h │ │ │ ├── string.h │ │ │ ├── sys │ │ │ │ └── time.h │ │ │ └── time.h │ │ │ ├── internal │ │ │ ├── atomic.h │ │ │ ├── complex_impl.h │ │ │ ├── floatscan.c │ │ │ ├── floatscan.h │ │ │ ├── intscan.c │ │ │ ├── intscan.h │ │ │ ├── libm.h │ │ │ ├── shgetc.c │ │ │ ├── shgetc.h │ │ │ └── stdio_impl.h │ │ │ ├── math │ │ │ ├── __cos.c │ │ │ ├── __cosdf.c │ │ │ ├── __cosl.c │ │ │ ├── __expo2.c │ │ │ ├── __expo2f.c │ │ │ ├── __fpclassify.c │ │ │ ├── __fpclassifyf.c │ │ │ ├── __fpclassifyl.c │ │ │ ├── __invtrigl.c │ │ │ ├── __invtrigl.h │ │ │ ├── __math_divzero.c │ │ │ ├── __math_divzerof.c │ │ │ ├── __math_invalid.c │ │ │ ├── __math_invalidf.c │ │ │ ├── __math_invalidl.c │ │ │ ├── __math_oflow.c │ │ │ ├── __math_oflowf.c │ │ │ ├── __math_uflow.c │ │ │ ├── __math_uflowf.c │ │ │ ├── __math_xflow.c │ │ │ ├── __math_xflowf.c │ │ │ ├── __polevll.c │ │ │ ├── __rem_pio2.c │ │ │ ├── __rem_pio2_large.c │ │ │ ├── __rem_pio2f.c │ │ │ ├── __rem_pio2l.c │ │ │ ├── __signbit.c │ │ │ ├── __signbitf.c │ │ │ ├── __signbitl.c │ │ │ ├── __sin.c │ │ │ ├── __sindf.c │ │ │ ├── __sinl.c │ │ │ ├── __tan.c │ │ │ ├── __tandf.c │ │ │ ├── __tanl.c │ │ │ ├── acos.c │ │ │ ├── acosf.c │ │ │ ├── acosh.c │ │ │ ├── acoshf.c │ │ │ ├── acoshl.c │ │ │ ├── acosl.c │ │ │ ├── asin.c │ │ │ ├── asinf.c │ │ │ ├── asinh.c │ │ │ ├── asinhf.c │ │ │ ├── asinhl.c │ │ │ ├── asinl.c │ │ │ ├── atan.c │ │ │ ├── atan2.c │ │ │ ├── atan2f.c │ │ │ ├── atan2l.c │ │ │ ├── atanf.c │ │ │ ├── atanh.c │ │ │ ├── atanhf.c │ │ │ ├── atanhl.c │ │ │ ├── atanl.c │ │ │ ├── cbrt.c │ │ │ ├── cbrtf.c │ │ │ ├── cbrtl.c │ │ │ ├── ceil.c │ │ │ ├── ceilf.c │ │ │ ├── ceill.c │ │ │ ├── copysign.c │ │ │ ├── copysignf.c │ │ │ ├── copysignl.c │ │ │ ├── cos.c │ │ │ ├── cosf.c │ │ │ ├── cosh.c │ │ │ ├── coshf.c │ │ │ ├── coshl.c │ │ │ ├── cosl.c │ │ │ ├── erf.c │ │ │ ├── erff.c │ │ │ ├── erfl.c │ │ │ ├── exp.c │ │ │ ├── exp10.c │ │ │ ├── exp10f.c │ │ │ ├── exp10l.c │ │ │ ├── exp2.c │ │ │ ├── exp2f.c │ │ │ ├── exp2f_data.c │ │ │ ├── exp2f_data.h │ │ │ ├── exp2l.c │ │ │ ├── exp_data.c │ │ │ ├── exp_data.h │ │ │ ├── expf.c │ │ │ ├── expl.c │ │ │ ├── expm1.c │ │ │ ├── expm1f.c │ │ │ ├── expm1l.c │ │ │ ├── fabs.c │ │ │ ├── fabsf.c │ │ │ ├── fabsl.c │ │ │ ├── fdim.c │ │ │ ├── fdimf.c │ │ │ ├── fdiml.c │ │ │ ├── finite.c │ │ │ ├── finitef.c │ │ │ ├── floor.c │ │ │ ├── floorf.c │ │ │ ├── floorl.c │ │ │ ├── fma.c │ │ │ ├── fmaf.c │ │ │ ├── fmal.c │ │ │ ├── fmax.c │ │ │ ├── fmaxf.c │ │ │ ├── fmaxl.c │ │ │ ├── fmin.c │ │ │ ├── fminf.c │ │ │ ├── fminl.c │ │ │ ├── fmod.c │ │ │ ├── fmodf.c │ │ │ ├── fmodl.c │ │ │ ├── frexp.c │ │ │ ├── frexpf.c │ │ │ ├── frexpl.c │ │ │ ├── hypot.c │ │ │ ├── hypotf.c │ │ │ ├── hypotl.c │ │ │ ├── ilogb.c │ │ │ ├── ilogbf.c │ │ │ ├── ilogbl.c │ │ │ ├── j0.c │ │ │ ├── j0f.c │ │ │ ├── j1.c │ │ │ ├── j1f.c │ │ │ ├── jn.c │ │ │ ├── jnf.c │ │ │ ├── ldexp.c │ │ │ ├── ldexpf.c │ │ │ ├── ldexpl.c │ │ │ ├── lgamma.c │ │ │ ├── lgamma_r.c │ │ │ ├── lgammaf.c │ │ │ ├── lgammaf_r.c │ │ │ ├── lgammal.c │ │ │ ├── llrint.c │ │ │ ├── llrintf.c │ │ │ ├── llrintl.c │ │ │ ├── llround.c │ │ │ ├── llroundf.c │ │ │ ├── llroundl.c │ │ │ ├── log.c │ │ │ ├── log10.c │ │ │ ├── log10f.c │ │ │ ├── log10l.c │ │ │ ├── log1p.c │ │ │ ├── log1pf.c │ │ │ ├── log1pl.c │ │ │ ├── log2.c │ │ │ ├── log2_data.c │ │ │ ├── log2_data.h │ │ │ ├── log2f.c │ │ │ ├── log2f_data.c │ │ │ ├── log2f_data.h │ │ │ ├── log2l.c │ │ │ ├── log_data.c │ │ │ ├── log_data.h │ │ │ ├── logb.c │ │ │ ├── logbf.c │ │ │ ├── logbl.c │ │ │ ├── logf.c │ │ │ ├── logf_data.c │ │ │ ├── logf_data.h │ │ │ ├── logl.c │ │ │ ├── lrint.c │ │ │ ├── lrintf.c │ │ │ ├── lrintl.c │ │ │ ├── lround.c │ │ │ ├── lroundf.c │ │ │ ├── lroundl.c │ │ │ ├── modf.c │ │ │ ├── modff.c │ │ │ ├── modfl.c │ │ │ ├── nan.c │ │ │ ├── nanf.c │ │ │ ├── nanl.c │ │ │ ├── nearbyint.c │ │ │ ├── nearbyintf.c │ │ │ ├── nearbyintl.c │ │ │ ├── nextafter.c │ │ │ ├── nextafterf.c │ │ │ ├── nextafterl.c │ │ │ ├── nexttoward.c │ │ │ ├── nexttowardf.c │ │ │ ├── nexttowardl.c │ │ │ ├── pow.c │ │ │ ├── pow_data.c │ │ │ ├── pow_data.h │ │ │ ├── powf.c │ │ │ ├── powf_data.c │ │ │ ├── powf_data.h │ │ │ ├── powl.c │ │ │ ├── remainder.c │ │ │ ├── remainderf.c │ │ │ ├── remainderl.c │ │ │ ├── remquo.c │ │ │ ├── remquof.c │ │ │ ├── remquol.c │ │ │ ├── rint.c │ │ │ ├── rintf.c │ │ │ ├── rintl.c │ │ │ ├── round.c │ │ │ ├── roundf.c │ │ │ ├── roundl.c │ │ │ ├── scalb.c │ │ │ ├── scalbf.c │ │ │ ├── scalbln.c │ │ │ ├── scalblnf.c │ │ │ ├── scalblnl.c │ │ │ ├── scalbn.c │ │ │ ├── scalbnf.c │ │ │ ├── scalbnl.c │ │ │ ├── signgam.c │ │ │ ├── significand.c │ │ │ ├── significandf.c │ │ │ ├── sin.c │ │ │ ├── sincos.c │ │ │ ├── sincosf.c │ │ │ ├── sincosl.c │ │ │ ├── sinf.c │ │ │ ├── sinh.c │ │ │ ├── sinhf.c │ │ │ ├── sinhl.c │ │ │ ├── sinl.c │ │ │ ├── sqrt.c │ │ │ ├── sqrt_data.c │ │ │ ├── sqrt_data.h │ │ │ ├── sqrtf.c │ │ │ ├── sqrtl.c │ │ │ ├── tan.c │ │ │ ├── tanf.c │ │ │ ├── tanh.c │ │ │ ├── tanhf.c │ │ │ ├── tanhl.c │ │ │ ├── tanl.c │ │ │ ├── tgamma.c │ │ │ ├── tgammaf.c │ │ │ ├── tgammal.c │ │ │ ├── trunc.c │ │ │ ├── truncf.c │ │ │ ├── truncl.c │ │ │ └── x86_64 │ │ │ │ ├── __invtrigl.s │ │ │ │ ├── acosl.s │ │ │ │ ├── asinl.s │ │ │ │ ├── atan2l.s │ │ │ │ ├── atanl.s │ │ │ │ ├── ceill.s │ │ │ │ ├── exp2l.s │ │ │ │ ├── expl.s │ │ │ │ ├── expm1l.s │ │ │ │ ├── fabs.c │ │ │ │ ├── fabsf.c │ │ │ │ ├── fabsl.c │ │ │ │ ├── floorl.s │ │ │ │ ├── fma.c │ │ │ │ ├── fmaf.c │ │ │ │ ├── fmodl.c │ │ │ │ ├── llrint.c │ │ │ │ ├── llrintf.c │ │ │ │ ├── llrintl.c │ │ │ │ ├── log10l.s │ │ │ │ ├── log1pl.s │ │ │ │ ├── log2l.s │ │ │ │ ├── logl.s │ │ │ │ ├── lrint.c │ │ │ │ ├── lrintf.c │ │ │ │ ├── lrintl.c │ │ │ │ ├── remainderl.c │ │ │ │ ├── remquol.c │ │ │ │ ├── rintl.c │ │ │ │ ├── sqrt.c │ │ │ │ ├── sqrtf.c │ │ │ │ ├── sqrtl.c │ │ │ │ └── truncl.s │ │ │ ├── misc │ │ │ ├── a64l.c │ │ │ ├── basename.c │ │ │ └── dirname.c │ │ │ ├── prng │ │ │ └── rand.c │ │ │ ├── setjmp │ │ │ └── x86_64 │ │ │ │ ├── longjmp.s │ │ │ │ └── setjmp.s │ │ │ ├── stdio │ │ │ ├── __toread.c │ │ │ ├── __towrite.c │ │ │ └── __uflow.c │ │ │ ├── stdlib │ │ │ ├── abs.c │ │ │ ├── atof.c │ │ │ ├── atoi.c │ │ │ ├── atol.c │ │ │ ├── atoll.c │ │ │ ├── bsearch.c │ │ │ ├── div.c │ │ │ ├── ecvt.c │ │ │ ├── fcvt.c │ │ │ ├── gcvt.c │ │ │ ├── imaxabs.c │ │ │ ├── imaxdiv.c │ │ │ ├── labs.c │ │ │ ├── ldiv.c │ │ │ ├── llabs.c │ │ │ ├── lldiv.c │ │ │ ├── qsort.c │ │ │ ├── qsort_nr.c │ │ │ ├── strtod.c │ │ │ ├── strtol.c │ │ │ ├── wcstod.c │ │ │ └── wcstol.c │ │ │ └── string │ │ │ ├── bcmp.c │ │ │ ├── bcopy.c │ │ │ ├── bzero.c │ │ │ ├── explicit_bzero.c │ │ │ ├── index.c │ │ │ ├── memccpy.c │ │ │ ├── memchr.c │ │ │ ├── memcmp.c │ │ │ ├── memcpy.c │ │ │ ├── memmem.c │ │ │ ├── memmove.c │ │ │ ├── mempcpy.c │ │ │ ├── memrchr.c │ │ │ ├── memset.c │ │ │ ├── rindex.c │ │ │ ├── stpcpy.c │ │ │ ├── stpncpy.c │ │ │ ├── strcasecmp.c │ │ │ ├── strcasestr.c │ │ │ ├── strcat.c │ │ │ ├── strchr.c │ │ │ ├── strchrnul.c │ │ │ ├── strcmp.c │ │ │ ├── strcpy.c │ │ │ ├── strcspn.c │ │ │ ├── strdup.c │ │ │ ├── strerror_r.c │ │ │ ├── strlcat.c │ │ │ ├── strlcpy.c │ │ │ ├── strlen.c │ │ │ ├── strncasecmp.c │ │ │ ├── strncat.c │ │ │ ├── strncmp.c │ │ │ ├── strncpy.c │ │ │ ├── strndup.c │ │ │ ├── strnlen.c │ │ │ ├── strpbrk.c │ │ │ ├── strrchr.c │ │ │ ├── strsep.c │ │ │ ├── strspn.c │ │ │ ├── strstr.c │ │ │ ├── strtok.c │ │ │ ├── strtok_r.c │ │ │ ├── strverscmp.c │ │ │ ├── wcpcpy.c │ │ │ ├── wcpncpy.c │ │ │ ├── wcscasecmp.c │ │ │ ├── wcscasecmp_l.c │ │ │ ├── wcscat.c │ │ │ ├── wcschr.c │ │ │ ├── wcscmp.c │ │ │ ├── wcscpy.c │ │ │ ├── wcscspn.c │ │ │ ├── wcsdup.c │ │ │ ├── wcslen.c │ │ │ ├── wcsncasecmp.c │ │ │ ├── wcsncasecmp_l.c │ │ │ ├── wcsncat.c │ │ │ ├── wcsncmp.c │ │ │ ├── wcsncpy.c │ │ │ ├── wcsnlen.c │ │ │ ├── wcspbrk.c │ │ │ ├── wcsrchr.c │ │ │ ├── wcsspn.c │ │ │ ├── wcsstr.c │ │ │ ├── wcstok.c │ │ │ ├── wcswcs.c │ │ │ ├── wmemchr.c │ │ │ ├── wmemcmp.c │ │ │ ├── wmemcpy.c │ │ │ ├── wmemmove.c │ │ │ └── wmemset.c │ │ └── printf │ │ ├── .gitattributes │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── README.md │ │ ├── codecov.yml │ │ ├── printf.c │ │ ├── printf.h │ │ ├── printf.patch │ │ └── test │ │ ├── catch.hpp │ │ └── test_suite.cpp ├── hyperlight_guest_capi │ ├── .cargo │ │ └── config.toml │ ├── Cargo.toml │ ├── README.md │ ├── build.rs │ ├── cbindgen.toml │ ├── include │ │ └── macro.h │ └── src │ │ ├── dispatch.rs │ │ ├── error.rs │ │ ├── flatbuffer.rs │ │ ├── lib.rs │ │ ├── logging.rs │ │ ├── types.rs │ │ └── types │ │ ├── function_call.rs │ │ ├── parameter.rs │ │ └── vec.rs ├── hyperlight_host │ ├── Cargo.toml │ ├── benches │ │ └── benchmarks.rs │ ├── build.rs │ ├── clippy.toml │ ├── examples │ │ ├── func_ctx │ │ │ └── main.rs │ │ ├── guest-debugging │ │ │ └── main.rs │ │ ├── hello-world │ │ │ └── main.rs │ │ ├── logging │ │ │ └── main.rs │ │ ├── metrics │ │ │ └── main.rs │ │ ├── tracing-chrome │ │ │ ├── README.md │ │ │ └── main.rs │ │ ├── tracing-otlp │ │ │ └── main.rs │ │ ├── tracing-tracy │ │ │ ├── README.md │ │ │ ├── image.png │ │ │ └── main.rs │ │ └── tracing │ │ │ └── main.rs │ ├── scripts │ │ └── apply-kvm-perf-mitigation.sh │ ├── src │ │ ├── error.rs │ │ ├── func │ │ │ ├── call_ctx.rs │ │ │ ├── guest_err.rs │ │ │ ├── host_functions.rs │ │ │ ├── mod.rs │ │ │ ├── param_type.rs │ │ │ ├── ret_type.rs │ │ │ └── utils.rs │ │ ├── hyperlight_surrogate │ │ │ ├── Cargo.toml_temp_name │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── hypervisor │ │ │ ├── crashdump.rs │ │ │ ├── fpu.rs │ │ │ ├── gdb │ │ │ │ ├── arch.rs │ │ │ │ ├── event_loop.rs │ │ │ │ ├── kvm_debug.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── mshv_debug.rs │ │ │ │ └── x86_64_target.rs │ │ │ ├── handlers.rs │ │ │ ├── hyperv_linux.rs │ │ │ ├── hyperv_windows.rs │ │ │ ├── kvm.rs │ │ │ ├── mod.rs │ │ │ ├── surrogate_process.rs │ │ │ ├── surrogate_process_manager.rs │ │ │ ├── windows_hypervisor_platform.rs │ │ │ └── wrappers.rs │ │ ├── lib.rs │ │ ├── mem │ │ │ ├── elf.rs │ │ │ ├── exe.rs │ │ │ ├── layout.rs │ │ │ ├── memory_region.rs │ │ │ ├── mgr.rs │ │ │ ├── mod.rs │ │ │ ├── ptr.rs │ │ │ ├── ptr_addr_space.rs │ │ │ ├── ptr_offset.rs │ │ │ ├── shared_mem.rs │ │ │ ├── shared_mem_snapshot.rs │ │ │ └── shared_mem_tests.rs │ │ ├── metrics │ │ │ └── mod.rs │ │ ├── sandbox │ │ │ ├── callable.rs │ │ │ ├── config.rs │ │ │ ├── host_funcs.rs │ │ │ ├── hypervisor.rs │ │ │ ├── initialized_multi_use.rs │ │ │ ├── mem_access.rs │ │ │ ├── mem_mgr.rs │ │ │ ├── mod.rs │ │ │ ├── outb.rs │ │ │ ├── uninitialized.rs │ │ │ └── uninitialized_evolve.rs │ │ ├── sandbox_state │ │ │ ├── mod.rs │ │ │ ├── sandbox.rs │ │ │ └── transition.rs │ │ ├── seccomp │ │ │ ├── guest.rs │ │ │ └── mod.rs │ │ ├── signal_handlers │ │ │ ├── mod.rs │ │ │ └── sigsys_signal_handler.rs │ │ └── testing │ │ │ ├── log_values.rs │ │ │ └── mod.rs │ └── tests │ │ ├── common │ │ └── mod.rs │ │ ├── integration_test.rs │ │ ├── sandbox_host_tests.rs │ │ └── wit_test.rs ├── hyperlight_testing │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── logger.rs │ │ ├── simplelogger.rs │ │ └── tracing_subscriber.rs ├── schema │ ├── function_call.fbs │ ├── function_call_result.fbs │ ├── function_types.fbs │ ├── guest_error.fbs │ └── guest_log_data.fbs └── tests │ ├── c_guests │ ├── bin │ │ ├── .gitkeep │ │ ├── debug │ │ │ └── .gitkeep │ │ └── release │ │ │ └── .gitkeep │ ├── c_callbackguest │ │ └── main.c │ └── c_simpleguest │ │ └── main.c │ └── rust_guests │ ├── bin │ ├── .gitkeep │ ├── debug │ │ └── .gitkeep │ └── release │ │ └── .gitkeep │ ├── callbackguest │ ├── .cargo │ │ └── config.toml │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ │ └── main.rs │ ├── dummyguest │ ├── .cargo │ │ └── config.toml │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ │ └── main.rs │ ├── simpleguest │ ├── .cargo │ │ └── config.toml │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ │ └── main.rs │ └── witguest │ ├── .cargo │ └── config.toml │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ ├── guest.wit │ └── src │ ├── bindings.rs │ └── main.rs └── typos.toml /.devcontainer/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Change device ownership 4 | sudo chown -R $REMOTE_USER:$REMOTE_GROUP $DEVICE 5 | 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Reference: https://github.com/dotnet/roslyn/blob/main/.editorconfig 2 | # EditorConfig is awesome: https://EditorConfig.org 3 | 4 | # top-most EditorConfig file 5 | root = true 6 | [*] 7 | indent_style = space 8 | indent_size = 4 9 | insert_final_newline = true 10 | charset = utf-8 11 | 12 | # JSON files 13 | [*.json] 14 | indent_size = 2 15 | 16 | # Powershell files 17 | [*.ps1] 18 | indent_size = 2 19 | 20 | # Shell script files 21 | [*.sh] 22 | end_of_line = lf 23 | indent_size = 2 24 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Global Code Owners 2 | * @danbugs @ludfjig @dblnz @devigned @syntactically @marosset @jprendes @simongdavies 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | time: "03:00" 8 | labels: 9 | - "kind/dependencies" 10 | - package-ecosystem: "cargo" 11 | directory: "/" 12 | schedule: 13 | interval: "daily" 14 | time: "03:00" 15 | labels: 16 | - "kind/dependencies" 17 | ignore: 18 | # The way we are using 2 different versions of the mshv crates seems to break dependabot 19 | - dependency-name: "mshv-ioctls" 20 | versions: [ ">=0.2.1" ] 21 | - dependency-name: "mshv-bindings" 22 | versions: [ ">=0.2.1" ] 23 | open-pull-requests-limit: 20 24 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | # .github/release.yml 2 | 3 | changelog: 4 | categories: 5 | - title: Full Changelog (excl. dependencies) 6 | labels: 7 | - "*" 8 | exclude: 9 | labels: 10 | - kind/dependencies 11 | - title: Full Changelog (dependencies) 12 | labels: 13 | - kind/dependencies -------------------------------------------------------------------------------- /.github/workflows/CargoAudit.yml: -------------------------------------------------------------------------------- 1 | name: Audit cargo dependencies for security vulnerabilities 2 | on: 3 | schedule: 4 | - cron: "0 9 * * 1" # run at 9am every Monday 5 | workflow_dispatch: # allow manual triggering 6 | 7 | permissions: 8 | issues: write # Creates issues for any vulnerabilities found 9 | contents: read 10 | checks: write # Needs to create check 11 | 12 | jobs: 13 | audit: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v4 17 | 18 | # We are not using the common workflow here because it installs a bunch of tools we don't need. 19 | # TODO: Once the runner image is updated to include the necessary tools (without downloading), we can switch to the common workflow. 20 | - uses: dtolnay/rust-toolchain@master 21 | with: 22 | toolchain: "1.85" 23 | 24 | - uses: rustsec/audit-check@v2.0.0 25 | with: 26 | token: ${{ secrets.GITHUB_TOKEN }} 27 | -------------------------------------------------------------------------------- /.github/workflows/CreateReleaseBranch.yml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json 2 | 3 | # When a new Tag with the prefix v is pushed to the repository, this workflow will create a new release branch called release/. 4 | 5 | name: Create a Release Branch 6 | 7 | on: 8 | push: 9 | tags: 10 | - "v*" 11 | 12 | permissions: 13 | contents: write # needed to push the new branch 14 | 15 | jobs: 16 | create-branch: 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - uses: actions/checkout@v4 21 | 22 | - name: Create Release Branch 23 | run: | 24 | git checkout -b release/${GITHUB_REF_NAME} 25 | git push --set-upstream origin release/${GITHUB_REF_NAME} 26 | shell: bash 27 | -------------------------------------------------------------------------------- /.github/workflows/Fuzzing.yml: -------------------------------------------------------------------------------- 1 | name: Fuzzing Workflow 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * 0' # Runs at 00:00 every Sunday 6 | workflow_dispatch: # Allow manual triggering 7 | 8 | permissions: 9 | id-token: write 10 | contents: read 11 | 12 | jobs: 13 | fuzzing: 14 | uses: ./.github/workflows/dep_fuzzing.yml 15 | with: 16 | targets: '["fuzz_host_print", "fuzz_guest_call", "fuzz_host_call"]' # Pass as a JSON array 17 | max_total_time: 18000 # 5 hours in seconds 18 | secrets: inherit -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.linkedProjects": [ 3 | "Cargo.toml", 4 | // guest crates for testing, not part of the workspace 5 | "src/tests/rust_guests/simpleguest/Cargo.toml", 6 | "src/tests/rust_guests/callbackguest/Cargo.toml" 7 | ] 8 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # CNCF Code of Conduct 2 | 3 | This project has adopted the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md). 4 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | # Current Maintainers 2 | 3 | | Name | GitHub ID | 4 | |--------------------|----------------------------------------------------| 5 | | Danilo Chiarlone | [@danbugs](https://github.com/danbugs) | 6 | | David Justice | [@devigned](https://github.com/devigned) | 7 | | Doru Blânzeanu | [@dblnz](https://github.com/dblnz) | 8 | | Jorge Prendes | [@jprendes](https://github.com/jprendes) | 9 | | Lucy Menon | [@syntactically](https://github.com/syntactically) | 10 | | Ludvig Liljenberg | [@ludfjig](https://github.com/ludfjig) | 11 | | Mark Rosetti | [@marosset](https://github.com/marosset) | 12 | | Simon Davies | [@simongdavies](https://github.com/simongdavies) | 13 | | Tomasz Andrzejak | [@andreiltd](https://github.com/andreiltd) | 14 | 15 | 16 | -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | # Support 2 | 3 | ## How to file issues and get help 4 | 5 | This project uses GitHub Issues to track bugs and feature requests. Please search the existing 6 | issues before filing new issues to avoid duplicates. For new issues, file your bug or 7 | feature request as a new Issue. 8 | 9 | [//]: <> (For help and questions about using this project, please use Slack channel [TODO: add Slack channel]) 10 | 11 | ## Microsoft Support Policy 12 | 13 | Support for this **Hyperlight** is limited to the resources listed above. 14 | -------------------------------------------------------------------------------- /dev/extract-changelog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -Eeuo pipefail 3 | 4 | # Inspired by https://stackoverflow.com/questions/40450238/parse-a-changelog-and-extract-changes-for-a-version 5 | # This script will extract the changelog for a specific version from the CHANGELOG.md file 6 | # Usage: ./extract-changelog.sh , for example ./extract-changelog.sh v0.2.0 7 | 8 | if [[ $# -lt 1 ]]; then 9 | echo "Usage: $0 " 10 | echo " Example: $0 v0.2.0" 11 | echo " Example: $0 Prerelease" 12 | exit 1 13 | fi 14 | 15 | version=$1 16 | 17 | awk -v ver="$version" ' 18 | /^## \[.*\]/ { 19 | if (p) exit 20 | if ($0 ~ "^## \\[" ver "\\]") { p=1; next } 21 | } 22 | p' CHANGELOG.md -------------------------------------------------------------------------------- /dev/verify-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -Eeuo pipefail 3 | cargo install -q jaq 4 | 5 | EXPECTED="$1" 6 | EXPECTED="${EXPECTED#refs/heads/release/}" 7 | EXPECTED="${EXPECTED#v}" 8 | shift 9 | 10 | for CRATE in "$@"; do 11 | VERSION=$(cargo metadata --format-version=1 2>/dev/null | jaq --raw-output '.packages[] | select(.name == "'$CRATE'").version') 12 | if [ "$VERSION" == "$EXPECTED" ] || [ "" == "$EXPECTED" ]; then 13 | echo -e " \u001b[1;32m✓\u001b[0m Crate \u001b[1m$CRATE\u001b[0m version is \u001b[1m$VERSION\u001b[0m" 14 | else 15 | echo -e " \u001b[1;31m✗\u001b[0m Crate \u001b[1m$CRATE\u001b[0m version is \u001b[1m$VERSION\u001b[0m, expected \u001b[1m$EXPECTED\u001b[0m" 16 | exit 1 17 | fi 18 | done 19 | -------------------------------------------------------------------------------- /docs/assets/hyperlight-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/docs/assets/hyperlight-logo.png -------------------------------------------------------------------------------- /docs/assets/hyperlight-logo.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/docs/assets/hyperlight-logo.xcf -------------------------------------------------------------------------------- /docs/assets/hyperlight_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/docs/assets/hyperlight_arch.png -------------------------------------------------------------------------------- /docs/assets/hyperlight_guest_to_host_boundary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/docs/assets/hyperlight_guest_to_host_boundary.png -------------------------------------------------------------------------------- /docs/assets/linear-address-translation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/docs/assets/linear-address-translation.png -------------------------------------------------------------------------------- /fuzz/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | corpus 3 | artifacts 4 | coverage 5 | -------------------------------------------------------------------------------- /fuzz/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hyperlight-fuzz" 3 | version = "0.0.0" 4 | publish = false 5 | edition = { workspace = true } 6 | 7 | [package.metadata] 8 | cargo-fuzz = true 9 | 10 | [dependencies] 11 | libfuzzer-sys = "0.4" 12 | hyperlight-testing = { workspace = true } 13 | hyperlight-host = { workspace = true, default-features = true, features = ["fuzzing"]} 14 | 15 | [[bin]] 16 | name = "fuzz_host_print" 17 | path = "fuzz_targets/host_print.rs" 18 | test = false 19 | doc = false 20 | bench = false 21 | 22 | [[bin]] 23 | name = "fuzz_guest_call" 24 | path = "fuzz_targets/guest_call.rs" 25 | test = false 26 | doc = false 27 | bench = false 28 | 29 | [[bin]] 30 | name = "fuzz_host_call" 31 | path = "fuzz_targets/host_call.rs" 32 | test = false 33 | doc = false 34 | bench = false -------------------------------------------------------------------------------- /fuzz/doc-assets/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/fuzz/doc-assets/image.png -------------------------------------------------------------------------------- /hack/rust-dependabot-patch.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM dependabot/dependabot-script 2 | RUN rustup toolchain install 1.85 && rustup default 1.85 3 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "1.85" 3 | # Target used for guest binaries. This is an additive list of targets in addition to host platform. 4 | # Will install the target if not already installed when building guest binaries. 5 | targets = ["x86_64-unknown-none"] -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | newline_style = "Native" 2 | unstable_features = true # Cargo fmt now needs to be called with `cargo +nightly fmt` 3 | group_imports = "StdExternalCrate" # create three groups for std, external and local crates 4 | # Merge imports from the same module 5 | # See: https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#imports_granularity 6 | imports_granularity = "Module" 7 | style_edition = "2024" 8 | -------------------------------------------------------------------------------- /src/hyperlight_common/src/clippy.toml: -------------------------------------------------------------------------------- 1 | disallowed-macros = [ 2 | { path = "std::assert", reason = "no asserts in release builds" }, 3 | { path = "std::assert_eq", reason = "no asserts in release builds" }, 4 | { path = "std::assert_ne", reason = "no asserts in release builds" }, 5 | { path = "std::assert_true", reason = "no asserts in release builds" }, 6 | { path = "std::assert_false", reason = "no asserts in release builds" }, 7 | ] 8 | -------------------------------------------------------------------------------- /src/hyperlight_common/src/flatbuffer_wrappers/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Hyperlight Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | pub mod function_call; 18 | pub mod function_types; 19 | pub mod guest_error; 20 | /// cbindgen:ignore 21 | pub mod guest_log_data; 22 | /// cbindgen:ignore 23 | pub mod guest_log_level; 24 | pub mod util; 25 | -------------------------------------------------------------------------------- /src/hyperlight_component_macro/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hyperlight-component-macro" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | readme.workspace = true 10 | description = """ 11 | Procedural macros to generate Hyperlight host and guest bindings from component types 12 | """ 13 | 14 | [lib] 15 | name = "hyperlight_component_macro" 16 | proc-macro = true 17 | 18 | [dependencies] 19 | wasmparser = { version = "0.224.0" } 20 | quote = { version = "1.0.38" } 21 | proc-macro2 = { version = "1.0.93" } 22 | syn = { version = "2.0.96" } 23 | itertools = { version = "0.14.0" } 24 | prettyplease = { version = "0.2.31" } 25 | hyperlight-component-util = { workspace = true } 26 | env_logger = { version = "0.11.8" } -------------------------------------------------------------------------------- /src/hyperlight_component_util/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hyperlight-component-util" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | readme.workspace = true 10 | description = """ 11 | Shared implementation for the procedural macros that generate Hyperlight host and guest bindings from component types 12 | """ 13 | 14 | [lib] 15 | name = "hyperlight_component_util" 16 | 17 | [dependencies] 18 | wasmparser = { version = "0.224.0" } 19 | quote = { version = "1.0.38" } 20 | proc-macro2 = { version = "1.0.93" } 21 | syn = { version = "2.0.96" } 22 | itertools = { version = "0.14.0" } 23 | prettyplease = { version = "0.2.31" } 24 | log = { version = "0.4" } -------------------------------------------------------------------------------- /src/hyperlight_guest/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hyperlight-guest" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | readme.workspace = true 10 | description = """ 11 | Library to build guest applications for hyperlight. 12 | """ 13 | 14 | [dependencies] 15 | anyhow = { version = "1.0.98", default-features = false } 16 | serde_json = { version = "1.0", default-features = false, features = ["alloc"] } 17 | hyperlight-common = { workspace = true } 18 | -------------------------------------------------------------------------------- /src/hyperlight_guest/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Hyperlight Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #![no_std] 18 | // Deps 19 | 20 | extern crate alloc; 21 | 22 | // Modules 23 | pub mod error; 24 | pub mod exit; 25 | 26 | pub mod guest_handle { 27 | pub mod handle; 28 | pub mod host_comm; 29 | pub mod io; 30 | } 31 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hyperlight-guest-bin" 3 | links = "c" 4 | version.workspace = true 5 | edition.workspace = true 6 | rust-version.workspace = true 7 | license.workspace = true 8 | homepage.workspace = true 9 | repository.workspace = true 10 | readme.workspace = true 11 | 12 | [features] 13 | default = ["libc", "printf"] 14 | libc = [] # compile musl libc 15 | printf = [] # compile printf 16 | 17 | [dependencies] 18 | hyperlight-guest = { workspace = true, default-features = false } 19 | hyperlight-common = { workspace = true, default-features = false } 20 | buddy_system_allocator = "0.11.0" 21 | log = { version = "0.4", default-features = false } 22 | spin = "0.10.0" 23 | 24 | [lints] 25 | workspace = true 26 | 27 | [build-dependencies] 28 | cc = "1.2" 29 | cfg-if = "1.0" 30 | glob = "0.3.2" 31 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/arch/generic/fp_arch.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/src/hyperlight_guest_bin/third_party/musl/arch/generic/fp_arch.h -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/fenv.h: -------------------------------------------------------------------------------- 1 | #define FE_INVALID 1 2 | #define __FE_DENORM 2 3 | #define FE_DIVBYZERO 4 4 | #define FE_OVERFLOW 8 5 | #define FE_UNDERFLOW 16 6 | #define FE_INEXACT 32 7 | 8 | #define FE_ALL_EXCEPT 63 9 | 10 | #define FE_TONEAREST 0 11 | #define FE_DOWNWARD 0x400 12 | #define FE_UPWARD 0x800 13 | #define FE_TOWARDZERO 0xc00 14 | 15 | typedef unsigned short fexcept_t; 16 | 17 | typedef struct { 18 | unsigned short __control_word; 19 | unsigned short __unused1; 20 | unsigned short __status_word; 21 | unsigned short __unused2; 22 | unsigned short __tags; 23 | unsigned short __unused3; 24 | unsigned int __eip; 25 | unsigned short __cs_selector; 26 | unsigned int __opcode:11; 27 | unsigned int __unused4:5; 28 | unsigned int __data_offset; 29 | unsigned short __data_selector; 30 | unsigned short __unused5; 31 | unsigned int __mxcsr; 32 | } fenv_t; 33 | 34 | #define FE_DFL_ENV ((const fenv_t *) -1) 35 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/limits.h: -------------------------------------------------------------------------------- 1 | #define PAGESIZE 4096 2 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/mman.h: -------------------------------------------------------------------------------- 1 | #define MAP_32BIT 0x40 2 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/posix.h: -------------------------------------------------------------------------------- 1 | #define _POSIX_V6_LP64_OFF64 1 2 | #define _POSIX_V7_LP64_OFF64 1 3 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/ptrace.h: -------------------------------------------------------------------------------- 1 | #define PTRACE_GET_THREAD_AREA 25 2 | #define PTRACE_SET_THREAD_AREA 26 3 | #define PTRACE_ARCH_PRCTL 30 4 | #define PTRACE_SYSEMU 31 5 | #define PTRACE_SYSEMU_SINGLESTEP 32 6 | #define PTRACE_SINGLEBLOCK 33 7 | 8 | #define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA 9 | #define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA 10 | #define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL 11 | #define PT_SYSEMU PTRACE_SYSEMU 12 | #define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP 13 | #define PT_STEPBLOCK PTRACE_SINGLEBLOCK 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/reg.h: -------------------------------------------------------------------------------- 1 | #undef __WORDSIZE 2 | #define __WORDSIZE 64 3 | #define R15 0 4 | #define R14 1 5 | #define R13 2 6 | #define R12 3 7 | #define RBP 4 8 | #define RBX 5 9 | #define R11 6 10 | #define R10 7 11 | #define R9 8 12 | #define R8 9 13 | #define RAX 10 14 | #define RCX 11 15 | #define RDX 12 16 | #define RSI 13 17 | #define RDI 14 18 | #define ORIG_RAX 15 19 | #define RIP 16 20 | #define CS 17 21 | #define EFLAGS 18 22 | #define RSP 19 23 | #define SS 20 24 | #define FS_BASE 21 25 | #define GS_BASE 22 26 | #define DS 23 27 | #define ES 24 28 | #define FS 25 29 | #define GS 26 30 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/setjmp.h: -------------------------------------------------------------------------------- 1 | typedef unsigned long __jmp_buf[8]; 2 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/arch/x86_64/bits/stdint.h: -------------------------------------------------------------------------------- 1 | typedef int32_t int_fast16_t; 2 | typedef int32_t int_fast32_t; 3 | typedef uint32_t uint_fast16_t; 4 | typedef uint32_t uint_fast32_t; 5 | 6 | #define INT_FAST16_MIN INT32_MIN 7 | #define INT_FAST32_MIN INT32_MIN 8 | 9 | #define INT_FAST16_MAX INT32_MAX 10 | #define INT_FAST32_MAX INT32_MAX 11 | 12 | #define UINT_FAST16_MAX UINT32_MAX 13 | #define UINT_FAST32_MAX UINT32_MAX 14 | 15 | #define INTPTR_MIN INT64_MIN 16 | #define INTPTR_MAX INT64_MAX 17 | #define UINTPTR_MAX UINT64_MAX 18 | #define PTRDIFF_MIN INT64_MIN 19 | #define PTRDIFF_MAX INT64_MAX 20 | #define SIZE_MAX UINT64_MAX 21 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/arch/x86_64/reloc.h: -------------------------------------------------------------------------------- 1 | #define LDSO_ARCH "x86_64" 2 | 3 | #define REL_SYMBOLIC R_X86_64_64 4 | #define REL_OFFSET32 R_X86_64_PC32 5 | #define REL_GOT R_X86_64_GLOB_DAT 6 | #define REL_PLT R_X86_64_JUMP_SLOT 7 | #define REL_RELATIVE R_X86_64_RELATIVE 8 | #define REL_COPY R_X86_64_COPY 9 | #define REL_DTPMOD R_X86_64_DTPMOD64 10 | #define REL_DTPOFF R_X86_64_DTPOFF64 11 | #define REL_TPOFF R_X86_64_TPOFF64 12 | #define REL_TLSDESC R_X86_64_TLSDESC 13 | 14 | #define CRTJMP(pc,sp) __asm__ __volatile__( \ 15 | "mov %1,%%rsp ; jmp *%0" : : "r"(pc), "r"(sp) : "memory" ) 16 | 17 | #define GETFUNCSYM(fp, sym, got) __asm__ ( \ 18 | ".hidden " #sym "\n" \ 19 | " lea " #sym "(%%rip),%0\n" \ 20 | : "=r"(*fp) : : "memory" ) 21 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/alloca.h: -------------------------------------------------------------------------------- 1 | #ifndef _ALLOCA_H 2 | #define _ALLOCA_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #define __NEED_size_t 9 | #include 10 | 11 | void *alloca(size_t); 12 | 13 | #define alloca __builtin_alloca 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/assert.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #undef assert 4 | 5 | #ifdef NDEBUG 6 | #define assert(x) (void)0 7 | #else 8 | #define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0))) 9 | #endif 10 | 11 | #if __STDC_VERSION__ >= 201112L && !defined(__cplusplus) 12 | #define static_assert _Static_assert 13 | #endif 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | _Noreturn void __assert_fail (const char *, const char *, int, const char *); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/byteswap.h: -------------------------------------------------------------------------------- 1 | #ifndef _BYTESWAP_H 2 | #define _BYTESWAP_H 3 | 4 | #include 5 | #include 6 | 7 | static __inline uint16_t __bswap_16(uint16_t __x) 8 | { 9 | return __x<<8 | __x>>8; 10 | } 11 | 12 | static __inline uint32_t __bswap_32(uint32_t __x) 13 | { 14 | return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24; 15 | } 16 | 17 | static __inline uint64_t __bswap_64(uint64_t __x) 18 | { 19 | return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32); 20 | } 21 | 22 | #define bswap_16(x) __bswap_16(x) 23 | #define bswap_32(x) __bswap_32(x) 24 | #define bswap_64(x) __bswap_64(x) 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/errno.h: -------------------------------------------------------------------------------- 1 | #ifndef _ERRNO_H 2 | #define _ERRNO_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | #include 11 | 12 | #ifdef __GNUC__ 13 | __attribute__((const)) 14 | #endif 15 | int *__errno_location(void); 16 | #define errno (*__errno_location()) 17 | 18 | #ifdef _GNU_SOURCE 19 | extern char *program_invocation_short_name, *program_invocation_name; 20 | #endif 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/fenv.h: -------------------------------------------------------------------------------- 1 | #ifndef _FENV_H 2 | #define _FENV_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | int feclearexcept(int); 11 | int fegetexceptflag(fexcept_t *, int); 12 | int feraiseexcept(int); 13 | int fesetexceptflag(const fexcept_t *, int); 14 | int fetestexcept(int); 15 | 16 | int fegetround(void); 17 | int fesetround(int); 18 | 19 | int fegetenv(fenv_t *); 20 | int feholdexcept(fenv_t *); 21 | int fesetenv(const fenv_t *); 22 | int feupdateenv(const fenv_t *); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/libgen.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBGEN_H 2 | #define _LIBGEN_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | char *dirname(char *); 9 | char *basename(char *); 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/memory.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H 2 | #define _STDARG_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #define __NEED_va_list 9 | 10 | #include 11 | 12 | #define va_start(v,l) __builtin_va_start(v,l) 13 | #define va_end(v) __builtin_va_end(v) 14 | #define va_arg(v,l) __builtin_va_arg(v,l) 15 | #define va_copy(d,s) __builtin_va_copy(d,s) 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/stdbool.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDBOOL_H 2 | #define _STDBOOL_H 3 | 4 | #ifndef __cplusplus 5 | 6 | #define true 1 7 | #define false 0 8 | #define bool _Bool 9 | 10 | #endif 11 | 12 | #define __bool_true_false_are_defined 1 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDDEF_H 2 | #define _STDDEF_H 3 | 4 | #if __cplusplus >= 201103L 5 | #define NULL nullptr 6 | #elif defined(__cplusplus) 7 | #define NULL 0L 8 | #else 9 | #define NULL ((void*)0) 10 | #endif 11 | 12 | #define __NEED_ptrdiff_t 13 | #define __NEED_size_t 14 | #define __NEED_wchar_t 15 | #if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L 16 | #define __NEED_max_align_t 17 | #endif 18 | 19 | #include 20 | 21 | #if __GNUC__ > 3 22 | #define offsetof(type, member) __builtin_offsetof(type, member) 23 | #else 24 | #define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 )) 25 | #endif 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/include/tar.h: -------------------------------------------------------------------------------- 1 | #ifndef _TAR_H 2 | #define _TAR_H 3 | 4 | #define TSUID 04000 5 | #define TSGID 02000 6 | #define TSVTX 01000 7 | #define TUREAD 00400 8 | #define TUWRITE 00200 9 | #define TUEXEC 00100 10 | #define TGREAD 00040 11 | #define TGWRITE 00020 12 | #define TGEXEC 00010 13 | #define TOREAD 00004 14 | #define TOWRITE 00002 15 | #define TOEXEC 00001 16 | 17 | #define REGTYPE '0' 18 | #define AREGTYPE '\0' 19 | #define LNKTYPE '1' 20 | #define SYMTYPE '2' 21 | #define CHRTYPE '3' 22 | #define BLKTYPE '4' 23 | #define DIRTYPE '5' 24 | #define FIFOTYPE '6' 25 | #define CONTTYPE '7' 26 | 27 | #define TMAGIC "ustar" 28 | #define TMAGLEN 6 29 | 30 | #define TVERSION "00" 31 | #define TVERSLEN 2 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cabs.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | double cabs(double complex z) 4 | { 5 | return hypot(creal(z), cimag(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cabsf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float cabsf(float complex z) 4 | { 5 | return hypotf(crealf(z), cimagf(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cabsl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double cabsl(long double complex z) 5 | { 6 | return cabs(z); 7 | } 8 | #else 9 | long double cabsl(long double complex z) 10 | { 11 | return hypotl(creall(z), cimagl(z)); 12 | } 13 | #endif 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cacos.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | // FIXME: Hull et al. "Implementing the complex arcsine and arccosine functions using exception handling" 1997 4 | 5 | /* acos(z) = pi/2 - asin(z) */ 6 | 7 | double complex cacos(double complex z) 8 | { 9 | z = casin(z); 10 | return CMPLX(M_PI_2 - creal(z), -cimag(z)); 11 | } 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cacosf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | // FIXME 4 | 5 | static const float float_pi_2 = M_PI_2; 6 | 7 | float complex cacosf(float complex z) 8 | { 9 | z = casinf(z); 10 | return CMPLXF(float_pi_2 - crealf(z), -cimagf(z)); 11 | } 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cacosh.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | /* acosh(z) = i acos(z) */ 4 | 5 | double complex cacosh(double complex z) 6 | { 7 | int zineg = signbit(cimag(z)); 8 | 9 | z = cacos(z); 10 | if (zineg) return CMPLX(cimag(z), -creal(z)); 11 | else return CMPLX(-cimag(z), creal(z)); 12 | } 13 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cacoshf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float complex cacoshf(float complex z) 4 | { 5 | int zineg = signbit(cimagf(z)); 6 | 7 | z = cacosf(z); 8 | if (zineg) return CMPLXF(cimagf(z), -crealf(z)); 9 | else return CMPLXF(-cimagf(z), crealf(z)); 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cacoshl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex cacoshl(long double complex z) 5 | { 6 | return cacosh(z); 7 | } 8 | #else 9 | long double complex cacoshl(long double complex z) 10 | { 11 | int zineg = signbit(cimagl(z)); 12 | 13 | z = cacosl(z); 14 | if (zineg) return CMPLXL(cimagl(z), -creall(z)); 15 | else return CMPLXL(-cimagl(z), creall(z)); 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cacosl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex cacosl(long double complex z) 5 | { 6 | return cacos(z); 7 | } 8 | #else 9 | // FIXME 10 | #define PI_2 1.57079632679489661923132169163975144L 11 | long double complex cacosl(long double complex z) 12 | { 13 | z = casinl(z); 14 | return CMPLXL(PI_2 - creall(z), -cimagl(z)); 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/carg.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | double carg(double complex z) 4 | { 5 | return atan2(cimag(z), creal(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cargf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float cargf(float complex z) 4 | { 5 | return atan2f(cimagf(z), crealf(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cargl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double cargl(long double complex z) 5 | { 6 | return carg(z); 7 | } 8 | #else 9 | long double cargl(long double complex z) 10 | { 11 | return atan2l(cimagl(z), creall(z)); 12 | } 13 | #endif 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/casin.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | // FIXME 4 | 5 | /* asin(z) = -i log(i z + sqrt(1 - z*z)) */ 6 | 7 | double complex casin(double complex z) 8 | { 9 | double complex w; 10 | double x, y; 11 | 12 | x = creal(z); 13 | y = cimag(z); 14 | w = CMPLX(1.0 - (x - y)*(x + y), -2.0*x*y); 15 | double complex r = clog(CMPLX(-y, x) + csqrt(w)); 16 | return CMPLX(cimag(r), -creal(r)); 17 | } 18 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/casinf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | // FIXME 4 | 5 | float complex casinf(float complex z) 6 | { 7 | float complex w; 8 | float x, y; 9 | 10 | x = crealf(z); 11 | y = cimagf(z); 12 | w = CMPLXF(1.0 - (x - y)*(x + y), -2.0*x*y); 13 | float complex r = clogf(CMPLXF(-y, x) + csqrtf(w)); 14 | return CMPLXF(cimagf(r), -crealf(r)); 15 | } 16 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/casinh.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | /* asinh(z) = -i asin(i z) */ 4 | 5 | double complex casinh(double complex z) 6 | { 7 | z = casin(CMPLX(-cimag(z), creal(z))); 8 | return CMPLX(cimag(z), -creal(z)); 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/casinhf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float complex casinhf(float complex z) 4 | { 5 | z = casinf(CMPLXF(-cimagf(z), crealf(z))); 6 | return CMPLXF(cimagf(z), -crealf(z)); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/casinhl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex casinhl(long double complex z) 5 | { 6 | return casinh(z); 7 | } 8 | #else 9 | long double complex casinhl(long double complex z) 10 | { 11 | z = casinl(CMPLXL(-cimagl(z), creall(z))); 12 | return CMPLXL(cimagl(z), -creall(z)); 13 | } 14 | #endif 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/casinl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex casinl(long double complex z) 5 | { 6 | return casin(z); 7 | } 8 | #else 9 | // FIXME 10 | long double complex casinl(long double complex z) 11 | { 12 | long double complex w; 13 | long double x, y; 14 | 15 | x = creall(z); 16 | y = cimagl(z); 17 | w = CMPLXL(1.0 - (x - y)*(x + y), -2.0*x*y); 18 | long double complex r = clogl(CMPLXL(-y, x) + csqrtl(w)); 19 | return CMPLXL(cimagl(r), -creall(r)); 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/catanh.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | /* atanh = -i atan(i z) */ 4 | 5 | double complex catanh(double complex z) 6 | { 7 | z = catan(CMPLX(-cimag(z), creal(z))); 8 | return CMPLX(cimag(z), -creal(z)); 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/catanhf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float complex catanhf(float complex z) 4 | { 5 | z = catanf(CMPLXF(-cimagf(z), crealf(z))); 6 | return CMPLXF(cimagf(z), -crealf(z)); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/catanhl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex catanhl(long double complex z) 5 | { 6 | return catanh(z); 7 | } 8 | #else 9 | long double complex catanhl(long double complex z) 10 | { 11 | z = catanl(CMPLXL(-cimagl(z), creall(z))); 12 | return CMPLXL(cimagl(z), -creall(z)); 13 | } 14 | #endif 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/ccos.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | /* cos(z) = cosh(i z) */ 4 | 5 | double complex ccos(double complex z) 6 | { 7 | return ccosh(CMPLX(-cimag(z), creal(z))); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/ccosf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float complex ccosf(float complex z) 4 | { 5 | return ccoshf(CMPLXF(-cimagf(z), crealf(z))); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/ccoshl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | //FIXME 4 | long double complex ccoshl(long double complex z) 5 | { 6 | return ccosh(z); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/ccosl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex ccosl(long double complex z) 5 | { 6 | return ccos(z); 7 | } 8 | #else 9 | long double complex ccosl(long double complex z) 10 | { 11 | return ccoshl(CMPLXL(-cimagl(z), creall(z))); 12 | } 13 | #endif 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cexpl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | //FIXME 4 | long double complex cexpl(long double complex z) 5 | { 6 | return cexp(z); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cimag.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | double (cimag)(double complex z) 4 | { 5 | return cimag(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cimagf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float (cimagf)(float complex z) 4 | { 5 | return cimagf(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cimagl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | long double (cimagl)(long double complex z) 4 | { 5 | return cimagl(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/clog.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | // FIXME 4 | 5 | /* log(z) = log(|z|) + i arg(z) */ 6 | 7 | double complex clog(double complex z) 8 | { 9 | double r, phi; 10 | 11 | r = cabs(z); 12 | phi = carg(z); 13 | return CMPLX(log(r), phi); 14 | } 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/clogf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | // FIXME 4 | 5 | float complex clogf(float complex z) 6 | { 7 | float r, phi; 8 | 9 | r = cabsf(z); 10 | phi = cargf(z); 11 | return CMPLXF(logf(r), phi); 12 | } 13 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/clogl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex clogl(long double complex z) 5 | { 6 | return clog(z); 7 | } 8 | #else 9 | // FIXME 10 | long double complex clogl(long double complex z) 11 | { 12 | long double r, phi; 13 | 14 | r = cabsl(z); 15 | phi = cargl(z); 16 | return CMPLXL(logl(r), phi); 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/conj.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | double complex conj(double complex z) 4 | { 5 | return CMPLX(creal(z), -cimag(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/conjf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float complex conjf(float complex z) 4 | { 5 | return CMPLXF(crealf(z), -cimagf(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/conjl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | long double complex conjl(long double complex z) 4 | { 5 | return CMPLXL(creall(z), -cimagl(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cpow.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | /* pow(z, c) = exp(c log(z)), See C99 G.6.4.1 */ 4 | 5 | double complex cpow(double complex z, double complex c) 6 | { 7 | return cexp(c * clog(z)); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cpowf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float complex cpowf(float complex z, float complex c) 4 | { 5 | return cexpf(c * clogf(z)); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cpowl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex cpowl(long double complex z, long double complex c) 5 | { 6 | return cpow(z, c); 7 | } 8 | #else 9 | long double complex cpowl(long double complex z, long double complex c) 10 | { 11 | return cexpl(c * clogl(z)); 12 | } 13 | #endif 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cproj.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | double complex cproj(double complex z) 4 | { 5 | if (isinf(creal(z)) || isinf(cimag(z))) 6 | return CMPLX(INFINITY, copysign(0.0, cimag(z))); 7 | return z; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cprojf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float complex cprojf(float complex z) 4 | { 5 | if (isinf(crealf(z)) || isinf(cimagf(z))) 6 | return CMPLXF(INFINITY, copysignf(0.0, cimagf(z))); 7 | return z; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/cprojl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex cprojl(long double complex z) 5 | { 6 | return cproj(z); 7 | } 8 | #else 9 | long double complex cprojl(long double complex z) 10 | { 11 | if (isinf(creall(z)) || isinf(cimagl(z))) 12 | return CMPLXL(INFINITY, copysignl(0.0, cimagl(z))); 13 | return z; 14 | } 15 | #endif 16 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/creal.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double (creal)(double complex z) 4 | { 5 | return creal(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/crealf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float (crealf)(float complex z) 4 | { 5 | return crealf(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/creall.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double (creall)(long double complex z) 4 | { 5 | return creall(z); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/csin.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | /* sin(z) = -i sinh(i z) */ 4 | 5 | double complex csin(double complex z) 6 | { 7 | z = csinh(CMPLX(-cimag(z), creal(z))); 8 | return CMPLX(cimag(z), -creal(z)); 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/csinf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float complex csinf(float complex z) 4 | { 5 | z = csinhf(CMPLXF(-cimagf(z), crealf(z))); 6 | return CMPLXF(cimagf(z), -crealf(z)); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/csinhl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | //FIXME 4 | long double complex csinhl(long double complex z) 5 | { 6 | return csinh(z); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/csinl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex csinl(long double complex z) 5 | { 6 | return csin(z); 7 | } 8 | #else 9 | long double complex csinl(long double complex z) 10 | { 11 | z = csinhl(CMPLXL(-cimagl(z), creall(z))); 12 | return CMPLXL(cimagl(z), -creall(z)); 13 | } 14 | #endif 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/csqrtl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | //FIXME 4 | long double complex csqrtl(long double complex z) 5 | { 6 | return csqrt(z); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/ctan.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | /* tan(z) = -i tanh(i z) */ 4 | 5 | double complex ctan(double complex z) 6 | { 7 | z = ctanh(CMPLX(-cimag(z), creal(z))); 8 | return CMPLX(cimag(z), -creal(z)); 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/ctanf.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | float complex ctanf(float complex z) 4 | { 5 | z = ctanhf(CMPLXF(-cimagf(z), crealf(z))); 6 | return CMPLXF(cimagf(z), -crealf(z)); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/ctanhl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | //FIXME 4 | long double complex ctanhl(long double complex z) 5 | { 6 | return ctanh(z); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/complex/ctanl.c: -------------------------------------------------------------------------------- 1 | #include "complex_impl.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double complex ctanl(long double complex z) 5 | { 6 | return ctan(z); 7 | } 8 | #else 9 | long double complex ctanl(long double complex z) 10 | { 11 | z = ctanhl(CMPLXL(-cimagl(z), creall(z))); 12 | return CMPLXL(cimagl(z), -creall(z)); 13 | } 14 | #endif 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/isalnum.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int isalnum(int c) 4 | { 5 | return isalpha(c) || isdigit(c); 6 | } 7 | 8 | int __isalnum_l(int c, locale_t l) 9 | { 10 | return isalnum(c); 11 | } 12 | 13 | weak_alias(__isalnum_l, isalnum_l); 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/isalpha.c: -------------------------------------------------------------------------------- 1 | #include 2 | #undef isalpha 3 | 4 | int isalpha(int c) 5 | { 6 | return ((unsigned)c|32)-'a' < 26; 7 | } 8 | 9 | int __isalpha_l(int c, locale_t l) 10 | { 11 | return isalpha(c); 12 | } 13 | 14 | weak_alias(__isalpha_l, isalpha_l); 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/isdigit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #undef isdigit 3 | 4 | int isdigit(int c) 5 | { 6 | return (unsigned)c-'0' < 10; 7 | } 8 | 9 | int __isdigit_l(int c, locale_t l) 10 | { 11 | return isdigit(c); 12 | } 13 | 14 | weak_alias(__isdigit_l, isdigit_l); 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/isgraph.c: -------------------------------------------------------------------------------- 1 | #include 2 | #undef isgraph 3 | 4 | int isgraph(int c) 5 | { 6 | return (unsigned)c-0x21 < 0x5e; 7 | } 8 | 9 | int __isgraph_l(int c, locale_t l) 10 | { 11 | return isgraph(c); 12 | } 13 | 14 | weak_alias(__isgraph_l, isgraph_l); 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/islower.c: -------------------------------------------------------------------------------- 1 | #include 2 | #undef islower 3 | 4 | int islower(int c) 5 | { 6 | return (unsigned)c-'a' < 26; 7 | } 8 | 9 | int __islower_l(int c, locale_t l) 10 | { 11 | return islower(c); 12 | } 13 | 14 | weak_alias(__islower_l, islower_l); 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/isprint.c: -------------------------------------------------------------------------------- 1 | #include 2 | #undef isprint 3 | 4 | int isprint(int c) 5 | { 6 | return (unsigned)c-0x20 < 0x5f; 7 | } 8 | 9 | int __isprint_l(int c, locale_t l) 10 | { 11 | return isprint(c); 12 | } 13 | 14 | weak_alias(__isprint_l, isprint_l); 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/isspace.c: -------------------------------------------------------------------------------- 1 | #include 2 | #undef isspace 3 | 4 | int isspace(int c) 5 | { 6 | return c == ' ' || (unsigned)c-'\t' < 5; 7 | } 8 | 9 | int __isspace_l(int c, locale_t l) 10 | { 11 | return isspace(c); 12 | } 13 | 14 | weak_alias(__isspace_l, isspace_l); 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/isupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | #undef isupper 3 | 4 | int isupper(int c) 5 | { 6 | return (unsigned)c-'A' < 26; 7 | } 8 | 9 | int __isupper_l(int c, locale_t l) 10 | { 11 | return isupper(c); 12 | } 13 | 14 | weak_alias(__isupper_l, isupper_l); 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/isxdigit.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int isxdigit(int c) 4 | { 5 | return isdigit(c) || ((unsigned)c|32)-'a' < 6; 6 | } 7 | 8 | int __isxdigit_l(int c, locale_t l) 9 | { 10 | return isxdigit(c); 11 | } 12 | 13 | weak_alias(__isxdigit_l, isxdigit_l); 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/tolower.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int tolower(int c) 4 | { 5 | if (isupper(c)) return c | 32; 6 | return c; 7 | } 8 | 9 | int __tolower_l(int c, locale_t l) 10 | { 11 | return tolower(c); 12 | } 13 | 14 | weak_alias(__tolower_l, tolower_l); 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/ctype/toupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int toupper(int c) 4 | { 5 | if (islower(c)) return c & 0x5f; 6 | return c; 7 | } 8 | 9 | int __toupper_l(int c, locale_t l) 10 | { 11 | return toupper(c); 12 | } 13 | 14 | weak_alias(__toupper_l, toupper_l); 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/errno/__errno_location.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int errno_val; 4 | 5 | int *__errno_location(void) 6 | { 7 | return &errno_val; 8 | } 9 | 10 | weak_alias(__errno_location, ___errno_location); -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/exit/assert.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "printf.h" 4 | 5 | _Noreturn void __assert_fail(const char *expr, const char *file, int line, const char *func) 6 | { 7 | printf("Assertion failed: %s (%s: %s: %d)\n", expr, file, func, line); 8 | abort(); 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/fenv/__flt_rounds.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int __flt_rounds() 5 | { 6 | switch (fegetround()) { 7 | #ifdef FE_TOWARDZERO 8 | case FE_TOWARDZERO: return 0; 9 | #endif 10 | case FE_TONEAREST: return 1; 11 | #ifdef FE_UPWARD 12 | case FE_UPWARD: return 2; 13 | #endif 14 | #ifdef FE_DOWNWARD 15 | case FE_DOWNWARD: return 3; 16 | #endif 17 | } 18 | return -1; 19 | } 20 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/fenv/fegetexceptflag.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fegetexceptflag(fexcept_t *fp, int mask) 4 | { 5 | *fp = fetestexcept(mask); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/fenv/feholdexcept.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int feholdexcept(fenv_t *envp) 4 | { 5 | fegetenv(envp); 6 | feclearexcept(FE_ALL_EXCEPT); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/fenv/fesetexceptflag.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fesetexceptflag(const fexcept_t *fp, int mask) 4 | { 5 | feclearexcept(~*fp & mask); 6 | feraiseexcept(*fp & mask); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/fenv/fesetround.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* __fesetround wrapper for arch independent argument check */ 5 | 6 | hidden int __fesetround(int); 7 | 8 | int fesetround(int r) 9 | { 10 | if (r != FE_TONEAREST 11 | #ifdef FE_DOWNWARD 12 | && r != FE_DOWNWARD 13 | #endif 14 | #ifdef FE_UPWARD 15 | && r != FE_UPWARD 16 | #endif 17 | #ifdef FE_TOWARDZERO 18 | && r != FE_TOWARDZERO 19 | #endif 20 | ) 21 | return -1; 22 | return __fesetround(r); 23 | } 24 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/fenv/feupdateenv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int feupdateenv(const fenv_t *envp) 4 | { 5 | int ex = fetestexcept(FE_ALL_EXCEPT); 6 | fesetenv(envp); 7 | feraiseexcept(ex); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/include/errno.h: -------------------------------------------------------------------------------- 1 | #ifndef ERRNO_H 2 | #define ERRNO_H 3 | 4 | #include "../../include/errno.h" 5 | 6 | #ifdef __GNUC__ 7 | __attribute__((const)) 8 | #endif 9 | hidden int *___errno_location(void); 10 | 11 | #undef errno 12 | #define errno (*___errno_location()) 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/include/features.h: -------------------------------------------------------------------------------- 1 | #ifndef FEATURES_H 2 | #define FEATURES_H 3 | 4 | #include "../../include/features.h" 5 | 6 | #define weak __attribute__((__weak__)) 7 | #define hidden __attribute__((__visibility__("hidden"))) 8 | #define weak_alias(old, new) \ 9 | extern __typeof(old) new __attribute__((__weak__, __alias__(#old))) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/include/stdlib.h: -------------------------------------------------------------------------------- 1 | #ifndef STDLIB_H 2 | #define STDLIB_H 3 | 4 | #include "../../include/stdlib.h" 5 | 6 | hidden int __putenv(char *, size_t, char *); 7 | hidden void __env_rm_add(char *, char *); 8 | hidden int __mkostemps(char *, int, int); 9 | hidden int __ptsname_r(int, char *, size_t); 10 | hidden char *__randname(char *); 11 | hidden void __qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *); 12 | 13 | hidden void *__libc_malloc(size_t); 14 | hidden void *__libc_malloc_impl(size_t); 15 | hidden void *__libc_calloc(size_t, size_t); 16 | hidden void *__libc_realloc(void *, size_t); 17 | hidden void __libc_free(void *); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef STRING_H 2 | #define STRING_H 3 | 4 | #include "../../include/string.h" 5 | 6 | hidden void *__memrchr(const void *, int, size_t); 7 | hidden char *__stpcpy(char *, const char *); 8 | hidden char *__stpncpy(char *, const char *, size_t); 9 | hidden char *__strchrnul(const char *, int); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/include/sys/time.h: -------------------------------------------------------------------------------- 1 | #ifndef SYS_TIME_H 2 | #define SYS_TIME_H 3 | 4 | #include "../../../include/sys/time.h" 5 | 6 | hidden int __futimesat(int, const char *, const struct timeval [2]); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/include/time.h: -------------------------------------------------------------------------------- 1 | #ifndef TIME_H 2 | #define TIME_H 3 | 4 | #include "../../include/time.h" 5 | 6 | hidden int __clock_gettime(clockid_t, struct timespec *); 7 | hidden int __clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *); 8 | 9 | hidden char *__asctime_r(const struct tm *, char *); 10 | hidden struct tm *__gmtime_r(const time_t *restrict, struct tm *restrict); 11 | hidden struct tm *__localtime_r(const time_t *restrict, struct tm *restrict); 12 | 13 | hidden size_t __strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/internal/complex_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPLEX_IMPL_H 2 | #define _COMPLEX_IMPL_H 3 | 4 | #include 5 | #include "libm.h" 6 | 7 | #undef __CMPLX 8 | #undef CMPLX 9 | #undef CMPLXF 10 | #undef CMPLXL 11 | 12 | #define __CMPLX(x, y, t) \ 13 | ((union { _Complex t __z; t __xy[2]; }){.__xy = {(x),(y)}}.__z) 14 | 15 | #define CMPLX(x, y) __CMPLX(x, y, double) 16 | #define CMPLXF(x, y) __CMPLX(x, y, float) 17 | #define CMPLXL(x, y) __CMPLX(x, y, long double) 18 | 19 | hidden double complex __ldexp_cexp(double complex,int); 20 | hidden float complex __ldexp_cexpf(float complex,int); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/internal/floatscan.h: -------------------------------------------------------------------------------- 1 | #ifndef FLOATSCAN_H 2 | #define FLOATSCAN_H 3 | 4 | #include 5 | 6 | hidden long double __floatscan(FILE *, int, int); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/internal/intscan.h: -------------------------------------------------------------------------------- 1 | #ifndef INTSCAN_H 2 | #define INTSCAN_H 3 | 4 | #include 5 | 6 | hidden unsigned long long __intscan(FILE *, unsigned, int, unsigned long long); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__expo2.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* k is such that k*ln2 has minimal relative error and x - kln2 > log(DBL_MIN) */ 4 | static const int k = 2043; 5 | static const double kln2 = 0x1.62066151add8bp+10; 6 | 7 | /* exp(x)/2 for x >= log(DBL_MAX), slightly better than 0.5*exp(x/2)*exp(x/2) */ 8 | double __expo2(double x, double sign) 9 | { 10 | double scale; 11 | 12 | /* note that k is odd and scale*scale overflows */ 13 | INSERT_WORDS(scale, (uint32_t)(0x3ff + k/2) << 20, 0); 14 | /* exp(x - k ln2) * 2**(k-1) */ 15 | /* in directed rounding correct sign before rounding or overflow is important */ 16 | return exp(x - kln2) * (sign * scale) * scale; 17 | } 18 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__expo2f.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* k is such that k*ln2 has minimal relative error and x - kln2 > log(FLT_MIN) */ 4 | static const int k = 235; 5 | static const float kln2 = 0x1.45c778p+7f; 6 | 7 | /* expf(x)/2 for x >= log(FLT_MAX), slightly better than 0.5f*expf(x/2)*expf(x/2) */ 8 | float __expo2f(float x, float sign) 9 | { 10 | float scale; 11 | 12 | /* note that k is odd and scale*scale overflows */ 13 | SET_FLOAT_WORD(scale, (uint32_t)(0x7f + k/2) << 23); 14 | /* exp(x - k ln2) * 2**(k-1) */ 15 | /* in directed rounding correct sign before rounding or overflow is important */ 16 | return expf(x - kln2) * (sign * scale) * scale; 17 | } 18 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassify.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int __fpclassify(double x) 5 | { 6 | union {double f; uint64_t i;} u = {x}; 7 | int e = u.i>>52 & 0x7ff; 8 | if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; 9 | if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; 10 | return FP_NORMAL; 11 | } 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__fpclassifyf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int __fpclassifyf(float x) 5 | { 6 | union {float f; uint32_t i;} u = {x}; 7 | int e = u.i>>23 & 0xff; 8 | if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; 9 | if (e==0xff) return u.i<<9 ? FP_NAN : FP_INFINITE; 10 | return FP_NORMAL; 11 | } 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__invtrigl.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* shared by acosl, asinl and atan2l */ 4 | #define pio2_hi __pio2_hi 5 | #define pio2_lo __pio2_lo 6 | hidden extern const long double pio2_hi, pio2_lo; 7 | 8 | hidden long double __invtrigl_R(long double z); 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_divzero.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double __math_divzero(uint32_t sign) 4 | { 5 | return fp_barrier(sign ? -1.0 : 1.0) / 0.0; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_divzerof.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float __math_divzerof(uint32_t sign) 4 | { 5 | return fp_barrierf(sign ? -1.0f : 1.0f) / 0.0f; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalid.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double __math_invalid(double x) 4 | { 5 | return (x - x) / (x - x); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalidf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float __math_invalidf(float x) 4 | { 5 | return (x - x) / (x - x); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_invalidl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libm.h" 3 | 4 | #if LDBL_MANT_DIG != DBL_MANT_DIG 5 | long double __math_invalidl(long double x) 6 | { 7 | return (x - x) / (x - x); 8 | } 9 | #endif 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_oflow.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double __math_oflow(uint32_t sign) 4 | { 5 | return __math_xflow(sign, 0x1p769); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_oflowf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float __math_oflowf(uint32_t sign) 4 | { 5 | return __math_xflowf(sign, 0x1p97f); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_uflow.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double __math_uflow(uint32_t sign) 4 | { 5 | return __math_xflow(sign, 0x1p-767); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_uflowf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float __math_uflowf(uint32_t sign) 4 | { 5 | return __math_xflowf(sign, 0x1p-95f); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_xflow.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double __math_xflow(uint32_t sign, double y) 4 | { 5 | return eval_as_double(fp_barrier(sign ? -y : y) * y); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__math_xflowf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float __math_xflowf(uint32_t sign, float y) 4 | { 5 | return eval_as_float(fp_barrierf(sign ? -y : y) * y); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__signbit.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | // FIXME: macro in math.h 4 | int __signbit(double x) 5 | { 6 | union { 7 | double d; 8 | uint64_t i; 9 | } y = { x }; 10 | return y.i>>63; 11 | } 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__signbitf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | // FIXME: macro in math.h 4 | int __signbitf(float x) 5 | { 6 | union { 7 | float f; 8 | uint32_t i; 9 | } y = { x }; 10 | return y.i>>31; 11 | } 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/__signbitl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 4 | int __signbitl(long double x) 5 | { 6 | union ldshape u = {x}; 7 | return u.i.se >> 15; 8 | } 9 | #elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 10 | int __signbitl(long double x) 11 | { 12 | return __signbit(x); 13 | } 14 | #endif 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/acosh.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if FLT_EVAL_METHOD==2 4 | #undef sqrt 5 | #define sqrt sqrtl 6 | #endif 7 | 8 | /* acosh(x) = log(x + sqrt(x*x-1)) */ 9 | double acosh(double x) 10 | { 11 | union {double f; uint64_t i;} u = {.f = x}; 12 | unsigned e = u.i >> 52 & 0x7ff; 13 | 14 | /* x < 1 domain error is handled in the called functions */ 15 | 16 | if (e < 0x3ff + 1) 17 | /* |x| < 2, up to 2ulp error in [1,1.125] */ 18 | return log1p(x-1 + sqrt((x-1)*(x-1)+2*(x-1))); 19 | if (e < 0x3ff + 26) 20 | /* |x| < 0x1p26 */ 21 | return log(2*x - 1/(x+sqrt(x*x-1))); 22 | /* |x| >= 0x1p26 or nan */ 23 | return log(x) + 0.693147180559945309417232121458176568; 24 | } 25 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/acoshf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if FLT_EVAL_METHOD==2 4 | #undef sqrtf 5 | #define sqrtf sqrtl 6 | #elif FLT_EVAL_METHOD==1 7 | #undef sqrtf 8 | #define sqrtf sqrt 9 | #endif 10 | 11 | /* acosh(x) = log(x + sqrt(x*x-1)) */ 12 | float acoshf(float x) 13 | { 14 | union {float f; uint32_t i;} u = {x}; 15 | uint32_t a = u.i & 0x7fffffff; 16 | 17 | if (a < 0x3f800000+(1<<23)) 18 | /* |x| < 2, invalid if x < 1 */ 19 | /* up to 2ulp error in [1,1.125] */ 20 | return log1pf(x-1 + sqrtf((x-1)*(x-1)+2*(x-1))); 21 | if (u.i < 0x3f800000+(12<<23)) 22 | /* 2 <= x < 0x1p12 */ 23 | return logf(2*x - 1/(x+sqrtf(x*x-1))); 24 | /* x >= 0x1p12 or x <= -2 or nan */ 25 | return logf(x) + 0.693147180559945309417232121458176568f; 26 | } 27 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/acoshl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double acoshl(long double x) 5 | { 6 | return acosh(x); 7 | } 8 | #elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 9 | /* acosh(x) = log(x + sqrt(x*x-1)) */ 10 | long double acoshl(long double x) 11 | { 12 | union ldshape u = {x}; 13 | int e = u.i.se; 14 | 15 | if (e < 0x3fff + 1) 16 | /* 0 <= x < 2, invalid if x < 1 */ 17 | return log1pl(x-1 + sqrtl((x-1)*(x-1)+2*(x-1))); 18 | if (e < 0x3fff + 32) 19 | /* 2 <= x < 0x1p32 */ 20 | return logl(2*x - 1/(x+sqrtl(x*x-1))); 21 | if (e & 0x8000) 22 | /* x < 0 or x = -0, invalid */ 23 | return (x - x) / (x - x); 24 | /* 0x1p32 <= x or nan */ 25 | return logl(x) + 0.693147180559945309417232121458176568L; 26 | } 27 | #elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 28 | // TODO: broken implementation to make things compile 29 | long double acoshl(long double x) 30 | { 31 | return acosh(x); 32 | } 33 | #endif 34 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/asinh.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */ 4 | double asinh(double x) 5 | { 6 | union {double f; uint64_t i;} u = {.f = x}; 7 | unsigned e = u.i >> 52 & 0x7ff; 8 | unsigned s = u.i >> 63; 9 | 10 | /* |x| */ 11 | u.i &= (uint64_t)-1/2; 12 | x = u.f; 13 | 14 | if (e >= 0x3ff + 26) { 15 | /* |x| >= 0x1p26 or inf or nan */ 16 | x = log(x) + 0.693147180559945309417232121458176568; 17 | } else if (e >= 0x3ff + 1) { 18 | /* |x| >= 2 */ 19 | x = log(2*x + 1/(sqrt(x*x+1)+x)); 20 | } else if (e >= 0x3ff - 26) { 21 | /* |x| >= 0x1p-26, up to 1.6ulp error in [0.125,0.5] */ 22 | x = log1p(x + x*x/(sqrt(x*x+1)+1)); 23 | } else { 24 | /* |x| < 0x1p-26, raise inexact if x != 0 */ 25 | FORCE_EVAL(x + 0x1p120f); 26 | } 27 | return s ? -x : x; 28 | } 29 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/asinhf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */ 4 | float asinhf(float x) 5 | { 6 | union {float f; uint32_t i;} u = {.f = x}; 7 | uint32_t i = u.i & 0x7fffffff; 8 | unsigned s = u.i >> 31; 9 | 10 | /* |x| */ 11 | u.i = i; 12 | x = u.f; 13 | 14 | if (i >= 0x3f800000 + (12<<23)) { 15 | /* |x| >= 0x1p12 or inf or nan */ 16 | x = logf(x) + 0.693147180559945309417232121458176568f; 17 | } else if (i >= 0x3f800000 + (1<<23)) { 18 | /* |x| >= 2 */ 19 | x = logf(2*x + 1/(sqrtf(x*x+1)+x)); 20 | } else if (i >= 0x3f800000 - (12<<23)) { 21 | /* |x| >= 0x1p-12, up to 1.6ulp error in [0.125,0.5] */ 22 | x = log1pf(x + x*x/(sqrtf(x*x+1)+1)); 23 | } else { 24 | /* |x| < 0x1p-12, raise inexact if x!=0 */ 25 | FORCE_EVAL(x + 0x1p120f); 26 | } 27 | return s ? -x : x; 28 | } 29 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/atanh.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5) */ 4 | double atanh(double x) 5 | { 6 | union {double f; uint64_t i;} u = {.f = x}; 7 | unsigned e = u.i >> 52 & 0x7ff; 8 | unsigned s = u.i >> 63; 9 | double_t y; 10 | 11 | /* |x| */ 12 | u.i &= (uint64_t)-1/2; 13 | y = u.f; 14 | 15 | if (e < 0x3ff - 1) { 16 | if (e < 0x3ff - 32) { 17 | /* handle underflow */ 18 | if (e == 0) 19 | FORCE_EVAL((float)y); 20 | } else { 21 | /* |x| < 0.5, up to 1.7ulp error */ 22 | y = 0.5*log1p(2*y + 2*y*y/(1-y)); 23 | } 24 | } else { 25 | /* avoid overflow */ 26 | y = 0.5*log1p(2*(y/(1-y))); 27 | } 28 | return s ? -y : y; 29 | } 30 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/atanhf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5) */ 4 | float atanhf(float x) 5 | { 6 | union {float f; uint32_t i;} u = {.f = x}; 7 | unsigned s = u.i >> 31; 8 | float_t y; 9 | 10 | /* |x| */ 11 | u.i &= 0x7fffffff; 12 | y = u.f; 13 | 14 | if (u.i < 0x3f800000 - (1<<23)) { 15 | if (u.i < 0x3f800000 - (32<<23)) { 16 | /* handle underflow */ 17 | if (u.i < (1<<23)) 18 | FORCE_EVAL((float)(y*y)); 19 | } else { 20 | /* |x| < 0.5, up to 1.7ulp error */ 21 | y = 0.5f*log1pf(2*y + 2*y*y/(1-y)); 22 | } 23 | } else { 24 | /* avoid overflow */ 25 | y = 0.5f*log1pf(2*(y/(1-y))); 26 | } 27 | return s ? -y : y; 28 | } 29 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/atanhl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double atanhl(long double x) 5 | { 6 | return atanh(x); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | /* atanh(x) = log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2 ~= x + x^3/3 + o(x^5) */ 10 | long double atanhl(long double x) 11 | { 12 | union ldshape u = {x}; 13 | unsigned e = u.i.se & 0x7fff; 14 | unsigned s = u.i.se >> 15; 15 | 16 | /* |x| */ 17 | u.i.se = e; 18 | x = u.f; 19 | 20 | if (e < 0x3ff - 1) { 21 | if (e < 0x3ff - LDBL_MANT_DIG/2) { 22 | /* handle underflow */ 23 | if (e == 0) 24 | FORCE_EVAL((float)x); 25 | } else { 26 | /* |x| < 0.5, up to 1.7ulp error */ 27 | x = 0.5*log1pl(2*x + 2*x*x/(1-x)); 28 | } 29 | } else { 30 | /* avoid overflow */ 31 | x = 0.5*log1pl(2*(x/(1-x))); 32 | } 33 | return s ? -x : x; 34 | } 35 | #endif 36 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/ceil.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 4 | #define EPS DBL_EPSILON 5 | #elif FLT_EVAL_METHOD==2 6 | #define EPS LDBL_EPSILON 7 | #endif 8 | static const double_t toint = 1/EPS; 9 | 10 | double ceil(double x) 11 | { 12 | union {double f; uint64_t i;} u = {x}; 13 | int e = u.i >> 52 & 0x7ff; 14 | double_t y; 15 | 16 | if (e >= 0x3ff+52 || x == 0) 17 | return x; 18 | /* y = int(x) - x, where int(x) is an integer neighbor of x */ 19 | if (u.i >> 63) 20 | y = x - toint + toint - x; 21 | else 22 | y = x + toint - toint - x; 23 | /* special case because of non-nearest rounding modes */ 24 | if (e <= 0x3ff-1) { 25 | FORCE_EVAL(y); 26 | return u.i >> 63 ? -0.0 : 1; 27 | } 28 | if (y < 0) 29 | return x + y + 1; 30 | return x + y; 31 | } 32 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/ceilf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float ceilf(float x) 4 | { 5 | union {float f; uint32_t i;} u = {x}; 6 | int e = (int)(u.i >> 23 & 0xff) - 0x7f; 7 | uint32_t m; 8 | 9 | if (e >= 23) 10 | return x; 11 | if (e >= 0) { 12 | m = 0x007fffff >> e; 13 | if ((u.i & m) == 0) 14 | return x; 15 | FORCE_EVAL(x + 0x1p120f); 16 | if (u.i >> 31 == 0) 17 | u.i += m; 18 | u.i &= ~m; 19 | } else { 20 | FORCE_EVAL(x + 0x1p120f); 21 | if (u.i >> 31) 22 | u.f = -0.0; 23 | else if (u.i << 1) 24 | u.f = 1.0; 25 | } 26 | return u.f; 27 | } 28 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/ceill.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double ceill(long double x) 5 | { 6 | return ceil(x); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | 10 | static const long double toint = 1/LDBL_EPSILON; 11 | 12 | long double ceill(long double x) 13 | { 14 | union ldshape u = {x}; 15 | int e = u.i.se & 0x7fff; 16 | long double y; 17 | 18 | if (e >= 0x3fff+LDBL_MANT_DIG-1 || x == 0) 19 | return x; 20 | /* y = int(x) - x, where int(x) is an integer neighbor of x */ 21 | if (u.i.se >> 15) 22 | y = x - toint + toint - x; 23 | else 24 | y = x + toint - toint - x; 25 | /* special case because of non-nearest rounding modes */ 26 | if (e <= 0x3fff-1) { 27 | FORCE_EVAL(y); 28 | return u.i.se >> 15 ? -0.0 : 1; 29 | } 30 | if (y < 0) 31 | return x + y + 1; 32 | return x + y; 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/copysign.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double copysign(double x, double y) { 4 | union {double f; uint64_t i;} ux={x}, uy={y}; 5 | ux.i &= -1ULL/2; 6 | ux.i |= uy.i & 1ULL<<63; 7 | return ux.f; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/copysignf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float copysignf(float x, float y) 5 | { 6 | union {float f; uint32_t i;} ux={x}, uy={y}; 7 | ux.i &= 0x7fffffff; 8 | ux.i |= uy.i & 0x80000000; 9 | return ux.f; 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/copysignl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double copysignl(long double x, long double y) 5 | { 6 | return copysign(x, y); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | long double copysignl(long double x, long double y) 10 | { 11 | union ldshape ux = {x}, uy = {y}; 12 | ux.i.se &= 0x7fff; 13 | ux.i.se |= uy.i.se & 0x8000; 14 | return ux.f; 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/cosh.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* cosh(x) = (exp(x) + 1/exp(x))/2 4 | * = 1 + 0.5*(exp(x)-1)*(exp(x)-1)/exp(x) 5 | * = 1 + x*x/2 + o(x^4) 6 | */ 7 | double cosh(double x) 8 | { 9 | union {double f; uint64_t i;} u = {.f = x}; 10 | uint32_t w; 11 | double t; 12 | 13 | /* |x| */ 14 | u.i &= (uint64_t)-1/2; 15 | x = u.f; 16 | w = u.i >> 32; 17 | 18 | /* |x| < log(2) */ 19 | if (w < 0x3fe62e42) { 20 | if (w < 0x3ff00000 - (26<<20)) { 21 | /* raise inexact if x!=0 */ 22 | FORCE_EVAL(x + 0x1p120f); 23 | return 1; 24 | } 25 | t = expm1(x); 26 | return 1 + t*t/(2*(1+t)); 27 | } 28 | 29 | /* |x| < log(DBL_MAX) */ 30 | if (w < 0x40862e42) { 31 | t = exp(x); 32 | /* note: if x>log(0x1p26) then the 1/t is not needed */ 33 | return 0.5*(t + 1/t); 34 | } 35 | 36 | /* |x| > log(DBL_MAX) or nan */ 37 | /* note: the result is stored to handle overflow */ 38 | t = __expo2(x, 1.0); 39 | return t; 40 | } 41 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/coshf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float coshf(float x) 4 | { 5 | union {float f; uint32_t i;} u = {.f = x}; 6 | uint32_t w; 7 | float t; 8 | 9 | /* |x| */ 10 | u.i &= 0x7fffffff; 11 | x = u.f; 12 | w = u.i; 13 | 14 | /* |x| < log(2) */ 15 | if (w < 0x3f317217) { 16 | if (w < 0x3f800000 - (12<<23)) { 17 | FORCE_EVAL(x + 0x1p120f); 18 | return 1; 19 | } 20 | t = expm1f(x); 21 | return 1 + t*t/(2*(1+t)); 22 | } 23 | 24 | /* |x| < log(FLT_MAX) */ 25 | if (w < 0x42b17217) { 26 | t = expf(x); 27 | return 0.5f*(t + 1/t); 28 | } 29 | 30 | /* |x| > log(FLT_MAX) or nan */ 31 | t = __expo2f(x, 1.0f); 32 | return t; 33 | } 34 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/cosl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double cosl(long double x) { 5 | return cos(x); 6 | } 7 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 8 | long double cosl(long double x) 9 | { 10 | union ldshape u = {x}; 11 | unsigned n; 12 | long double y[2], hi, lo; 13 | 14 | u.i.se &= 0x7fff; 15 | if (u.i.se == 0x7fff) 16 | return x - x; 17 | x = u.f; 18 | if (x < M_PI_4) { 19 | if (u.i.se < 0x3fff - LDBL_MANT_DIG) 20 | /* raise inexact if x!=0 */ 21 | return 1.0 + x; 22 | return __cosl(x, 0); 23 | } 24 | n = __rem_pio2l(x, y); 25 | hi = y[0]; 26 | lo = y[1]; 27 | switch (n & 3) { 28 | case 0: 29 | return __cosl(hi, lo); 30 | case 1: 31 | return -__sinl(hi, lo, 1); 32 | case 2: 33 | return -__cosl(hi, lo); 34 | case 3: 35 | default: 36 | return __sinl(hi, lo, 1); 37 | } 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/exp10.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | 5 | double exp10(double x) 6 | { 7 | static const double p10[] = { 8 | 1e-15, 1e-14, 1e-13, 1e-12, 1e-11, 1e-10, 9 | 1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 10 | 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 11 | 1e10, 1e11, 1e12, 1e13, 1e14, 1e15 12 | }; 13 | double n, y = modf(x, &n); 14 | union {double f; uint64_t i;} u = {n}; 15 | /* fabs(n) < 16 without raising invalid on nan */ 16 | if ((u.i>>52 & 0x7ff) < 0x3ff+4) { 17 | if (!y) return p10[(int)n+15]; 18 | y = exp2(3.32192809488736234787031942948939 * y); 19 | return y * p10[(int)n+15]; 20 | } 21 | return pow(10.0, x); 22 | } 23 | 24 | weak_alias(exp10, pow10); 25 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/exp10f.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | 5 | float exp10f(float x) 6 | { 7 | static const float p10[] = { 8 | 1e-7f, 1e-6f, 1e-5f, 1e-4f, 1e-3f, 1e-2f, 1e-1f, 9 | 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7 10 | }; 11 | float n, y = modff(x, &n); 12 | union {float f; uint32_t i;} u = {n}; 13 | /* fabsf(n) < 8 without raising invalid on nan */ 14 | if ((u.i>>23 & 0xff) < 0x7f+3) { 15 | if (!y) return p10[(int)n+7]; 16 | y = exp2f(3.32192809488736234787031942948939f * y); 17 | return y * p10[(int)n+7]; 18 | } 19 | return exp2(3.32192809488736234787031942948939 * x); 20 | } 21 | 22 | weak_alias(exp10f, pow10f); 23 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/exp10l.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include "libm.h" 5 | 6 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 7 | long double exp10l(long double x) 8 | { 9 | return exp10(x); 10 | } 11 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 12 | long double exp10l(long double x) 13 | { 14 | static const long double p10[] = { 15 | 1e-15L, 1e-14L, 1e-13L, 1e-12L, 1e-11L, 1e-10L, 16 | 1e-9L, 1e-8L, 1e-7L, 1e-6L, 1e-5L, 1e-4L, 1e-3L, 1e-2L, 1e-1L, 17 | 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 18 | 1e10, 1e11, 1e12, 1e13, 1e14, 1e15 19 | }; 20 | long double n, y = modfl(x, &n); 21 | union ldshape u = {n}; 22 | /* fabsl(n) < 16 without raising invalid on nan */ 23 | if ((u.i.se & 0x7fff) < 0x3fff+4) { 24 | if (!y) return p10[(int)n+15]; 25 | y = exp2l(3.32192809488736234787031942948939L * y); 26 | return y * p10[(int)n+15]; 27 | } 28 | return powl(10.0, x); 29 | } 30 | #endif 31 | 32 | weak_alias(exp10l, pow10l); 33 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/exp2f_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018, Arm Limited. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | #ifndef _EXP2F_DATA_H 6 | #define _EXP2F_DATA_H 7 | 8 | #include 9 | #include 10 | 11 | /* Shared between expf, exp2f and powf. */ 12 | #define EXP2F_TABLE_BITS 5 13 | #define EXP2F_POLY_ORDER 3 14 | extern hidden const struct exp2f_data { 15 | uint64_t tab[1 << EXP2F_TABLE_BITS]; 16 | double shift_scaled; 17 | double poly[EXP2F_POLY_ORDER]; 18 | double shift; 19 | double invln2_scaled; 20 | double poly_scaled[EXP2F_POLY_ORDER]; 21 | } __exp2f_data; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/exp_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Arm Limited. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | #ifndef _EXP_DATA_H 6 | #define _EXP_DATA_H 7 | 8 | #include 9 | #include 10 | 11 | #define EXP_TABLE_BITS 7 12 | #define EXP_POLY_ORDER 5 13 | #define EXP_USE_TOINT_NARROW 0 14 | #define EXP2_POLY_ORDER 5 15 | extern hidden const struct exp_data { 16 | double invln2N; 17 | double shift; 18 | double negln2hiN; 19 | double negln2loN; 20 | double poly[4]; /* Last four coefficients. */ 21 | double exp2_shift; 22 | double exp2_poly[EXP2_POLY_ORDER]; 23 | uint64_t tab[2*(1 << EXP_TABLE_BITS)]; 24 | } __exp_data; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fabs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | double fabs(double x) 5 | { 6 | union {double f; uint64_t i;} u = {x}; 7 | u.i &= -1ULL/2; 8 | return u.f; 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fabsf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float fabsf(float x) 5 | { 6 | union {float f; uint32_t i;} u = {x}; 7 | u.i &= 0x7fffffff; 8 | return u.f; 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fabsl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 3 | long double fabsl(long double x) 4 | { 5 | return fabs(x); 6 | } 7 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 8 | long double fabsl(long double x) 9 | { 10 | union ldshape u = {x}; 11 | 12 | u.i.se &= 0x7fff; 13 | return u.f; 14 | } 15 | #endif 16 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fdim.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fdim(double x, double y) 4 | { 5 | if (isnan(x)) 6 | return x; 7 | if (isnan(y)) 8 | return y; 9 | return x > y ? x - y : 0; 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fdimf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fdimf(float x, float y) 4 | { 5 | if (isnan(x)) 6 | return x; 7 | if (isnan(y)) 8 | return y; 9 | return x > y ? x - y : 0; 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fdiml.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 5 | long double fdiml(long double x, long double y) 6 | { 7 | return fdim(x, y); 8 | } 9 | #else 10 | long double fdiml(long double x, long double y) 11 | { 12 | if (isnan(x)) 13 | return x; 14 | if (isnan(y)) 15 | return y; 16 | return x > y ? x - y : 0; 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/finite.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | int finite(double x) 5 | { 6 | return isfinite(x); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/finitef.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | int finitef(float x) 5 | { 6 | return isfinite(x); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/floor.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 4 | #define EPS DBL_EPSILON 5 | #elif FLT_EVAL_METHOD==2 6 | #define EPS LDBL_EPSILON 7 | #endif 8 | static const double_t toint = 1/EPS; 9 | 10 | double floor(double x) 11 | { 12 | union {double f; uint64_t i;} u = {x}; 13 | int e = u.i >> 52 & 0x7ff; 14 | double_t y; 15 | 16 | if (e >= 0x3ff+52 || x == 0) 17 | return x; 18 | /* y = int(x) - x, where int(x) is an integer neighbor of x */ 19 | if (u.i >> 63) 20 | y = x - toint + toint - x; 21 | else 22 | y = x + toint - toint - x; 23 | /* special case because of non-nearest rounding modes */ 24 | if (e <= 0x3ff-1) { 25 | FORCE_EVAL(y); 26 | return u.i >> 63 ? -1 : 0; 27 | } 28 | if (y > 0) 29 | return x + y - 1; 30 | return x + y; 31 | } 32 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/floorf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float floorf(float x) 4 | { 5 | union {float f; uint32_t i;} u = {x}; 6 | int e = (int)(u.i >> 23 & 0xff) - 0x7f; 7 | uint32_t m; 8 | 9 | if (e >= 23) 10 | return x; 11 | if (e >= 0) { 12 | m = 0x007fffff >> e; 13 | if ((u.i & m) == 0) 14 | return x; 15 | FORCE_EVAL(x + 0x1p120f); 16 | if (u.i >> 31) 17 | u.i += m; 18 | u.i &= ~m; 19 | } else { 20 | FORCE_EVAL(x + 0x1p120f); 21 | if (u.i >> 31 == 0) 22 | u.i = 0; 23 | else if (u.i << 1) 24 | u.f = -1.0; 25 | } 26 | return u.f; 27 | } 28 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/floorl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double floorl(long double x) 5 | { 6 | return floor(x); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | 10 | static const long double toint = 1/LDBL_EPSILON; 11 | 12 | long double floorl(long double x) 13 | { 14 | union ldshape u = {x}; 15 | int e = u.i.se & 0x7fff; 16 | long double y; 17 | 18 | if (e >= 0x3fff+LDBL_MANT_DIG-1 || x == 0) 19 | return x; 20 | /* y = int(x) - x, where int(x) is an integer neighbor of x */ 21 | if (u.i.se >> 15) 22 | y = x - toint + toint - x; 23 | else 24 | y = x + toint - toint - x; 25 | /* special case because of non-nearest rounding modes */ 26 | if (e <= 0x3fff-1) { 27 | FORCE_EVAL(y); 28 | return u.i.se >> 15 ? -1 : 0; 29 | } 30 | if (y > 0) 31 | return x + y - 1; 32 | return x + y; 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fmax.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fmax(double x, double y) 4 | { 5 | if (isnan(x)) 6 | return y; 7 | if (isnan(y)) 8 | return x; 9 | /* handle signed zeros, see C99 Annex F.9.9.2 */ 10 | if (signbit(x) != signbit(y)) 11 | return signbit(x) ? y : x; 12 | return x < y ? y : x; 13 | } 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fmaxf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fmaxf(float x, float y) 4 | { 5 | if (isnan(x)) 6 | return y; 7 | if (isnan(y)) 8 | return x; 9 | /* handle signed zeroes, see C99 Annex F.9.9.2 */ 10 | if (signbit(x) != signbit(y)) 11 | return signbit(x) ? y : x; 12 | return x < y ? y : x; 13 | } 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fmaxl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 5 | long double fmaxl(long double x, long double y) 6 | { 7 | return fmax(x, y); 8 | } 9 | #else 10 | long double fmaxl(long double x, long double y) 11 | { 12 | if (isnan(x)) 13 | return y; 14 | if (isnan(y)) 15 | return x; 16 | /* handle signed zeros, see C99 Annex F.9.9.2 */ 17 | if (signbit(x) != signbit(y)) 18 | return signbit(x) ? y : x; 19 | return x < y ? y : x; 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fmin.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fmin(double x, double y) 4 | { 5 | if (isnan(x)) 6 | return y; 7 | if (isnan(y)) 8 | return x; 9 | /* handle signed zeros, see C99 Annex F.9.9.2 */ 10 | if (signbit(x) != signbit(y)) 11 | return signbit(x) ? x : y; 12 | return x < y ? x : y; 13 | } 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fminf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fminf(float x, float y) 4 | { 5 | if (isnan(x)) 6 | return y; 7 | if (isnan(y)) 8 | return x; 9 | /* handle signed zeros, see C99 Annex F.9.9.2 */ 10 | if (signbit(x) != signbit(y)) 11 | return signbit(x) ? x : y; 12 | return x < y ? x : y; 13 | } 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/fminl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 5 | long double fminl(long double x, long double y) 6 | { 7 | return fmin(x, y); 8 | } 9 | #else 10 | long double fminl(long double x, long double y) 11 | { 12 | if (isnan(x)) 13 | return y; 14 | if (isnan(y)) 15 | return x; 16 | /* handle signed zeros, see C99 Annex F.9.9.2 */ 17 | if (signbit(x) != signbit(y)) 18 | return signbit(x) ? x : y; 19 | return x < y ? x : y; 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/frexp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | double frexp(double x, int *e) 5 | { 6 | union { double d; uint64_t i; } y = { x }; 7 | int ee = y.i>>52 & 0x7ff; 8 | 9 | if (!ee) { 10 | if (x) { 11 | x = frexp(x*0x1p64, e); 12 | *e -= 64; 13 | } else *e = 0; 14 | return x; 15 | } else if (ee == 0x7ff) { 16 | return x; 17 | } 18 | 19 | *e = ee - 0x3fe; 20 | y.i &= 0x800fffffffffffffull; 21 | y.i |= 0x3fe0000000000000ull; 22 | return y.d; 23 | } 24 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/frexpf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float frexpf(float x, int *e) 5 | { 6 | union { float f; uint32_t i; } y = { x }; 7 | int ee = y.i>>23 & 0xff; 8 | 9 | if (!ee) { 10 | if (x) { 11 | x = frexpf(x*0x1p64, e); 12 | *e -= 64; 13 | } else *e = 0; 14 | return x; 15 | } else if (ee == 0xff) { 16 | return x; 17 | } 18 | 19 | *e = ee - 0x7e; 20 | y.i &= 0x807ffffful; 21 | y.i |= 0x3f000000ul; 22 | return y.f; 23 | } 24 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/frexpl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double frexpl(long double x, int *e) 5 | { 6 | return frexp(x, e); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | long double frexpl(long double x, int *e) 10 | { 11 | union ldshape u = {x}; 12 | int ee = u.i.se & 0x7fff; 13 | 14 | if (!ee) { 15 | if (x) { 16 | x = frexpl(x*0x1p120, e); 17 | *e -= 120; 18 | } else *e = 0; 19 | return x; 20 | } else if (ee == 0x7fff) { 21 | return x; 22 | } 23 | 24 | *e = ee - 0x3ffe; 25 | u.i.se &= 0x8000; 26 | u.i.se |= 0x3ffe; 27 | return u.f; 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/hypotf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float hypotf(float x, float y) 5 | { 6 | union {float f; uint32_t i;} ux = {x}, uy = {y}, ut; 7 | float_t z; 8 | 9 | ux.i &= -1U>>1; 10 | uy.i &= -1U>>1; 11 | if (ux.i < uy.i) { 12 | ut = ux; 13 | ux = uy; 14 | uy = ut; 15 | } 16 | 17 | x = ux.f; 18 | y = uy.f; 19 | if (uy.i == 0xff<<23) 20 | return y; 21 | if (ux.i >= 0xff<<23 || uy.i == 0 || ux.i - uy.i >= 25<<23) 22 | return x + y; 23 | 24 | z = 1; 25 | if (ux.i >= (0x7f+60)<<23) { 26 | z = 0x1p90f; 27 | x *= 0x1p-90f; 28 | y *= 0x1p-90f; 29 | } else if (uy.i < (0x7f-60)<<23) { 30 | z = 0x1p-90f; 31 | x *= 0x1p90f; 32 | y *= 0x1p90f; 33 | } 34 | return z*sqrtf((double)x*x + (double)y*y); 35 | } 36 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/ilogb.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libm.h" 3 | 4 | int ilogb(double x) 5 | { 6 | #pragma STDC FENV_ACCESS ON 7 | union {double f; uint64_t i;} u = {x}; 8 | uint64_t i = u.i; 9 | int e = i>>52 & 0x7ff; 10 | 11 | if (!e) { 12 | i <<= 12; 13 | if (i == 0) { 14 | FORCE_EVAL(0/0.0f); 15 | return FP_ILOGB0; 16 | } 17 | /* subnormal x */ 18 | for (e = -0x3ff; i>>63 == 0; e--, i<<=1); 19 | return e; 20 | } 21 | if (e == 0x7ff) { 22 | FORCE_EVAL(0/0.0f); 23 | return i<<12 ? FP_ILOGBNAN : INT_MAX; 24 | } 25 | return e - 0x3ff; 26 | } 27 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/ilogbf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libm.h" 3 | 4 | int ilogbf(float x) 5 | { 6 | #pragma STDC FENV_ACCESS ON 7 | union {float f; uint32_t i;} u = {x}; 8 | uint32_t i = u.i; 9 | int e = i>>23 & 0xff; 10 | 11 | if (!e) { 12 | i <<= 9; 13 | if (i == 0) { 14 | FORCE_EVAL(0/0.0f); 15 | return FP_ILOGB0; 16 | } 17 | /* subnormal x */ 18 | for (e = -0x7f; i>>31 == 0; e--, i<<=1); 19 | return e; 20 | } 21 | if (e == 0xff) { 22 | FORCE_EVAL(0/0.0f); 23 | return i<<9 ? FP_ILOGBNAN : INT_MAX; 24 | } 25 | return e - 0x7f; 26 | } 27 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/ldexp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double ldexp(double x, int n) 4 | { 5 | return scalbn(x, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/ldexpf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float ldexpf(float x, int n) 4 | { 5 | return scalbnf(x, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/ldexpl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double ldexpl(long double x, int n) 4 | { 5 | return scalbnl(x, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/lgamma.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libm.h" 3 | 4 | double lgamma(double x) 5 | { 6 | return __lgamma_r(x, &__signgam); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/lgammaf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libm.h" 3 | 4 | float lgammaf(float x) 5 | { 6 | return __lgammaf_r(x, &__signgam); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/llrint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* uses LLONG_MAX > 2^53, see comments in lrint.c */ 4 | 5 | long long llrint(double x) 6 | { 7 | return rint(x); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/llrintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* uses LLONG_MAX > 2^24, see comments in lrint.c */ 4 | 5 | long long llrintf(float x) 6 | { 7 | return rintf(x); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/llrintl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "libm.h" 4 | 5 | 6 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 7 | long long llrintl(long double x) 8 | { 9 | return llrint(x); 10 | } 11 | #elif defined(FE_INEXACT) 12 | /* 13 | see comments in lrint.c 14 | 15 | Note that if LLONG_MAX == 0x7fffffffffffffff && LDBL_MANT_DIG == 64 16 | then x == 2**63 - 0.5 is the only input that overflows and 17 | raises inexact (with tonearest or upward rounding mode) 18 | */ 19 | long long llrintl(long double x) 20 | { 21 | #pragma STDC FENV_ACCESS ON 22 | int e; 23 | 24 | e = fetestexcept(FE_INEXACT); 25 | x = rintl(x); 26 | if (!e && (x > LLONG_MAX || x < LLONG_MIN)) 27 | feclearexcept(FE_INEXACT); 28 | /* conversion */ 29 | return x; 30 | } 31 | #else 32 | long long llrintl(long double x) 33 | { 34 | return rintl(x); 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/llround.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llround(double x) 4 | { 5 | return round(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/llroundf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llroundf(float x) 4 | { 5 | return roundf(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/llroundl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llroundl(long double x) 4 | { 5 | return roundl(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/log2_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Arm Limited. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | #ifndef _LOG2_DATA_H 6 | #define _LOG2_DATA_H 7 | 8 | #include 9 | 10 | #define LOG2_TABLE_BITS 6 11 | #define LOG2_POLY_ORDER 7 12 | #define LOG2_POLY1_ORDER 11 13 | extern hidden const struct log2_data { 14 | double invln2hi; 15 | double invln2lo; 16 | double poly[LOG2_POLY_ORDER - 1]; 17 | double poly1[LOG2_POLY1_ORDER - 1]; 18 | struct { 19 | double invc, logc; 20 | } tab[1 << LOG2_TABLE_BITS]; 21 | #if !__FP_FAST_FMA 22 | struct { 23 | double chi, clo; 24 | } tab2[1 << LOG2_TABLE_BITS]; 25 | #endif 26 | } __log2_data; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/log2f_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018, Arm Limited. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | #ifndef _LOG2F_DATA_H 6 | #define _LOG2F_DATA_H 7 | 8 | #include 9 | 10 | #define LOG2F_TABLE_BITS 4 11 | #define LOG2F_POLY_ORDER 4 12 | extern hidden const struct log2f_data { 13 | struct { 14 | double invc, logc; 15 | } tab[1 << LOG2F_TABLE_BITS]; 16 | double poly[LOG2F_POLY_ORDER]; 17 | } __log2f_data; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/log_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Arm Limited. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | #ifndef _LOG_DATA_H 6 | #define _LOG_DATA_H 7 | 8 | #include 9 | 10 | #define LOG_TABLE_BITS 7 11 | #define LOG_POLY_ORDER 6 12 | #define LOG_POLY1_ORDER 12 13 | extern hidden const struct log_data { 14 | double ln2hi; 15 | double ln2lo; 16 | double poly[LOG_POLY_ORDER - 1]; /* First coefficient is 1. */ 17 | double poly1[LOG_POLY1_ORDER - 1]; 18 | struct { 19 | double invc, logc; 20 | } tab[1 << LOG_TABLE_BITS]; 21 | #if !__FP_FAST_FMA 22 | struct { 23 | double chi, clo; 24 | } tab2[1 << LOG_TABLE_BITS]; 25 | #endif 26 | } __log_data; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/logb.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | special cases: 5 | logb(+-0) = -inf, and raise divbyzero 6 | logb(+-inf) = +inf 7 | logb(nan) = nan 8 | */ 9 | 10 | double logb(double x) 11 | { 12 | if (!isfinite(x)) 13 | return x * x; 14 | if (x == 0) 15 | return -1/(x*x); 16 | return ilogb(x); 17 | } 18 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/logbf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float logbf(float x) 4 | { 5 | if (!isfinite(x)) 6 | return x * x; 7 | if (x == 0) 8 | return -1/(x*x); 9 | return ilogbf(x); 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/logbl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 3 | long double logbl(long double x) 4 | { 5 | return logb(x); 6 | } 7 | #else 8 | long double logbl(long double x) 9 | { 10 | if (!isfinite(x)) 11 | return x * x; 12 | if (x == 0) 13 | return -1/(x*x); 14 | return ilogbl(x); 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/logf_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018, Arm Limited. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | #ifndef _LOGF_DATA_H 6 | #define _LOGF_DATA_H 7 | 8 | #include 9 | 10 | #define LOGF_TABLE_BITS 4 11 | #define LOGF_POLY_ORDER 4 12 | extern hidden const struct logf_data { 13 | struct { 14 | double invc, logc; 15 | } tab[1 << LOGF_TABLE_BITS]; 16 | double ln2; 17 | double poly[LOGF_POLY_ORDER - 1]; /* First order coefficient is 1. */ 18 | } __logf_data; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/lrintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* uses LONG_MAX > 2^24, see comments in lrint.c */ 4 | 5 | long lrintf(float x) 6 | { 7 | return rintf(x); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/lrintl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "libm.h" 4 | 5 | 6 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 7 | long lrintl(long double x) 8 | { 9 | return lrint(x); 10 | } 11 | #elif defined(FE_INEXACT) 12 | /* 13 | see comments in lrint.c 14 | 15 | Note that if LONG_MAX == 0x7fffffffffffffff && LDBL_MANT_DIG == 64 16 | then x == 2**63 - 0.5 is the only input that overflows and 17 | raises inexact (with tonearest or upward rounding mode) 18 | */ 19 | long lrintl(long double x) 20 | { 21 | #pragma STDC FENV_ACCESS ON 22 | int e; 23 | 24 | e = fetestexcept(FE_INEXACT); 25 | x = rintl(x); 26 | if (!e && (x > LONG_MAX || x < LONG_MIN)) 27 | feclearexcept(FE_INEXACT); 28 | /* conversion */ 29 | return x; 30 | } 31 | #else 32 | long lrintl(long double x) 33 | { 34 | return rintl(x); 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/lround.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lround(double x) 4 | { 5 | return round(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/lroundf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lroundf(float x) 4 | { 5 | return roundf(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/lroundl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lroundl(long double x) 4 | { 5 | return roundl(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/modf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double modf(double x, double *iptr) 4 | { 5 | union {double f; uint64_t i;} u = {x}; 6 | uint64_t mask; 7 | int e = (int)(u.i>>52 & 0x7ff) - 0x3ff; 8 | 9 | /* no fractional part */ 10 | if (e >= 52) { 11 | *iptr = x; 12 | if (e == 0x400 && u.i<<12 != 0) /* nan */ 13 | return x; 14 | u.i &= 1ULL<<63; 15 | return u.f; 16 | } 17 | 18 | /* no integral part*/ 19 | if (e < 0) { 20 | u.i &= 1ULL<<63; 21 | *iptr = u.f; 22 | return x; 23 | } 24 | 25 | mask = -1ULL>>12>>e; 26 | if ((u.i & mask) == 0) { 27 | *iptr = x; 28 | u.i &= 1ULL<<63; 29 | return u.f; 30 | } 31 | u.i &= ~mask; 32 | *iptr = u.f; 33 | return x - u.f; 34 | } 35 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/modff.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float modff(float x, float *iptr) 4 | { 5 | union {float f; uint32_t i;} u = {x}; 6 | uint32_t mask; 7 | int e = (int)(u.i>>23 & 0xff) - 0x7f; 8 | 9 | /* no fractional part */ 10 | if (e >= 23) { 11 | *iptr = x; 12 | if (e == 0x80 && u.i<<9 != 0) { /* nan */ 13 | return x; 14 | } 15 | u.i &= 0x80000000; 16 | return u.f; 17 | } 18 | /* no integral part */ 19 | if (e < 0) { 20 | u.i &= 0x80000000; 21 | *iptr = u.f; 22 | return x; 23 | } 24 | 25 | mask = 0x007fffff>>e; 26 | if ((u.i & mask) == 0) { 27 | *iptr = x; 28 | u.i &= 0x80000000; 29 | return u.f; 30 | } 31 | u.i &= ~mask; 32 | *iptr = u.f; 33 | return x - u.f; 34 | } 35 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nan.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double nan(const char *s) 4 | { 5 | return NAN; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nanf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float nanf(const char *s) 4 | { 5 | return NAN; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nanl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double nanl(const char *s) 4 | { 5 | return NAN; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nearbyint.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* nearbyint is the same as rint, but it must not raise the inexact exception */ 5 | 6 | double nearbyint(double x) 7 | { 8 | #ifdef FE_INEXACT 9 | #pragma STDC FENV_ACCESS ON 10 | int e; 11 | 12 | e = fetestexcept(FE_INEXACT); 13 | #endif 14 | x = rint(x); 15 | #ifdef FE_INEXACT 16 | if (!e) 17 | feclearexcept(FE_INEXACT); 18 | #endif 19 | return x; 20 | } 21 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nearbyintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float nearbyintf(float x) 5 | { 6 | #ifdef FE_INEXACT 7 | #pragma STDC FENV_ACCESS ON 8 | int e; 9 | 10 | e = fetestexcept(FE_INEXACT); 11 | #endif 12 | x = rintf(x); 13 | #ifdef FE_INEXACT 14 | if (!e) 15 | feclearexcept(FE_INEXACT); 16 | #endif 17 | return x; 18 | } 19 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nearbyintl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 5 | long double nearbyintl(long double x) 6 | { 7 | return nearbyint(x); 8 | } 9 | #else 10 | #include 11 | long double nearbyintl(long double x) 12 | { 13 | #ifdef FE_INEXACT 14 | #pragma STDC FENV_ACCESS ON 15 | int e; 16 | 17 | e = fetestexcept(FE_INEXACT); 18 | #endif 19 | x = rintl(x); 20 | #ifdef FE_INEXACT 21 | if (!e) 22 | feclearexcept(FE_INEXACT); 23 | #endif 24 | return x; 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nextafter.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double nextafter(double x, double y) 4 | { 5 | union {double f; uint64_t i;} ux={x}, uy={y}; 6 | uint64_t ax, ay; 7 | int e; 8 | 9 | if (isnan(x) || isnan(y)) 10 | return x + y; 11 | if (ux.i == uy.i) 12 | return y; 13 | ax = ux.i & -1ULL/2; 14 | ay = uy.i & -1ULL/2; 15 | if (ax == 0) { 16 | if (ay == 0) 17 | return y; 18 | ux.i = (uy.i & 1ULL<<63) | 1; 19 | } else if (ax > ay || ((ux.i ^ uy.i) & 1ULL<<63)) 20 | ux.i--; 21 | else 22 | ux.i++; 23 | e = ux.i >> 52 & 0x7ff; 24 | /* raise overflow if ux.f is infinite and x is finite */ 25 | if (e == 0x7ff) 26 | FORCE_EVAL(x+x); 27 | /* raise underflow if ux.f is subnormal or zero */ 28 | if (e == 0) 29 | FORCE_EVAL(x*x + ux.f*ux.f); 30 | return ux.f; 31 | } 32 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nextafterf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float nextafterf(float x, float y) 4 | { 5 | union {float f; uint32_t i;} ux={x}, uy={y}; 6 | uint32_t ax, ay, e; 7 | 8 | if (isnan(x) || isnan(y)) 9 | return x + y; 10 | if (ux.i == uy.i) 11 | return y; 12 | ax = ux.i & 0x7fffffff; 13 | ay = uy.i & 0x7fffffff; 14 | if (ax == 0) { 15 | if (ay == 0) 16 | return y; 17 | ux.i = (uy.i & 0x80000000) | 1; 18 | } else if (ax > ay || ((ux.i ^ uy.i) & 0x80000000)) 19 | ux.i--; 20 | else 21 | ux.i++; 22 | e = ux.i & 0x7f800000; 23 | /* raise overflow if ux.f is infinite and x is finite */ 24 | if (e == 0x7f800000) 25 | FORCE_EVAL(x+x); 26 | /* raise underflow if ux.f is subnormal or zero */ 27 | if (e == 0) 28 | FORCE_EVAL(x*x + ux.f*ux.f); 29 | return ux.f; 30 | } 31 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nexttoward.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | double nexttoward(double x, long double y) 5 | { 6 | return nextafter(x, y); 7 | } 8 | #else 9 | double nexttoward(double x, long double y) 10 | { 11 | union {double f; uint64_t i;} ux = {x}; 12 | int e; 13 | 14 | if (isnan(x) || isnan(y)) 15 | return x + y; 16 | if (x == y) 17 | return y; 18 | if (x == 0) { 19 | ux.i = 1; 20 | if (signbit(y)) 21 | ux.i |= 1ULL<<63; 22 | } else if (x < y) { 23 | if (signbit(x)) 24 | ux.i--; 25 | else 26 | ux.i++; 27 | } else { 28 | if (signbit(x)) 29 | ux.i++; 30 | else 31 | ux.i--; 32 | } 33 | e = ux.i>>52 & 0x7ff; 34 | /* raise overflow if ux.f is infinite and x is finite */ 35 | if (e == 0x7ff) 36 | FORCE_EVAL(x+x); 37 | /* raise underflow if ux.f is subnormal or zero */ 38 | if (e == 0) 39 | FORCE_EVAL(x*x + ux.f*ux.f); 40 | return ux.f; 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nexttowardf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float nexttowardf(float x, long double y) 4 | { 5 | union {float f; uint32_t i;} ux = {x}; 6 | uint32_t e; 7 | 8 | if (isnan(x) || isnan(y)) 9 | return x + y; 10 | if (x == y) 11 | return y; 12 | if (x == 0) { 13 | ux.i = 1; 14 | if (signbit(y)) 15 | ux.i |= 0x80000000; 16 | } else if (x < y) { 17 | if (signbit(x)) 18 | ux.i--; 19 | else 20 | ux.i++; 21 | } else { 22 | if (signbit(x)) 23 | ux.i++; 24 | else 25 | ux.i--; 26 | } 27 | e = ux.i & 0x7f800000; 28 | /* raise overflow if ux.f is infinite and x is finite */ 29 | if (e == 0x7f800000) 30 | FORCE_EVAL(x+x); 31 | /* raise underflow if ux.f is subnormal or zero */ 32 | if (e == 0) 33 | FORCE_EVAL(x*x + ux.f*ux.f); 34 | return ux.f; 35 | } 36 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/nexttowardl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double nexttowardl(long double x, long double y) 4 | { 5 | return nextafterl(x, y); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/pow_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, Arm Limited. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | #ifndef _POW_DATA_H 6 | #define _POW_DATA_H 7 | 8 | #include 9 | 10 | #define POW_LOG_TABLE_BITS 7 11 | #define POW_LOG_POLY_ORDER 8 12 | extern hidden const struct pow_log_data { 13 | double ln2hi; 14 | double ln2lo; 15 | double poly[POW_LOG_POLY_ORDER - 1]; /* First coefficient is 1. */ 16 | /* Note: the pad field is unused, but allows slightly faster indexing. */ 17 | struct { 18 | double invc, pad, logc, logctail; 19 | } tab[1 << POW_LOG_TABLE_BITS]; 20 | } __pow_log_data; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/powf_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018, Arm Limited. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | #ifndef _POWF_DATA_H 6 | #define _POWF_DATA_H 7 | 8 | #include "libm.h" 9 | #include "exp2f_data.h" 10 | 11 | #define POWF_LOG2_TABLE_BITS 4 12 | #define POWF_LOG2_POLY_ORDER 5 13 | #if TOINT_INTRINSICS 14 | #define POWF_SCALE_BITS EXP2F_TABLE_BITS 15 | #else 16 | #define POWF_SCALE_BITS 0 17 | #endif 18 | #define POWF_SCALE ((double)(1 << POWF_SCALE_BITS)) 19 | extern hidden const struct powf_log2_data { 20 | struct { 21 | double invc, logc; 22 | } tab[1 << POWF_LOG2_TABLE_BITS]; 23 | double poly[POWF_LOG2_POLY_ORDER]; 24 | } __powf_log2_data; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/remainder.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double remainder(double x, double y) 4 | { 5 | int q; 6 | return remquo(x, y, &q); 7 | } 8 | 9 | weak_alias(remainder, drem); 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/remainderf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float remainderf(float x, float y) 4 | { 5 | int q; 6 | return remquof(x, y, &q); 7 | } 8 | 9 | weak_alias(remainderf, dremf); 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/remainderl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 5 | long double remainderl(long double x, long double y) 6 | { 7 | return remainder(x, y); 8 | } 9 | #else 10 | long double remainderl(long double x, long double y) 11 | { 12 | int q; 13 | return remquol(x, y, &q); 14 | } 15 | #endif 16 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/rint.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 6 | #define EPS DBL_EPSILON 7 | #elif FLT_EVAL_METHOD==2 8 | #define EPS LDBL_EPSILON 9 | #endif 10 | static const double_t toint = 1/EPS; 11 | 12 | double rint(double x) 13 | { 14 | union {double f; uint64_t i;} u = {x}; 15 | int e = u.i>>52 & 0x7ff; 16 | int s = u.i>>63; 17 | double_t y; 18 | 19 | if (e >= 0x3ff+52) 20 | return x; 21 | if (s) 22 | y = x - toint + toint; 23 | else 24 | y = x + toint - toint; 25 | if (y == 0) 26 | return s ? -0.0 : 0; 27 | return y; 28 | } 29 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/rintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #if FLT_EVAL_METHOD==0 6 | #define EPS FLT_EPSILON 7 | #elif FLT_EVAL_METHOD==1 8 | #define EPS DBL_EPSILON 9 | #elif FLT_EVAL_METHOD==2 10 | #define EPS LDBL_EPSILON 11 | #endif 12 | static const float_t toint = 1/EPS; 13 | 14 | float rintf(float x) 15 | { 16 | union {float f; uint32_t i;} u = {x}; 17 | int e = u.i>>23 & 0xff; 18 | int s = u.i>>31; 19 | float_t y; 20 | 21 | if (e >= 0x7f+23) 22 | return x; 23 | if (s) 24 | y = x - toint + toint; 25 | else 26 | y = x + toint - toint; 27 | if (y == 0) 28 | return s ? -0.0f : 0.0f; 29 | return y; 30 | } 31 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/rintl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double rintl(long double x) 5 | { 6 | return rint(x); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | 10 | static const long double toint = 1/LDBL_EPSILON; 11 | 12 | long double rintl(long double x) 13 | { 14 | union ldshape u = {x}; 15 | int e = u.i.se & 0x7fff; 16 | int s = u.i.se >> 15; 17 | long double y; 18 | 19 | if (e >= 0x3fff+LDBL_MANT_DIG-1) 20 | return x; 21 | if (s) 22 | y = x - toint + toint; 23 | else 24 | y = x + toint - toint; 25 | if (y == 0) 26 | return 0*x; 27 | return y; 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/round.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1 4 | #define EPS DBL_EPSILON 5 | #elif FLT_EVAL_METHOD==2 6 | #define EPS LDBL_EPSILON 7 | #endif 8 | static const double_t toint = 1/EPS; 9 | 10 | double round(double x) 11 | { 12 | union {double f; uint64_t i;} u = {x}; 13 | int e = u.i >> 52 & 0x7ff; 14 | double_t y; 15 | 16 | if (e >= 0x3ff+52) 17 | return x; 18 | if (u.i >> 63) 19 | x = -x; 20 | if (e < 0x3ff-1) { 21 | /* raise inexact if x!=0 */ 22 | FORCE_EVAL(x + toint); 23 | return 0*u.f; 24 | } 25 | y = x + toint - toint - x; 26 | if (y > 0.5) 27 | y = y + x - 1; 28 | else if (y <= -0.5) 29 | y = y + x + 1; 30 | else 31 | y = y + x; 32 | if (u.i >> 63) 33 | y = -y; 34 | return y; 35 | } 36 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/roundf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if FLT_EVAL_METHOD==0 4 | #define EPS FLT_EPSILON 5 | #elif FLT_EVAL_METHOD==1 6 | #define EPS DBL_EPSILON 7 | #elif FLT_EVAL_METHOD==2 8 | #define EPS LDBL_EPSILON 9 | #endif 10 | static const float_t toint = 1/EPS; 11 | 12 | float roundf(float x) 13 | { 14 | union {float f; uint32_t i;} u = {x}; 15 | int e = u.i >> 23 & 0xff; 16 | float_t y; 17 | 18 | if (e >= 0x7f+23) 19 | return x; 20 | if (u.i >> 31) 21 | x = -x; 22 | if (e < 0x7f-1) { 23 | FORCE_EVAL(x + toint); 24 | return 0*u.f; 25 | } 26 | y = x + toint - toint - x; 27 | if (y > 0.5f) 28 | y = y + x - 1; 29 | else if (y <= -0.5f) 30 | y = y + x + 1; 31 | else 32 | y = y + x; 33 | if (u.i >> 31) 34 | y = -y; 35 | return y; 36 | } 37 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/roundl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double roundl(long double x) 5 | { 6 | return round(x); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | 10 | static const long double toint = 1/LDBL_EPSILON; 11 | 12 | long double roundl(long double x) 13 | { 14 | union ldshape u = {x}; 15 | int e = u.i.se & 0x7fff; 16 | long double y; 17 | 18 | if (e >= 0x3fff+LDBL_MANT_DIG-1) 19 | return x; 20 | if (u.i.se >> 15) 21 | x = -x; 22 | if (e < 0x3fff-1) { 23 | FORCE_EVAL(x + toint); 24 | return 0*u.f; 25 | } 26 | y = x + toint - toint - x; 27 | if (y > 0.5) 28 | y = y + x - 1; 29 | else if (y <= -0.5) 30 | y = y + x + 1; 31 | else 32 | y = y + x; 33 | if (u.i.se >> 15) 34 | y = -y; 35 | return y; 36 | } 37 | #endif 38 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/scalbln.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | double scalbln(double x, long n) 5 | { 6 | if (n > INT_MAX) 7 | n = INT_MAX; 8 | else if (n < INT_MIN) 9 | n = INT_MIN; 10 | return scalbn(x, n); 11 | } 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/scalblnf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float scalblnf(float x, long n) 5 | { 6 | if (n > INT_MAX) 7 | n = INT_MAX; 8 | else if (n < INT_MIN) 9 | n = INT_MIN; 10 | return scalbnf(x, n); 11 | } 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/scalblnl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 6 | long double scalblnl(long double x, long n) 7 | { 8 | return scalbln(x, n); 9 | } 10 | #else 11 | long double scalblnl(long double x, long n) 12 | { 13 | if (n > INT_MAX) 14 | n = INT_MAX; 15 | else if (n < INT_MIN) 16 | n = INT_MIN; 17 | return scalbnl(x, n); 18 | } 19 | #endif 20 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/scalbn.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | double scalbn(double x, int n) 5 | { 6 | union {double f; uint64_t i;} u; 7 | double_t y = x; 8 | 9 | if (n > 1023) { 10 | y *= 0x1p1023; 11 | n -= 1023; 12 | if (n > 1023) { 13 | y *= 0x1p1023; 14 | n -= 1023; 15 | if (n > 1023) 16 | n = 1023; 17 | } 18 | } else if (n < -1022) { 19 | /* make sure final n < -53 to avoid double 20 | rounding in the subnormal range */ 21 | y *= 0x1p-1022 * 0x1p53; 22 | n += 1022 - 53; 23 | if (n < -1022) { 24 | y *= 0x1p-1022 * 0x1p53; 25 | n += 1022 - 53; 26 | if (n < -1022) 27 | n = -1022; 28 | } 29 | } 30 | u.i = (uint64_t)(0x3ff+n)<<52; 31 | x = y * u.f; 32 | return x; 33 | } 34 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/scalbnf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float scalbnf(float x, int n) 5 | { 6 | union {float f; uint32_t i;} u; 7 | float_t y = x; 8 | 9 | if (n > 127) { 10 | y *= 0x1p127f; 11 | n -= 127; 12 | if (n > 127) { 13 | y *= 0x1p127f; 14 | n -= 127; 15 | if (n > 127) 16 | n = 127; 17 | } 18 | } else if (n < -126) { 19 | y *= 0x1p-126f * 0x1p24f; 20 | n += 126 - 24; 21 | if (n < -126) { 22 | y *= 0x1p-126f * 0x1p24f; 23 | n += 126 - 24; 24 | if (n < -126) 25 | n = -126; 26 | } 27 | } 28 | u.i = (uint32_t)(0x7f+n)<<23; 29 | x = y * u.f; 30 | return x; 31 | } 32 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/scalbnl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double scalbnl(long double x, int n) 5 | { 6 | return scalbn(x, n); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | long double scalbnl(long double x, int n) 10 | { 11 | union ldshape u; 12 | 13 | if (n > 16383) { 14 | x *= 0x1p16383L; 15 | n -= 16383; 16 | if (n > 16383) { 17 | x *= 0x1p16383L; 18 | n -= 16383; 19 | if (n > 16383) 20 | n = 16383; 21 | } 22 | } else if (n < -16382) { 23 | x *= 0x1p-16382L * 0x1p113L; 24 | n += 16382 - 113; 25 | if (n < -16382) { 26 | x *= 0x1p-16382L * 0x1p113L; 27 | n += 16382 - 113; 28 | if (n < -16382) 29 | n = -16382; 30 | } 31 | } 32 | u.f = 1.0; 33 | u.i.se = 0x3fff + n; 34 | return x * u.f; 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/signgam.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libm.h" 3 | 4 | int __signgam = 0; 5 | 6 | weak_alias(__signgam, signgam); 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/significand.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | double significand(double x) 5 | { 6 | return scalbn(x, -ilogb(x)); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/significandf.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | float significandf(float x) 5 | { 6 | return scalbnf(x, -ilogbf(x)); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/sinh.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | /* sinh(x) = (exp(x) - 1/exp(x))/2 4 | * = (exp(x)-1 + (exp(x)-1)/exp(x))/2 5 | * = x + x^3/6 + o(x^5) 6 | */ 7 | double sinh(double x) 8 | { 9 | union {double f; uint64_t i;} u = {.f = x}; 10 | uint32_t w; 11 | double t, h, absx; 12 | 13 | h = 0.5; 14 | if (u.i >> 63) 15 | h = -h; 16 | /* |x| */ 17 | u.i &= (uint64_t)-1/2; 18 | absx = u.f; 19 | w = u.i >> 32; 20 | 21 | /* |x| < log(DBL_MAX) */ 22 | if (w < 0x40862e42) { 23 | t = expm1(absx); 24 | if (w < 0x3ff00000) { 25 | if (w < 0x3ff00000 - (26<<20)) 26 | /* note: inexact and underflow are raised by expm1 */ 27 | /* note: this branch avoids spurious underflow */ 28 | return x; 29 | return h*(2*t - t*t/(t+1)); 30 | } 31 | /* note: |x|>log(0x1p26)+eps could be just h*exp(x) */ 32 | return h*(t + t/(t+1)); 33 | } 34 | 35 | /* |x| > log(DBL_MAX) or nan */ 36 | /* note: the result is stored to handle overflow */ 37 | t = __expo2(absx, 2*h); 38 | return t; 39 | } 40 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/sinhf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float sinhf(float x) 4 | { 5 | union {float f; uint32_t i;} u = {.f = x}; 6 | uint32_t w; 7 | float t, h, absx; 8 | 9 | h = 0.5; 10 | if (u.i >> 31) 11 | h = -h; 12 | /* |x| */ 13 | u.i &= 0x7fffffff; 14 | absx = u.f; 15 | w = u.i; 16 | 17 | /* |x| < log(FLT_MAX) */ 18 | if (w < 0x42b17217) { 19 | t = expm1f(absx); 20 | if (w < 0x3f800000) { 21 | if (w < 0x3f800000 - (12<<23)) 22 | return x; 23 | return h*(2*t - t*t/(t+1)); 24 | } 25 | return h*(t + t/(t+1)); 26 | } 27 | 28 | /* |x| > logf(FLT_MAX) or nan */ 29 | t = __expo2f(absx, 2*h); 30 | return t; 31 | } 32 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/sinl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double sinl(long double x) 5 | { 6 | return sin(x); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | long double sinl(long double x) 10 | { 11 | union ldshape u = {x}; 12 | unsigned n; 13 | long double y[2], hi, lo; 14 | 15 | u.i.se &= 0x7fff; 16 | if (u.i.se == 0x7fff) 17 | return x - x; 18 | if (u.f < M_PI_4) { 19 | if (u.i.se < 0x3fff - LDBL_MANT_DIG/2) { 20 | /* raise inexact if x!=0 and underflow if subnormal */ 21 | FORCE_EVAL(u.i.se == 0 ? x*0x1p-120f : x+0x1p120f); 22 | return x; 23 | } 24 | return __sinl(x, 0.0, 0); 25 | } 26 | n = __rem_pio2l(x, y); 27 | hi = y[0]; 28 | lo = y[1]; 29 | switch (n & 3) { 30 | case 0: 31 | return __sinl(hi, lo, 1); 32 | case 1: 33 | return __cosl(hi, lo); 34 | case 2: 35 | return -__sinl(hi, lo, 1); 36 | case 3: 37 | default: 38 | return -__cosl(hi, lo); 39 | } 40 | } 41 | #endif 42 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/sqrt_data.h: -------------------------------------------------------------------------------- 1 | #ifndef _SQRT_DATA_H 2 | #define _SQRT_DATA_H 3 | 4 | #include 5 | #include 6 | 7 | /* if x in [1,2): i = (int)(64*x); 8 | if x in [2,4): i = (int)(32*x-64); 9 | __rsqrt_tab[i]*2^-16 is estimating 1/sqrt(x) with small relative error: 10 | |__rsqrt_tab[i]*0x1p-16*sqrt(x) - 1| < -0x1.fdp-9 < 2^-8 */ 11 | extern hidden const uint16_t __rsqrt_tab[128]; 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/tanhf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float tanhf(float x) 4 | { 5 | union {float f; uint32_t i;} u = {.f = x}; 6 | uint32_t w; 7 | int sign; 8 | float t; 9 | 10 | /* x = |x| */ 11 | sign = u.i >> 31; 12 | u.i &= 0x7fffffff; 13 | x = u.f; 14 | w = u.i; 15 | 16 | if (w > 0x3f0c9f54) { 17 | /* |x| > log(3)/2 ~= 0.5493 or nan */ 18 | if (w > 0x41200000) { 19 | /* |x| > 10 */ 20 | t = 1 + 0/x; 21 | } else { 22 | t = expm1f(2*x); 23 | t = 1 - 2/(t+2); 24 | } 25 | } else if (w > 0x3e82c578) { 26 | /* |x| > log(5/3)/2 ~= 0.2554 */ 27 | t = expm1f(2*x); 28 | t = t/(t+2); 29 | } else if (w >= 0x00800000) { 30 | /* |x| >= 0x1p-126 */ 31 | t = expm1f(-2*x); 32 | t = -t/(t+2); 33 | } else { 34 | /* |x| is subnormal */ 35 | FORCE_EVAL(x*x); 36 | t = x; 37 | } 38 | return sign ? -t : t; 39 | } 40 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/tanl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double tanl(long double x) 5 | { 6 | return tan(x); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | long double tanl(long double x) 10 | { 11 | union ldshape u = {x}; 12 | long double y[2]; 13 | unsigned n; 14 | 15 | u.i.se &= 0x7fff; 16 | if (u.i.se == 0x7fff) 17 | return x - x; 18 | if (u.f < M_PI_4) { 19 | if (u.i.se < 0x3fff - LDBL_MANT_DIG/2) { 20 | /* raise inexact if x!=0 and underflow if subnormal */ 21 | FORCE_EVAL(u.i.se == 0 ? x*0x1p-120f : x+0x1p120f); 22 | return x; 23 | } 24 | return __tanl(x, 0, 0); 25 | } 26 | n = __rem_pio2l(x, y); 27 | return __tanl(y[0], y[1], n&1); 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/tgammaf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float tgammaf(float x) 4 | { 5 | return tgamma(x); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/trunc.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | double trunc(double x) 4 | { 5 | union {double f; uint64_t i;} u = {x}; 6 | int e = (int)(u.i >> 52 & 0x7ff) - 0x3ff + 12; 7 | uint64_t m; 8 | 9 | if (e >= 52 + 12) 10 | return x; 11 | if (e < 12) 12 | e = 1; 13 | m = -1ULL >> e; 14 | if ((u.i & m) == 0) 15 | return x; 16 | FORCE_EVAL(x + 0x1p120f); 17 | u.i &= ~m; 18 | return u.f; 19 | } 20 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/truncf.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | float truncf(float x) 4 | { 5 | union {float f; uint32_t i;} u = {x}; 6 | int e = (int)(u.i >> 23 & 0xff) - 0x7f + 9; 7 | uint32_t m; 8 | 9 | if (e >= 23 + 9) 10 | return x; 11 | if (e < 9) 12 | e = 1; 13 | m = -1U >> e; 14 | if ((u.i & m) == 0) 15 | return x; 16 | FORCE_EVAL(x + 0x1p120f); 17 | u.i &= ~m; 18 | return u.f; 19 | } 20 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/truncl.c: -------------------------------------------------------------------------------- 1 | #include "libm.h" 2 | 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4 | long double truncl(long double x) 5 | { 6 | return trunc(x); 7 | } 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 9 | 10 | static const long double toint = 1/LDBL_EPSILON; 11 | 12 | long double truncl(long double x) 13 | { 14 | union ldshape u = {x}; 15 | int e = u.i.se & 0x7fff; 16 | int s = u.i.se >> 15; 17 | long double y; 18 | 19 | if (e >= 0x3fff+LDBL_MANT_DIG-1) 20 | return x; 21 | if (e <= 0x3fff-1) { 22 | FORCE_EVAL(x + 0x1p120f); 23 | return x*0; 24 | } 25 | /* y = int(|x|) - |x|, where int(|x|) is an integer neighbor of |x| */ 26 | if (s) 27 | x = -x; 28 | y = x + toint - toint - x; 29 | if (y > 0) 30 | y -= 1; 31 | x += y; 32 | return s ? -x : x; 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/__invtrigl.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/__invtrigl.s -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/acosl.s: -------------------------------------------------------------------------------- 1 | # see ../i386/acos.s 2 | 3 | .global acosl 4 | acosl: 5 | fldt 8(%rsp) 6 | 1: fld %st(0) 7 | fld1 8 | fsub %st(0),%st(1) 9 | fadd %st(2) 10 | fmulp 11 | fsqrt 12 | fabs 13 | fxch %st(1) 14 | fpatan 15 | ret 16 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/asinl.s: -------------------------------------------------------------------------------- 1 | .global asinl 2 | asinl: 3 | fldt 8(%rsp) 4 | 1: fld %st(0) 5 | fld1 6 | fsub %st(0),%st(1) 7 | fadd %st(2) 8 | fmulp 9 | fsqrt 10 | fpatan 11 | ret 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/atan2l.s: -------------------------------------------------------------------------------- 1 | .global atan2l 2 | atan2l: 3 | fldt 8(%rsp) 4 | fldt 24(%rsp) 5 | fpatan 6 | ret 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/atanl.s: -------------------------------------------------------------------------------- 1 | .global atanl 2 | atanl: 3 | fldt 8(%rsp) 4 | fld1 5 | fpatan 6 | ret 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/ceill.s: -------------------------------------------------------------------------------- 1 | # see floorl.s 2 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/expm1l.s: -------------------------------------------------------------------------------- 1 | # see exp2l.s 2 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double fabs(double x) 4 | { 5 | double t; 6 | __asm__ ("pcmpeqd %0, %0" : "=x"(t)); // t = ~0 7 | __asm__ ("psrlq $1, %0" : "+x"(t)); // t >>= 1 8 | __asm__ ("andps %1, %0" : "+x"(x) : "x"(t)); // x &= t 9 | return x; 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabsf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float fabsf(float x) 4 | { 5 | float t; 6 | __asm__ ("pcmpeqd %0, %0" : "=x"(t)); // t = ~0 7 | __asm__ ("psrld $1, %0" : "+x"(t)); // t >>= 1 8 | __asm__ ("andps %1, %0" : "+x"(x) : "x"(t)); // x &= t 9 | return x; 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fabsl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double fabsl(long double x) 4 | { 5 | __asm__ ("fabs" : "+t"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/floorl.s: -------------------------------------------------------------------------------- 1 | .global floorl 2 | floorl: 3 | fldt 8(%rsp) 4 | 1: mov $0x7,%al 5 | 1: fstcw 8(%rsp) 6 | mov 9(%rsp),%ah 7 | mov %al,9(%rsp) 8 | fldcw 8(%rsp) 9 | frndint 10 | mov %ah,9(%rsp) 11 | fldcw 8(%rsp) 12 | ret 13 | 14 | .global ceill 15 | ceill: 16 | fldt 8(%rsp) 17 | mov $0xb,%al 18 | jmp 1b 19 | 20 | .global truncl 21 | truncl: 22 | fldt 8(%rsp) 23 | mov $0xf,%al 24 | jmp 1b 25 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fma.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if __FMA__ 4 | 5 | double fma(double x, double y, double z) 6 | { 7 | __asm__ ("vfmadd132sd %1, %2, %0" : "+x" (x) : "x" (y), "x" (z)); 8 | return x; 9 | } 10 | 11 | #elif __FMA4__ 12 | 13 | double fma(double x, double y, double z) 14 | { 15 | __asm__ ("vfmaddsd %3, %2, %1, %0" : "=x" (x) : "x" (x), "x" (y), "x" (z)); 16 | return x; 17 | } 18 | 19 | #else 20 | 21 | #include "../fma.c" 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fmaf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if __FMA__ 4 | 5 | float fmaf(float x, float y, float z) 6 | { 7 | __asm__ ("vfmadd132ss %1, %2, %0" : "+x" (x) : "x" (y), "x" (z)); 8 | return x; 9 | } 10 | 11 | #elif __FMA4__ 12 | 13 | float fmaf(float x, float y, float z) 14 | { 15 | __asm__ ("vfmaddss %3, %2, %1, %0" : "=x" (x) : "x" (x), "x" (y), "x" (z)); 16 | return x; 17 | } 18 | 19 | #else 20 | 21 | #include "../fmaf.c" 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/fmodl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double fmodl(long double x, long double y) 4 | { 5 | unsigned short fpsr; 6 | do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); 7 | while (fpsr & 0x400); 8 | return x; 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llrint(double x) 4 | { 5 | long long r; 6 | __asm__ ("cvtsd2si %1, %0" : "=r"(r) : "x"(x)); 7 | return r; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llrintf(float x) 4 | { 5 | long long r; 6 | __asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x)); 7 | return r; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/llrintl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llrintl(long double x) 4 | { 5 | long long r; 6 | __asm__ ("fistpll %0" : "=m"(r) : "t"(x) : "st"); 7 | return r; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log10l.s: -------------------------------------------------------------------------------- 1 | .global log10l 2 | log10l: 3 | fldlg2 4 | fldt 8(%rsp) 5 | fyl2x 6 | ret 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log1pl.s: -------------------------------------------------------------------------------- 1 | .global log1pl 2 | log1pl: 3 | mov 14(%rsp),%eax 4 | fldln2 5 | and $0x7fffffff,%eax 6 | fldt 8(%rsp) 7 | cmp $0x3ffd9400,%eax 8 | ja 1f 9 | fyl2xp1 10 | ret 11 | 1: fld1 12 | faddp 13 | fyl2x 14 | ret 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/log2l.s: -------------------------------------------------------------------------------- 1 | .global log2l 2 | log2l: 3 | fld1 4 | fldt 8(%rsp) 5 | fyl2x 6 | ret 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/logl.s: -------------------------------------------------------------------------------- 1 | .global logl 2 | logl: 3 | fldln2 4 | fldt 8(%rsp) 5 | fyl2x 6 | ret 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lrint(double x) 4 | { 5 | long r; 6 | __asm__ ("cvtsd2si %1, %0" : "=r"(r) : "x"(x)); 7 | return r; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lrintf(float x) 4 | { 5 | long r; 6 | __asm__ ("cvtss2si %1, %0" : "=r"(r) : "x"(x)); 7 | return r; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/lrintl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long lrintl(long double x) 4 | { 5 | long r; 6 | __asm__ ("fistpll %0" : "=m"(r) : "t"(x) : "st"); 7 | return r; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/remainderl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double remainderl(long double x, long double y) 4 | { 5 | unsigned short fpsr; 6 | do __asm__ ("fprem1; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y)); 7 | while (fpsr & 0x400); 8 | return x; 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/rintl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double rintl(long double x) 4 | { 5 | __asm__ ("frndint" : "+t"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrt.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double sqrt(double x) 4 | { 5 | __asm__ ("sqrtsd %1, %0" : "=x"(x) : "x"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrtf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float sqrtf(float x) 4 | { 5 | __asm__ ("sqrtss %1, %0" : "=x"(x) : "x"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/sqrtl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long double sqrtl(long double x) 4 | { 5 | __asm__ ("fsqrt" : "+t"(x)); 6 | return x; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/math/x86_64/truncl.s: -------------------------------------------------------------------------------- 1 | # see floorl.s 2 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/misc/a64l.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static const char digits[] = 6 | "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 7 | 8 | long a64l(const char *s) 9 | { 10 | int e; 11 | uint32_t x = 0; 12 | for (e=0; e<36 && *s; e+=6, s++) { 13 | const char *d = strchr(digits, *s); 14 | if (!d) break; 15 | x |= (uint32_t)(d-digits)<>=6) 26 | *p = digits[x&63]; 27 | *p = 0; 28 | return s; 29 | } 30 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/misc/basename.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *basename(char *s) 5 | { 6 | size_t i; 7 | if (!s || !*s) return "."; 8 | i = strlen(s)-1; 9 | for (; i&&s[i]=='/'; i--) s[i] = 0; 10 | for (; i&&s[i-1]!='/'; i--); 11 | return s+i; 12 | } 13 | 14 | weak_alias(basename, __xpg_basename); 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/misc/dirname.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *dirname(char *s) 5 | { 6 | size_t i; 7 | if (!s || !*s) return "."; 8 | i = strlen(s)-1; 9 | for (; s[i]=='/'; i--) if (!i) return "/"; 10 | for (; s[i]!='/'; i--) if (!i) return "."; 11 | for (; s[i]=='/'; i--) if (!i) return "/"; 12 | s[i+1] = 0; 13 | return s; 14 | } 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/prng/rand.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static uint64_t seed; 5 | 6 | void srand(unsigned s) 7 | { 8 | seed = s-1; 9 | } 10 | 11 | int rand(void) 12 | { 13 | seed = 6364136223846793005ULL*seed + 1; 14 | return seed>>33; 15 | } 16 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/setjmp/x86_64/longjmp.s: -------------------------------------------------------------------------------- 1 | /* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ 2 | .global _longjmp 3 | .global longjmp 4 | .type _longjmp,@function 5 | .type longjmp,@function 6 | _longjmp: 7 | longjmp: 8 | xor %eax,%eax 9 | cmp $1,%esi /* CF = val ? 0 : 1 */ 10 | adc %esi,%eax /* eax = val + !val */ 11 | mov (%rdi),%rbx /* rdi is the jmp_buf, restore regs from it */ 12 | mov 8(%rdi),%rbp 13 | mov 16(%rdi),%r12 14 | mov 24(%rdi),%r13 15 | mov 32(%rdi),%r14 16 | mov 40(%rdi),%r15 17 | mov 48(%rdi),%rsp 18 | jmp *56(%rdi) /* goto saved address without altering rsp */ -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/setjmp/x86_64/setjmp.s: -------------------------------------------------------------------------------- 1 | /* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ 2 | .global __setjmp 3 | .global _setjmp 4 | .global setjmp 5 | .type __setjmp,@function 6 | .type _setjmp,@function 7 | .type setjmp,@function 8 | __setjmp: 9 | _setjmp: 10 | setjmp: 11 | mov %rbx,(%rdi) /* rdi is jmp_buf, move registers onto it */ 12 | mov %rbp,8(%rdi) 13 | mov %r12,16(%rdi) 14 | mov %r13,24(%rdi) 15 | mov %r14,32(%rdi) 16 | mov %r15,40(%rdi) 17 | lea 8(%rsp),%rdx /* this is our rsp WITHOUT current ret addr */ 18 | mov %rdx,48(%rdi) 19 | mov (%rsp),%rdx /* save return addr ptr for new rip */ 20 | mov %rdx,56(%rdi) 21 | xor %eax,%eax /* always return 0 */ 22 | ret -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdio/__toread.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int __toread(FILE *f) 4 | { 5 | f->mode |= f->mode-1; 6 | if (f->wpos != f->wbase) f->write(f, 0, 0); 7 | f->wpos = f->wbase = f->wend = 0; 8 | if (f->flags & F_NORD) { 9 | f->flags |= F_ERR; 10 | return EOF; 11 | } 12 | f->rpos = f->rend = f->buf + f->buf_size; 13 | return (f->flags & F_EOF) ? EOF : 0; 14 | } 15 | 16 | #ifndef HYPERLIGHT 17 | hidden void __toread_needs_stdio_exit() 18 | { 19 | __stdio_exit_needed(); 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdio/__towrite.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | int __towrite(FILE *f) 4 | { 5 | f->mode |= f->mode-1; 6 | if (f->flags & F_NOWR) { 7 | f->flags |= F_ERR; 8 | return EOF; 9 | } 10 | /* Clear read buffer (easier than summoning nasal demons) */ 11 | f->rpos = f->rend = 0; 12 | 13 | /* Activate write through the buffer. */ 14 | f->wpos = f->wbase = f->buf; 15 | f->wend = f->buf + f->buf_size; 16 | 17 | return 0; 18 | } 19 | 20 | #ifndef HYPERLIGHT 21 | hidden void __towrite_needs_stdio_exit() 22 | { 23 | __stdio_exit_needed(); 24 | } 25 | #endif 26 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdio/__uflow.c: -------------------------------------------------------------------------------- 1 | #include "stdio_impl.h" 2 | 3 | /* This function assumes it will never be called if there is already 4 | * data buffered for reading. */ 5 | 6 | int __uflow(FILE *f) 7 | { 8 | unsigned char c; 9 | if (!__toread(f) && f->read(f, &c, 1)==1) return c; 10 | return EOF; 11 | } 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/abs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int abs(int a) 4 | { 5 | return a>0 ? a : -a; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/atof.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | double atof(const char *s) 4 | { 5 | return strtod(s, 0); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/atoi.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int atoi(const char *s) 5 | { 6 | int n=0, neg=0; 7 | while (isspace(*s)) s++; 8 | switch (*s) { 9 | case '-': neg=1; 10 | case '+': s++; 11 | } 12 | /* Compute n as a negative number to avoid overflow on INT_MIN */ 13 | while (isdigit(*s)) 14 | n = 10*n - (*s++ - '0'); 15 | return neg ? n : -n; 16 | } 17 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/atol.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | long atol(const char *s) 5 | { 6 | long n=0; 7 | int neg=0; 8 | while (isspace(*s)) s++; 9 | switch (*s) { 10 | case '-': neg=1; 11 | case '+': s++; 12 | } 13 | /* Compute n as a negative number to avoid overflow on LONG_MIN */ 14 | while (isdigit(*s)) 15 | n = 10*n - (*s++ - '0'); 16 | return neg ? n : -n; 17 | } 18 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/atoll.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | long long atoll(const char *s) 5 | { 6 | long long n=0; 7 | int neg=0; 8 | while (isspace(*s)) s++; 9 | switch (*s) { 10 | case '-': neg=1; 11 | case '+': s++; 12 | } 13 | /* Compute n as a negative number to avoid overflow on LLONG_MIN */ 14 | while (isdigit(*s)) 15 | n = 10*n - (*s++ - '0'); 16 | return neg ? n : -n; 17 | } 18 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/bsearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void *bsearch(const void *key, const void *base, size_t nel, size_t width, int (*cmp)(const void *, const void *)) 4 | { 5 | void *try; 6 | int sign; 7 | while (nel > 0) { 8 | try = (char *)base + width*(nel/2); 9 | sign = cmp(key, try); 10 | if (sign < 0) { 11 | nel /= 2; 12 | } else if (sign > 0) { 13 | base = (char *)try + width; 14 | nel -= nel/2+1; 15 | } else { 16 | return try; 17 | } 18 | } 19 | return NULL; 20 | } 21 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/div.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | div_t div(int num, int den) 4 | { 5 | return (div_t){ num/den, num%den }; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/ecvt.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include "printf.h" 5 | 6 | char *ecvt(double x, int n, int *dp, int *sign) 7 | { 8 | static char buf[16]; 9 | char tmp[32]; 10 | int i, j; 11 | 12 | if (n-1U > 15) n = 15; 13 | sprintf(tmp, "%.*e", n-1, x); 14 | i = *sign = (tmp[0]=='-'); 15 | for (j=0; tmp[i]!='e'; j+=(tmp[i++]!='.')) 16 | buf[j] = tmp[i]; 17 | buf[j] = 0; 18 | *dp = atoi(tmp+i+1)+1; 19 | 20 | return buf; 21 | } 22 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/fcvt.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include 5 | #include "printf.h" 6 | 7 | char *fcvt(double x, int n, int *dp, int *sign) 8 | { 9 | char tmp[1500]; 10 | int i, lz; 11 | 12 | if (n > 1400U) n = 1400; 13 | sprintf(tmp, "%.*f", n, x); 14 | i = (tmp[0] == '-'); 15 | if (tmp[i] == '0') lz = strspn(tmp+i+2, "0"); 16 | else lz = -(int)strcspn(tmp+i, "."); 17 | 18 | if (n<=lz) { 19 | *sign = i; 20 | *dp = 1; 21 | if (n>14U) n = 14; 22 | return "000000000000000"+14-n; 23 | } 24 | 25 | return ecvt(x, n-lz, dp, sign); 26 | } 27 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/gcvt.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include "printf.h" 5 | 6 | char *gcvt(double x, int n, char *b) 7 | { 8 | sprintf(b, "%.*g", n, x); 9 | return b; 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/imaxabs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | intmax_t imaxabs(intmax_t a) 4 | { 5 | return a>0 ? a : -a; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/imaxdiv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | imaxdiv_t imaxdiv(intmax_t num, intmax_t den) 4 | { 5 | return (imaxdiv_t){ num/den, num%den }; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/labs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long labs(long a) 4 | { 5 | return a>0 ? a : -a; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/ldiv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | ldiv_t ldiv(long num, long den) 4 | { 5 | return (ldiv_t){ num/den, num%den }; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/llabs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | long long llabs(long long a) 4 | { 5 | return a>0 ? a : -a; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/lldiv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | lldiv_t lldiv(long long num, long long den) 4 | { 5 | return (lldiv_t){ num/den, num%den }; 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/qsort_nr.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | 4 | typedef int (*cmpfun)(const void *, const void *); 5 | 6 | static int wrapper_cmp(const void *v1, const void *v2, void *cmp) 7 | { 8 | return ((cmpfun)cmp)(v1, v2); 9 | } 10 | 11 | void qsort(void *base, size_t nel, size_t width, cmpfun cmp) 12 | { 13 | __qsort_r(base, nel, width, wrapper_cmp, (void *)cmp); 14 | } 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/stdlib/strtod.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "shgetc.h" 3 | #include "floatscan.h" 4 | #include "stdio_impl.h" 5 | 6 | static long double strtox(const char *s, char **p, int prec) 7 | { 8 | FILE f; 9 | sh_fromstring(&f, s); 10 | shlim(&f, 0); 11 | long double y = __floatscan(&f, prec, 1); 12 | off_t cnt = shcnt(&f); 13 | if (p) *p = cnt ? (char *)s + cnt : (char *)s; 14 | return y; 15 | } 16 | 17 | float strtof(const char *restrict s, char **restrict p) 18 | { 19 | return strtox(s, p, 0); 20 | } 21 | 22 | double strtod(const char *restrict s, char **restrict p) 23 | { 24 | return strtox(s, p, 1); 25 | } 26 | 27 | long double strtold(const char *restrict s, char **restrict p) 28 | { 29 | return strtox(s, p, 2); 30 | } 31 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/bcmp.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | 5 | int bcmp(const void *s1, const void *s2, size_t n) 6 | { 7 | return memcmp(s1, s2, n); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/bcopy.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | 5 | void bcopy(const void *s1, void *s2, size_t n) 6 | { 7 | memmove(s2, s1, n); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/bzero.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | 5 | void bzero(void *s, size_t n) 6 | { 7 | memset(s, 0, n); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/explicit_bzero.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | 4 | void explicit_bzero(void *d, size_t n) 5 | { 6 | d = memset(d, 0, n); 7 | __asm__ __volatile__ ("" : : "r"(d) : "memory"); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/index.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | 5 | char *index(const char *s, int c) 6 | { 7 | return strchr(s, c); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/memchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define SS (sizeof(size_t)) 6 | #define ALIGN (sizeof(size_t)-1) 7 | #define ONES ((size_t)-1/UCHAR_MAX) 8 | #define HIGHS (ONES * (UCHAR_MAX/2+1)) 9 | #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) 10 | 11 | void *memchr(const void *src, int c, size_t n) 12 | { 13 | const unsigned char *s = src; 14 | c = (unsigned char)c; 15 | #ifdef __GNUC__ 16 | for (; ((uintptr_t)s & ALIGN) && n && *s != c; s++, n--); 17 | if (n && *s != c) { 18 | typedef size_t __attribute__((__may_alias__)) word; 19 | const word *w; 20 | size_t k = ONES * c; 21 | for (w = (const void *)s; n>=SS && !HASZERO(*w^k); w++, n-=SS); 22 | s = (const void *)w; 23 | } 24 | #endif 25 | for (; n && *s != c; s++, n--); 26 | return n ? (void *)s : 0; 27 | } 28 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/memcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int memcmp(const void *vl, const void *vr, size_t n) 4 | { 5 | const unsigned char *l=vl, *r=vr; 6 | for (; n && *l == *r; n--, l++, r++); 7 | return n ? *l-*r : 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/mempcpy.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | void *mempcpy(void *dest, const void *src, size_t n) 5 | { 6 | return (char *)memcpy(dest, src, n) + n; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/memrchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void *__memrchr(const void *m, int c, size_t n) 4 | { 5 | const unsigned char *s = m; 6 | c = (unsigned char)c; 7 | while (n--) if (s[n]==c) return (void *)(s+n); 8 | return 0; 9 | } 10 | 11 | weak_alias(__memrchr, memrchr); 12 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/rindex.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | 5 | char *rindex(const char *s, int c) 6 | { 7 | return strrchr(s, c); 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/stpcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define ALIGN (sizeof(size_t)) 6 | #define ONES ((size_t)-1/UCHAR_MAX) 7 | #define HIGHS (ONES * (UCHAR_MAX/2+1)) 8 | #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) 9 | 10 | char *__stpcpy(char *restrict d, const char *restrict s) 11 | { 12 | #ifdef __GNUC__ 13 | typedef size_t __attribute__((__may_alias__)) word; 14 | word *wd; 15 | const word *ws; 16 | if ((uintptr_t)s % ALIGN == (uintptr_t)d % ALIGN) { 17 | for (; (uintptr_t)s % ALIGN; s++, d++) 18 | if (!(*d=*s)) return d; 19 | wd=(void *)d; ws=(const void *)s; 20 | for (; !HASZERO(*ws); *wd++ = *ws++); 21 | d=(void *)wd; s=(const void *)ws; 22 | } 23 | #endif 24 | for (; (*d=*s); s++, d++); 25 | 26 | return d; 27 | } 28 | 29 | weak_alias(__stpcpy, stpcpy); 30 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/stpncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define ALIGN (sizeof(size_t)-1) 6 | #define ONES ((size_t)-1/UCHAR_MAX) 7 | #define HIGHS (ONES * (UCHAR_MAX/2+1)) 8 | #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) 9 | 10 | char *__stpncpy(char *restrict d, const char *restrict s, size_t n) 11 | { 12 | #ifdef __GNUC__ 13 | typedef size_t __attribute__((__may_alias__)) word; 14 | word *wd; 15 | const word *ws; 16 | if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) { 17 | for (; ((uintptr_t)s & ALIGN) && n && (*d=*s); n--, s++, d++); 18 | if (!n || !*s) goto tail; 19 | wd=(void *)d; ws=(const void *)s; 20 | for (; n>=sizeof(size_t) && !HASZERO(*ws); 21 | n-=sizeof(size_t), ws++, wd++) *wd = *ws; 22 | d=(void *)wd; s=(const void *)ws; 23 | } 24 | #endif 25 | for (; n && (*d=*s); n--, s++, d++); 26 | tail: 27 | memset(d, 0, n); 28 | return d; 29 | } 30 | 31 | weak_alias(__stpncpy, stpncpy); 32 | 33 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strcasecmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int strcasecmp(const char *_l, const char *_r) 5 | { 6 | const unsigned char *l=(void *)_l, *r=(void *)_r; 7 | for (; *l && *r && (*l == *r || tolower(*l) == tolower(*r)); l++, r++); 8 | return tolower(*l) - tolower(*r); 9 | } 10 | 11 | int __strcasecmp_l(const char *l, const char *r, locale_t loc) 12 | { 13 | return strcasecmp(l, r); 14 | } 15 | 16 | weak_alias(__strcasecmp_l, strcasecmp_l); 17 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strcasestr.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | char *strcasestr(const char *h, const char *n) 5 | { 6 | size_t l = strlen(n); 7 | for (; *h; h++) if (!strncasecmp(h, n, l)) return (char *)h; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strcat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strcat(char *restrict dest, const char *restrict src) 4 | { 5 | strcpy(dest + strlen(dest), src); 6 | return dest; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strchr(const char *s, int c) 4 | { 5 | char *r = __strchrnul(s, c); 6 | return *(unsigned char *)r == (unsigned char)c ? r : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strchrnul.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define ALIGN (sizeof(size_t)) 6 | #define ONES ((size_t)-1/UCHAR_MAX) 7 | #define HIGHS (ONES * (UCHAR_MAX/2+1)) 8 | #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) 9 | 10 | char *__strchrnul(const char *s, int c) 11 | { 12 | c = (unsigned char)c; 13 | if (!c) return (char *)s + strlen(s); 14 | 15 | #ifdef __GNUC__ 16 | typedef size_t __attribute__((__may_alias__)) word; 17 | const word *w; 18 | for (; (uintptr_t)s % ALIGN; s++) 19 | if (!*s || *(unsigned char *)s == c) return (char *)s; 20 | size_t k = ONES * c; 21 | for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w^k); w++); 22 | s = (void *)w; 23 | #endif 24 | for (; *s && *(unsigned char *)s != c; s++); 25 | return (char *)s; 26 | } 27 | 28 | weak_alias(__strchrnul, strchrnul); 29 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int strcmp(const char *l, const char *r) 4 | { 5 | for (; *l==*r && *l; l++, r++); 6 | return *(unsigned char *)l - *(unsigned char *)r; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strcpy(char *restrict dest, const char *restrict src) 4 | { 5 | __stpcpy(dest, src); 6 | return dest; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strcspn.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define BITOP(a,b,op) \ 4 | ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a)))) 5 | 6 | size_t strcspn(const char *s, const char *c) 7 | { 8 | const char *a = s; 9 | size_t byteset[32/sizeof(size_t)]; 10 | 11 | if (!c[0] || !c[1]) return __strchrnul(s, *c)-a; 12 | 13 | memset(byteset, 0, sizeof byteset); 14 | for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++); 15 | for (; *s && !BITOP(byteset, *(unsigned char *)s, &); s++); 16 | return s-a; 17 | } 18 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strdup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *strdup(const char *s) 5 | { 6 | size_t l = strlen(s); 7 | char *d = malloc(l+1); 8 | if (!d) return NULL; 9 | return memcpy(d, s, l+1); 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strerror_r.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int strerror_r(int err, char *buf, size_t buflen) 5 | { 6 | char *msg = strerror(err); 7 | size_t l = strlen(msg); 8 | if (l >= buflen) { 9 | if (buflen) { 10 | memcpy(buf, msg, buflen-1); 11 | buf[buflen-1] = 0; 12 | } 13 | return ERANGE; 14 | } 15 | memcpy(buf, msg, l+1); 16 | return 0; 17 | } 18 | 19 | weak_alias(strerror_r, __xpg_strerror_r); 20 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strlcat.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | 4 | size_t strlcat(char *d, const char *s, size_t n) 5 | { 6 | size_t l = strnlen(d, n); 7 | if (l == n) return l + strlen(s); 8 | return l + strlcpy(d+l, s, n-l); 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strlcpy.c: -------------------------------------------------------------------------------- 1 | #define _BSD_SOURCE 2 | #include 3 | #include 4 | #include 5 | 6 | #define ALIGN (sizeof(size_t)-1) 7 | #define ONES ((size_t)-1/UCHAR_MAX) 8 | #define HIGHS (ONES * (UCHAR_MAX/2+1)) 9 | #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) 10 | 11 | size_t strlcpy(char *d, const char *s, size_t n) 12 | { 13 | char *d0 = d; 14 | size_t *wd; 15 | 16 | if (!n--) goto finish; 17 | #ifdef __GNUC__ 18 | typedef size_t __attribute__((__may_alias__)) word; 19 | const word *ws; 20 | if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) { 21 | for (; ((uintptr_t)s & ALIGN) && n && (*d=*s); n--, s++, d++); 22 | if (n && *s) { 23 | wd=(void *)d; ws=(const void *)s; 24 | for (; n>=sizeof(size_t) && !HASZERO(*ws); 25 | n-=sizeof(size_t), ws++, wd++) *wd = *ws; 26 | d=(void *)wd; s=(const void *)ws; 27 | } 28 | } 29 | #endif 30 | for (; n && (*d=*s); n--, s++, d++); 31 | *d = 0; 32 | finish: 33 | return d-d0 + strlen(s); 34 | } 35 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define ALIGN (sizeof(size_t)) 6 | #define ONES ((size_t)-1/UCHAR_MAX) 7 | #define HIGHS (ONES * (UCHAR_MAX/2+1)) 8 | #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) 9 | 10 | size_t strlen(const char *s) 11 | { 12 | const char *a = s; 13 | #ifdef __GNUC__ 14 | typedef size_t __attribute__((__may_alias__)) word; 15 | const word *w; 16 | for (; (uintptr_t)s % ALIGN; s++) if (!*s) return s-a; 17 | for (w = (const void *)s; !HASZERO(*w); w++); 18 | s = (const void *)w; 19 | #endif 20 | for (; *s; s++); 21 | return s-a; 22 | } 23 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strncasecmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int strncasecmp(const char *_l, const char *_r, size_t n) 5 | { 6 | const unsigned char *l=(void *)_l, *r=(void *)_r; 7 | if (!n--) return 0; 8 | for (; *l && *r && n && (*l == *r || tolower(*l) == tolower(*r)); l++, r++, n--); 9 | return tolower(*l) - tolower(*r); 10 | } 11 | 12 | int __strncasecmp_l(const char *l, const char *r, size_t n, locale_t loc) 13 | { 14 | return strncasecmp(l, r, n); 15 | } 16 | 17 | weak_alias(__strncasecmp_l, strncasecmp_l); 18 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strncat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strncat(char *restrict d, const char *restrict s, size_t n) 4 | { 5 | char *a = d; 6 | d += strlen(d); 7 | while (n && *s) n--, *d++ = *s++; 8 | *d++ = 0; 9 | return a; 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strncmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int strncmp(const char *_l, const char *_r, size_t n) 4 | { 5 | const unsigned char *l=(void *)_l, *r=(void *)_r; 6 | if (!n--) return 0; 7 | for (; *l && *r && n && *l == *r ; l++, r++, n--); 8 | return *l - *r; 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strncpy(char *restrict d, const char *restrict s, size_t n) 4 | { 5 | __stpncpy(d, s, n); 6 | return d; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strndup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *strndup(const char *s, size_t n) 5 | { 6 | size_t l = strnlen(s, n); 7 | char *d = malloc(l+1); 8 | if (!d) return NULL; 9 | memcpy(d, s, l); 10 | d[l] = 0; 11 | return d; 12 | } 13 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strnlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t strnlen(const char *s, size_t n) 4 | { 5 | const char *p = memchr(s, 0, n); 6 | return p ? p-s : n; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strpbrk.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strpbrk(const char *s, const char *b) 4 | { 5 | s += strcspn(s, b); 6 | return *s ? (char *)s : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strrchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strrchr(const char *s, int c) 4 | { 5 | return __memrchr(s, c, strlen(s) + 1); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strsep.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | 4 | char *strsep(char **str, const char *sep) 5 | { 6 | char *s = *str, *end; 7 | if (!s) return NULL; 8 | end = s + strcspn(s, sep); 9 | if (*end) *end++ = 0; 10 | else end = 0; 11 | *str = end; 12 | return s; 13 | } 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strspn.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define BITOP(a,b,op) \ 4 | ((a)[(size_t)(b)/(8*sizeof *(a))] op (size_t)1<<((size_t)(b)%(8*sizeof *(a)))) 5 | 6 | size_t strspn(const char *s, const char *c) 7 | { 8 | const char *a = s; 9 | size_t byteset[32/sizeof(size_t)] = { 0 }; 10 | 11 | if (!c[0]) return 0; 12 | if (!c[1]) { 13 | for (; *s == *c; s++); 14 | return s-a; 15 | } 16 | 17 | for (; *c && BITOP(byteset, *(unsigned char *)c, |=); c++); 18 | for (; *s && BITOP(byteset, *(unsigned char *)s, &); s++); 19 | return s-a; 20 | } 21 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strtok.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strtok(char *restrict s, const char *restrict sep) 4 | { 5 | static char *p; 6 | if (!s && !(s = p)) return NULL; 7 | s += strspn(s, sep); 8 | if (!*s) return p = 0; 9 | p = s + strcspn(s, sep); 10 | if (*p) *p++ = 0; 11 | else p = 0; 12 | return s; 13 | } 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/strtok_r.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strtok_r(char *restrict s, const char *restrict sep, char **restrict p) 4 | { 5 | if (!s && !(s = *p)) return NULL; 6 | s += strspn(s, sep); 7 | if (!*s) return *p = 0; 8 | *p = s + strcspn(s, sep); 9 | if (**p) *(*p)++ = 0; 10 | else *p = 0; 11 | return s; 12 | } 13 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcpcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcpcpy(wchar_t *restrict d, const wchar_t *restrict s) 4 | { 5 | return wcscpy(d, s) + wcslen(s); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcpncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcpncpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n) 4 | { 5 | return wcsncpy(d, s, n) + wcsnlen(s, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcscasecmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int wcscasecmp(const wchar_t *l, const wchar_t *r) 5 | { 6 | return wcsncasecmp(l, r, -1); 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcscasecmp_l.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcscasecmp_l(const wchar_t *l, const wchar_t *r, locale_t locale) 4 | { 5 | return wcscasecmp(l, r); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcscat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcscat(wchar_t *restrict dest, const wchar_t *restrict src) 4 | { 5 | wcscpy(dest + wcslen(dest), src); 6 | return dest; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcschr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcschr(const wchar_t *s, wchar_t c) 4 | { 5 | if (!c) return (wchar_t *)s + wcslen(s); 6 | for (; *s && *s != c; s++); 7 | return *s ? (wchar_t *)s : 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcscmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcscmp(const wchar_t *l, const wchar_t *r) 4 | { 5 | for (; *l==*r && *l && *r; l++, r++); 6 | return *l < *r ? -1 : *l > *r; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcscpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcscpy(wchar_t *restrict d, const wchar_t *restrict s) 4 | { 5 | wchar_t *a = d; 6 | while ((*d++ = *s++)); 7 | return a; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcscspn.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t wcscspn(const wchar_t *s, const wchar_t *c) 4 | { 5 | const wchar_t *a; 6 | if (!c[0]) return wcslen(s); 7 | if (!c[1]) return (s=wcschr(a=s, *c)) ? s-a : wcslen(a); 8 | for (a=s; *s && !wcschr(c, *s); s++); 9 | return s-a; 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcsdup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | wchar_t *wcsdup(const wchar_t *s) 5 | { 6 | size_t l = wcslen(s); 7 | wchar_t *d = malloc((l+1)*sizeof(wchar_t)); 8 | if (!d) return NULL; 9 | return wmemcpy(d, s, l+1); 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcslen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t wcslen(const wchar_t *s) 4 | { 5 | const wchar_t *a; 6 | for (a=s; *s; s++); 7 | return s-a; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcsncasecmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int wcsncasecmp(const wchar_t *l, const wchar_t *r, size_t n) 5 | { 6 | if (!n--) return 0; 7 | for (; *l && *r && n && (*l == *r || towlower(*l) == towlower(*r)); l++, r++, n--); 8 | return towlower(*l) - towlower(*r); 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcsncasecmp_l.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcsncasecmp_l(const wchar_t *l, const wchar_t *r, size_t n, locale_t locale) 4 | { 5 | return wcsncasecmp(l, r, n); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcsncat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcsncat(wchar_t *restrict d, const wchar_t *restrict s, size_t n) 4 | { 5 | wchar_t *a = d; 6 | d += wcslen(d); 7 | while (n && *s) n--, *d++ = *s++; 8 | *d++ = 0; 9 | return a; 10 | } 11 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcsncmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcsncmp(const wchar_t *l, const wchar_t *r, size_t n) 4 | { 5 | for (; n && *l==*r && *l && *r; n--, l++, r++); 6 | return n ? (*l < *r ? -1 : *l > *r) : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcsncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcsncpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n) 4 | { 5 | wchar_t *a = d; 6 | while (n && *s) n--, *d++ = *s++; 7 | wmemset(d, 0, n); 8 | return a; 9 | } 10 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcsnlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t wcsnlen(const wchar_t *s, size_t n) 4 | { 5 | const wchar_t *z = wmemchr(s, 0, n); 6 | if (z) n = z-s; 7 | return n; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcspbrk.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcspbrk(const wchar_t *s, const wchar_t *b) 4 | { 5 | s += wcscspn(s, b); 6 | return *s ? (wchar_t *)s : NULL; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcsrchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcsrchr(const wchar_t *s, wchar_t c) 4 | { 5 | const wchar_t *p; 6 | for (p=s+wcslen(s); p>=s && *p!=c; p--); 7 | return p>=s ? (wchar_t *)p : 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcsspn.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t wcsspn(const wchar_t *s, const wchar_t *c) 4 | { 5 | const wchar_t *a; 6 | for (a=s; *s && wcschr(c, *s); s++); 7 | return s-a; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcstok.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcstok(wchar_t *restrict s, const wchar_t *restrict sep, wchar_t **restrict p) 4 | { 5 | if (!s && !(s = *p)) return NULL; 6 | s += wcsspn(s, sep); 7 | if (!*s) return *p = 0; 8 | *p = s + wcscspn(s, sep); 9 | if (**p) *(*p)++ = 0; 10 | else *p = 0; 11 | return s; 12 | } 13 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wcswcs.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wcswcs(const wchar_t *haystack, const wchar_t *needle) 4 | { 5 | return wcsstr(haystack, needle); 6 | } 7 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wmemchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n) 4 | { 5 | for (; n && *s != c; n--, s++); 6 | return n ? (wchar_t *)s : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wmemcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wmemcmp(const wchar_t *l, const wchar_t *r, size_t n) 4 | { 5 | for (; n && *l==*r; n--, l++, r++); 6 | return n ? (*l < *r ? -1 : *l > *r) : 0; 7 | } 8 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wmemcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wmemcpy(wchar_t *restrict d, const wchar_t *restrict s, size_t n) 4 | { 5 | wchar_t *a = d; 6 | while (n--) *d++ = *s++; 7 | return a; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wmemmove.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | wchar_t *wmemmove(wchar_t *d, const wchar_t *s, size_t n) 5 | { 6 | wchar_t *d0 = d; 7 | if (d == s) return d; 8 | if ((uintptr_t)d-(uintptr_t)s < n * sizeof *d) 9 | while (n--) d[n] = s[n]; 10 | else 11 | while (n--) *d++ = *s++; 12 | return d0; 13 | } 14 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/musl/src/string/wmemset.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t *wmemset(wchar_t *d, wchar_t c, size_t n) 4 | { 5 | wchar_t *ret = d; 6 | while (n--) *d++ = c; 7 | return ret; 8 | } 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/printf/.gitattributes: -------------------------------------------------------------------------------- 1 | # ignore test path 2 | test/* linguist-vendored 3 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/printf/codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "test" # ignore the test folder 3 | -------------------------------------------------------------------------------- /src/hyperlight_guest_bin/third_party/printf/printf.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/hyperlight_guest/third_party/printf/printf.c b/src/hyperlight_guest/third_party/printf/printf.c 2 | index 8a700ad..caf375a 100644 3 | --- a/src/hyperlight_guest/third_party/printf/printf.c 4 | +++ b/src/hyperlight_guest/third_party/printf/printf.c 5 | @@ -149,9 +149,7 @@ static inline void _out_null(char character, void* buffer, size_t idx, size_t ma 6 | static inline void _out_char(char character, void* buffer, size_t idx, size_t maxlen) 7 | { 8 | (void)buffer; (void)idx; (void)maxlen; 9 | - if (character) { 10 | _putchar(character); 11 | - } 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/hyperlight_guest_capi/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-unknown-none" 3 | 4 | [profile.release] 5 | panic = "abort" 6 | 7 | [profile.dev] 8 | panic = "abort" 9 | -------------------------------------------------------------------------------- /src/hyperlight_guest_capi/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hyperlight_guest_capi" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | exclude = ["/include"] 7 | 8 | [lib] 9 | crate-type = ["staticlib"] 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | hyperlight-guest = { workspace = true, default-features = false } 16 | hyperlight-guest-bin = { workspace = true, default-features = true } 17 | hyperlight-common = { workspace = true, default-features = false } 18 | log = { version = "0.4", default-features = false } 19 | 20 | [build-dependencies] 21 | cbindgen = "0.29.0" 22 | -------------------------------------------------------------------------------- /src/hyperlight_guest_capi/build.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Hyperlight Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | use std::env; 18 | 19 | fn main() { 20 | let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR should be set"); 21 | 22 | cbindgen::generate(&crate_dir) 23 | .expect("Could not generate hyperlight_guest.h") 24 | .write_to_file("include/hyperlight_guest.h"); 25 | } 26 | -------------------------------------------------------------------------------- /src/hyperlight_guest_capi/cbindgen.toml: -------------------------------------------------------------------------------- 1 | language = "C" 2 | 3 | includes = ["stdint.h", "stdbool.h", "macro.h"] 4 | no_includes = true 5 | after_includes = "#define LOG(level, message) hl_log(level, message, __LINE__, __FILE__)\n#define _alloca _alloca_wrapper" 6 | documentation = false 7 | style = "type" 8 | include_guard = "HYPERLIGHT_GUEST_H" 9 | header = "/* This file is automatically generated by cbindgen from hyperlight_guest_capi/build.rs.\n Do not modify.*/" 10 | 11 | [parse] 12 | parse_deps = true 13 | include = ["hyperlight-guest", "hyperlight-guest-bin", "log", "hyperlight-common"] 14 | extra_bindings = ["hyperlight-guest-bin"] 15 | 16 | [enum] 17 | prefix_with_name = true 18 | 19 | [export] 20 | prefix = "hl_" 21 | 22 | [export.rename] 23 | "FfiFunctionCall" = "FunctionCall" 24 | "FfiParameter" = "Parameter" 25 | "FfiParameterValue" = "ParameterValue" 26 | "FfiVec" = "Vec" 27 | 28 | -------------------------------------------------------------------------------- /src/hyperlight_guest_capi/src/lib.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Hyperlight Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #![no_std] 18 | #![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] 19 | 20 | extern crate alloc; 21 | 22 | pub mod dispatch; 23 | pub mod error; 24 | pub mod flatbuffer; 25 | pub mod logging; 26 | pub mod types; 27 | -------------------------------------------------------------------------------- /src/hyperlight_guest_capi/src/types.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Hyperlight Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | mod function_call; 18 | pub use function_call::*; 19 | 20 | mod parameter; 21 | pub use parameter::*; 22 | 23 | mod vec; 24 | pub use vec::*; 25 | -------------------------------------------------------------------------------- /src/hyperlight_host/clippy.toml: -------------------------------------------------------------------------------- 1 | disallowed-macros = [ 2 | { path = "std::assert", reason = "no asserts in release builds" }, 3 | { path = "std::assert_eq", reason = "no asserts in release builds" }, 4 | { path = "std::assert_ne", reason = "no asserts in release builds" }, 5 | { path = "std::assert_true", reason = "no asserts in release builds" }, 6 | { path = "std::assert_false", reason = "no asserts in release builds" }, 7 | ] 8 | -------------------------------------------------------------------------------- /src/hyperlight_host/examples/tracing-chrome/README.md: -------------------------------------------------------------------------------- 1 | This is an example of using the tracing-chrome tracing-subscriber. When ran, it will generate a file `trace-*.json` in the root directory. This file can then be visualized by going to `chrome://tracing` or `ui.perfetto.dev`. Both these sites can be navigated using WASD. -------------------------------------------------------------------------------- /src/hyperlight_host/examples/tracing-tracy/README.md: -------------------------------------------------------------------------------- 1 | This is an example of using the tracing-tracy tracing-subscriber. When ran, it will generate traces that can be viewed in the tracy profiler. 2 | 3 | You can run it with: 4 | 5 | ```console 6 | TRACY_NO_EXIT=1 RUST_LOG=trace cargo run --package hyperlight-host --example tracing-tracy --profile release-with-debug 7 | ``` 8 | 9 | and then the client should show up in the profiler GUI: 10 | 11 | ![pic of tracy profiler](image.png) -------------------------------------------------------------------------------- /src/hyperlight_host/examples/tracing-tracy/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/src/hyperlight_host/examples/tracing-tracy/image.png -------------------------------------------------------------------------------- /src/hyperlight_host/scripts/apply-kvm-perf-mitigation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -Eeuo pipefail 3 | kernel_version=$(uname -r) 4 | if [[ "$kernel_version" == 6.* ]]; then 5 | if [[ $(cat /sys/devices/system/cpu/vulnerabilities/itlb_multihit) == "Not affected" ]]; then 6 | KVM_VENDOR_MOD=$(lsmod |grep -P "^kvm_(amd|intel)" | awk '{print $1}') 7 | sudo modprobe -r $KVM_VENDOR_MOD kvm 8 | sudo modprobe kvm nx_huge_pages=never 9 | sudo modprobe $KVM_VENDOR_MOD 10 | fi 11 | if [ -f /sys/fs/cgroup/cgroup.controllers ]; then 12 | sudo mount -o remount,favordynmods /sys/fs/cgroup 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /src/hyperlight_host/src/hyperlight_surrogate/Cargo.toml_temp_name: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hyperlight_surrogate" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [workspace] 9 | 10 | [dependencies] 11 | 12 | # Note - This crate will currently get built during the build.rs script for the hyperlight-host crate. 13 | # Cargo package does not allow for files named 'Cargo.toml' to be included in a crate so we'll rename 14 | # during the build.rs script so this file can be included with source for hyperlight_surrogate.exe 15 | # the in hyperlight-host crate. 16 | -------------------------------------------------------------------------------- /src/hyperlight_host/src/hyperlight_surrogate/src/main.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Hyperlight Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | fn main() { 18 | std::thread::sleep(std::time::Duration::MAX) 19 | } 20 | -------------------------------------------------------------------------------- /src/hyperlight_host/src/sandbox_state/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Hyperlight Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | /// The standardized `Sandbox` trait and the ways it ban be transitioned 18 | /// to a different `Sandbox` trait 19 | pub mod sandbox; 20 | /// Metadata about transitions between `Sandbox` states 21 | pub mod transition; 22 | -------------------------------------------------------------------------------- /src/hyperlight_testing/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hyperlight-testing" 3 | version.workspace = true 4 | edition = "2021" 5 | 6 | [dependencies] 7 | anyhow = "1.0.98" 8 | log = "0.4" 9 | once_cell = "1.21" 10 | tracing = { version = "0.1.41", features = ["log"] } 11 | tracing-log = "0.2.0" 12 | tracing-core = "0.1.33" 13 | tracing-serde = "0.2" 14 | serde = { version = "1.0", features = ["derive"] } 15 | serde_json = "1.0" 16 | 17 | [lib] 18 | bench = false # see https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options 19 | # reduce noise in test output 20 | test = false 21 | doctest = false -------------------------------------------------------------------------------- /src/schema/function_call_result.fbs: -------------------------------------------------------------------------------- 1 | include "function_types.fbs"; 2 | 3 | namespace Hyperlight.Generated; 4 | 5 | table FunctionCallResult { 6 | return_value:ReturnValue(required); 7 | } 8 | 9 | root_type FunctionCallResult; -------------------------------------------------------------------------------- /src/schema/guest_log_data.fbs: -------------------------------------------------------------------------------- 1 | namespace Hyperlight.Generated; 2 | 3 | enum LogLevel: uint8 { 4 | Trace = 0, 5 | Debug = 1, 6 | Information = 2, 7 | Warning = 3, 8 | Error = 4, 9 | Critical = 5, 10 | None = 6, 11 | } 12 | 13 | table GuestLogData { 14 | message: string; 15 | source: string; 16 | level: LogLevel; 17 | caller: string; 18 | source_file: string; 19 | line: uint32; 20 | } 21 | 22 | root_type GuestLogData; 23 | -------------------------------------------------------------------------------- /src/tests/c_guests/bin/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/src/tests/c_guests/bin/.gitkeep -------------------------------------------------------------------------------- /src/tests/c_guests/bin/debug/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/src/tests/c_guests/bin/debug/.gitkeep -------------------------------------------------------------------------------- /src/tests/c_guests/bin/release/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/src/tests/c_guests/bin/release/.gitkeep -------------------------------------------------------------------------------- /src/tests/rust_guests/bin/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/src/tests/rust_guests/bin/.gitkeep -------------------------------------------------------------------------------- /src/tests/rust_guests/bin/debug/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/src/tests/rust_guests/bin/debug/.gitkeep -------------------------------------------------------------------------------- /src/tests/rust_guests/bin/release/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperlight-dev/hyperlight/18cae10daaf6cbc0dc7434585145568ac6e0f526/src/tests/rust_guests/bin/release/.gitkeep -------------------------------------------------------------------------------- /src/tests/rust_guests/callbackguest/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-unknown-none" 3 | 4 | [target.x86_64-unknown-none] 5 | rustflags = [ 6 | "-C", 7 | "code-model=small", 8 | "-C", 9 | "link-args=-e entrypoint", 10 | ] 11 | linker = "rust-lld" 12 | 13 | [profile.release] 14 | opt-level = 0 15 | panic = "abort" 16 | 17 | [profile.dev] 18 | opt-level = 0 19 | panic = "abort" -------------------------------------------------------------------------------- /src/tests/rust_guests/callbackguest/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "callbackguest" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | hyperlight-guest = { path = "../../../hyperlight_guest" } 8 | hyperlight-guest-bin = { path = "../../../hyperlight_guest_bin" } 9 | hyperlight-common = { path = "../../../hyperlight_common", default-features = false } -------------------------------------------------------------------------------- /src/tests/rust_guests/dummyguest/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-unknown-none" 3 | 4 | [target.x86_64-unknown-none] 5 | rustflags = [ 6 | "-C", 7 | "code-model=small", 8 | "-C", 9 | "link-args=-e entrypoint", 10 | ] 11 | linker = "rust-lld" 12 | 13 | [profile.release] 14 | panic = "abort" 15 | 16 | [profile.dev] 17 | panic = "abort" -------------------------------------------------------------------------------- /src/tests/rust_guests/dummyguest/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "dummyguest" 7 | version = "0.4.0" 8 | -------------------------------------------------------------------------------- /src/tests/rust_guests/dummyguest/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dummyguest" 3 | version = "0.4.0" 4 | edition = "2021" -------------------------------------------------------------------------------- /src/tests/rust_guests/simpleguest/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-unknown-none" 3 | 4 | [target.x86_64-unknown-none] 5 | rustflags = [ 6 | "-C", 7 | "code-model=small", 8 | "-C", 9 | "link-args=-e entrypoint", 10 | ] 11 | linker = "rust-lld" 12 | 13 | [profile.release] 14 | panic = "abort" 15 | 16 | [profile.dev] 17 | panic = "abort" 18 | -------------------------------------------------------------------------------- /src/tests/rust_guests/simpleguest/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "simpleguest" 3 | version = "0.4.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | hyperlight-guest = { path = "../../../hyperlight_guest" } 8 | hyperlight-guest-bin = { path = "../../../hyperlight_guest_bin" } 9 | hyperlight-common = { path = "../../../hyperlight_common", default-features = false } 10 | log = {version = "0.4", default-features = false } 11 | -------------------------------------------------------------------------------- /src/tests/rust_guests/witguest/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-unknown-none" 3 | 4 | [target.x86_64-unknown-none] 5 | rustflags = [ 6 | "-C", 7 | "code-model=small", 8 | "-C", 9 | "link-args=-e entrypoint", 10 | ] 11 | linker = "rust-lld" 12 | 13 | [profile.release] 14 | opt-level = 0 15 | panic = "abort" 16 | 17 | [profile.dev] 18 | opt-level = 0 19 | panic = "abort" -------------------------------------------------------------------------------- /src/tests/rust_guests/witguest/.gitignore: -------------------------------------------------------------------------------- 1 | *.wasm -------------------------------------------------------------------------------- /src/tests/rust_guests/witguest/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "witguest" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | hyperlight-guest = { path = "../../../hyperlight_guest" } 8 | hyperlight-guest-bin = { path = "../../../hyperlight_guest_bin" } 9 | hyperlight-common = { path = "../../../hyperlight_common", default-features = false } 10 | hyperlight-component-macro = { path = "../../../hyperlight_component_macro" } -------------------------------------------------------------------------------- /src/tests/rust_guests/witguest/src/bindings.rs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2025 The Hyperlight Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | extern crate alloc; 18 | 19 | hyperlight_component_macro::guest_bindgen!("interface.wasm"); 20 | -------------------------------------------------------------------------------- /typos.toml: -------------------------------------------------------------------------------- 1 | [default] 2 | extend-ignore-identifiers-re = ["Fo", "edn", "ue"] 3 | 4 | [files] 5 | extend-exclude = ["**/*.patch", "src/hyperlight_guest_bin/third_party/**/*", "NOTICE.txt"] 6 | 7 | [default.extend-words] 8 | # typ is used for field name as type is a reserved keyword 9 | typ="typ" 10 | --------------------------------------------------------------------------------