alloca.s

来自「MINIX系统源码」· S 代码 · 共 34 行

S
34
字号
#
!	alloca() - allocate space on the stack		Author: Kees J. Bot
!								2 Dec 1993
.sect .text; .sect .rom; .sect .data; .sect .bss

.sect .text
	.align	16
.define _alloca
_alloca:
#if __ACK__
	pop	ecx		! Return address
	pop	eax		! Bytes to allocate
	add	eax, 2*4+3	! Add space for two saved register variables
	andb	al, 0xFC	! Align
	mov	ebx, esp	! Keep current esp
	sub	esp, eax	! Lower stack
	mov	eax, esp	! Return value
	push	4(ebx)		! Push what is probably the saved esi
	push	(ebx)		! Saved edi
				! Now ACK can still do:
				!	pop edi; pop esi; leave; ret
	push	eax		! Dummy argument
	jmp	ecx
#else
	pop	ecx		! Return address
	pop	eax		! Bytes to allocate
	add	eax, 3
	andb	al, 0xFC	! Align
	sub	esp, eax	! Lower stack
	mov	eax, esp	! Return value
	push	eax		! Dummy argument
	jmp	ecx
#endif

⌨️ 快捷键说明

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