The build is successful, testing is required

This commit is contained in:
2025-08-23 12:12:22 +08:00
parent 9ae3a3f374
commit 5594a4a4a9
4 changed files with 123 additions and 24 deletions

View File

@ -57,6 +57,21 @@
#include <archdeps.h>
#include <asm/pgtable.h>
/* Compatibility function for vfs_fstat which is not exported in newer kernels */
static inline int mcctrl_vfs_fstat(int fd, struct kstat *stat)
{
struct file *file;
int error;
file = fget(fd);
if (!file)
return -EBADF;
error = vfs_getattr(&file->f_path, stat, STATX_BASIC_STATS, AT_STATX_SYNC_AS_STAT);
fput(file);
return error;
}
#define ALIGN_WAIT_BUF(z) (((z + 63) >> 6) << 6)
//#define SC_DEBUG
@ -950,7 +965,7 @@ static int pager_req_create(ihk_os_t os, int fd, uintptr_t result_pa)
dprintk("pager_req_create(%d,%lx)\n", fd, (long)result_pa);
error = vfs_fstat(fd, &st);
error = mcctrl_vfs_fstat(fd, &st);
if (error) {
printk("pager_req_create(%d,%lx):vfs_stat failed. %d\n", fd, (long)result_pa, error);
goto out;
@ -1587,7 +1602,7 @@ retry:
pmd = pmd_offset(pud, va);
if (!pmd_none(*pmd) && !pmd_bad(*pmd) &&
pmd_present(*pmd)) {
pte = pte_offset_map(pmd, va);
pte = pte_offset_kernel(pmd, va);
if (!pte_none(*pte) && pte_present(*pte)) {
pfn = (uintptr_t)pte_pfn(*pte) << PAGE_SHIFT;
#define PFN_PRESENT ((uintptr_t)1 << 0)