PR kern/57626: instead of an (arbitrary) FAKE_PAGE_SHIFT (and always
using 4k pages), query the hypervisor for the real page size of the host kernel and use that for architectures that do not have compile time constant page sizes.
This commit is contained in:
parent
dc05387222
commit
3fd84419c8
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rumpuser.c,v 1.67 2015/08/16 11:05:06 pooka Exp $ */
|
||||
/* $NetBSD: rumpuser.c,v 1.68 2023/09/24 09:33:26 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
|
||||
|
@ -28,7 +28,7 @@
|
|||
#include "rumpuser_port.h"
|
||||
|
||||
#if !defined(lint)
|
||||
__RCSID("$NetBSD: rumpuser.c,v 1.67 2015/08/16 11:05:06 pooka Exp $");
|
||||
__RCSID("$NetBSD: rumpuser.c,v 1.68 2023/09/24 09:33:26 martin Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
@ -268,3 +268,9 @@ rumpuser_kill(int64_t pid, int rumpsig)
|
|||
raise(sig);
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
rumpuser_getpagesize(void)
|
||||
{
|
||||
return sysconf(_SC_PAGESIZE);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rumpuser.h,v 1.116 2020/03/22 13:30:10 pgoyette Exp $ */
|
||||
/* $NetBSD: rumpuser.h,v 1.117 2023/09/24 09:33:26 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved.
|
||||
|
@ -167,6 +167,11 @@ void rumpuser_dprintf(const char *, ...) __printflike(1, 2);
|
|||
#define RUMPUSER_RANDOM_NOWAIT 0x02
|
||||
int rumpuser_getrandom(void *, size_t, int, size_t *);
|
||||
|
||||
/*
|
||||
* for architectures with non-constant page size
|
||||
*/
|
||||
unsigned long rumpuser_getpagesize(void);
|
||||
|
||||
/*
|
||||
* threads, scheduling (host) and synchronization
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vm.c,v 1.196 2023/04/22 13:53:53 riastradh Exp $ */
|
||||
/* $NetBSD: vm.c,v 1.197 2023/09/24 09:33:26 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.196 2023/04/22 13:53:53 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.197 2023/09/24 09:33:26 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/atomic.h>
|
||||
|
@ -375,11 +375,9 @@ uvm_init(void)
|
|||
uvmexp.pagemask = PAGE_MASK;
|
||||
uvmexp.pageshift = PAGE_SHIFT;
|
||||
#else
|
||||
#define FAKE_PAGE_SHIFT 12
|
||||
uvmexp.pageshift = FAKE_PAGE_SHIFT;
|
||||
uvmexp.pagesize = 1<<FAKE_PAGE_SHIFT;
|
||||
uvmexp.pagemask = (1<<FAKE_PAGE_SHIFT)-1;
|
||||
#undef FAKE_PAGE_SHIFT
|
||||
uvmexp.pagesize = rumpuser_getpagesize();
|
||||
uvmexp.pagemask = uvmexp.pagesize-1;
|
||||
uvmexp.pageshift = ffs(uvmexp.pagesize)-1;
|
||||
#endif
|
||||
|
||||
mutex_init(&pagermtx, MUTEX_DEFAULT, IPL_NONE);
|
||||
|
|
Loading…
Reference in New Issue