Plan 9 from Bell Labs’s /usr/web/sources/contrib/rsc/linuxemu/stack.s

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



/*
 * add N bytes to the stack pointer
 * N is often negative
 *
 * return the new stack pointer.
 * this doesn't work: it just confuses
 * the compiler.
 */
TEXT addstack(SB), 1, $0
	MOVL n+0(FP), CX
	POPL BX	/* grab return address */
	MOVL SP, AX
	ADDL CX, AX	/* allocate stack space */
	MOVL AX, SP
	PUSHL BX	/* put the return address back */
	RET

/*
 * jump somewhere, with
 * the stack pointer set to something
 */
TEXT jumpstack(SB), 1, $0
	MOVL addr+0(FP), BX
	MOVL stack+4(FP), AX
	MOVL AX, SP
	JMP* BX

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].