startup.s16

来自「Windows上的精简Linux系统」· S16 代码 · 共 38 行

S16
38
字号
	.code16gcc	.globl _start_start:	/* Make sure stack pointer is normalized */	movzwl %sp,%esp	/* Zero .bss */	movw $__bss_start,%di	xorl %eax,%eax	movw $(_end+3),%cx	subw %di,%cx	shrw $2,%cx	cld	rep ; stosl	/* Normalize the command line.  At startup 0x80 = length and	   the command line starts at 0x81, but with whitespace */	movl $0x81,%esi	movzbw (0x80),%bx	movb $0,(%bx,%si)		/* Null-terminate the string */1:	lodsb	dec %al				/* Stop on null */	cmp $31,%al			/* Whitespace? */	jbe 1b	dec %si				/* Unskip first character */	/* Invoke _cstart */	pushl %esi			/* Pointer to command line */	calll _cstart	/* Terminate program (with error code in %al) */	movb $0x4c,%ah	int $0x21	hlt

⌨️ 快捷键说明

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