cfi.h 1.4 KB
Newer Older
D
dhy308 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (c) 2023 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

D
dhy308 已提交
16 17
#include "dynlink.h"

D
dhy308 已提交
18 19 20 21 22 23
#define CFI_SUCCESS             0
#define CFI_FAILED              -1
/* Define LIBRARY_ALIGNMENT to balance the size of CFI shadow and the number of DSOs that each process can load.
 * The LIBRARY_ALIGNMENT is use to calculate the start address of a DSO. Each DSO should be in the different
 * LIBRARY_ALIGNMENT memory range so that each DSO can be well mapped to the CFI shadow.
 */
D
dhy308 已提交
24 25 26 27
#define LIBRARY_ALIGNMENT_BITS  18
#define LIBRARY_ALIGNMENT       (1UL << LIBRARY_ALIGNMENT_BITS)

/* map all the dso and the dependents to cfi shadow */
D
dhy308 已提交
28
int init_cfi_shadow(struct dso *dso_list);
D
dhy308 已提交
29
/* map a dso and the dependents to cfi shadow */
D
dhy308 已提交
30
int map_dso_to_cfi_shadow(struct dso *dso);
D
dhy308 已提交
31 32
/* unmap a dso from cfi shadow */
void unmap_dso_from_cfi_shadow(struct dso *dso);