bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 13/17] tests: Add vm_page_size


From: Samuel Thibault
Subject: Re: [PATCH 13/17] tests: Add vm_page_size
Date: Wed, 27 Mar 2024 19:57:19 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Sergey Bugaev, le mer. 27 mars 2024 19:18:37 +0300, a ecrit:
> ---
>  tests/include/testlib.h |  2 ++
>  tests/testlib.c         | 13 +++++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/tests/include/testlib.h b/tests/include/testlib.h
> index d2367124..035fdc28 100644
> --- a/tests/include/testlib.h
> +++ b/tests/include/testlib.h
> @@ -70,6 +70,8 @@ thread_t test_thread_start(task_t task, 
> void(*routine)(void*), void* arg);
>  mach_port_t host_priv(void);
>  mach_port_t device_priv(void);
>  
> +extern vm_size_t vm_page_size;
> +
>  extern void mach_msg_destroy(mach_msg_header_t *msg);
>  
>  extern mach_msg_return_t mach_msg_server(
> diff --git a/tests/testlib.c b/tests/testlib.c
> index baf1ce5c..12c5e771 100644
> --- a/tests/testlib.c
> +++ b/tests/testlib.c
> @@ -29,6 +29,11 @@
>  #include <mach_port.user.h>
>  #include <mach_host.user.h>
>  
> +#ifdef PAGE_SIZE
> +vm_size_t vm_page_size = PAGE_SIZE;
> +#else
> +vm_size_t vm_page_size;
> +#endif
>  
>  static int argc = 0;
>  static char *argv_unknown[] = {"unknown", "m1", "123", "456"};
> @@ -212,6 +217,7 @@ mach_msg_return_t mach_msg_server_once(
>  void __attribute__((used, retain))
>  c_start(void **argptr)
>  {
> +  kern_return_t kr;
>    intptr_t* argcptr = (intptr_t*)argptr;
>    argc = argcptr[0];
>    argv = (char **) &argcptr[1];
> @@ -224,6 +230,13 @@ c_start(void **argptr)
>    mach_atoi(argv[1], &host_priv_port);
>    mach_atoi(argv[2], &device_master_port);
>  
> +#ifndef PAGE_SIZE
> +  vm_statistics_data_t stats;
> +  kr = vm_statistics (mach_task_self(), &stats);
> +  ASSERT_RET(kr, "can't get page size");
> +  vm_page_size = stats.pagesize;
> +#endif
> +
>    printf("started %s", argv[0]);
>    for (int i=1; i<argc; i++)
>    {
> -- 
> 2.44.0
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]