-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusertests.asm
7938 lines (7605 loc) · 306 KB
/
usertests.asm
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
_usertests: file format elf32-i386
Disassembly of section .text:
00000000 <iputtest>:
int stdout = 1;
// does chdir() call iput(p->cwd) in a transaction?
void
iputtest(void)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 08 sub $0x8,%esp
printf(stdout, "iput test\n");
6: a1 b8 62 00 00 mov 0x62b8,%eax
b: 83 ec 08 sub $0x8,%esp
e: 68 12 44 00 00 push $0x4412
13: 50 push %eax
14: e8 2d 40 00 00 call 4046 <printf>
19: 83 c4 10 add $0x10,%esp
if(mkdir("iputdir") < 0){
1c: 83 ec 0c sub $0xc,%esp
1f: 68 1d 44 00 00 push $0x441d
24: e8 0e 3f 00 00 call 3f37 <mkdir>
29: 83 c4 10 add $0x10,%esp
2c: 85 c0 test %eax,%eax
2e: 79 1b jns 4b <iputtest+0x4b>
printf(stdout, "mkdir failed\n");
30: a1 b8 62 00 00 mov 0x62b8,%eax
35: 83 ec 08 sub $0x8,%esp
38: 68 25 44 00 00 push $0x4425
3d: 50 push %eax
3e: e8 03 40 00 00 call 4046 <printf>
43: 83 c4 10 add $0x10,%esp
exit();
46: e8 84 3e 00 00 call 3ecf <exit>
}
if(chdir("iputdir") < 0){
4b: 83 ec 0c sub $0xc,%esp
4e: 68 1d 44 00 00 push $0x441d
53: e8 e7 3e 00 00 call 3f3f <chdir>
58: 83 c4 10 add $0x10,%esp
5b: 85 c0 test %eax,%eax
5d: 79 1b jns 7a <iputtest+0x7a>
printf(stdout, "chdir iputdir failed\n");
5f: a1 b8 62 00 00 mov 0x62b8,%eax
64: 83 ec 08 sub $0x8,%esp
67: 68 33 44 00 00 push $0x4433
6c: 50 push %eax
6d: e8 d4 3f 00 00 call 4046 <printf>
72: 83 c4 10 add $0x10,%esp
exit();
75: e8 55 3e 00 00 call 3ecf <exit>
}
if(unlink("../iputdir") < 0){
7a: 83 ec 0c sub $0xc,%esp
7d: 68 49 44 00 00 push $0x4449
82: e8 98 3e 00 00 call 3f1f <unlink>
87: 83 c4 10 add $0x10,%esp
8a: 85 c0 test %eax,%eax
8c: 79 1b jns a9 <iputtest+0xa9>
printf(stdout, "unlink ../iputdir failed\n");
8e: a1 b8 62 00 00 mov 0x62b8,%eax
93: 83 ec 08 sub $0x8,%esp
96: 68 54 44 00 00 push $0x4454
9b: 50 push %eax
9c: e8 a5 3f 00 00 call 4046 <printf>
a1: 83 c4 10 add $0x10,%esp
exit();
a4: e8 26 3e 00 00 call 3ecf <exit>
}
if(chdir("/") < 0){
a9: 83 ec 0c sub $0xc,%esp
ac: 68 6e 44 00 00 push $0x446e
b1: e8 89 3e 00 00 call 3f3f <chdir>
b6: 83 c4 10 add $0x10,%esp
b9: 85 c0 test %eax,%eax
bb: 79 1b jns d8 <iputtest+0xd8>
printf(stdout, "chdir / failed\n");
bd: a1 b8 62 00 00 mov 0x62b8,%eax
c2: 83 ec 08 sub $0x8,%esp
c5: 68 70 44 00 00 push $0x4470
ca: 50 push %eax
cb: e8 76 3f 00 00 call 4046 <printf>
d0: 83 c4 10 add $0x10,%esp
exit();
d3: e8 f7 3d 00 00 call 3ecf <exit>
}
printf(stdout, "iput test ok\n");
d8: a1 b8 62 00 00 mov 0x62b8,%eax
dd: 83 ec 08 sub $0x8,%esp
e0: 68 80 44 00 00 push $0x4480
e5: 50 push %eax
e6: e8 5b 3f 00 00 call 4046 <printf>
eb: 83 c4 10 add $0x10,%esp
}
ee: 90 nop
ef: c9 leave
f0: c3 ret
000000f1 <exitiputtest>:
// does exit() call iput(p->cwd) in a transaction?
void
exitiputtest(void)
{
f1: 55 push %ebp
f2: 89 e5 mov %esp,%ebp
f4: 83 ec 18 sub $0x18,%esp
int pid;
printf(stdout, "exitiput test\n");
f7: a1 b8 62 00 00 mov 0x62b8,%eax
fc: 83 ec 08 sub $0x8,%esp
ff: 68 8e 44 00 00 push $0x448e
104: 50 push %eax
105: e8 3c 3f 00 00 call 4046 <printf>
10a: 83 c4 10 add $0x10,%esp
pid = fork();
10d: e8 b5 3d 00 00 call 3ec7 <fork>
112: 89 45 f4 mov %eax,-0xc(%ebp)
if(pid < 0){
115: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
119: 79 1b jns 136 <exitiputtest+0x45>
printf(stdout, "fork failed\n");
11b: a1 b8 62 00 00 mov 0x62b8,%eax
120: 83 ec 08 sub $0x8,%esp
123: 68 9d 44 00 00 push $0x449d
128: 50 push %eax
129: e8 18 3f 00 00 call 4046 <printf>
12e: 83 c4 10 add $0x10,%esp
exit();
131: e8 99 3d 00 00 call 3ecf <exit>
}
if(pid == 0){
136: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
13a: 0f 85 92 00 00 00 jne 1d2 <exitiputtest+0xe1>
if(mkdir("iputdir") < 0){
140: 83 ec 0c sub $0xc,%esp
143: 68 1d 44 00 00 push $0x441d
148: e8 ea 3d 00 00 call 3f37 <mkdir>
14d: 83 c4 10 add $0x10,%esp
150: 85 c0 test %eax,%eax
152: 79 1b jns 16f <exitiputtest+0x7e>
printf(stdout, "mkdir failed\n");
154: a1 b8 62 00 00 mov 0x62b8,%eax
159: 83 ec 08 sub $0x8,%esp
15c: 68 25 44 00 00 push $0x4425
161: 50 push %eax
162: e8 df 3e 00 00 call 4046 <printf>
167: 83 c4 10 add $0x10,%esp
exit();
16a: e8 60 3d 00 00 call 3ecf <exit>
}
if(chdir("iputdir") < 0){
16f: 83 ec 0c sub $0xc,%esp
172: 68 1d 44 00 00 push $0x441d
177: e8 c3 3d 00 00 call 3f3f <chdir>
17c: 83 c4 10 add $0x10,%esp
17f: 85 c0 test %eax,%eax
181: 79 1b jns 19e <exitiputtest+0xad>
printf(stdout, "child chdir failed\n");
183: a1 b8 62 00 00 mov 0x62b8,%eax
188: 83 ec 08 sub $0x8,%esp
18b: 68 aa 44 00 00 push $0x44aa
190: 50 push %eax
191: e8 b0 3e 00 00 call 4046 <printf>
196: 83 c4 10 add $0x10,%esp
exit();
199: e8 31 3d 00 00 call 3ecf <exit>
}
if(unlink("../iputdir") < 0){
19e: 83 ec 0c sub $0xc,%esp
1a1: 68 49 44 00 00 push $0x4449
1a6: e8 74 3d 00 00 call 3f1f <unlink>
1ab: 83 c4 10 add $0x10,%esp
1ae: 85 c0 test %eax,%eax
1b0: 79 1b jns 1cd <exitiputtest+0xdc>
printf(stdout, "unlink ../iputdir failed\n");
1b2: a1 b8 62 00 00 mov 0x62b8,%eax
1b7: 83 ec 08 sub $0x8,%esp
1ba: 68 54 44 00 00 push $0x4454
1bf: 50 push %eax
1c0: e8 81 3e 00 00 call 4046 <printf>
1c5: 83 c4 10 add $0x10,%esp
exit();
1c8: e8 02 3d 00 00 call 3ecf <exit>
}
exit();
1cd: e8 fd 3c 00 00 call 3ecf <exit>
}
wait();
1d2: e8 00 3d 00 00 call 3ed7 <wait>
printf(stdout, "exitiput test ok\n");
1d7: a1 b8 62 00 00 mov 0x62b8,%eax
1dc: 83 ec 08 sub $0x8,%esp
1df: 68 be 44 00 00 push $0x44be
1e4: 50 push %eax
1e5: e8 5c 3e 00 00 call 4046 <printf>
1ea: 83 c4 10 add $0x10,%esp
}
1ed: 90 nop
1ee: c9 leave
1ef: c3 ret
000001f0 <openiputtest>:
// for(i = 0; i < 10000; i++)
// yield();
// }
void
openiputtest(void)
{
1f0: 55 push %ebp
1f1: 89 e5 mov %esp,%ebp
1f3: 83 ec 18 sub $0x18,%esp
int pid;
printf(stdout, "openiput test\n");
1f6: a1 b8 62 00 00 mov 0x62b8,%eax
1fb: 83 ec 08 sub $0x8,%esp
1fe: 68 d0 44 00 00 push $0x44d0
203: 50 push %eax
204: e8 3d 3e 00 00 call 4046 <printf>
209: 83 c4 10 add $0x10,%esp
if(mkdir("oidir") < 0){
20c: 83 ec 0c sub $0xc,%esp
20f: 68 df 44 00 00 push $0x44df
214: e8 1e 3d 00 00 call 3f37 <mkdir>
219: 83 c4 10 add $0x10,%esp
21c: 85 c0 test %eax,%eax
21e: 79 1b jns 23b <openiputtest+0x4b>
printf(stdout, "mkdir oidir failed\n");
220: a1 b8 62 00 00 mov 0x62b8,%eax
225: 83 ec 08 sub $0x8,%esp
228: 68 e5 44 00 00 push $0x44e5
22d: 50 push %eax
22e: e8 13 3e 00 00 call 4046 <printf>
233: 83 c4 10 add $0x10,%esp
exit();
236: e8 94 3c 00 00 call 3ecf <exit>
}
pid = fork();
23b: e8 87 3c 00 00 call 3ec7 <fork>
240: 89 45 f4 mov %eax,-0xc(%ebp)
if(pid < 0){
243: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
247: 79 1b jns 264 <openiputtest+0x74>
printf(stdout, "fork failed\n");
249: a1 b8 62 00 00 mov 0x62b8,%eax
24e: 83 ec 08 sub $0x8,%esp
251: 68 9d 44 00 00 push $0x449d
256: 50 push %eax
257: e8 ea 3d 00 00 call 4046 <printf>
25c: 83 c4 10 add $0x10,%esp
exit();
25f: e8 6b 3c 00 00 call 3ecf <exit>
}
if(pid == 0){
264: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
268: 75 3b jne 2a5 <openiputtest+0xb5>
int fd = open("oidir", O_RDWR);
26a: 83 ec 08 sub $0x8,%esp
26d: 6a 02 push $0x2
26f: 68 df 44 00 00 push $0x44df
274: e8 96 3c 00 00 call 3f0f <open>
279: 83 c4 10 add $0x10,%esp
27c: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd >= 0){
27f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
283: 78 1b js 2a0 <openiputtest+0xb0>
printf(stdout, "open directory for write succeeded\n");
285: a1 b8 62 00 00 mov 0x62b8,%eax
28a: 83 ec 08 sub $0x8,%esp
28d: 68 fc 44 00 00 push $0x44fc
292: 50 push %eax
293: e8 ae 3d 00 00 call 4046 <printf>
298: 83 c4 10 add $0x10,%esp
exit();
29b: e8 2f 3c 00 00 call 3ecf <exit>
}
exit();
2a0: e8 2a 3c 00 00 call 3ecf <exit>
}
sleep(1);
2a5: 83 ec 0c sub $0xc,%esp
2a8: 6a 01 push $0x1
2aa: e8 b0 3c 00 00 call 3f5f <sleep>
2af: 83 c4 10 add $0x10,%esp
if(unlink("oidir") != 0){
2b2: 83 ec 0c sub $0xc,%esp
2b5: 68 df 44 00 00 push $0x44df
2ba: e8 60 3c 00 00 call 3f1f <unlink>
2bf: 83 c4 10 add $0x10,%esp
2c2: 85 c0 test %eax,%eax
2c4: 74 1b je 2e1 <openiputtest+0xf1>
printf(stdout, "unlink failed\n");
2c6: a1 b8 62 00 00 mov 0x62b8,%eax
2cb: 83 ec 08 sub $0x8,%esp
2ce: 68 20 45 00 00 push $0x4520
2d3: 50 push %eax
2d4: e8 6d 3d 00 00 call 4046 <printf>
2d9: 83 c4 10 add $0x10,%esp
exit();
2dc: e8 ee 3b 00 00 call 3ecf <exit>
}
wait();
2e1: e8 f1 3b 00 00 call 3ed7 <wait>
printf(stdout, "openiput test ok\n");
2e6: a1 b8 62 00 00 mov 0x62b8,%eax
2eb: 83 ec 08 sub $0x8,%esp
2ee: 68 2f 45 00 00 push $0x452f
2f3: 50 push %eax
2f4: e8 4d 3d 00 00 call 4046 <printf>
2f9: 83 c4 10 add $0x10,%esp
}
2fc: 90 nop
2fd: c9 leave
2fe: c3 ret
000002ff <opentest>:
// simple file system tests
void
opentest(void)
{
2ff: 55 push %ebp
300: 89 e5 mov %esp,%ebp
302: 83 ec 18 sub $0x18,%esp
int fd;
printf(stdout, "open test\n");
305: a1 b8 62 00 00 mov 0x62b8,%eax
30a: 83 ec 08 sub $0x8,%esp
30d: 68 41 45 00 00 push $0x4541
312: 50 push %eax
313: e8 2e 3d 00 00 call 4046 <printf>
318: 83 c4 10 add $0x10,%esp
fd = open("echo", 0);
31b: 83 ec 08 sub $0x8,%esp
31e: 6a 00 push $0x0
320: 68 fc 43 00 00 push $0x43fc
325: e8 e5 3b 00 00 call 3f0f <open>
32a: 83 c4 10 add $0x10,%esp
32d: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0){
330: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
334: 79 1b jns 351 <opentest+0x52>
printf(stdout, "open echo failed!\n");
336: a1 b8 62 00 00 mov 0x62b8,%eax
33b: 83 ec 08 sub $0x8,%esp
33e: 68 4c 45 00 00 push $0x454c
343: 50 push %eax
344: e8 fd 3c 00 00 call 4046 <printf>
349: 83 c4 10 add $0x10,%esp
exit();
34c: e8 7e 3b 00 00 call 3ecf <exit>
}
close(fd);
351: 83 ec 0c sub $0xc,%esp
354: ff 75 f4 pushl -0xc(%ebp)
357: e8 9b 3b 00 00 call 3ef7 <close>
35c: 83 c4 10 add $0x10,%esp
fd = open("doesnotexist", 0);
35f: 83 ec 08 sub $0x8,%esp
362: 6a 00 push $0x0
364: 68 5f 45 00 00 push $0x455f
369: e8 a1 3b 00 00 call 3f0f <open>
36e: 83 c4 10 add $0x10,%esp
371: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd >= 0){
374: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
378: 78 1b js 395 <opentest+0x96>
printf(stdout, "open doesnotexist succeeded!\n");
37a: a1 b8 62 00 00 mov 0x62b8,%eax
37f: 83 ec 08 sub $0x8,%esp
382: 68 6c 45 00 00 push $0x456c
387: 50 push %eax
388: e8 b9 3c 00 00 call 4046 <printf>
38d: 83 c4 10 add $0x10,%esp
exit();
390: e8 3a 3b 00 00 call 3ecf <exit>
}
printf(stdout, "open test ok\n");
395: a1 b8 62 00 00 mov 0x62b8,%eax
39a: 83 ec 08 sub $0x8,%esp
39d: 68 8a 45 00 00 push $0x458a
3a2: 50 push %eax
3a3: e8 9e 3c 00 00 call 4046 <printf>
3a8: 83 c4 10 add $0x10,%esp
}
3ab: 90 nop
3ac: c9 leave
3ad: c3 ret
000003ae <writetest>:
void
writetest(void)
{
3ae: 55 push %ebp
3af: 89 e5 mov %esp,%ebp
3b1: 83 ec 18 sub $0x18,%esp
int fd;
int i;
printf(stdout, "small file test\n");
3b4: a1 b8 62 00 00 mov 0x62b8,%eax
3b9: 83 ec 08 sub $0x8,%esp
3bc: 68 98 45 00 00 push $0x4598
3c1: 50 push %eax
3c2: e8 7f 3c 00 00 call 4046 <printf>
3c7: 83 c4 10 add $0x10,%esp
fd = open("small", O_CREATE|O_RDWR);
3ca: 83 ec 08 sub $0x8,%esp
3cd: 68 02 02 00 00 push $0x202
3d2: 68 a9 45 00 00 push $0x45a9
3d7: e8 33 3b 00 00 call 3f0f <open>
3dc: 83 c4 10 add $0x10,%esp
3df: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd >= 0){
3e2: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
3e6: 78 22 js 40a <writetest+0x5c>
printf(stdout, "creat small succeeded; ok\n");
3e8: a1 b8 62 00 00 mov 0x62b8,%eax
3ed: 83 ec 08 sub $0x8,%esp
3f0: 68 af 45 00 00 push $0x45af
3f5: 50 push %eax
3f6: e8 4b 3c 00 00 call 4046 <printf>
3fb: 83 c4 10 add $0x10,%esp
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++){
3fe: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
405: e9 8f 00 00 00 jmp 499 <writetest+0xeb>
printf(stdout, "small file test\n");
fd = open("small", O_CREATE|O_RDWR);
if(fd >= 0){
printf(stdout, "creat small succeeded; ok\n");
} else {
printf(stdout, "error: creat small failed!\n");
40a: a1 b8 62 00 00 mov 0x62b8,%eax
40f: 83 ec 08 sub $0x8,%esp
412: 68 ca 45 00 00 push $0x45ca
417: 50 push %eax
418: e8 29 3c 00 00 call 4046 <printf>
41d: 83 c4 10 add $0x10,%esp
exit();
420: e8 aa 3a 00 00 call 3ecf <exit>
}
for(i = 0; i < 100; i++){
if(write(fd, "aaaaaaaaaa", 10) != 10){
425: 83 ec 04 sub $0x4,%esp
428: 6a 0a push $0xa
42a: 68 e6 45 00 00 push $0x45e6
42f: ff 75 f0 pushl -0x10(%ebp)
432: e8 b8 3a 00 00 call 3eef <write>
437: 83 c4 10 add $0x10,%esp
43a: 83 f8 0a cmp $0xa,%eax
43d: 74 1e je 45d <writetest+0xaf>
printf(stdout, "error: write aa %d new file failed\n", i);
43f: a1 b8 62 00 00 mov 0x62b8,%eax
444: 83 ec 04 sub $0x4,%esp
447: ff 75 f4 pushl -0xc(%ebp)
44a: 68 f4 45 00 00 push $0x45f4
44f: 50 push %eax
450: e8 f1 3b 00 00 call 4046 <printf>
455: 83 c4 10 add $0x10,%esp
exit();
458: e8 72 3a 00 00 call 3ecf <exit>
}
if(write(fd, "bbbbbbbbbb", 10) != 10){
45d: 83 ec 04 sub $0x4,%esp
460: 6a 0a push $0xa
462: 68 18 46 00 00 push $0x4618
467: ff 75 f0 pushl -0x10(%ebp)
46a: e8 80 3a 00 00 call 3eef <write>
46f: 83 c4 10 add $0x10,%esp
472: 83 f8 0a cmp $0xa,%eax
475: 74 1e je 495 <writetest+0xe7>
printf(stdout, "error: write bb %d new file failed\n", i);
477: a1 b8 62 00 00 mov 0x62b8,%eax
47c: 83 ec 04 sub $0x4,%esp
47f: ff 75 f4 pushl -0xc(%ebp)
482: 68 24 46 00 00 push $0x4624
487: 50 push %eax
488: e8 b9 3b 00 00 call 4046 <printf>
48d: 83 c4 10 add $0x10,%esp
exit();
490: e8 3a 3a 00 00 call 3ecf <exit>
printf(stdout, "creat small succeeded; ok\n");
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++){
495: 83 45 f4 01 addl $0x1,-0xc(%ebp)
499: 83 7d f4 63 cmpl $0x63,-0xc(%ebp)
49d: 7e 86 jle 425 <writetest+0x77>
if(write(fd, "bbbbbbbbbb", 10) != 10){
printf(stdout, "error: write bb %d new file failed\n", i);
exit();
}
}
printf(stdout, "writes ok\n");
49f: a1 b8 62 00 00 mov 0x62b8,%eax
4a4: 83 ec 08 sub $0x8,%esp
4a7: 68 48 46 00 00 push $0x4648
4ac: 50 push %eax
4ad: e8 94 3b 00 00 call 4046 <printf>
4b2: 83 c4 10 add $0x10,%esp
close(fd);
4b5: 83 ec 0c sub $0xc,%esp
4b8: ff 75 f0 pushl -0x10(%ebp)
4bb: e8 37 3a 00 00 call 3ef7 <close>
4c0: 83 c4 10 add $0x10,%esp
fd = open("small", O_RDONLY);
4c3: 83 ec 08 sub $0x8,%esp
4c6: 6a 00 push $0x0
4c8: 68 a9 45 00 00 push $0x45a9
4cd: e8 3d 3a 00 00 call 3f0f <open>
4d2: 83 c4 10 add $0x10,%esp
4d5: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd >= 0){
4d8: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
4dc: 78 3c js 51a <writetest+0x16c>
printf(stdout, "open small succeeded ok\n");
4de: a1 b8 62 00 00 mov 0x62b8,%eax
4e3: 83 ec 08 sub $0x8,%esp
4e6: 68 53 46 00 00 push $0x4653
4eb: 50 push %eax
4ec: e8 55 3b 00 00 call 4046 <printf>
4f1: 83 c4 10 add $0x10,%esp
} else {
printf(stdout, "error: open small failed!\n");
exit();
}
i = read(fd, buf, 2000);
4f4: 83 ec 04 sub $0x4,%esp
4f7: 68 d0 07 00 00 push $0x7d0
4fc: 68 a0 8a 00 00 push $0x8aa0
501: ff 75 f0 pushl -0x10(%ebp)
504: e8 de 39 00 00 call 3ee7 <read>
509: 83 c4 10 add $0x10,%esp
50c: 89 45 f4 mov %eax,-0xc(%ebp)
if(i == 2000){
50f: 81 7d f4 d0 07 00 00 cmpl $0x7d0,-0xc(%ebp)
516: 75 57 jne 56f <writetest+0x1c1>
518: eb 1b jmp 535 <writetest+0x187>
close(fd);
fd = open("small", O_RDONLY);
if(fd >= 0){
printf(stdout, "open small succeeded ok\n");
} else {
printf(stdout, "error: open small failed!\n");
51a: a1 b8 62 00 00 mov 0x62b8,%eax
51f: 83 ec 08 sub $0x8,%esp
522: 68 6c 46 00 00 push $0x466c
527: 50 push %eax
528: e8 19 3b 00 00 call 4046 <printf>
52d: 83 c4 10 add $0x10,%esp
exit();
530: e8 9a 39 00 00 call 3ecf <exit>
}
i = read(fd, buf, 2000);
if(i == 2000){
printf(stdout, "read succeeded ok\n");
535: a1 b8 62 00 00 mov 0x62b8,%eax
53a: 83 ec 08 sub $0x8,%esp
53d: 68 87 46 00 00 push $0x4687
542: 50 push %eax
543: e8 fe 3a 00 00 call 4046 <printf>
548: 83 c4 10 add $0x10,%esp
} else {
printf(stdout, "read failed\n");
exit();
}
close(fd);
54b: 83 ec 0c sub $0xc,%esp
54e: ff 75 f0 pushl -0x10(%ebp)
551: e8 a1 39 00 00 call 3ef7 <close>
556: 83 c4 10 add $0x10,%esp
if(unlink("small") < 0){
559: 83 ec 0c sub $0xc,%esp
55c: 68 a9 45 00 00 push $0x45a9
561: e8 b9 39 00 00 call 3f1f <unlink>
566: 83 c4 10 add $0x10,%esp
569: 85 c0 test %eax,%eax
56b: 79 38 jns 5a5 <writetest+0x1f7>
56d: eb 1b jmp 58a <writetest+0x1dc>
}
i = read(fd, buf, 2000);
if(i == 2000){
printf(stdout, "read succeeded ok\n");
} else {
printf(stdout, "read failed\n");
56f: a1 b8 62 00 00 mov 0x62b8,%eax
574: 83 ec 08 sub $0x8,%esp
577: 68 9a 46 00 00 push $0x469a
57c: 50 push %eax
57d: e8 c4 3a 00 00 call 4046 <printf>
582: 83 c4 10 add $0x10,%esp
exit();
585: e8 45 39 00 00 call 3ecf <exit>
}
close(fd);
if(unlink("small") < 0){
printf(stdout, "unlink small failed\n");
58a: a1 b8 62 00 00 mov 0x62b8,%eax
58f: 83 ec 08 sub $0x8,%esp
592: 68 a7 46 00 00 push $0x46a7
597: 50 push %eax
598: e8 a9 3a 00 00 call 4046 <printf>
59d: 83 c4 10 add $0x10,%esp
exit();
5a0: e8 2a 39 00 00 call 3ecf <exit>
}
printf(stdout, "small file test ok\n");
5a5: a1 b8 62 00 00 mov 0x62b8,%eax
5aa: 83 ec 08 sub $0x8,%esp
5ad: 68 bc 46 00 00 push $0x46bc
5b2: 50 push %eax
5b3: e8 8e 3a 00 00 call 4046 <printf>
5b8: 83 c4 10 add $0x10,%esp
}
5bb: 90 nop
5bc: c9 leave
5bd: c3 ret
000005be <writetest1>:
void
writetest1(void)
{
5be: 55 push %ebp
5bf: 89 e5 mov %esp,%ebp
5c1: 83 ec 18 sub $0x18,%esp
int i, fd, n;
printf(stdout, "big files test\n");
5c4: a1 b8 62 00 00 mov 0x62b8,%eax
5c9: 83 ec 08 sub $0x8,%esp
5cc: 68 d0 46 00 00 push $0x46d0
5d1: 50 push %eax
5d2: e8 6f 3a 00 00 call 4046 <printf>
5d7: 83 c4 10 add $0x10,%esp
fd = open("big", O_CREATE|O_RDWR);
5da: 83 ec 08 sub $0x8,%esp
5dd: 68 02 02 00 00 push $0x202
5e2: 68 e0 46 00 00 push $0x46e0
5e7: e8 23 39 00 00 call 3f0f <open>
5ec: 83 c4 10 add $0x10,%esp
5ef: 89 45 ec mov %eax,-0x14(%ebp)
if(fd < 0){
5f2: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
5f6: 79 1b jns 613 <writetest1+0x55>
printf(stdout, "error: creat big failed!\n");
5f8: a1 b8 62 00 00 mov 0x62b8,%eax
5fd: 83 ec 08 sub $0x8,%esp
600: 68 e4 46 00 00 push $0x46e4
605: 50 push %eax
606: e8 3b 3a 00 00 call 4046 <printf>
60b: 83 c4 10 add $0x10,%esp
exit();
60e: e8 bc 38 00 00 call 3ecf <exit>
}
for(i = 0; i < MAXFILE; i++){
613: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
61a: eb 4b jmp 667 <writetest1+0xa9>
((int*)buf)[0] = i;
61c: ba a0 8a 00 00 mov $0x8aa0,%edx
621: 8b 45 f4 mov -0xc(%ebp),%eax
624: 89 02 mov %eax,(%edx)
if(write(fd, buf, 512) != 512){
626: 83 ec 04 sub $0x4,%esp
629: 68 00 02 00 00 push $0x200
62e: 68 a0 8a 00 00 push $0x8aa0
633: ff 75 ec pushl -0x14(%ebp)
636: e8 b4 38 00 00 call 3eef <write>
63b: 83 c4 10 add $0x10,%esp
63e: 3d 00 02 00 00 cmp $0x200,%eax
643: 74 1e je 663 <writetest1+0xa5>
printf(stdout, "error: write big file failed\n", i);
645: a1 b8 62 00 00 mov 0x62b8,%eax
64a: 83 ec 04 sub $0x4,%esp
64d: ff 75 f4 pushl -0xc(%ebp)
650: 68 fe 46 00 00 push $0x46fe
655: 50 push %eax
656: e8 eb 39 00 00 call 4046 <printf>
65b: 83 c4 10 add $0x10,%esp
exit();
65e: e8 6c 38 00 00 call 3ecf <exit>
if(fd < 0){
printf(stdout, "error: creat big failed!\n");
exit();
}
for(i = 0; i < MAXFILE; i++){
663: 83 45 f4 01 addl $0x1,-0xc(%ebp)
667: 8b 45 f4 mov -0xc(%ebp),%eax
66a: 3d 8b 00 00 00 cmp $0x8b,%eax
66f: 76 ab jbe 61c <writetest1+0x5e>
printf(stdout, "error: write big file failed\n", i);
exit();
}
}
close(fd);
671: 83 ec 0c sub $0xc,%esp
674: ff 75 ec pushl -0x14(%ebp)
677: e8 7b 38 00 00 call 3ef7 <close>
67c: 83 c4 10 add $0x10,%esp
fd = open("big", O_RDONLY);
67f: 83 ec 08 sub $0x8,%esp
682: 6a 00 push $0x0
684: 68 e0 46 00 00 push $0x46e0
689: e8 81 38 00 00 call 3f0f <open>
68e: 83 c4 10 add $0x10,%esp
691: 89 45 ec mov %eax,-0x14(%ebp)
if(fd < 0){
694: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
698: 79 1b jns 6b5 <writetest1+0xf7>
printf(stdout, "error: open big failed!\n");
69a: a1 b8 62 00 00 mov 0x62b8,%eax
69f: 83 ec 08 sub $0x8,%esp
6a2: 68 1c 47 00 00 push $0x471c
6a7: 50 push %eax
6a8: e8 99 39 00 00 call 4046 <printf>
6ad: 83 c4 10 add $0x10,%esp
exit();
6b0: e8 1a 38 00 00 call 3ecf <exit>
}
n = 0;
6b5: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(;;){
i = read(fd, buf, 512);
6bc: 83 ec 04 sub $0x4,%esp
6bf: 68 00 02 00 00 push $0x200
6c4: 68 a0 8a 00 00 push $0x8aa0
6c9: ff 75 ec pushl -0x14(%ebp)
6cc: e8 16 38 00 00 call 3ee7 <read>
6d1: 83 c4 10 add $0x10,%esp
6d4: 89 45 f4 mov %eax,-0xc(%ebp)
if(i == 0){
6d7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
6db: 75 27 jne 704 <writetest1+0x146>
if(n == MAXFILE - 1){
6dd: 81 7d f0 8b 00 00 00 cmpl $0x8b,-0x10(%ebp)
6e4: 75 7d jne 763 <writetest1+0x1a5>
printf(stdout, "read only %d blocks from big", n);
6e6: a1 b8 62 00 00 mov 0x62b8,%eax
6eb: 83 ec 04 sub $0x4,%esp
6ee: ff 75 f0 pushl -0x10(%ebp)
6f1: 68 35 47 00 00 push $0x4735
6f6: 50 push %eax
6f7: e8 4a 39 00 00 call 4046 <printf>
6fc: 83 c4 10 add $0x10,%esp
exit();
6ff: e8 cb 37 00 00 call 3ecf <exit>
}
break;
} else if(i != 512){
704: 81 7d f4 00 02 00 00 cmpl $0x200,-0xc(%ebp)
70b: 74 1e je 72b <writetest1+0x16d>
printf(stdout, "read failed %d\n", i);
70d: a1 b8 62 00 00 mov 0x62b8,%eax
712: 83 ec 04 sub $0x4,%esp
715: ff 75 f4 pushl -0xc(%ebp)
718: 68 52 47 00 00 push $0x4752
71d: 50 push %eax
71e: e8 23 39 00 00 call 4046 <printf>
723: 83 c4 10 add $0x10,%esp
exit();
726: e8 a4 37 00 00 call 3ecf <exit>
}
if(((int*)buf)[0] != n){
72b: b8 a0 8a 00 00 mov $0x8aa0,%eax
730: 8b 00 mov (%eax),%eax
732: 3b 45 f0 cmp -0x10(%ebp),%eax
735: 74 23 je 75a <writetest1+0x19c>
printf(stdout, "read content of block %d is %d\n",
n, ((int*)buf)[0]);
737: b8 a0 8a 00 00 mov $0x8aa0,%eax
} else if(i != 512){
printf(stdout, "read failed %d\n", i);
exit();
}
if(((int*)buf)[0] != n){
printf(stdout, "read content of block %d is %d\n",
73c: 8b 10 mov (%eax),%edx
73e: a1 b8 62 00 00 mov 0x62b8,%eax
743: 52 push %edx
744: ff 75 f0 pushl -0x10(%ebp)
747: 68 64 47 00 00 push $0x4764
74c: 50 push %eax
74d: e8 f4 38 00 00 call 4046 <printf>
752: 83 c4 10 add $0x10,%esp
n, ((int*)buf)[0]);
exit();
755: e8 75 37 00 00 call 3ecf <exit>
}
n++;
75a: 83 45 f0 01 addl $0x1,-0x10(%ebp)
}
75e: e9 59 ff ff ff jmp 6bc <writetest1+0xfe>
if(i == 0){
if(n == MAXFILE - 1){
printf(stdout, "read only %d blocks from big", n);
exit();
}
break;
763: 90 nop
n, ((int*)buf)[0]);
exit();
}
n++;
}
close(fd);
764: 83 ec 0c sub $0xc,%esp
767: ff 75 ec pushl -0x14(%ebp)
76a: e8 88 37 00 00 call 3ef7 <close>
76f: 83 c4 10 add $0x10,%esp
if(unlink("big") < 0){
772: 83 ec 0c sub $0xc,%esp
775: 68 e0 46 00 00 push $0x46e0
77a: e8 a0 37 00 00 call 3f1f <unlink>
77f: 83 c4 10 add $0x10,%esp
782: 85 c0 test %eax,%eax
784: 79 1b jns 7a1 <writetest1+0x1e3>
printf(stdout, "unlink big failed\n");
786: a1 b8 62 00 00 mov 0x62b8,%eax
78b: 83 ec 08 sub $0x8,%esp
78e: 68 84 47 00 00 push $0x4784
793: 50 push %eax
794: e8 ad 38 00 00 call 4046 <printf>
799: 83 c4 10 add $0x10,%esp
exit();
79c: e8 2e 37 00 00 call 3ecf <exit>
}
printf(stdout, "big files ok\n");
7a1: a1 b8 62 00 00 mov 0x62b8,%eax
7a6: 83 ec 08 sub $0x8,%esp
7a9: 68 97 47 00 00 push $0x4797
7ae: 50 push %eax
7af: e8 92 38 00 00 call 4046 <printf>
7b4: 83 c4 10 add $0x10,%esp
}
7b7: 90 nop
7b8: c9 leave
7b9: c3 ret
000007ba <createtest>:
void
createtest(void)
{
7ba: 55 push %ebp
7bb: 89 e5 mov %esp,%ebp
7bd: 83 ec 18 sub $0x18,%esp
int i, fd;
printf(stdout, "many creates, followed by unlink test\n");
7c0: a1 b8 62 00 00 mov 0x62b8,%eax
7c5: 83 ec 08 sub $0x8,%esp
7c8: 68 a8 47 00 00 push $0x47a8
7cd: 50 push %eax
7ce: e8 73 38 00 00 call 4046 <printf>
7d3: 83 c4 10 add $0x10,%esp
name[0] = 'a';
7d6: c6 05 a0 aa 00 00 61 movb $0x61,0xaaa0
name[2] = '\0';
7dd: c6 05 a2 aa 00 00 00 movb $0x0,0xaaa2
for(i = 0; i < 52; i++){
7e4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
7eb: eb 35 jmp 822 <createtest+0x68>
name[1] = '0' + i;
7ed: 8b 45 f4 mov -0xc(%ebp),%eax
7f0: 83 c0 30 add $0x30,%eax
7f3: a2 a1 aa 00 00 mov %al,0xaaa1
fd = open(name, O_CREATE|O_RDWR);
7f8: 83 ec 08 sub $0x8,%esp
7fb: 68 02 02 00 00 push $0x202
800: 68 a0 aa 00 00 push $0xaaa0
805: e8 05 37 00 00 call 3f0f <open>
80a: 83 c4 10 add $0x10,%esp
80d: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
810: 83 ec 0c sub $0xc,%esp
813: ff 75 f0 pushl -0x10(%ebp)
816: e8 dc 36 00 00 call 3ef7 <close>
81b: 83 c4 10 add $0x10,%esp
printf(stdout, "many creates, followed by unlink test\n");
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++){
81e: 83 45 f4 01 addl $0x1,-0xc(%ebp)
822: 83 7d f4 33 cmpl $0x33,-0xc(%ebp)
826: 7e c5 jle 7ed <createtest+0x33>
name[1] = '0' + i;
fd = open(name, O_CREATE|O_RDWR);
close(fd);
}
name[0] = 'a';
828: c6 05 a0 aa 00 00 61 movb $0x61,0xaaa0
name[2] = '\0';
82f: c6 05 a2 aa 00 00 00 movb $0x0,0xaaa2
for(i = 0; i < 52; i++){
836: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
83d: eb 1f jmp 85e <createtest+0xa4>
name[1] = '0' + i;
83f: 8b 45 f4 mov -0xc(%ebp),%eax
842: 83 c0 30 add $0x30,%eax
845: a2 a1 aa 00 00 mov %al,0xaaa1
unlink(name);
84a: 83 ec 0c sub $0xc,%esp
84d: 68 a0 aa 00 00 push $0xaaa0
852: e8 c8 36 00 00 call 3f1f <unlink>
857: 83 c4 10 add $0x10,%esp
fd = open(name, O_CREATE|O_RDWR);
close(fd);
}
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++){
85a: 83 45 f4 01 addl $0x1,-0xc(%ebp)
85e: 83 7d f4 33 cmpl $0x33,-0xc(%ebp)
862: 7e db jle 83f <createtest+0x85>
name[1] = '0' + i;
unlink(name);
}
printf(stdout, "many creates, followed by unlink; ok\n");
864: a1 b8 62 00 00 mov 0x62b8,%eax
869: 83 ec 08 sub $0x8,%esp
86c: 68 d0 47 00 00 push $0x47d0
871: 50 push %eax
872: e8 cf 37 00 00 call 4046 <printf>
877: 83 c4 10 add $0x10,%esp
}
87a: 90 nop
87b: c9 leave
87c: c3 ret
0000087d <dirtest>:
void dirtest(void)
{
87d: 55 push %ebp
87e: 89 e5 mov %esp,%ebp
880: 83 ec 08 sub $0x8,%esp
printf(stdout, "mkdir test\n");
883: a1 b8 62 00 00 mov 0x62b8,%eax
888: 83 ec 08 sub $0x8,%esp
88b: 68 f6 47 00 00 push $0x47f6
890: 50 push %eax
891: e8 b0 37 00 00 call 4046 <printf>
896: 83 c4 10 add $0x10,%esp
if(mkdir("dir0") < 0){
899: 83 ec 0c sub $0xc,%esp
89c: 68 02 48 00 00 push $0x4802
8a1: e8 91 36 00 00 call 3f37 <mkdir>
8a6: 83 c4 10 add $0x10,%esp
8a9: 85 c0 test %eax,%eax
8ab: 79 1b jns 8c8 <dirtest+0x4b>
printf(stdout, "mkdir failed\n");
8ad: a1 b8 62 00 00 mov 0x62b8,%eax
8b2: 83 ec 08 sub $0x8,%esp
8b5: 68 25 44 00 00 push $0x4425
8ba: 50 push %eax
8bb: e8 86 37 00 00 call 4046 <printf>
8c0: 83 c4 10 add $0x10,%esp
exit();
8c3: e8 07 36 00 00 call 3ecf <exit>
}
if(chdir("dir0") < 0){
8c8: 83 ec 0c sub $0xc,%esp
8cb: 68 02 48 00 00 push $0x4802
8d0: e8 6a 36 00 00 call 3f3f <chdir>
8d5: 83 c4 10 add $0x10,%esp
8d8: 85 c0 test %eax,%eax
8da: 79 1b jns 8f7 <dirtest+0x7a>
printf(stdout, "chdir dir0 failed\n");
8dc: a1 b8 62 00 00 mov 0x62b8,%eax