> compile NEMU
ysyx_22040000 李心杨 Linux calcite 6.1.69 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 20 16:00:29 UTC 2023 x86_64 GNU/Linux 23:23:43 up 23:39, 2 users, load average: 0.78, 0.72, 0.57
This commit is contained in:
parent
965ce580d8
commit
a1e7000829
14 changed files with 253 additions and 1960 deletions
3
nemu/.clang-format
Normal file
3
nemu/.clang-format
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: LLVM
|
71
nemu/.gitignore
vendored
71
nemu/.gitignore
vendored
|
@ -1,12 +1,63 @@
|
||||||
*.*
|
|
||||||
*
|
|
||||||
!*/
|
|
||||||
!Makefile
|
|
||||||
!*.mk
|
|
||||||
!*.[cSh]
|
|
||||||
!*.cc
|
|
||||||
!.gitignore
|
|
||||||
!README.md
|
|
||||||
!Kconfig
|
|
||||||
include/config
|
include/config
|
||||||
include/generated
|
include/generated
|
||||||
|
configs/defconfig
|
||||||
|
build/
|
||||||
|
.cache/
|
||||||
|
.direnv/
|
||||||
|
.config
|
||||||
|
.envrc
|
||||||
|
compile_commands.json
|
||||||
|
|
||||||
|
### C ###
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Linker output
|
||||||
|
*.ilk
|
||||||
|
*.map
|
||||||
|
*.exp
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
|
||||||
|
# Debug files
|
||||||
|
*.dSYM/
|
||||||
|
*.su
|
||||||
|
*.idb
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# Kernel Module Compile Results
|
||||||
|
*.mod*
|
||||||
|
*.cmd
|
||||||
|
.tmp_versions/
|
||||||
|
modules.order
|
||||||
|
Module.symvers
|
||||||
|
Mkfile.old
|
||||||
|
dkms.conf
|
||||||
|
|
127
nemu/LICENSE
Normal file
127
nemu/LICENSE
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
木兰宽松许可证, 第2版
|
||||||
|
|
||||||
|
木兰宽松许可证, 第2版
|
||||||
|
2020年1月 http://license.coscl.org.cn/MulanPSL2
|
||||||
|
|
||||||
|
|
||||||
|
您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束:
|
||||||
|
|
||||||
|
0. 定义
|
||||||
|
|
||||||
|
“软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
|
||||||
|
|
||||||
|
“贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
|
||||||
|
|
||||||
|
“贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
|
||||||
|
|
||||||
|
“法人实体”是指提交贡献的机构及其“关联实体”。
|
||||||
|
|
||||||
|
“关联实体”是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
|
||||||
|
|
||||||
|
1. 授予版权许可
|
||||||
|
|
||||||
|
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
|
||||||
|
|
||||||
|
2. 授予专利许可
|
||||||
|
|
||||||
|
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
|
||||||
|
|
||||||
|
3. 无商标许可
|
||||||
|
|
||||||
|
“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。
|
||||||
|
|
||||||
|
4. 分发限制
|
||||||
|
|
||||||
|
您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
|
||||||
|
|
||||||
|
5. 免责声明与责任限制
|
||||||
|
|
||||||
|
“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
|
||||||
|
|
||||||
|
6. 语言
|
||||||
|
“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。
|
||||||
|
|
||||||
|
条款结束
|
||||||
|
|
||||||
|
如何将木兰宽松许可证,第2版,应用到您的软件
|
||||||
|
|
||||||
|
如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步:
|
||||||
|
|
||||||
|
1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
|
||||||
|
|
||||||
|
2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中;
|
||||||
|
|
||||||
|
3, 请将如下声明文本放入每个源文件的头部注释中。
|
||||||
|
|
||||||
|
Copyright (c) 2014-2022 Zihao Yu, Nanjing University
|
||||||
|
NEMU is licensed under Mulan PSL v2.
|
||||||
|
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
http://license.coscl.org.cn/MulanPSL2
|
||||||
|
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
See the Mulan PSL v2 for more details.
|
||||||
|
|
||||||
|
|
||||||
|
Mulan Permissive Software License,Version 2
|
||||||
|
|
||||||
|
Mulan Permissive Software License,Version 2 (Mulan PSL v2)
|
||||||
|
January 2020 http://license.coscl.org.cn/MulanPSL2
|
||||||
|
|
||||||
|
Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
|
||||||
|
|
||||||
|
0. Definition
|
||||||
|
|
||||||
|
Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
|
||||||
|
|
||||||
|
Contribution means the copyrightable work licensed by a particular Contributor under this License.
|
||||||
|
|
||||||
|
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
|
||||||
|
|
||||||
|
Legal Entity means the entity making a Contribution and all its Affiliates.
|
||||||
|
|
||||||
|
Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
|
||||||
|
|
||||||
|
1. Grant of Copyright License
|
||||||
|
|
||||||
|
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
|
||||||
|
|
||||||
|
2. Grant of Patent License
|
||||||
|
|
||||||
|
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
|
||||||
|
|
||||||
|
3. No Trademark License
|
||||||
|
|
||||||
|
No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4.
|
||||||
|
|
||||||
|
4. Distribution Restriction
|
||||||
|
|
||||||
|
You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
|
||||||
|
|
||||||
|
5. Disclaimer of Warranty and Limitation of Liability
|
||||||
|
|
||||||
|
THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
6. Language
|
||||||
|
|
||||||
|
THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
|
||||||
|
|
||||||
|
END OF THE TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software
|
||||||
|
|
||||||
|
To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:
|
||||||
|
|
||||||
|
i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
|
||||||
|
|
||||||
|
ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package;
|
||||||
|
|
||||||
|
iii Attach the statement to the appropriate annotated syntax at the beginning of each source file.
|
||||||
|
|
||||||
|
|
||||||
|
Copyright (c) 2014-2022 Zihao Yu, Nanjing University
|
||||||
|
NEMU is licensed under Mulan PSL v2.
|
||||||
|
You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
http://license.coscl.org.cn/MulanPSL2
|
||||||
|
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
See the Mulan PSL v2 for more details.
|
|
@ -13,6 +13,8 @@
|
||||||
# See the Mulan PSL v2 for more details.
|
# See the Mulan PSL v2 for more details.
|
||||||
#**************************************************************************************/
|
#**************************************************************************************/
|
||||||
|
|
||||||
|
.EXPORT:
|
||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
ifeq ($(wildcard $(NEMU_HOME)/src/nemu-main.c),)
|
ifeq ($(wildcard $(NEMU_HOME)/src/nemu-main.c),)
|
||||||
$(error NEMU_HOME=$(NEMU_HOME) is not a NEMU repo)
|
$(error NEMU_HOME=$(NEMU_HOME) is not a NEMU repo)
|
||||||
|
|
1387
nemu/calculator.c
1387
nemu/calculator.c
File diff suppressed because it is too large
Load diff
|
@ -40,9 +40,11 @@
|
||||||
gnumake
|
gnumake
|
||||||
flex
|
flex
|
||||||
bison
|
bison
|
||||||
|
pkg-config
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
check
|
||||||
readline
|
readline
|
||||||
libllvm
|
libllvm
|
||||||
];
|
];
|
||||||
|
|
1
nemu/src/isa/riscv64
Symbolic link
1
nemu/src/isa/riscv64
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
riscv32
|
2
nemu/src/monitor/sdb/.gitignore
vendored
Normal file
2
nemu/src/monitor/sdb/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
addrexp_lex.h
|
||||||
|
addrexp.h
|
|
@ -1,84 +0,0 @@
|
||||||
/* A Bison parser, made by GNU Bison 3.8.2. */
|
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
|
||||||
|
|
||||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
|
|
||||||
Inc.
|
|
||||||
|
|
||||||
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 3 of the License, 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, see <https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
/* As a special exception, you may create a larger work that contains
|
|
||||||
part or all of the Bison parser skeleton and distribute that work
|
|
||||||
under terms of your choice, so long as that work isn't itself a
|
|
||||||
parser generator using the skeleton or a modified version thereof
|
|
||||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
|
||||||
the parser skeleton itself, you may (at your option) remove this
|
|
||||||
special exception, which will cause the skeleton and the resulting
|
|
||||||
Bison output files to be licensed under the GNU General Public
|
|
||||||
License without this special exception.
|
|
||||||
|
|
||||||
This special exception was added by the Free Software Foundation in
|
|
||||||
version 2.2 of Bison. */
|
|
||||||
|
|
||||||
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
|
|
||||||
especially those whose name start with YY_ or yy_. They are
|
|
||||||
private implementation details that can be changed or removed. */
|
|
||||||
|
|
||||||
#ifndef YY_YY_SRC_MONITOR_SDB_ADDREXP_H_INCLUDED
|
|
||||||
# define YY_YY_SRC_MONITOR_SDB_ADDREXP_H_INCLUDED
|
|
||||||
/* Debug traces. */
|
|
||||||
#ifndef YYDEBUG
|
|
||||||
# define YYDEBUG 0
|
|
||||||
#endif
|
|
||||||
#if YYDEBUG
|
|
||||||
extern int yydebug;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Token kinds. */
|
|
||||||
#ifndef YYTOKENTYPE
|
|
||||||
# define YYTOKENTYPE
|
|
||||||
enum yytokentype
|
|
||||||
{
|
|
||||||
YYEMPTY = -2,
|
|
||||||
YYEOF = 0, /* "end of file" */
|
|
||||||
YYerror = 256, /* error */
|
|
||||||
YYUNDEF = 257, /* "invalid token" */
|
|
||||||
NUMBER = 258, /* NUMBER */
|
|
||||||
HEX_NUMBER = 259 /* HEX_NUMBER */
|
|
||||||
};
|
|
||||||
typedef enum yytokentype yytoken_kind_t;
|
|
||||||
#endif
|
|
||||||
/* Token kinds. */
|
|
||||||
#define YYEMPTY -2
|
|
||||||
#define YYEOF 0
|
|
||||||
#define YYerror 256
|
|
||||||
#define YYUNDEF 257
|
|
||||||
#define NUMBER 258
|
|
||||||
#define HEX_NUMBER 259
|
|
||||||
|
|
||||||
/* Value type. */
|
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
|
||||||
typedef uint32_t YYSTYPE;
|
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
|
||||||
|
|
||||||
|
|
||||||
int yyparse (uint32_t *result);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* !YY_YY_SRC_MONITOR_SDB_ADDREXP_H_INCLUDED */
|
|
13
nemu/src/monitor/sdb/addrexp.l
Normal file
13
nemu/src/monitor/sdb/addrexp.l
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
%{
|
||||||
|
#include <addrexp.h>
|
||||||
|
%}
|
||||||
|
%option noyywrap
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
0[xX][0-9a-fA-F]+ { yylval = strtol(yytext, NULL, 16); return HEX_NUMBER; }
|
||||||
|
[0-9]+ { yylval = atoi(yytext); return NUMBER; }
|
||||||
|
[+\-*/()] { return *yytext; }
|
||||||
|
[ \t] { }
|
||||||
|
. { printf("Unexpected character: %s\n", yytext); }
|
||||||
|
%%
|
36
nemu/src/monitor/sdb/addrexp.y
Normal file
36
nemu/src/monitor/sdb/addrexp.y
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
%{
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
extern int yylex(void);
|
||||||
|
void yyerror(uint32_t *result, const char *s) {
|
||||||
|
fprintf(stderr, "Error: %s\n", s);
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
%token NUMBER HEX_NUMBER
|
||||||
|
%start input
|
||||||
|
%define api.value.type { uint32_t }
|
||||||
|
%parse-param { uint32_t *result }
|
||||||
|
%left '+' '-'
|
||||||
|
%left '*' '/'
|
||||||
|
|
||||||
|
%%
|
||||||
|
input
|
||||||
|
: expression { *result = $1; }
|
||||||
|
;
|
||||||
|
|
||||||
|
expression
|
||||||
|
: expression '+' expression { $$ = $1 + $3; }
|
||||||
|
| expression '-' expression { $$ = $1 - $3; }
|
||||||
|
| expression '*' expression { $$ = $1 * $3; }
|
||||||
|
| expression '/' expression { $$ = $1 / $3; }
|
||||||
|
| '-' number { $$ = -$2; }
|
||||||
|
| '(' expression ')' { $$ = $2; }
|
||||||
|
| number { $$ = $1; }
|
||||||
|
|
||||||
|
number
|
||||||
|
: NUMBER
|
||||||
|
| HEX_NUMBER
|
||||||
|
|
||||||
|
%%
|
|
@ -1,479 +0,0 @@
|
||||||
#ifndef yyHEADER_H
|
|
||||||
#define yyHEADER_H 1
|
|
||||||
#define yyIN_HEADER 1
|
|
||||||
|
|
||||||
#line 5 "src/monitor/sdb/addrexp_lex.h"
|
|
||||||
|
|
||||||
#line 7 "src/monitor/sdb/addrexp_lex.h"
|
|
||||||
|
|
||||||
#define YY_NO_UNPUT 1
|
|
||||||
#define YY_NO_INPUT 1
|
|
||||||
#define YY_INT_ALIGNED short int
|
|
||||||
|
|
||||||
/* A lexical scanner generated by flex */
|
|
||||||
|
|
||||||
#define FLEX_SCANNER
|
|
||||||
#define YY_FLEX_MAJOR_VERSION 2
|
|
||||||
#define YY_FLEX_MINOR_VERSION 6
|
|
||||||
#define YY_FLEX_SUBMINOR_VERSION 4
|
|
||||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
|
||||||
#define FLEX_BETA
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* First, we deal with platform-specific or compiler-specific issues. */
|
|
||||||
|
|
||||||
/* begin standard C headers. */
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/* end standard C headers. */
|
|
||||||
|
|
||||||
/* flex integer type definitions */
|
|
||||||
|
|
||||||
#ifndef FLEXINT_H
|
|
||||||
#define FLEXINT_H
|
|
||||||
|
|
||||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
|
||||||
|
|
||||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
||||||
|
|
||||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
|
||||||
* if you want the limit (max/min) macros for int types.
|
|
||||||
*/
|
|
||||||
#ifndef __STDC_LIMIT_MACROS
|
|
||||||
#define __STDC_LIMIT_MACROS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
typedef int8_t flex_int8_t;
|
|
||||||
typedef uint8_t flex_uint8_t;
|
|
||||||
typedef int16_t flex_int16_t;
|
|
||||||
typedef uint16_t flex_uint16_t;
|
|
||||||
typedef int32_t flex_int32_t;
|
|
||||||
typedef uint32_t flex_uint32_t;
|
|
||||||
#else
|
|
||||||
typedef signed char flex_int8_t;
|
|
||||||
typedef short int flex_int16_t;
|
|
||||||
typedef int flex_int32_t;
|
|
||||||
typedef unsigned char flex_uint8_t;
|
|
||||||
typedef unsigned short int flex_uint16_t;
|
|
||||||
typedef unsigned int flex_uint32_t;
|
|
||||||
|
|
||||||
/* Limits of integral types. */
|
|
||||||
#ifndef INT8_MIN
|
|
||||||
#define INT8_MIN (-128)
|
|
||||||
#endif
|
|
||||||
#ifndef INT16_MIN
|
|
||||||
#define INT16_MIN (-32767-1)
|
|
||||||
#endif
|
|
||||||
#ifndef INT32_MIN
|
|
||||||
#define INT32_MIN (-2147483647-1)
|
|
||||||
#endif
|
|
||||||
#ifndef INT8_MAX
|
|
||||||
#define INT8_MAX (127)
|
|
||||||
#endif
|
|
||||||
#ifndef INT16_MAX
|
|
||||||
#define INT16_MAX (32767)
|
|
||||||
#endif
|
|
||||||
#ifndef INT32_MAX
|
|
||||||
#define INT32_MAX (2147483647)
|
|
||||||
#endif
|
|
||||||
#ifndef UINT8_MAX
|
|
||||||
#define UINT8_MAX (255U)
|
|
||||||
#endif
|
|
||||||
#ifndef UINT16_MAX
|
|
||||||
#define UINT16_MAX (65535U)
|
|
||||||
#endif
|
|
||||||
#ifndef UINT32_MAX
|
|
||||||
#define UINT32_MAX (4294967295U)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SIZE_MAX
|
|
||||||
#define SIZE_MAX (~(size_t)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ! C99 */
|
|
||||||
|
|
||||||
#endif /* ! FLEXINT_H */
|
|
||||||
|
|
||||||
/* begin standard C++ headers. */
|
|
||||||
|
|
||||||
/* TODO: this is always defined, so inline it */
|
|
||||||
#define yyconst const
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
|
||||||
#define yynoreturn __attribute__((__noreturn__))
|
|
||||||
#else
|
|
||||||
#define yynoreturn
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Size of default input buffer. */
|
|
||||||
#ifndef YY_BUF_SIZE
|
|
||||||
#ifdef __ia64__
|
|
||||||
/* On IA-64, the buffer size is 16k, not 8k.
|
|
||||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
|
||||||
* Ditto for the __ia64__ case accordingly.
|
|
||||||
*/
|
|
||||||
#define YY_BUF_SIZE 32768
|
|
||||||
#else
|
|
||||||
#define YY_BUF_SIZE 16384
|
|
||||||
#endif /* __ia64__ */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
|
||||||
#define YY_TYPEDEF_YY_BUFFER_STATE
|
|
||||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
|
||||||
#define YY_TYPEDEF_YY_SIZE_T
|
|
||||||
typedef size_t yy_size_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int yyleng;
|
|
||||||
|
|
||||||
extern FILE *yyin, *yyout;
|
|
||||||
|
|
||||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
|
||||||
#define YY_STRUCT_YY_BUFFER_STATE
|
|
||||||
struct yy_buffer_state
|
|
||||||
{
|
|
||||||
FILE *yy_input_file;
|
|
||||||
|
|
||||||
char *yy_ch_buf; /* input buffer */
|
|
||||||
char *yy_buf_pos; /* current position in input buffer */
|
|
||||||
|
|
||||||
/* Size of input buffer in bytes, not including room for EOB
|
|
||||||
* characters.
|
|
||||||
*/
|
|
||||||
int yy_buf_size;
|
|
||||||
|
|
||||||
/* Number of characters read into yy_ch_buf, not including EOB
|
|
||||||
* characters.
|
|
||||||
*/
|
|
||||||
int yy_n_chars;
|
|
||||||
|
|
||||||
/* Whether we "own" the buffer - i.e., we know we created it,
|
|
||||||
* and can realloc() it to grow it, and should free() it to
|
|
||||||
* delete it.
|
|
||||||
*/
|
|
||||||
int yy_is_our_buffer;
|
|
||||||
|
|
||||||
/* Whether this is an "interactive" input source; if so, and
|
|
||||||
* if we're using stdio for input, then we want to use getc()
|
|
||||||
* instead of fread(), to make sure we stop fetching input after
|
|
||||||
* each newline.
|
|
||||||
*/
|
|
||||||
int yy_is_interactive;
|
|
||||||
|
|
||||||
/* Whether we're considered to be at the beginning of a line.
|
|
||||||
* If so, '^' rules will be active on the next match, otherwise
|
|
||||||
* not.
|
|
||||||
*/
|
|
||||||
int yy_at_bol;
|
|
||||||
|
|
||||||
int yy_bs_lineno; /**< The line count. */
|
|
||||||
int yy_bs_column; /**< The column count. */
|
|
||||||
|
|
||||||
/* Whether to try to fill the input buffer when we reach the
|
|
||||||
* end of it.
|
|
||||||
*/
|
|
||||||
int yy_fill_buffer;
|
|
||||||
|
|
||||||
int yy_buffer_status;
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
|
||||||
|
|
||||||
void yyrestart ( FILE *input_file );
|
|
||||||
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
|
||||||
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
|
||||||
void yy_delete_buffer ( YY_BUFFER_STATE b );
|
|
||||||
void yy_flush_buffer ( YY_BUFFER_STATE b );
|
|
||||||
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
|
|
||||||
void yypop_buffer_state ( void );
|
|
||||||
|
|
||||||
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
|
|
||||||
YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
|
|
||||||
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
|
|
||||||
|
|
||||||
void *yyalloc ( yy_size_t );
|
|
||||||
void *yyrealloc ( void *, yy_size_t );
|
|
||||||
void yyfree ( void * );
|
|
||||||
|
|
||||||
/* Begin user sect3 */
|
|
||||||
|
|
||||||
#define yywrap() (/*CONSTCOND*/1)
|
|
||||||
#define YY_SKIP_YYWRAP
|
|
||||||
|
|
||||||
extern int yylineno;
|
|
||||||
|
|
||||||
extern char *yytext;
|
|
||||||
#ifdef yytext_ptr
|
|
||||||
#undef yytext_ptr
|
|
||||||
#endif
|
|
||||||
#define yytext_ptr yytext
|
|
||||||
|
|
||||||
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
|
|
||||||
#define INITIAL 0
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YY_NO_UNISTD_H
|
|
||||||
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
|
||||||
* down here because we want the user's section 1 to have been scanned first.
|
|
||||||
* The user has a chance to override it with an option.
|
|
||||||
*/
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YY_EXTRA_TYPE
|
|
||||||
#define YY_EXTRA_TYPE void *
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Accessor methods to globals.
|
|
||||||
These are made visible to non-reentrant scanners for convenience. */
|
|
||||||
|
|
||||||
int yylex_destroy ( void );
|
|
||||||
|
|
||||||
int yyget_debug ( void );
|
|
||||||
|
|
||||||
void yyset_debug ( int debug_flag );
|
|
||||||
|
|
||||||
YY_EXTRA_TYPE yyget_extra ( void );
|
|
||||||
|
|
||||||
void yyset_extra ( YY_EXTRA_TYPE user_defined );
|
|
||||||
|
|
||||||
FILE *yyget_in ( void );
|
|
||||||
|
|
||||||
void yyset_in ( FILE * _in_str );
|
|
||||||
|
|
||||||
FILE *yyget_out ( void );
|
|
||||||
|
|
||||||
void yyset_out ( FILE * _out_str );
|
|
||||||
|
|
||||||
int yyget_leng ( void );
|
|
||||||
|
|
||||||
char *yyget_text ( void );
|
|
||||||
|
|
||||||
int yyget_lineno ( void );
|
|
||||||
|
|
||||||
void yyset_lineno ( int _line_number );
|
|
||||||
|
|
||||||
/* Macros after this point can all be overridden by user definitions in
|
|
||||||
* section 1.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef YY_SKIP_YYWRAP
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" int yywrap ( void );
|
|
||||||
#else
|
|
||||||
extern int yywrap ( void );
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef yytext_ptr
|
|
||||||
static void yy_flex_strncpy ( char *, const char *, int );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef YY_NEED_STRLEN
|
|
||||||
static int yy_flex_strlen ( const char * );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YY_NO_INPUT
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Amount of stuff to slurp up with each read. */
|
|
||||||
#ifndef YY_READ_BUF_SIZE
|
|
||||||
#ifdef __ia64__
|
|
||||||
/* On IA-64, the buffer size is 16k, not 8k */
|
|
||||||
#define YY_READ_BUF_SIZE 16384
|
|
||||||
#else
|
|
||||||
#define YY_READ_BUF_SIZE 8192
|
|
||||||
#endif /* __ia64__ */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Number of entries by which start-condition stack grows. */
|
|
||||||
#ifndef YY_START_STACK_INCR
|
|
||||||
#define YY_START_STACK_INCR 25
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Default declaration of generated scanner - a define so the user can
|
|
||||||
* easily add parameters.
|
|
||||||
*/
|
|
||||||
#ifndef YY_DECL
|
|
||||||
#define YY_DECL_IS_OURS 1
|
|
||||||
|
|
||||||
extern int yylex (void);
|
|
||||||
|
|
||||||
#define YY_DECL int yylex (void)
|
|
||||||
#endif /* !YY_DECL */
|
|
||||||
|
|
||||||
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
|
||||||
|
|
||||||
#undef YY_NEW_FILE
|
|
||||||
#undef YY_FLUSH_BUFFER
|
|
||||||
#undef yy_set_bol
|
|
||||||
#undef yy_new_buffer
|
|
||||||
#undef yy_set_interactive
|
|
||||||
#undef YY_DO_BEFORE_ACTION
|
|
||||||
|
|
||||||
#ifdef YY_DECL_IS_OURS
|
|
||||||
#undef YY_DECL_IS_OURS
|
|
||||||
#undef YY_DECL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef yy_create_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_create_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef yy_delete_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_delete_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef yy_scan_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_scan_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef yy_scan_string_ALREADY_DEFINED
|
|
||||||
#undef yy_scan_string
|
|
||||||
#endif
|
|
||||||
#ifndef yy_scan_bytes_ALREADY_DEFINED
|
|
||||||
#undef yy_scan_bytes
|
|
||||||
#endif
|
|
||||||
#ifndef yy_init_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_init_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef yy_flush_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_flush_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef yy_load_buffer_state_ALREADY_DEFINED
|
|
||||||
#undef yy_load_buffer_state
|
|
||||||
#endif
|
|
||||||
#ifndef yy_switch_to_buffer_ALREADY_DEFINED
|
|
||||||
#undef yy_switch_to_buffer
|
|
||||||
#endif
|
|
||||||
#ifndef yypush_buffer_state_ALREADY_DEFINED
|
|
||||||
#undef yypush_buffer_state
|
|
||||||
#endif
|
|
||||||
#ifndef yypop_buffer_state_ALREADY_DEFINED
|
|
||||||
#undef yypop_buffer_state
|
|
||||||
#endif
|
|
||||||
#ifndef yyensure_buffer_stack_ALREADY_DEFINED
|
|
||||||
#undef yyensure_buffer_stack
|
|
||||||
#endif
|
|
||||||
#ifndef yylex_ALREADY_DEFINED
|
|
||||||
#undef yylex
|
|
||||||
#endif
|
|
||||||
#ifndef yyrestart_ALREADY_DEFINED
|
|
||||||
#undef yyrestart
|
|
||||||
#endif
|
|
||||||
#ifndef yylex_init_ALREADY_DEFINED
|
|
||||||
#undef yylex_init
|
|
||||||
#endif
|
|
||||||
#ifndef yylex_init_extra_ALREADY_DEFINED
|
|
||||||
#undef yylex_init_extra
|
|
||||||
#endif
|
|
||||||
#ifndef yylex_destroy_ALREADY_DEFINED
|
|
||||||
#undef yylex_destroy
|
|
||||||
#endif
|
|
||||||
#ifndef yyget_debug_ALREADY_DEFINED
|
|
||||||
#undef yyget_debug
|
|
||||||
#endif
|
|
||||||
#ifndef yyset_debug_ALREADY_DEFINED
|
|
||||||
#undef yyset_debug
|
|
||||||
#endif
|
|
||||||
#ifndef yyget_extra_ALREADY_DEFINED
|
|
||||||
#undef yyget_extra
|
|
||||||
#endif
|
|
||||||
#ifndef yyset_extra_ALREADY_DEFINED
|
|
||||||
#undef yyset_extra
|
|
||||||
#endif
|
|
||||||
#ifndef yyget_in_ALREADY_DEFINED
|
|
||||||
#undef yyget_in
|
|
||||||
#endif
|
|
||||||
#ifndef yyset_in_ALREADY_DEFINED
|
|
||||||
#undef yyset_in
|
|
||||||
#endif
|
|
||||||
#ifndef yyget_out_ALREADY_DEFINED
|
|
||||||
#undef yyget_out
|
|
||||||
#endif
|
|
||||||
#ifndef yyset_out_ALREADY_DEFINED
|
|
||||||
#undef yyset_out
|
|
||||||
#endif
|
|
||||||
#ifndef yyget_leng_ALREADY_DEFINED
|
|
||||||
#undef yyget_leng
|
|
||||||
#endif
|
|
||||||
#ifndef yyget_text_ALREADY_DEFINED
|
|
||||||
#undef yyget_text
|
|
||||||
#endif
|
|
||||||
#ifndef yyget_lineno_ALREADY_DEFINED
|
|
||||||
#undef yyget_lineno
|
|
||||||
#endif
|
|
||||||
#ifndef yyset_lineno_ALREADY_DEFINED
|
|
||||||
#undef yyset_lineno
|
|
||||||
#endif
|
|
||||||
#ifndef yyget_column_ALREADY_DEFINED
|
|
||||||
#undef yyget_column
|
|
||||||
#endif
|
|
||||||
#ifndef yyset_column_ALREADY_DEFINED
|
|
||||||
#undef yyset_column
|
|
||||||
#endif
|
|
||||||
#ifndef yywrap_ALREADY_DEFINED
|
|
||||||
#undef yywrap
|
|
||||||
#endif
|
|
||||||
#ifndef yyget_lval_ALREADY_DEFINED
|
|
||||||
#undef yyget_lval
|
|
||||||
#endif
|
|
||||||
#ifndef yyset_lval_ALREADY_DEFINED
|
|
||||||
#undef yyset_lval
|
|
||||||
#endif
|
|
||||||
#ifndef yyget_lloc_ALREADY_DEFINED
|
|
||||||
#undef yyget_lloc
|
|
||||||
#endif
|
|
||||||
#ifndef yyset_lloc_ALREADY_DEFINED
|
|
||||||
#undef yyset_lloc
|
|
||||||
#endif
|
|
||||||
#ifndef yyalloc_ALREADY_DEFINED
|
|
||||||
#undef yyalloc
|
|
||||||
#endif
|
|
||||||
#ifndef yyrealloc_ALREADY_DEFINED
|
|
||||||
#undef yyrealloc
|
|
||||||
#endif
|
|
||||||
#ifndef yyfree_ALREADY_DEFINED
|
|
||||||
#undef yyfree
|
|
||||||
#endif
|
|
||||||
#ifndef yytext_ALREADY_DEFINED
|
|
||||||
#undef yytext
|
|
||||||
#endif
|
|
||||||
#ifndef yyleng_ALREADY_DEFINED
|
|
||||||
#undef yyleng
|
|
||||||
#endif
|
|
||||||
#ifndef yyin_ALREADY_DEFINED
|
|
||||||
#undef yyin
|
|
||||||
#endif
|
|
||||||
#ifndef yyout_ALREADY_DEFINED
|
|
||||||
#undef yyout
|
|
||||||
#endif
|
|
||||||
#ifndef yy_flex_debug_ALREADY_DEFINED
|
|
||||||
#undef yy_flex_debug
|
|
||||||
#endif
|
|
||||||
#ifndef yylineno_ALREADY_DEFINED
|
|
||||||
#undef yylineno
|
|
||||||
#endif
|
|
||||||
#ifndef yytables_fload_ALREADY_DEFINED
|
|
||||||
#undef yytables_fload
|
|
||||||
#endif
|
|
||||||
#ifndef yytables_destroy_ALREADY_DEFINED
|
|
||||||
#undef yytables_destroy
|
|
||||||
#endif
|
|
||||||
#ifndef yyTABLES_NAME_ALREADY_DEFINED
|
|
||||||
#undef yyTABLES_NAME
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#line 13 "src/monitor/sdb/addrexp.l"
|
|
||||||
|
|
||||||
|
|
||||||
#line 477 "src/monitor/sdb/addrexp_lex.h"
|
|
||||||
#undef yyIN_HEADER
|
|
||||||
#endif /* yyHEADER_H */
|
|
3
nemu/tests/Makefile
Normal file
3
nemu/tests/Makefile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
CFLGAS += $(pkg-config --cflags --libs check)
|
||||||
|
|
||||||
|
include $(NEMU_HOME)/scripts/build.mk
|
3
nemu/tests/expr_test.c
Normal file
3
nemu/tests/expr_test.c
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#include <check.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue