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

📄 genregmove.awk

📁 C++ 编写的EROS RTOS
💻 AWK
字号:
## Copyright (C) 1998, 1999, Jonathan S. Shapiro.## This file is part of the EROS Operating System.## This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 2,# or (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.#BEGIN {  nmask = 0;  nunit = 0;  nfx = 0;  nfpu = 0;  last = 14;}/^keysize/ {  keysize = $2;}/^gen/	{  if ($6 != "root")    printf("HELP!!! all 'gen' regs should be in ROOT.\n");    to_fix[nfx] = sprintf("  %s = *((%s *) (ROOTSLOT(%d) + %d + 4)); \\\n", $2, $4, $7, $8);  from_fix[nfx] = sprintf("  *((%s *)(ROOTSLOT(%d) + %d + 4)) = %s; \\\n", $4, $7, $8, $2);  nfx++;}/^fix/	{  if ($6 == "*")    next;    if ($6 == "root") {    to_fix[nfx] = sprintf("  fixRegs.%s = *((%s *) (ROOTSLOT(%d) + %d + 4)); \\\n", $2, $4, $7, $8);    from_fix[nfx] = sprintf("  *((%s *)(ROOTSLOT(%d) + %d + 4)) = fixRegs.%s; \\\n", $4, $7, $8, $2);  }  else {    to_fix[nfx] = sprintf("  fixRegs.%s = *((%s *) (ANXSLOT(%d,%d) + %d + 4)); \\\n", $2, $4, $6, $7, $8);    from_fix[nfx] = sprintf("  *((%s *)(ANXSLOT(%d,%d) + %d + 4)) = fixRegs.%s; \\\n", $4, $6, $7, $8, $2);  }  nfx++;}/^stat/	{  if ($6 == "*")    next;    if ($6 == "root") {    to_fix[nfx] = sprintf("  stats.%s = *((%s *) (ROOTSLOT(%d) + %d + 4)); \\\n", $2, $4, $7, $8);    from_fix[nfx] = sprintf("  *((%s *)(ROOTSLOT(%d) + %d + 4)) = stats.%s; \\\n", $4, $7, $8, $2);  }  else {    to_fix[nfx] = sprintf("  fixRegs.%s = *((%s *) (ANXSLOT(%d,%d) + %d + 4)); \\\n", $2, $4, $6, $7, $8);    from_fix[nfx] = sprintf("  *((%s *)(ANXSLOT(%d,%d) + %d + 4)) = fixRegs.%s; \\\n", $4, $6, $7, $8, $2);  }  nfx++;}/^fpu/	{  if ($6 == "*")    next;    if ($6 == "root") {    to_fpu[nfpu] = sprintf("  fpuRegs.%s = *((%s *) (ROOTSLOT(%d) + %d + 4)); \\\n", $2, $4, $7, $8);    from_fpu[nfpu] = sprintf("  *((%s *)(ROOTSLOT(%d) + %d + 4)) = fpuRegs.%s; \\\n", $4, $7, $8, $2);  }  else {    to_fpu[nfpu] = sprintf("  fpuRegs.%s = *((%s *) (ANXSLOT(%d,%d) + %d + 4)); \\\n", $2, $4, $6, $7, $8);    from_fpu[nfpu] = sprintf("  *((%s *)(ANXSLOT(%d,%d) + %d + 4)) = fpuRegs.%s; \\\n", $4, $6, $7, $8, $2);  }  nfpu++;}END	{  printf("#ifndef __GEN_REGMOVE_HXX__\n");	  printf("#define __GEN_REGMOVE_HXX__\n\n");	  printf("/* This file is automatically generated and is hereby\n");  printf("   placed in the public domain */\n\n");  printf("#define ROOTSLOT(x) (rootkey0 + %d*(x))\n", keysize);  printf("#define ANXSLOT(anx,x) (annex##anx + %d*(x))\n", keysize);  printf("#define LOAD_FIX_REGS \\\n");  for (i = 0; i < nfx; i++)    printf(to_fix[i]);  printf("\n");  printf("#define UNLOAD_FIX_REGS \\\n");  for (i = 0; i < nfx; i++)    printf(from_fix[i]);  printf("\n");  printf("#define LOAD_FLOAT_REGS \\\n");  for (i = 0; i < nfx; i++)    printf(to_fpu[i]);  printf("\n");  printf("#define UNLOAD_FLOAT_REGS \\\n");  for (i = 0; i < nfx; i++)    printf(from_fpu[i]);  printf("\n");  printf("#endif /* __GEN_REGMOVE_HXX__ */\n");	}

⌨️ 快捷键说明

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