[PATCH v3 33/43] bsd-user: Make cpu_model and cpu_type visible to all of main.c

imp@bsdimp.com posted 43 patches 4 years, 5 months ago
Maintainers: Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>
[PATCH v3 33/43] bsd-user: Make cpu_model and cpu_type visible to all of main.c
Posted by imp@bsdimp.com 4 years, 5 months ago
From: Warner Losh <imp@FreeBSD.org>

cpu_model and cpu_type will be used future commits, so move them from
main() scoped to file scoped.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
---
 bsd-user/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 71fd9d5aba..50c8fdc1e2 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -54,6 +54,8 @@
 int singlestep;
 unsigned long mmap_min_addr;
 uintptr_t guest_base;
+static const char *cpu_model;
+static const char *cpu_type;
 bool have_guest_base;
 unsigned long reserved_va;
 
@@ -201,8 +203,6 @@ static void save_proc_pathname(char *argv0)
 int main(int argc, char **argv)
 {
     const char *filename;
-    const char *cpu_model;
-    const char *cpu_type;
     const char *log_file = NULL;
     const char *log_mask = NULL;
     const char *seed_optarg = NULL;
-- 
2.32.0


Re: [PATCH v3 33/43] bsd-user: Make cpu_model and cpu_type visible to all of main.c
Posted by Kyle Evans 4 years, 5 months ago
On Thu, Sep 2, 2021 at 6:53 PM <imp@bsdimp.com> wrote:
>
> From: Warner Losh <imp@FreeBSD.org>
>
> cpu_model and cpu_type will be used future commits, so move them from
> main() scoped to file scoped.
>
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> Acked-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  bsd-user/main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

I think we should reduce this one to just moving cpu_type. cpu_model
is really only used in main() to derive the appropriate cpu_type,
which we do use later.

>
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 71fd9d5aba..50c8fdc1e2 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -54,6 +54,8 @@
>  int singlestep;
>  unsigned long mmap_min_addr;
>  uintptr_t guest_base;
> +static const char *cpu_model;
> +static const char *cpu_type;
>  bool have_guest_base;
>  unsigned long reserved_va;
>
> @@ -201,8 +203,6 @@ static void save_proc_pathname(char *argv0)
>  int main(int argc, char **argv)
>  {
>      const char *filename;
> -    const char *cpu_model;
> -    const char *cpu_type;
>      const char *log_file = NULL;
>      const char *log_mask = NULL;
>      const char *seed_optarg = NULL;
> --
> 2.32.0
>

Re: [PATCH v3 33/43] bsd-user: Make cpu_model and cpu_type visible to all of main.c
Posted by Warner Losh 4 years, 5 months ago
On Sun, Sep 5, 2021 at 12:57 PM Kyle Evans <kevans@freebsd.org> wrote:

> On Thu, Sep 2, 2021 at 6:53 PM <imp@bsdimp.com> wrote:
> >
> > From: Warner Losh <imp@FreeBSD.org>
> >
> > cpu_model and cpu_type will be used future commits, so move them from
> > main() scoped to file scoped.
> >
> > Signed-off-by: Warner Losh <imp@bsdimp.com>
> > Acked-by: Richard Henderson <richard.henderson@linaro.org>
> > ---
> >  bsd-user/main.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> I think we should reduce this one to just moving cpu_type. cpu_model
> is really only used in main() to derive the appropriate cpu_type,
> which we do use later
>

Fair point. I think I'm going to drop this patch from the series (yea, back
to 42)
and work it out with you on the bsd-user 'blitz' branch and try again in a
future
patch round.

Warner


> >
> > diff --git a/bsd-user/main.c b/bsd-user/main.c
> > index 71fd9d5aba..50c8fdc1e2 100644
> > --- a/bsd-user/main.c
> > +++ b/bsd-user/main.c
> > @@ -54,6 +54,8 @@
> >  int singlestep;
> >  unsigned long mmap_min_addr;
> >  uintptr_t guest_base;
> > +static const char *cpu_model;
> > +static const char *cpu_type;
> >  bool have_guest_base;
> >  unsigned long reserved_va;
> >
> > @@ -201,8 +203,6 @@ static void save_proc_pathname(char *argv0)
> >  int main(int argc, char **argv)
> >  {
> >      const char *filename;
> > -    const char *cpu_model;
> > -    const char *cpu_type;
> >      const char *log_file = NULL;
> >      const char *log_mask = NULL;
> >      const char *seed_optarg = NULL;
> > --
> > 2.32.0
> >
>