-
Notifications
You must be signed in to change notification settings - Fork 154
/
Copy path0.6.html
1165 lines (642 loc) · 55.1 KB
/
0.6.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Getting Source Code for PAs · GitBook</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<link rel="stylesheet" href="gitbook/style.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-intopic-toc/style.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-page-footer-ex/style/plugin.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-callouts/plugin.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-theme-comscore/test.css">
<link rel="stylesheet" href="styles.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="PA1.html" />
<link rel="prev" href="0.5.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="index.html">
<a href="index.html">
Introduction
</a>
</li>
<li class="chapter " data-level="1.2" data-path="PA0.html">
<a href="PA0.html">
PA0 - 世界诞生的前夜: 开发环境配置
</a>
<ul class="articles">
<li class="chapter " data-level="1.2.1" data-path="0.1.html">
<a href="0.1.html">
Installing GNU/Linux
</a>
</li>
<li class="chapter " data-level="1.2.2" data-path="0.2.html">
<a href="0.2.html">
First Exploration with GNU/Linux
</a>
</li>
<li class="chapter " data-level="1.2.3" data-path="0.3.html">
<a href="0.3.html">
Installing Tools
</a>
</li>
<li class="chapter " data-level="1.2.4" data-path="0.4.html">
<a href="0.4.html">
Configuring vim
</a>
</li>
<li class="chapter " data-level="1.2.5" data-path="0.5.html">
<a href="0.5.html">
More Exploration
</a>
</li>
<li class="chapter active" data-level="1.2.6" data-path="0.6.html">
<a href="0.6.html">
Getting Source Code for PAs
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.3" data-path="PA1.html">
<a href="PA1.html">
PA1 - 开天辟地的篇章: 最简单的计算机
</a>
<ul class="articles">
<li class="chapter " data-level="1.3.1" data-path="1.1.html">
<a href="1.1.html">
在开始愉快的PA之旅之前
</a>
</li>
<li class="chapter " data-level="1.3.2" data-path="1.2.html">
<a href="1.2.html">
开天辟地的篇章
</a>
</li>
<li class="chapter " data-level="1.3.3" data-path="1.3.html">
<a href="1.3.html">
RTFSC
</a>
</li>
<li class="chapter " data-level="1.3.4" data-path="1.4.html">
<a href="1.4.html">
基础设施
</a>
</li>
<li class="chapter " data-level="1.3.5" data-path="1.5.html">
<a href="1.5.html">
表达式求值
</a>
</li>
<li class="chapter " data-level="1.3.6" data-path="1.6.html">
<a href="1.6.html">
监视点
</a>
</li>
<li class="chapter " data-level="1.3.7" data-path="1.7.html">
<a href="1.7.html">
如何阅读手册
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.4" data-path="PA2.html">
<a href="PA2.html">
PA2 - 简单复杂的机器: 冯诺依曼计算机系统
</a>
<ul class="articles">
<li class="chapter " data-level="1.4.1" data-path="2.1.html">
<a href="2.1.html">
不停计算的机器
</a>
</li>
<li class="chapter " data-level="1.4.2" data-path="2.2.html">
<a href="2.2.html">
RTFSC(2)
</a>
</li>
<li class="chapter " data-level="1.4.3" data-path="2.3.html">
<a href="2.3.html">
程序, 运行时环境与AM
</a>
</li>
<li class="chapter " data-level="1.4.4" data-path="2.4.html">
<a href="2.4.html">
基础设施(2)
</a>
</li>
<li class="chapter " data-level="1.4.5" data-path="2.5.html">
<a href="2.5.html">
输入输出
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.5" data-path="PA3.html">
<a href="PA3.html">
PA3 - 穿越时空的旅程: 批处理系统
</a>
<ul class="articles">
<li class="chapter " data-level="1.5.1" data-path="3.1.html">
<a href="3.1.html">
最简单的操作系统
</a>
</li>
<li class="chapter " data-level="1.5.2" data-path="3.2.html">
<a href="3.2.html">
穿越时空的旅程
</a>
</li>
<li class="chapter " data-level="1.5.3" data-path="3.3.html">
<a href="3.3.html">
用户程序和系统调用
</a>
</li>
<li class="chapter " data-level="1.5.4" data-path="3.4.html">
<a href="3.4.html">
文件系统
</a>
</li>
<li class="chapter " data-level="1.5.5" data-path="3.5.html">
<a href="3.5.html">
精彩纷呈的应用程序
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.6" data-path="PA4.html">
<a href="PA4.html">
PA4 - 虚实交错的魔法: 分时多任务
</a>
<ul class="articles">
<li class="chapter " data-level="1.6.1" data-path="4.1.html">
<a href="4.1.html">
多道程序
</a>
</li>
<li class="chapter " data-level="1.6.2" data-path="4.2.html">
<a href="4.2.html">
虚实交错的魔法
</a>
</li>
<li class="chapter " data-level="1.6.3" data-path="4.3.html">
<a href="4.3.html">
超越容量的界限
</a>
</li>
<li class="chapter " data-level="1.6.4" data-path="4.4.html">
<a href="4.4.html">
来自外部的声音
</a>
</li>
<li class="chapter " data-level="1.6.5" data-path="4.5.html">
<a href="4.5.html">
编写不朽的传奇
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="1.7" data-path="blank.html">
<a href="blank.html">
杂项
</a>
<ul class="articles">
<li class="chapter " data-level="1.7.1" data-path="FAQ.html">
<a href="FAQ.html">
常见问题(FAQ)
</a>
</li>
<li class="chapter " data-level="1.7.2" data-path="why.html">
<a href="why.html">
为什么要学习计算机系统基础
</a>
</li>
<li class="chapter " data-level="1.7.3" data-path="linux.html">
<a href="linux.html">
Linux入门教程
</a>
</li>
<li class="chapter " data-level="1.7.4" data-path="man.html">
<a href="man.html">
man入门教程
</a>
</li>
<li class="chapter " data-level="1.7.5" data-path="git.html">
<a href="git.html">
git入门教程
</a>
</li>
<li class="chapter " data-level="1.7.6" data-path="nemu-isa-api.html">
<a href="nemu-isa-api.html">
NEMU ISA相关API说明文档
</a>
</li>
<li class="chapter " data-level="1.7.7" data-path="changelog.html">
<a href="changelog.html">
更新日志
</a>
</li>
<li class="chapter " data-level="1.7.8" data-path="i386-intro.html">
<a href="i386-intro.html">
i386手册指令集阅读指南
</a>
</li>
<li class="chapter " data-level="1.7.9" data-path="exec.html">
<a href="exec.html">
指令执行例子
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="." >Getting Source Code for PAs</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h2 id="getting-source-code-for-pas">Getting Source Code for PAs</h2>
<h3 id="getting-source-code">Getting Source Code</h3>
<p>Go back to the home directory by</p>
<pre><code>cd ~
</code></pre><p>Usually, all works unrelated to system should be performed under the home directory.
Other directories under the root of file system (<code>/</code>) are related to system.
Therefore, do NOT finish your PAs and Labs under these directories by <code>sudo</code>.</p>
<div class="panel panel-danger"><div class="panel-heading"><h5 class="panel-title" id="不要使用root账户做实验"><i class="fa fa-exclamation"></i> 不要使用root账户做实验!!!</h5></div><div class="panel-body"><p>使用root账户进行实验, 会改变实验相关文件的权限属性, 可能会导致开发跟踪系统无法正常工作;
更严重的, 你的误操作可能会无意中损坏系统文件, 导致系统无法启动!
往届有若干学长因此而影响了实验进度, 甚至由于损坏了实验相关的文件而影响了分数.
请大家引以为鉴, 不要贪图方便, 否则后果自负!</p><p>如果你仍然不理解为什么要这样做, 你可以阅读这个页面: <a href="http://askubuntu.com/questions/16178/why-is-it-bad-to-login-as-root" target="_blank">Why is it bad to login as root?</a>
正确的做法是: 永远使用你的普通账号做那些安分守己的事情(例如写代码),
当你需要进行一些需要root权限才能进行的操作时, 使用<code>sudo</code>.</p></div></div>
<div class="panel panel-warning"><div class="panel-heading"><h5 class="panel-title" id="在github上添加ssh-key"><i class="fa fa-edit"></i> 在github上添加ssh key</h5></div><div class="panel-body"><p>在获取框架代码之前, 首先请你在github上添加一个ssh key, 具体操作请STFW.</p></div></div>
<p>Now get the source code for PA by the following command:</p>
<div class="panel panel-danger"><div class="panel-heading"><h5 class="panel-title" id="参加一生一芯的同学-请参考一生一芯讲义获取代码链接"><i class="fa fa-exclamation"></i> 参加"一生一芯"的同学, 请参考"一生一芯"讲义获取代码链接</h5></div><div class="panel-body"><p>如果你参加"一生一芯", 请勿使用下面的代码链接.
此外, PA讲义中关于作业提交的要求, "一生一芯"的同学可以全部忽略,
但需要关注"一生一芯"讲义中的提交要求.</p></div></div>
<pre><code>git clone -b 2024 [email protected]:NJU-ProjectN/ics-pa.git ics2024
</code></pre><p>A directory called <code>ics2024</code> will be created.
This is the project directory for PAs.
Details will be explained in PA1.</p>
<p>Then issue the following commands to perform <code>git</code> configuration:</p>
<pre><code>git config --global user.name "231220000-Zhang San" # your student ID and name
git config --global user.email "[email protected]" # your email
git config --global core.editor vim # your favorite editor
git config --global color.ui true
</code></pre><p>You should configure <code>git</code> with your student ID, name, and email.
Before continuing, please read <a href="git.html">this</a> <code>git</code> tutorial to learn some basics of <code>git</code>.
Another material recommended by jyy is <a href="http://onlywei.github.io/explain-git-with-d3" target="_blank">Visualizing Git Concepts with D3</a>.
You can learn some <code>git</code> commands with the help of visualization.</p>
<p>Enter the project directory <code>ics2024</code>, then run</p>
<pre><code>git branch -m master
bash init.sh nemu
bash init.sh abstract-machine
</code></pre><p>to initialize some subprojects.
The script will pull some subprojects from github.
We will explain them later.</p>
<p>Besides, the script will also add some environment variables into the bash configuration file <code>~/.bashrc</code>.
These variables are defined by absolute path to support the compilation of the subprojects.
Therefore, <font color="red">DO NOT move your project to another directory once finishing the initialization</font>,
else these variables will become invalid.
Particularly, if you use shell other than <code>bash</code>,
please set these variables in the corresponding configuration file manually.</p>
<p>To let the environment variables take effect, run</p>
<pre><code>source ~/.bashrc
</code></pre><p>Then try</p>
<pre><code>echo $NEMU_HOME
echo $AM_HOME
cd $NEMU_HOME
cd $AM_HOME
</code></pre><p>to check whether these environment variables get the right paths.
If both the <code>echo</code> commands report the right paths,
and both the <code>cd</code> command change to the target paths without errors, we are done.
If not, please double check the steps above and the shell you are using.</p>
<h3 id="git-usage">Git usage</h3>
<p>We will use the <code>branch</code> feature of <code>git</code> to manage the process of development.
A branch is an ordered list of commits, where a commit refers to some modifications in the project.</p>
<p>You can list all branches by</p>
<pre><code>git branch
</code></pre><p>You will see there is only one branch called "master" now.</p>
<pre><code>* master
</code></pre><p>To create a new branch, use <code>git checkout</code> command:</p>
<pre><code>git checkout -b pa0
</code></pre><p>This command will create a branch called <code>pa0</code>, and check out to it.
Now list all branches again, and you will see we are now at branch <code>pa0</code>:</p>
<pre><code> master
* pa0
</code></pre><p>From now on, all modifications of files in the project will be recorded in the branch <code>pa0</code>.</p>
<p>Now have a try!
Modify the <code>STUID</code> and <code>STUNAME</code> variables in <code>ics2024/Makefile</code>:</p>
<pre><code>STUID = 231220000 # your student ID
STUNAME = 张三 # your Chinese name
</code></pre><p>Run</p>
<pre><code>git status
</code></pre><p>to see those files modified from the last commit:</p>
<pre><code>On branch pa0
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Makefile
no changes added to commit (use "git add" and/or "git commit -a")
</code></pre><p>Run</p>
<pre><code>git diff
</code></pre><p>to list modifications from the last commit:</p>
<pre><code class="lang-diff">diff --git a/Makefile b/Makefile
index c9b1708..b7b2e02 100644
<span class="hljs-comment">--- a/Makefile</span>
<span class="hljs-comment">+++ b/Makefile</span>
<span class="hljs-meta">@@ -1,4 +1,4 @@</span>
<span class="hljs-deletion">-STUID = 231220000</span>
<span class="hljs-deletion">-STUNAME = 张三</span>
<span class="hljs-addition">+STUID = 231221234</span>
<span class="hljs-addition">+STUNAME = 李四</span>
# DO NOT modify the following code!!!
</code></pre>
<p>You should see <code>STUID</code> and <code>STUNAME</code> are modified.
Now add the changes to commit by <code>git add</code>, and issue <code>git commit</code>:</p>
<pre><code>git add .
git commit
</code></pre><p>The <code>git commit</code> command will call the text editor.
Type <code>modified my info</code> in the first line, and keep the remaining contents unchanged.
Save and exit the editor, and this finishes a commit.
Now you should see a log labeled with your student ID and name by</p>
<pre><code>git log
</code></pre><p>Now switch back to the <code>master</code> branch by</p>
<pre><code>git checkout master
</code></pre><p>Open <code>ics2024/Makefile</code>, and you will find that <code>STUID</code> and <code>STUNAME</code> are still unchanged!
By issuing <code>git log</code>, you will find that the commit log you just created has disappeared!</p>
<p>Don't worry! This is a feature of branches in <code>git</code>.
Modifications in different branches are isolated,
which means modifying files in one branch will not affect other branches.
Switch back to <code>pa0</code> branch by</p>
<pre><code>git checkout pa0
</code></pre><p>You will find that everything comes back!
At the beginning of PA1, you will merge all changes in branch <code>pa0</code> into <code>master</code>.</p>
<p>The workflow above shows how you will use branch in PAs:</p>
<ul>
<li>before starting a new PA, new a branch <code>pa?</code> and check out to it</li>
<li>coding in the branch <code>pa?</code> (this will introduce lot of modifications)</li>
<li>after finish the PA, merge the branch <code>pa?</code> into <code>master</code>, and check out back to <code>master</code></li>
</ul>
<h3 id="compiling-and-running-nemu">Compiling and Running NEMU</h3>
<p>Now enter <code>nemu/</code> directory.
Before the first time to compile NEMU, a configuration file should be generated by</p>
<pre><code>make menuconfig
</code></pre><div class="panel panel-danger"><div class="panel-heading"><h5 class="panel-title" id="编译报错了"><i class="fa fa-bullhorn"></i> 编译报错了</h5></div><div class="panel-body"><p>你有可能会遇到这个错误信息, 好吧确实是讲义疏忽了.
那就正好当作一个练习吧: 你需要把缺少的工具装上.
至于怎么装, 当然是STFW了.</p><p>注意, 你需要<font color="red"><strong>仔细阅读输出的每一个字符</strong></font>,
如果你阅读得足够仔细, 你应该能明白问题的根源是什么.
否则, 你可能会花费很多不必要的时间, 我们已经见到过不少这样的同学了,</p></div></div>
<p>A menu will pop up. DO NOT modify anything.
Just choose <code>Exit</code> and <code>Yes</code> to save the new configuration.
After that, compile the project by <code>make</code>:</p>
<pre><code>make
</code></pre><p>If nothing goes wrong, NEMU will be compiled successfully.</p>
<div class="panel panel-info"><div class="panel-heading"><h5 class="panel-title" id="what-happened"><i class="fa fa-question-circle"></i> What happened?</h5></div><div class="panel-body"><p>You should know how a program is generated in the 程序设计基础 course.
But do you have any idea about what happened
when a bunch of information is output to the screen during <code>make</code> is executed?</p></div></div>
<p>To perform a fresh compilation, type</p>
<pre><code>make clean
</code></pre><p>to remove the old compilation result, then <code>make</code> again.</p>
<p>To run NEMU, type</p>
<pre><code>make run
</code></pre><div class="panel panel-danger"><div class="panel-heading"><h5 class="panel-title" id="修复capstone版本不一致的问题"><i class="fa fa-exclamation"></i> 修复capstone版本不一致的问题</h5></div><div class="panel-body"><p>第三方库capstone在2024/09/30 23:11:00发布了新版本<code>6.0.0-Alpha1</code>, 与框架代码中指示的版本不兼容,
从而造成以下运行时错误:</p><pre><code>riscv32-nemu-interpreter: src/utils/disasm.c:29: void init_disasm(): Assertion `dl_handle' failed.
</code></pre><p>如果你在2024/10/01 16:10:00前获取NEMU的代码, 并遇到了上述错误,
请参考<a href="https://github.com/NJU-ProjectN/nemu/commit/710a08994ef0a4c5ab2726072f96fbf981751c32" target="_blank">这里</a>更新代码, 并删除<code>nemu/tools/capstone/repo</code>目录,
然后重新运行<code>make run</code>, 即可修复上述问题.</p></div></div>
<p>However, you will see an error message:</p>
<pre><code>[src/monitor/monitor.c:35 welcome] Exercise: Please remove me in the source code and compile NEMU again.
riscv32-nemu-interpreter: src/monitor/monitor.c:36: welcome: Assertion `0' failed.
</code></pre><p>This message tells you that the program has triggered an assertion fail
at line 36 of the file <code>nemu/src/monitor/monitor.c</code>.
If you do not know what is assertion, blame the 程序设计基础 course.
But just ignore it now, and you will fix it in PA1.</p>
<p>To debug NEMU with gdb, type</p>
<pre><code>make gdb
</code></pre><h3 id="development-tracing">Development Tracing</h3>
<p>Once the compilation succeeds, the change of source code will be traced by <code>git</code>.
Type</p>
<pre><code>git log
</code></pre><p>If you see something like</p>
<pre><code>commit 4072d39e5b6c6b6837077f2d673cb0b5014e6ef9
Author: tracer-ics2024 <[email protected]>
Date: Sun Jul 26 14:30:31 2024 +0800
> run NEMU
231220000 张三
Linux 9900k 5.10.0-10-amd64 #1 SMP Debian 5.10.84-1 (2021-12-08) x86_64 GNU/Linux
15:57:01 up 22 days, 6:01, 16 users, load average: 0.00, 0.00, 0.00
</code></pre><p>this means the change is traced successfully.</p>
<div class="panel panel-info"><div class="panel-heading"><h5 class="panel-title" id="一生一芯的代码跟踪日志位于另一个分支"><i class="fa fa-info-circle"></i> "一生一芯"的代码跟踪日志位于另一个分支</h5></div><div class="panel-body"><p>如果你参加"一生一芯", 请通过<code>git log tracer-ysyx</code>查看代码跟踪日志.</p></div></div>
<p>If you see the following message while executing make, this means the tracing fails.</p>
<pre><code>fatal: Unable to create '/home/user/ics2024/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
</code></pre><p>Try to clean the compilation result and compile again:</p>
<pre><code>make clean
make
</code></pre><p>If the error message above always appears, please contact us as soon as possible.</p>
<div class="panel panel-danger"><div class="panel-heading"><h5 class="panel-title" id="开发跟踪"><i class="fa fa-exclamation"></i> 开发跟踪</h5></div><div class="panel-body"><p>我们使用<code>git</code>对你的实验过程进行跟踪, 不合理的跟踪记录会影响你的成绩.
往届有学长"完成"了某部分实验内容, 但我们找不到相应的git log, 最终该部分内容被视为没有完成.
git log是独立完成实验的最有力证据, 完成了实验内容却缺少合理的git log,
不仅会损失大量分数, 还会给抄袭判定提供最有力的证据.
因此, 请你注意以下事项:</p><ul>
<li>请你不定期查看自己的git log, 检查是否与自己的开发过程相符.</li>
<li>提交往届代码将被视为没有提交.</li>
<li>不要把你的代码上传到公开的地方(现在github个人账号也可以创建私有仓库了).</li>
<li>总是在工程目录下进行开发, 不要在其它地方进行开发, 然后一次性将代码复制到工程目录下, 这样<code>git</code>将不能正确记录你的开发过程.</li>
<li>不要修改<code>Makefile</code>中与开发跟踪相关的内容.</li>
<li>不要删除我们要求创建的分支, 否则会影响我们的脚本运行, 从而影响你的成绩</li>
<li>不要清除git log</li>
</ul><p>偶然的跟踪失败不会影响你的成绩.
如果上文中的错误信息总是出现, 请尽快联系我们.</p></div></div>
<!-- -->
<div class="panel panel-info"><div class="panel-heading"><h5 class="panel-title" id="我不是修读本课程的学生-是否能够关闭开发跟踪"><i class="fa fa-comment-o"></i> 我不是修读本课程的学生, 是否能够关闭开发跟踪?</h5></div><div class="panel-body"><p>可进行如下修改关闭开发跟踪:</p><pre><code class="lang-diff">diff --git a/Makefile b/Makefile
index c9b1708..b7b2e02 100644
<span class="hljs-comment">--- a/Makefile</span>
<span class="hljs-comment">+++ b/Makefile</span>
<span class="hljs-meta">@@ -9,6 +9,6 @@</span>
define git_commit
<span class="hljs-deletion">- -@git add .. -A --ignore-errors</span>
<span class="hljs-deletion">- -@while (test -e .git/index.lock); do sleep 0.1; done</span>
<span class="hljs-deletion">- -@(echo "> $(1)" && echo $(STUID) $(STUNAME) && uname -a && uptime) | git commit -F - $(GITFLAGS)</span>
<span class="hljs-deletion">- -@sync</span>
<span class="hljs-addition">+# -@git add .. -A --ignore-errors</span>
<span class="hljs-addition">+# -@while (test -e .git/index.lock); do sleep 0.1; done</span>
<span class="hljs-addition">+# -@(echo "> $(1)" && echo $(STUID) $(STUNAME) && uname -a && uptime) | git commit -F - $(GITFLAGS)</span>
<span class="hljs-addition">+# -@sync</span>
endef
</code></pre></div></div>
<h3 id="local-commit">Local Commit</h3>
<p>Although the development tracing system will trace the change of your code
after every successful compilation, the trace record is not suitable for your development.
This is because the code is still buggy at most of the time.
Also, it is not easy for you to identify those bug-free traces.
Therefore, you should trace your bug-free code manually.</p>
<p>When you want to commit the change, type</p>
<pre><code>git add .
git commit --allow-empty
</code></pre><p>The <code>--allow-empty</code> option is necessary,
because usually the change is already committed by development tracing system.
Without this option, <code>git</code> will reject no-change commits.
If the commit succeeds, you can see a log labeled with your student ID and name by</p>
<pre><code>git log
</code></pre><p>To filter out the commit logs corresponding to your manual commit, use <code>--author</code> option with <code>git log</code>.
For details about how to use this option, RTFM.</p>
<h3 id="writing-report">Writing Report</h3>
<div class="panel panel-danger"><div class="panel-heading"><h5 class="panel-title" id="实验报告内容"><i class="fa fa-exclamation"></i> 实验报告内容</h5></div><div class="panel-body"><p>你必须在实验报告中描述以下内容:</p><ul>
<li><font color="red">实验进度. 简单描述即可, 例如"我完成了所有内容", "我只完成了xxx".<br>缺少实验进度的描述, 或者描述与实际情况不符, 将被视为没有完成本次实验.</font></li>
<li><font color="red">必答题.</font>
</li>
</ul><p>你可以自由选择报告的其它内容. 你不必详细地描述实验过程, 但我们鼓励你在报告中描述如下内容:</p><ul>
<li>你遇到的问题和对这些问题的思考</li>
<li>对讲义中蓝框思考题的看法</li>
<li>或者你的其它想法, 例如实验心得, 对提供帮助的同学的感谢等</li>
</ul><p>认真描述实验心得和想法的报告将会获得分数的奖励;
蓝框题为选做, 完成了也不会得到分数的奖励,
但它们是经过精心准备的, 可以加深你对某些知识的理解和认识.