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

📄 gencode.sh

📁 a linux like c++ kernel
💻 SH
字号:
#!/bin/shcat <<\! > idletaskcode.S #include "../lib/unistd.h"	.text	.global _start_start: movl $__NR_fork,%eax	int $0x80	cmpl $0,%eax	jne 1f	/* child process */	movl $__NR_setup,%eax	int $0x80	movl $__NR_execve,%eax	movl $path,%ebx	movl $argv,%ecx	movl $envp,%edx 	int $0x801:	/* parent process */	movl $__NR_nice,%eax	int $0x80	jmp 1bpath:	.asciz "/sbin/init"arg0:	.asciz "init"argv:	.long arg0,0env0:	.asciz "bee=sparrow"envp:	.long env0,0!cc -c -o idletaskcode.o idletaskcode.Sld -Ttext 0x1000 idletaskcode.o -o idletaskcode# readelf output format: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Alignexec > idletaskcode.hecho "/* this file is auto generated by gencode.sh */"echo "#define IDLETASKSTART 0x1000 /* ld depend this */"echo "#define IDLETASKEND 0x2000 /* ld depend this */"offset=$(readelf --segments idletaskcode | awk '/LOAD/ { print $2; exit; }')filesz=$(readelf --segments idletaskcode | awk '/LOAD/ { print $5; exit; }')od --width=1 --output-duplicates --skip-bytes=$offset --read-bytes=$filesz \-t x1 idletaskcode | awk 'BEGIN	{	tab = 0		print "char idletaskcode[] = {"	}// 	{	if (NF == 2) {			printf("0x%s, ",$2)			if ((tab++ % 8) == 7)				printf("\n")		}	}END	{	print "};"	}'rm -f idletaskcode.S idletaskcode.o idletaskcode

⌨️ 快捷键说明

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