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

📄 mem.h

📁 T-kernel 的extension源代码
💻 H
字号:
/* *---------------------------------------------------------------------- *    T-Kernel / Standard Extension * *    Copyright (C) 2006 by Ken Sakamura. All rights reserved. *    T-Kernel / Standard Extension is distributed  *      under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * *    Version:   1.00.00 *    Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* *	mem.h (libtkse) * *	Local memory allocation library */#include <basic.h>#include <sys/memalloc.h>#include <libstr.h>/* * Minimum unit of fragmentation *	Since memory is allocated per unit of ROUNDSZ, *	Lower three bits of address are always 0. *	In an area queue, these bits are used as flag. */#define	ROUNDSZ			( sizeof(QUEUE) )	/* 8 bytes */#define	ROUND(sz)		( ((sz) + (ROUNDSZ - 1)) & ~(UW)(ROUNDSZ - 1) )/* Minimum fragment size */#define	MIN_FRAGMENT	( _mem_minfragment )/* Maximum allocation size (for parameter check) */#define	MAX_ALLOCATE	0x80000000U/* * Flag that uses the lower bits in an area queue */#define	AREA_USE		0x00000001U	/* In use */#define	AREA_TOP		0x00000002U	/* Start of page */#define	AREA_END		0x00000004U	/* End of page */#define	AREA_MASK		0x00000007U#define	setAreaFlag(q, f)	( (q)->prev = (QUEUE*)((UW)(q)->prev |  (f)) )#define	clrAreaFlag(q, f)	( (q)->prev = (QUEUE*)((UW)(q)->prev & ~(f)) )#define	chkAreaFlag(q, f)	( ((UW)(q)->prev & (f)) != 0 )#define	Mask(x)			( (QUEUE*)((UW)(x) & ~(UW)AREA_MASK) )#define	Assign(x, y)		( (x) = (QUEUE*)(((UW)(x) & AREA_MASK) | (UW)(y)) )/* * Area size */#define	AreaSize(aq)		( (VB*)(aq)->next - (VB*)((aq) + 1) )#define	FreeSize(fq)		( (VB*)((fq) - 1)->next - (VB*)(fq) )/* * Memory allocation check function */IMPORT BOOL (*_mem_chkalloc)( void *ptr, int mode, MACB *macb );

⌨️ 快捷键说明

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