bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH 09/17] Move copy{in,out}msg declarations to copy_user.h


From: Samuel Thibault
Subject: Re: [PATCH 09/17] Move copy{in,out}msg declarations to copy_user.h
Date: Wed, 27 Mar 2024 19:49:40 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Sergey Bugaev, le mer. 27 mars 2024 19:18:33 +0300, a ecrit:
> Since they are implemented in copy_user.c
> ---
>  i386/i386/locore.h |  4 ----
>  ipc/copy_user.h    | 15 +++++++++++++++
>  kern/exception.c   |  1 +
>  3 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/i386/i386/locore.h b/i386/i386/locore.h
> index 217e6dec..8ff587ed 100644
> --- a/i386/i386/locore.h
> +++ b/i386/i386/locore.h
> @@ -52,10 +52,6 @@ extern int copyinmsg (const void *userbuf, void 
> *kernelbuf, size_t cn, size_t kn
>  extern int copyout (const void *kernelbuf, void *userbuf, size_t cn);
>  #ifdef USER32
>  extern int copyoutmsg (const void *kernelbuf, void *userbuf, size_t cn);

Didn't you also want to move this one?

> -#else
> -static inline int copyoutmsg (const void *kernelbuf, void *userbuf, size_t 
> cn) {
> -     return copyout (kernelbuf, userbuf, cn);
> -}
>  #endif
>  
>  extern int inst_fetch (int eip, int cs);
> diff --git a/ipc/copy_user.h b/ipc/copy_user.h
> index a57b3ee5..33beacd0 100644
> --- a/ipc/copy_user.h
> +++ b/ipc/copy_user.h
> @@ -25,6 +25,21 @@
>  #include <machine/locore.h>
>  #include <mach/message.h>
>  
> +int copyinmsg(
> +     const void      *userbuf,
> +     void            *kernelbuf,
> +     size_t          usize,
> +     size_t          ksize);
> +
> +#ifdef USER32
> +int copyoutmsg(
> +     const void      *kernelbuf,
> +     void            *userbuf,
> +     size_t          ksize);
> +#else
> +#define copyoutmsg   copyout

Better define with parameters, so that it doesn't catch e.g. variables
called copyoutmsg.

> +#endif
> +
>  /*
>   * The copyin_32to64() and copyout_64to32() routines are meant for data types
>   * that have different size in kernel and user space. They should be 
> independent
> diff --git a/kern/exception.c b/kern/exception.c
> index 7139b466..cc023d45 100644
> --- a/kern/exception.c
> +++ b/kern/exception.c
> @@ -30,6 +30,7 @@
>  #include <mach/port.h>
>  #include <mach/mig_errors.h>
>  #include <machine/locore.h>
> +#include <ipc/copy_user.h>
>  #include <ipc/port.h>
>  #include <ipc/ipc_entry.h>
>  #include <ipc/ipc_notify.h>
> -- 
> 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]