fpsimd_restore_state(ctx->extregs);
}
-static inline struct sw_ctx *arch_alloc_sw_ctx(struct uk_alloc *allocator)
+static inline void arch_init_extregs(struct sw_ctx *ctx)
{
- struct sw_ctx *ctx;
-
- ctx = (struct sw_ctx *)uk_malloc(allocator,
- sizeof(struct sw_ctx) + sizeof(struct fpsimd_state));
if (ctx)
- ctx->extregs = (uintptr_t)((void *)ctx + sizeof(struct sw_ctx));
+ ctx->extregs = (uintptr_t)ctx->_extregs;
uk_pr_debug("Allocating %lu + %lu bytes for sw ctx at %p, extregs at %p\n",
- sizeof(struct sw_ctx), sizeof(struct fpsimd_state),
- ctx, (void *)ctx->extregs);
-
- return ctx;
+ sizeof(struct sw_ctx), sizeof(struct fpsimd_state),
+ ctx, (void *)ctx->extregs);
}
-static inline void arch_init_extregs(struct sw_ctx *ctx __unused)
+static inline __sz arch_extregs_size(void)
{
+ return sizeof(struct fpsimd_state);
}
#else /* !CONFIG_FPSIMD */
{
}
-static inline struct sw_ctx *arch_alloc_sw_ctx(struct uk_alloc *allocator)
+static inline void arch_init_extregs(struct sw_ctx *ctx)
{
- struct sw_ctx *ctx;
-
- ctx = (struct sw_ctx *)uk_malloc(allocator, sizeof(struct sw_ctx));
- uk_pr_debug("Allocating %lu bytes for sw ctx at %p\n",
- sizeof(struct sw_ctx), ctx);
-
- return ctx;
+ if (ctx)
+ ctx->extregs = (uintptr_t)ctx->_extregs;
}
-static inline void arch_init_extregs(struct sw_ctx *ctx)
+static inline __sz arch_extregs_size(void)
{
- ctx->extregs = (uintptr_t)ctx + sizeof(struct sw_ctx);
+ return 0;
}
-
#endif /* CONFIG_FPSIMD */
+
+
#endif /* __PLAT_COMMON_ARM64_CPU_H__ */