⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dyncode.h

📁 大名鼎鼎的CE下播放软件,TCPPMP的源代码!!!2410下可以流畅的解QVGA的H264,MPEG4等格式.
💻 H
字号:
/*****************************************************************************
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 * $Id: dyncode.h 585 2006-01-16 09:48:55Z picard $
 *
 * The Core Pocket Media Player
 * Copyright (c) 2004-2005 Gabor Kovacs
 *
 ****************************************************************************/

#ifndef __DYNCODE_H
#define __DYNCODE_H

typedef uint8_t reg;

#define NONE	((reg)-1)	

typedef struct dyncode
{
	char* Code;
	int Size;
	int Allocated;
} dyncode;

typedef struct dyninst
{
	int Tag;
	struct dyninst* Next;
	struct dyninst* Prev;
	int RdFlags;
	int WrFlags;
	int RdRegs;
	int WrRegs;
	struct dyninst* ReAlloc;
	bool_t Branch;
	int CodeSmall;
	char* CodeLarge;
	int CodeSize;
	char* Address;

} dyninst;

#include "dyncode_arm.h"
#include "dyncode_mips.h"
#include "dyncode_sh3.h"

void DynCode_Init();
void DynCode_Done();

#ifdef CONFIG_DYNCODE
void CodeInit(dyncode*);
void CodeDone(dyncode*);
void CodeBuild(dyncode*);
void CodeStart(dyncode*);
#else
static INLINE void CodeInit(dyncode* p) { memset(p,0,sizeof(dyncode)); }
static INLINE void CodeDone(dyncode* p) {}
static INLINE void CodeBuild(dyncode* p) {}
static INLINE void CodeStart(dyncode* p) {}
#endif

void Align(int);
void MB();
void DS();
dyninst* Label(bool_t DoPost);

//-----------------------------------------------------------------------

static INLINE char* InstCode(dyninst* p)
{
	return p->CodeLarge ? p->CodeLarge : (char*)&p->CodeSmall;
}

static INLINE int InstSize(dyninst* p, int Pos)
{
	if (p->CodeSize >= 0)
		return p->CodeSize;
	Pos = Pos % -p->CodeSize;
	if (Pos)
		Pos = -p->CodeSize - Pos;
	return Pos;
}

static INLINE bool_t InstReadWrite(const dyninst* a, const dyninst* b)
{
	return (a->RdFlags & b->WrFlags) != 0 ||
		   (a->RdRegs & b->WrRegs) != 0;
}

static INLINE bool_t InstBothWrite(const dyninst* a, const dyninst* b)
{
	return (a->WrFlags & b->WrFlags) != 0 ||
		   (a->WrRegs & b->WrRegs) != 0;
}

static INLINE int RotateRight(int v, int Bits)
{
	Bits &= 31;
	return ((v >> Bits) & ((1 << (32-Bits))-1)) | (v << (32-Bits));
}

bool_t InstReAlloc(dyninst*,dyninst*);
void InstPost(dyninst*);
void InstInit();

void InstAdd(dyninst*,context*);
dyninst* InstCreate(const void* Code, int CodeSize, reg Wr, reg Rd1, reg Rd2, int RdFlags, int WrFlags);
dyninst* InstCreate16(int Code16, reg Wr, reg Rd1, reg Rd2, int RdFlags, int WrFlags);
dyninst* InstCreate32(int Code32, reg Wr, reg Rd1, reg Rd2, int RdFlags, int WrFlags);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -