mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
compel/arch/riscv64: properly implement compel_task_size()
We need to dynamically calculate TASK_SIZE depending on the MMU on RISC-V system. [We are using analogical approach on aarch64/ppc64le.] This change was tested on physical machine: StarFive VisionFive 2 isa : rv64imafdc_zicntr_zicsr_zifencei_zihpm_zca_zcd_zba_zbb mmu : sv39 uarch : sifive,u74-mc mvendorid : 0x489 marchid : 0x8000000000000007 mimpid : 0x4210427 hart isa : rv64imafdc_zicntr_zicsr_zifencei_zihpm_zca_zcd_zba_zbb Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
This commit is contained in:
parent
399d7bdcbb
commit
40b7f04b7c
1 changed files with 13 additions and 11 deletions
|
|
@ -181,20 +181,22 @@ int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s)
|
|||
* Task size is the maximum virtual address space size that a process can occupy in the memory
|
||||
* Refer to linux kernel arch/riscv/include/asm/pgtable.h,
|
||||
* task size is:
|
||||
* - 0x9fc00000 (~2.5GB) for RV32.
|
||||
* - 0x4000000000 ( 256GB) for RV64 using SV39 mmu
|
||||
* - 0x800000000000 ( 128TB) for RV64 using SV48 mmu
|
||||
*
|
||||
* Note that PGDIR_SIZE must evenly divide TASK_SIZE since "RISC-V
|
||||
* Instruction Set Manual Volume II: Privileged Architecture" states that
|
||||
* "load and store effective addresses, which are 64bits, must have bits
|
||||
* 63–48 all equal to bit 47, or else a page-fault exception will occur."
|
||||
*/
|
||||
#define TASK_SIZE 0x800000000000UL // hardcoded for SV48 MMU
|
||||
* - 0x9fc00000 (~2.5GB) for RV32.
|
||||
* - 0x4000000000 ( 256GB) for RV64 using SV39 mmu
|
||||
* - 0x800000000000 ( 128TB) for RV64 using SV48 mmu
|
||||
* - 0x100000000000000 ( 64PB) for RV64 using SV57 mmu
|
||||
*/
|
||||
#define TASK_SIZE_MIN (1UL << 38)
|
||||
#define TASK_SIZE_MAX (1UL << 56)
|
||||
|
||||
unsigned long compel_task_size(void)
|
||||
{
|
||||
return TASK_SIZE;
|
||||
unsigned long task_size;
|
||||
|
||||
for (task_size = TASK_SIZE_MIN; task_size < TASK_SIZE_MAX; task_size <<= 1)
|
||||
if (munmap((void *)task_size, page_size()))
|
||||
break;
|
||||
return task_size;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue