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

📄 mem_mgr.lst

📁 au1200下的boot代码
💻 LST
📖 第 1 页 / 共 5 页
字号:
 115:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	MemSet( mem, 0, list->size ); 198              		.loc 1 115 0 199 00f4 00008680 		lb	$6,0($4) 200 00f8 22000008 		j	MemSet 201 00fc 21280000 		move	$5,$0 202              	 203              		.set	macro 204              		.set	reorder 205              	$LFE5: 206              		.end	destroy 207              		.align	2 208              		.ent	alloc 209              		.type	alloc, @function 210              	alloc: 211              	$LFB6: 116:/mnt/hgfs/boot/booter/source/mem_mgr.c **** } 117:/mnt/hgfs/boot/booter/source/mem_mgr.c **** GAS LISTING /tmp/cc4WPeaK.s 			page 7 118:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  119:/mnt/hgfs/boot/booter/source/mem_mgr.c **** static void * alloc( void * pool, unsigned long _size, void * context ) 120:/mnt/hgfs/boot/booter/source/mem_mgr.c **** { 212              		.loc 1 120 0 213              		.frame	$sp,24,$31		# vars= 0, regs= 2/0, args= 16, gp= 0 214              		.mask	0x80010000,-4 215              		.fmask	0x00000000,0 216              		.set	noreorder 217              		.set	nomacro 218              		 219 0100 E8FFBD27 		addiu	$sp,$sp,-24 220              	$LCFI5: 121:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	PBUFFER pcurrent=(PBUFFER)pool; 122:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	PBUFFER new; 123:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	unsigned long size; 124:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	void 	*ptr; 125:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  126:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	/* Round requested size 32bit boundry */ 127:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	if (_size & 0x03) size = (_size & ~0x3) + 0x4; 221              		.loc 1 127 0 222 0104 0300A230 		andi	$2,$5,0x3 223              		.loc 1 120 0 224 0108 1000B0AF 		sw	$16,16($sp) 225              	$LCFI6: 226 010c 2138C000 		move	$7,$6 227 0110 1400BFAF 		sw	$31,20($sp) 228              	$LCFI7: 229              		.loc 1 121 0 230 0114 21808000 		move	$16,$4 128:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	else size=_size; 231              		.loc 1 128 0 232              		.loc 1 127 0 233 0118 04004010 		beq	$2,$0,$L21 234 011c 2130A000 		move	$6,$5 235              	 236 0120 FCFF0224 		li	$2,-4			# 0xfffffffffffffffc 237 0124 2410A200 		and	$2,$5,$2 238 0128 04004624 		addiu	$6,$2,4 239              	$L21: 129:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  130:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	do 131:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	{ 132:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		if (!pcurrent) return NULL; 240              		.loc 1 132 0 241 012c 0B000012 		beq	$16,$0,$L27 242 0130 1400C424 		addiu	$4,$6,20 243              	 244              	$L28: 133:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  134:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		if( (!pcurrent->inuse) && (pcurrent->size >= size + sizeof(BUFFER)) ) break; 245              		.loc 1 134 0 246 0134 0400028E 		lw	$2,4($16) 247 0138 05004014 		bne	$2,$0,$L25 248 013c 00000000 		nop 249              	 250 0140 0000038E 		lw	$3,0($16) 251 0144 2B106400 		sltu	$2,$3,$4GAS LISTING /tmp/cc4WPeaK.s 			page 8 252 0148 09004010 		beq	$2,$0,$L23 253 014c 00000000 		nop 254              	 255              	$L25: 135:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  136:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		/* Goto next node in list */ 137:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pcurrent = pcurrent->next; 256              		.loc 1 137 0 257 0150 0800108E 		lw	$16,8($16) 258              		.loc 1 132 0 259 0154 F7FF0016 		bne	$16,$0,$L28 260 0158 00000000 		nop 261              	 262              	$L27: 138:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	} while(1);	 139:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  140:/mnt/hgfs/boot/booter/source/mem_mgr.c **** #ifdef DEBUG 141:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		dump(pool); 142:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		printf("\nalloc: pcurrent:%X req_size:%d new_size:%d\n", pcurrent,_size,size); 143:/mnt/hgfs/boot/booter/source/mem_mgr.c **** #endif 144:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	/* 	If we get to this point -- pcurrent is a valid descriptor 145:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	 *  First thing we need to do is create a new descriptor for the left over data 146:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	 *	and fill in the proper values. Only do this if we have left overs 147:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	 */ 148:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	if ( pcurrent->size != size ) 149:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	{ 150:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		new 				= (PBUFFER)((unsigned long)pcurrent + size + sizeof(BUFFER)); 151:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		new->size			= pcurrent->size - size - sizeof(BUFFER); 152:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		new->inuse			= 0; 153:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		new->prev			= pcurrent; 154:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		new->next			= pcurrent->next; 155:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  156:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pcurrent->next 		= new; 157:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pcurrent->size  	= size; 158:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pcurrent->context 	= context; 159:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pcurrent->inuse 	= 1; 160:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  161:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	} 162:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  163:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	// Prepare to zero-out the newly allocated memory 164:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	ptr = (void*)( (uint32)pcurrent + sizeof(BUFFER)); 165:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	MemSet( ptr, 0, size ); 166:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  167:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	/* return a pointer to the actual data area */ 168:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	return ptr; 169:/mnt/hgfs/boot/booter/source/mem_mgr.c **** } 263              		.loc 1 169 0 264 015c 1400BF8F 		lw	$31,20($sp) 265 0160 1000B08F 		lw	$16,16($sp) 266              		.loc 1 132 0 267 0164 21100000 		move	$2,$0 268              		.loc 1 169 0 269 0168 0800E003 		j	$31 270 016c 1800BD27 		addiu	$sp,$sp,24 271              	 272              	$L23: 273              		.loc 1 151 0GAS LISTING /tmp/cc4WPeaK.s 			page 9 274              		.loc 1 148 0 275 0170 0E006610 		beq	$3,$6,$L26 276 0174 23106600 		subu	$2,$3,$6 277              	 278              		.loc 1 154 0 279 0178 0800058E 		lw	$5,8($16) 280              		.loc 1 150 0 281 017c 21200602 		addu	$4,$16,$6 282              		.loc 1 151 0 283 0180 ECFF4224 		addiu	$2,$2,-20 284              		.loc 1 150 0 285 0184 14008324 		addiu	$3,$4,20 286              		.loc 1 151 0 287 0188 140082AC 		sw	$2,20($4) 288              		.loc 1 159 0 289 018c 01000224 		li	$2,1			# 0x1 290              		.loc 1 154 0 291 0190 080065AC 		sw	$5,8($3) 292              		.loc 1 152 0 293 0194 040060AC 		sw	$0,4($3) 294              		.loc 1 158 0 295 0198 100007AE 		sw	$7,16($16) 296              		.loc 1 156 0 297 019c 080003AE 		sw	$3,8($16) 298              		.loc 1 159 0 299 01a0 040002AE 		sw	$2,4($16) 300              		.loc 1 153 0 301 01a4 0C0070AC 		sw	$16,12($3) 302              		.loc 1 157 0 303 01a8 000006AE 		sw	$6,0($16) 304              	$L26: 305              		.loc 1 164 0 306 01ac 14001026 		addiu	$16,$16,20 307              		.loc 1 165 0 308 01b0 00360600 		sll	$6,$6,24 309 01b4 21200002 		move	$4,$16 310 01b8 03360600 		sra	$6,$6,24 311 01bc 2200000C 		jal	MemSet 312 01c0 21280000 		move	$5,$0 313              	 314              		.loc 1 168 0 315 01c4 21100002 		move	$2,$16 316              		.loc 1 169 0 317 01c8 1400BF8F 		lw	$31,20($sp) 318 01cc 1000B08F 		lw	$16,16($sp) 319 01d0 0800E003 		j	$31 320 01d4 1800BD27 		addiu	$sp,$sp,24 321              	 322              		.set	macro 323              		.set	reorder 324              	$LFE6: 325              		.end	alloc 326              		.align	2 327              		.ent	free 328              		.type	free, @function 329              	free: 330              	$LFB7:GAS LISTING /tmp/cc4WPeaK.s 			page 10 170:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  171:/mnt/hgfs/boot/booter/source/mem_mgr.c **** static void free ( void * buffer ) 172:/mnt/hgfs/boot/booter/source/mem_mgr.c **** { 331              		.loc 1 172 0 332              		.frame	$sp,0,$31		# vars= 0, regs= 0/0, args= 0, gp= 0 333              		.mask	0x00000000,0 334              		.fmask	0x00000000,0 335              		.set	noreorder 336              		.set	nomacro 337              		 173:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	// We pass the actual data buffer to the user -- now we must compensate 174:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	// for the header being sizeof(BUFFER) ahead of the user's pointer 175:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	// 176:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	PBUFFER pbuf  = (PBUFFER)((uint32)buffer - sizeof(BUFFER)); 338              		.loc 1 176 0 339 01d8 ECFF8524 		addiu	$5,$4,-20 177:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	PBUFFER	pprev; 178:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	PBUFFER pnext; 179:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  180:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	pprev = pbuf->prev; 340              		.loc 1 180 0 341 01dc 0C00A68C 		lw	$6,12($5) 342              		.loc 1 172 0 343 01e0 21408000 		move	$8,$4 181:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	pnext = pbuf->next; 344              		.loc 1 181 0 182:/mnt/hgfs/boot/booter/source/mem_mgr.c ****  183:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	/* 184:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	 *	We have to merge the nodes when they are freed 185:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	 *  There are four cases : 186:/mnt/hgfs/boot/booter/source/mem_mgr.c ****      *    1) Prev and Next nodes are also free 187:/mnt/hgfs/boot/booter/source/mem_mgr.c ****      *	  2) Prev node is free 188:/mnt/hgfs/boot/booter/source/mem_mgr.c ****      *    3) Next node is free 189:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	 *    4) No neighbors are free 190:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	 */ 191:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	if ( pprev && (!pprev->inuse) && pnext && !(pnext->inuse) ) 345              		.loc 1 191 0 346 01e4 2200C010 		beq	$6,$0,$L32 347 01e8 0800A78C 		lw	$7,8($5) 348              	 349 01ec 0400C38C 		lw	$3,4($6) 350 01f0 0E006010 		beq	$3,$0,$L37 351 01f4 00000000 		nop 352              	 353              	$L30: 192:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	{ 193:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pprev->size += pnext->size + pbuf->size + (sizeof(BUFFER)*2); 194:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pprev->next = pnext->next; 195:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		((PBUFFER)(pnext->next))->prev = pprev; 196:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	} 197:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	else if ( pprev && (!pprev->inuse) ) 354              		.loc 1 197 0 355 01f8 1D00C010 		beq	$6,$0,$L32 356 01fc 00000000 		nop 357              	 358 0200 1B006014 		bne	$3,$0,$L32 359 0204 00000000 		nopGAS LISTING /tmp/cc4WPeaK.s 			page 11 360              	 198:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	{ 199:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pprev->size += pbuf->size + sizeof(BUFFER); 361              		.loc 1 199 0 362 0208 0000C28C 		lw	$2,0($6) 363 020c 0000A38C 		lw	$3,0($5) 200:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pprev->next = pbuf->next; 364              		.loc 1 200 0 365 0210 0800C7AC 		sw	$7,8($6) 201:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		((PBUFFER)pbuf->next)->prev = pprev; 366              		.loc 1 201 0 367 0214 0800A48C 		lw	$4,8($5) 368              		.loc 1 199 0 369 0218 21104300 		addu	$2,$2,$3 370 021c 14004224 		addiu	$2,$2,20 371              		.loc 1 201 0 372 0220 0C0086AC 		sw	$6,12($4) 373              		.loc 1 199 0 374              		.loc 1 201 0 375 0224 0800E003 		j	$31 376 0228 0000C2AC 		sw	$2,0($6) 377              	 378              	$L37: 379              		.loc 1 191 0 380 022c F2FFE010 		beq	$7,$0,$L30 381 0230 00000000 		nop 382              	 383 0234 0400E28C 		lw	$2,4($7) 384 0238 EFFF4014 		bne	$2,$0,$L30 385 023c 00000000 		nop 386              	 387              		.loc 1 194 0 388 0240 0800E48C 		lw	$4,8($7) 389              		.loc 1 193 0 390 0244 ECFF058D 		lw	$5,-20($8) 391 0248 0000E38C 		lw	$3,0($7) 392 024c 0000C28C 		lw	$2,0($6) 393              		.loc 1 194 0 394 0250 0800C4AC 		sw	$4,8($6) 395              		.loc 1 193 0 396 0254 21186500 		addu	$3,$3,$5 397              		.loc 1 195 0 398 0258 0800E48C 		lw	$4,8($7) 399              		.loc 1 193 0 400 025c 21104300 		addu	$2,$2,$3 401 0260 28004224 		addiu	$2,$2,40 402              		.loc 1 201 0 403 0264 0C0086AC 		sw	$6,12($4) 404              		.loc 1 199 0 405              		.loc 1 201 0 406 0268 0800E003 		j	$31 407 026c 0000C2AC 		sw	$2,0($6) 408              	 409              	$L32: 202:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	} 203:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	else if ( pnext && (!pnext->inuse) ) 410              		.loc 1 203 0GAS LISTING /tmp/cc4WPeaK.s 			page 12 411 0270 0D00E010 		beq	$7,$0,$L34 412 0274 00000000 		nop 413              	 414 0278 0400E28C 		lw	$2,4($7) 415 027c 0A004014 		bne	$2,$0,$L34 416 0280 00000000 		nop 417              	 204:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 	{ 205:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pbuf->size += pnext->size + sizeof(BUFFER); 418              		.loc 1 205 0 419 0284 0000A28C 		lw	$2,0($5) 420 0288 0000E38C 		lw	$3,0($7) 206:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pbuf->next = pnext->next; 421              		.loc 1 206 0 422 028c 0800E48C 		lw	$4,8($7) 207:/mnt/hgfs/boot/booter/source/mem_mgr.c **** 		pbuf->inuse = 0; 423              		.loc 1 207 0 424 0290 0400A0AC 		sw	$0,4($5) 425              		.loc 1 205 0 426 0294 21104300 		addu	$2,$2,$3 427 0298 14004224 		addiu	$2,$2,20 428 029c 0000A2AC 		sw	$2,0($5) 429              		.loc 1 206 0

⌨️ 快捷键说明

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