All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH v2 4/6] sim: or1k: add or1k target to sim
Date: Tue, 14 Feb 2017 13:52:08 -0500	[thread overview]
Message-ID: <20170214185208.GJ28432@vapier> (raw)
In-Reply-To: <92c04bd768b66a48e03850af185e975d01605435.1484967575.git.shorne@gmail.com>

On 21 Jan 2017 12:03, Stafford Horne wrote:
> --- /dev/null
> +++ b/sim/or1k/Makefile.in
>
> +# Extra headers included by sim-main.h.

you shouldn't need to do any manual dep management.  i'd suggest
deleting all this logic and seeing if things still work.

> --- /dev/null
> +++ b/sim/or1k/configure.ac
> @@ -0,0 +1,41 @@
> +dnl Process this file with autoconf to produce a configure script.
> +AC_PREREQ(2.64)dnl
> +AC_INIT(Makefile.in)
> +sinclude(../common/acinclude.m4)
> +
> +  case "${target_alias}" in

drop the indentation

> +  or1k-linux*|or1knd-linux*)
> +    traps_obj=traps32-linux.o
> +    ;;
> +  or1k-*|or1knd-*)
> +    traps_obj=traps32.o
> +    ;;
> +  esac

we really don't like to see this kind of logic.  can't you do a single
build and then select the right details at runtime ?

--- /dev/null
> +++ b/sim/or1k/or1k.h
> @@ -0,0 +1,38 @@
> +#ifndef OR1K_H
> +#define OR1K_H

all files should have a header with copyright & license info

also, please use namespaced defines like SIM_OR1K_H

> --- /dev/null
> +++ b/sim/or1k/sim-if.c
> @@ -0,0 +1,318 @@
> +/* Main simulator entry points specific to the OR1K.
> +   Copyright (C) 1996-1999, 2003, 2007-2012 Free Software Foundation,
> +   Inc.
> +   Contributed by Cygnus Support.

looks like you need to double check where you copied & pasted things from.
cygnus isn't doing this port ;).

> +SIM_DESC
> +sim_open (kind, callback, abfd, argv)
> +     SIM_OPEN_KIND kind;
> +     host_callback *callback;
> +     struct bfd *abfd;
> +     char * const *argv;

you need to update all your prototypes.  we don't do old style ones like
this anymore.

> +#ifdef HAVE_DV_SOCKSER /* FIXME: was done differently before */
> +  if (dv_sockser_install (sd) != SIM_RC_OK)
> +    {
> +      free_state (sd);
> +      return 0;
> +    }
> +#endif

delete this.  common code handles it for you now.

> +  /* Allocate core managed memory if none specified by user.
> +     Use address 4 here in case the user wanted address 0 unmapped.  */
> +  if (sim_core_read_buffer (sd, NULL, read_map, &c, 4, 1) == 0) {
> +    sim_do_commandf (sd, "memory region 0,0x%x", OR1K_DEFAULT_MEM_SIZE);
> +  }

this isn't using GNU style for the braces/if body.  this comes up
multiple times in this patch, so please fix them all.

> +  /* check for/establish the reference program image */

this comment isn't using GNU style.  this comes up
multiple times in this patch, so please fix them all.

> +
> +  for (c = 0; c < MAX_NR_PROCESSORS; ++c)
> +    {
> +      SIM_CPU *cpu = STATE_CPU (sd, i);
> +      /* Only needed for profiling, but the structure member is small.  */
> +      memset (CPU_OR1K_MISC_PROFILE (cpu), 0,
> +	      sizeof (* CPU_OR1K_MISC_PROFILE (cpu)));
> +
> +#ifdef WANT_CPU_OR1K32BF
> +      or1k32bf_h_spr_set_raw(cpu, SPR_ADDR(SYS,VR),      or1k_vr);
> +      or1k32bf_h_spr_set_raw(cpu, SPR_ADDR(SYS,UPR),     or1k_upr);
> +      or1k32bf_h_spr_set_raw(cpu, SPR_ADDR(SYS,CPUCFGR), or1k_cpucfgr);
> +
> +      or1k32bf_cpu_init (sd, cpu);
> +#endif
> +    }

this loop has to call these funcs:
	CPU_REG_FETCH
	CPU_REG_STORE
	CPU_PC_FETCH
	CPU_PC_STORE

> +  /* Store in a global so things like sparc32_dump_regs can be invoked
> +     from the gdb command line.  */
> +  current_state = sd;

you must kill current_state.  we do not allow global state anymore.

> --- /dev/null
> +++ b/sim/or1k/sim-main.h
>
> +typedef IAI sim_cia;
> +#define CIA_GET(cpu) CPU_PC_GET (cpu)
> +#define CIA_SET(cpu,val) CPU_PC_SET ((cpu),(val))

these defines are dead -> delete

> +typedef struct _sim_cpu SIM_CPU;

delete this

> +#ifdef OR1K_LINUX

nothing defines this -> delete

> +#if (WITH_SMP)
> +#define STATE_CPU(sd, n) ((sd)->cpu[n])
> +#else
> +#define STATE_CPU(sd, n) ((sd)->cpu[0])
> +#endif

delete these -- common code does it for you now
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20170214/3ef1d98b/attachment.sig>

  reply	other threads:[~2017-02-14 18:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-21  3:03 [OpenRISC] [PATCH v2 0/6] sim: Port for OpenRISC Stafford Horne
2017-01-21  3:03 ` [OpenRISC] [PATCH v2 1/6] sim: cgen: add rem (remainder) function (needed for OR1K lf.rem.[sd]) Stafford Horne
2017-01-21  3:03 ` [OpenRISC] [PATCH v2 2/6] sim: cgen: add mul-o1flag, mul-o2flag RTL functions to CGEN Stafford Horne
2017-01-21  3:03 ` [OpenRISC] [PATCH v2 3/6] sim: cgen: allow suffix on generated arch.[ch] and cpuall.h Stafford Horne
2017-01-21  3:03 ` [OpenRISC] [PATCH v2 4/6] sim: or1k: add or1k target to sim Stafford Horne
2017-02-14 18:52   ` Mike Frysinger [this message]
2017-02-15 13:24     ` Stafford Horne
2017-02-15 15:42       ` Mike Frysinger
2017-02-28 11:07     ` Stafford Horne
2017-01-21  3:03 ` [OpenRISC] [PATCH v2 5/6] sim: or1k: Add generated files Stafford Horne
2017-01-21  3:03 ` [OpenRISC] [PATCH v2 6/6] sim: testsuite: add testsuite for or1k sim Stafford Horne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170214185208.GJ28432@vapier \
    --to=vapier@gentoo.org \
    --cc=openrisc@lists.librecores.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.