1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2016-20 Intel Corporation. */
3
4 #include <stddef.h>
5 #include "defines.h"
6
7 static uint8_t encl_buffer[8192] = { 1 };
8
memcpy(void * dest,const void * src,size_t n)9 static void *memcpy(void *dest, const void *src, size_t n)
10 {
11 size_t i;
12
13 for (i = 0; i < n; i++)
14 ((char *)dest)[i] = ((char *)src)[i];
15
16 return dest;
17 }
18
encl_body(void * rdi,void * rsi)19 void encl_body(void *rdi, void *rsi)
20 {
21 struct encl_op *op = (struct encl_op *)rdi;
22
23 switch (op->type) {
24 case ENCL_OP_PUT:
25 memcpy(&encl_buffer[0], &op->buffer, 8);
26 break;
27
28 case ENCL_OP_GET:
29 memcpy(&op->buffer, &encl_buffer[0], 8);
30 break;
31
32 default:
33 break;
34 }
35 }
36