OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_68/] [or1ksim/] [cpu/] [or32/] [op_i386.h] - Diff between revs 1462 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 1462 Rev 1765
/* op_i386.h -- i386 specific support routines for micro operations
/* op_i386.h -- i386 specific support routines for micro operations
   Copyright (C) 2005 György `nog' Jeney, nog@sdf.lonestar.org
   Copyright (C) 2005 György `nog' Jeney, nog@sdf.lonestar.org
 
 
This file is part of OpenRISC 1000 Architectural Simulator.
This file is part of OpenRISC 1000 Architectural Simulator.
 
 
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
(at your option) any later version.
 
 
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
GNU General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
#include "common_i386.h"
#include "common_i386.h"
 
 
#define OP_JUMP(x) asm("jmp *%0" : : "rm" (x))
#define OP_JUMP(x) asm("jmp *%0" : : "rm" (x))
 
 
#define FORCE_RET asm volatile ("")
#define FORCE_RET asm volatile ("")
 
 
/* Handles the scheduler and PC updateing.  Yes, useing MMX is a requirement. It
/* Handles the scheduler and PC updateing.  Yes, useing MMX is a requirement. It
 * just won't change.  This must be as compact as possible */
 * just won't change.  This must be as compact as possible */
static inline void handle_sched(void)
static inline void handle_sched(void)
{
{
  asm("paddd %%mm1, %%mm0\n"
  asm("paddd %%mm1, %%mm0\n"
      "\tmovd %%mm0, %%eax\n"
      "\tmovd %%mm0, %%eax\n"
      "\ttestl %%eax, %%eax\n"
      "\ttestl %%eax, %%eax\n"
      "\tjg .no_need_run_sched\n"
      "\tjg .no_need_run_sched\n"
      "\tcall do_sched_wrap\n"
      "\tcall do_sched_wrap\n"
      "\t.no_need_run_sched:" : : );
      "\t.no_need_run_sched:" : : );
}
}
 
 
static inline int32_t do_cycles(void)
static inline int32_t do_cycles(void)
{
{
  register uint32_t cycles;
  register uint32_t cycles;
 
 
  asm("paddd %%mm1, %%mm0\n"
  asm("paddd %%mm1, %%mm0\n"
      "\tmovd %%mm0, %0\n"
      "\tmovd %%mm0, %0\n"
      : "=r" (cycles));
      : "=r" (cycles));
  return cycles;
  return cycles;
}
}
 
 
/* Joins runtime.sim.mem_cycles with the cycle counter */
/* Joins runtime.sim.mem_cycles with the cycle counter */
static inline void join_mem_cycles(void)
static inline void join_mem_cycles(void)
{
{
  runtime.sim.mem_cycles = -runtime.sim.mem_cycles;
  runtime.sim.mem_cycles = -runtime.sim.mem_cycles;
  asm volatile ("movd %0, %%mm2\n"
  asm volatile ("movd %0, %%mm2\n"
                "\tpaddd %%mm2, %%mm0"
                "\tpaddd %%mm2, %%mm0"
                : : "m" (runtime.sim.mem_cycles));
                : : "m" (runtime.sim.mem_cycles));
  runtime.sim.mem_cycles = 0;
  runtime.sim.mem_cycles = 0;
}
}
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.