Index: sys/amd64/amd64/fpu.c =================================================================== --- sys/amd64/amd64/fpu.c +++ sys/amd64/amd64/fpu.c @@ -1058,6 +1058,15 @@ M_FPUKERN_CTX, fpu_kern_malloc_flags(flags))); } +void +fpu_kern_free_ctx_domain(struct fpu_kern_ctx *ctx) +{ + + KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) == 0, ("free'ing inuse ctx")); + /* XXXKIB clear the memory ? */ + free_domain(ctx, M_FPUKERN_CTX); +} + void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx) { Index: sys/amd64/include/fpu.h =================================================================== --- sys/amd64/include/fpu.h +++ sys/amd64/include/fpu.h @@ -73,6 +73,7 @@ struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); struct fpu_kern_ctx *fpu_kern_alloc_ctx_domain(int domain, u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); +void fpu_kern_free_ctx_domain(struct fpu_kern_ctx *ctx); void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags); int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); Index: sys/crypto/aesni/aesni.c =================================================================== --- sys/crypto/aesni/aesni.c +++ sys/crypto/aesni/aesni.c @@ -148,7 +148,11 @@ CPU_FOREACH(i) { if (ctx_fpu[i] != NULL) { mtx_destroy(&ctx_mtx[i]); +#ifdef __amd64__ + fpu_kern_free_ctx_domain(ctx_fpu[i]); +#else fpu_kern_free_ctx(ctx_fpu[i]); +#endif } ctx_fpu[i] = NULL; } Index: sys/crypto/blake2/blake2_cryptodev.c =================================================================== --- sys/crypto/blake2/blake2_cryptodev.c +++ sys/crypto/blake2/blake2_cryptodev.c @@ -109,7 +109,11 @@ CPU_FOREACH(i) { if (ctx_fpu[i] != NULL) { mtx_destroy(&ctx_mtx[i]); +#ifdef __amd64__ + fpu_kern_free_ctx_domain(ctx_fpu[i]); +#else fpu_kern_free_ctx(ctx_fpu[i]); +#endif } ctx_fpu[i] = NULL; }