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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_68/] [or1ksim/] [cpu/] [or32/] [op_i386.h] - Rev 1780

Go to most recent revision | Compare with Previous | Blame | View Log

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

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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