-
Notifications
You must be signed in to change notification settings - Fork 1
/
kernel.asm
14991 lines (14274 loc) · 565 KB
/
kernel.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
kernel: file format elf32-i386
Disassembly of section .text:
80100000 <multiboot_header>:
80100000: 02 b0 ad 1b 00 00 add 0x1bad(%eax),%dh
80100006: 00 00 add %al,(%eax)
80100008: fe 4f 52 decb 0x52(%edi)
8010000b: e4 .byte 0xe4
8010000c <entry>:
# Entering xv6 on boot processor, with paging off.
.globl entry
entry:
# Turn on page size extension for 4Mbyte pages
movl %cr4, %eax
8010000c: 0f 20 e0 mov %cr4,%eax
orl $(CR4_PSE), %eax
8010000f: 83 c8 10 or $0x10,%eax
movl %eax, %cr4
80100012: 0f 22 e0 mov %eax,%cr4
# Set page directory
movl $(V2P_WO(entrypgdir)), %eax
80100015: b8 00 90 10 00 mov $0x109000,%eax
movl %eax, %cr3
8010001a: 0f 22 d8 mov %eax,%cr3
# Turn on paging.
movl %cr0, %eax
8010001d: 0f 20 c0 mov %cr0,%eax
orl $(CR0_PG|CR0_WP), %eax
80100020: 0d 00 00 01 80 or $0x80010000,%eax
movl %eax, %cr0
80100025: 0f 22 c0 mov %eax,%cr0
# Set up the stack pointer.
movl $(stack + KSTACKSIZE), %esp
80100028: bc 90 5e 11 80 mov $0x80115e90,%esp
# Jump to main(), and switch to executing at
# high addresses. The indirect call is needed because
# the assembler produces a PC-relative instruction
# for a direct jump.
mov $main, %eax
8010002d: b8 7f 2a 10 80 mov $0x80102a7f,%eax
jmp *%eax
80100032: ff e0 jmp *%eax
80100034 <bget>:
// Look through buffer cache for block on device dev.
// If not found, allocate a buffer.
// In either case, return locked buffer.
static struct buf*
bget(uint dev, uint blockno)
{
80100034: 55 push %ebp
80100035: 89 e5 mov %esp,%ebp
80100037: 57 push %edi
80100038: 56 push %esi
80100039: 53 push %ebx
8010003a: 83 ec 18 sub $0x18,%esp
8010003d: 89 c6 mov %eax,%esi
8010003f: 89 d7 mov %edx,%edi
struct buf *b;
acquire(&bcache.lock);
80100041: 68 20 a5 10 80 push $0x8010a520
80100046: e8 24 43 00 00 call 8010436f <acquire>
// Is the block already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
8010004b: 8b 1d 70 ec 10 80 mov 0x8010ec70,%ebx
80100051: 83 c4 10 add $0x10,%esp
80100054: eb 03 jmp 80100059 <bget+0x25>
80100056: 8b 5b 54 mov 0x54(%ebx),%ebx
80100059: 81 fb 1c ec 10 80 cmp $0x8010ec1c,%ebx
8010005f: 74 30 je 80100091 <bget+0x5d>
if(b->dev == dev && b->blockno == blockno){
80100061: 39 73 04 cmp %esi,0x4(%ebx)
80100064: 75 f0 jne 80100056 <bget+0x22>
80100066: 39 7b 08 cmp %edi,0x8(%ebx)
80100069: 75 eb jne 80100056 <bget+0x22>
b->refcnt++;
8010006b: 8b 43 4c mov 0x4c(%ebx),%eax
8010006e: 83 c0 01 add $0x1,%eax
80100071: 89 43 4c mov %eax,0x4c(%ebx)
release(&bcache.lock);
80100074: 83 ec 0c sub $0xc,%esp
80100077: 68 20 a5 10 80 push $0x8010a520
8010007c: e8 53 43 00 00 call 801043d4 <release>
acquiresleep(&b->lock);
80100081: 8d 43 0c lea 0xc(%ebx),%eax
80100084: 89 04 24 mov %eax,(%esp)
80100087: e8 cf 40 00 00 call 8010415b <acquiresleep>
return b;
8010008c: 83 c4 10 add $0x10,%esp
8010008f: eb 4c jmp 801000dd <bget+0xa9>
}
// Not cached; recycle an unused buffer.
// Even if refcnt==0, B_DIRTY indicates a buffer is in use
// because log.c has modified it but not yet committed it.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100091: 8b 1d 6c ec 10 80 mov 0x8010ec6c,%ebx
80100097: eb 03 jmp 8010009c <bget+0x68>
80100099: 8b 5b 50 mov 0x50(%ebx),%ebx
8010009c: 81 fb 1c ec 10 80 cmp $0x8010ec1c,%ebx
801000a2: 74 43 je 801000e7 <bget+0xb3>
if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) {
801000a4: 83 7b 4c 00 cmpl $0x0,0x4c(%ebx)
801000a8: 75 ef jne 80100099 <bget+0x65>
801000aa: f6 03 04 testb $0x4,(%ebx)
801000ad: 75 ea jne 80100099 <bget+0x65>
b->dev = dev;
801000af: 89 73 04 mov %esi,0x4(%ebx)
b->blockno = blockno;
801000b2: 89 7b 08 mov %edi,0x8(%ebx)
b->flags = 0;
801000b5: c7 03 00 00 00 00 movl $0x0,(%ebx)
b->refcnt = 1;
801000bb: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx)
release(&bcache.lock);
801000c2: 83 ec 0c sub $0xc,%esp
801000c5: 68 20 a5 10 80 push $0x8010a520
801000ca: e8 05 43 00 00 call 801043d4 <release>
acquiresleep(&b->lock);
801000cf: 8d 43 0c lea 0xc(%ebx),%eax
801000d2: 89 04 24 mov %eax,(%esp)
801000d5: e8 81 40 00 00 call 8010415b <acquiresleep>
return b;
801000da: 83 c4 10 add $0x10,%esp
}
}
panic("bget: no buffers");
}
801000dd: 89 d8 mov %ebx,%eax
801000df: 8d 65 f4 lea -0xc(%ebp),%esp
801000e2: 5b pop %ebx
801000e3: 5e pop %esi
801000e4: 5f pop %edi
801000e5: 5d pop %ebp
801000e6: c3 ret
panic("bget: no buffers");
801000e7: 83 ec 0c sub $0xc,%esp
801000ea: 68 40 6f 10 80 push $0x80106f40
801000ef: e8 54 02 00 00 call 80100348 <panic>
801000f4 <binit>:
{
801000f4: 55 push %ebp
801000f5: 89 e5 mov %esp,%ebp
801000f7: 53 push %ebx
801000f8: 83 ec 0c sub $0xc,%esp
initlock(&bcache.lock, "bcache");
801000fb: 68 51 6f 10 80 push $0x80106f51
80100100: 68 20 a5 10 80 push $0x8010a520
80100105: e8 29 41 00 00 call 80104233 <initlock>
bcache.head.prev = &bcache.head;
8010010a: c7 05 6c ec 10 80 1c movl $0x8010ec1c,0x8010ec6c
80100111: ec 10 80
bcache.head.next = &bcache.head;
80100114: c7 05 70 ec 10 80 1c movl $0x8010ec1c,0x8010ec70
8010011b: ec 10 80
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
8010011e: 83 c4 10 add $0x10,%esp
80100121: bb 54 a5 10 80 mov $0x8010a554,%ebx
80100126: eb 37 jmp 8010015f <binit+0x6b>
b->next = bcache.head.next;
80100128: a1 70 ec 10 80 mov 0x8010ec70,%eax
8010012d: 89 43 54 mov %eax,0x54(%ebx)
b->prev = &bcache.head;
80100130: c7 43 50 1c ec 10 80 movl $0x8010ec1c,0x50(%ebx)
initsleeplock(&b->lock, "buffer");
80100137: 83 ec 08 sub $0x8,%esp
8010013a: 68 58 6f 10 80 push $0x80106f58
8010013f: 8d 43 0c lea 0xc(%ebx),%eax
80100142: 50 push %eax
80100143: e8 e0 3f 00 00 call 80104128 <initsleeplock>
bcache.head.next->prev = b;
80100148: a1 70 ec 10 80 mov 0x8010ec70,%eax
8010014d: 89 58 50 mov %ebx,0x50(%eax)
bcache.head.next = b;
80100150: 89 1d 70 ec 10 80 mov %ebx,0x8010ec70
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100156: 81 c3 5c 02 00 00 add $0x25c,%ebx
8010015c: 83 c4 10 add $0x10,%esp
8010015f: 81 fb 1c ec 10 80 cmp $0x8010ec1c,%ebx
80100165: 72 c1 jb 80100128 <binit+0x34>
}
80100167: 8b 5d fc mov -0x4(%ebp),%ebx
8010016a: c9 leave
8010016b: c3 ret
8010016c <bread>:
// Return a locked buf with the contents of the indicated block.
struct buf*
bread(uint dev, uint blockno)
{
8010016c: 55 push %ebp
8010016d: 89 e5 mov %esp,%ebp
8010016f: 53 push %ebx
80100170: 83 ec 04 sub $0x4,%esp
struct buf *b;
b = bget(dev, blockno);
80100173: 8b 55 0c mov 0xc(%ebp),%edx
80100176: 8b 45 08 mov 0x8(%ebp),%eax
80100179: e8 b6 fe ff ff call 80100034 <bget>
8010017e: 89 c3 mov %eax,%ebx
if((b->flags & B_VALID) == 0) {
80100180: f6 00 02 testb $0x2,(%eax)
80100183: 74 07 je 8010018c <bread+0x20>
iderw(b);
}
return b;
}
80100185: 89 d8 mov %ebx,%eax
80100187: 8b 5d fc mov -0x4(%ebp),%ebx
8010018a: c9 leave
8010018b: c3 ret
iderw(b);
8010018c: 83 ec 0c sub $0xc,%esp
8010018f: 50 push %eax
80100190: e8 62 1c 00 00 call 80101df7 <iderw>
80100195: 83 c4 10 add $0x10,%esp
return b;
80100198: eb eb jmp 80100185 <bread+0x19>
8010019a <bwrite>:
// Write b's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
8010019a: 55 push %ebp
8010019b: 89 e5 mov %esp,%ebp
8010019d: 53 push %ebx
8010019e: 83 ec 10 sub $0x10,%esp
801001a1: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holdingsleep(&b->lock))
801001a4: 8d 43 0c lea 0xc(%ebx),%eax
801001a7: 50 push %eax
801001a8: e8 38 40 00 00 call 801041e5 <holdingsleep>
801001ad: 83 c4 10 add $0x10,%esp
801001b0: 85 c0 test %eax,%eax
801001b2: 74 14 je 801001c8 <bwrite+0x2e>
panic("bwrite");
b->flags |= B_DIRTY;
801001b4: 83 0b 04 orl $0x4,(%ebx)
iderw(b);
801001b7: 83 ec 0c sub $0xc,%esp
801001ba: 53 push %ebx
801001bb: e8 37 1c 00 00 call 80101df7 <iderw>
}
801001c0: 83 c4 10 add $0x10,%esp
801001c3: 8b 5d fc mov -0x4(%ebp),%ebx
801001c6: c9 leave
801001c7: c3 ret
panic("bwrite");
801001c8: 83 ec 0c sub $0xc,%esp
801001cb: 68 5f 6f 10 80 push $0x80106f5f
801001d0: e8 73 01 00 00 call 80100348 <panic>
801001d5 <brelse>:
// Release a locked buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
801001d5: 55 push %ebp
801001d6: 89 e5 mov %esp,%ebp
801001d8: 56 push %esi
801001d9: 53 push %ebx
801001da: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holdingsleep(&b->lock))
801001dd: 8d 73 0c lea 0xc(%ebx),%esi
801001e0: 83 ec 0c sub $0xc,%esp
801001e3: 56 push %esi
801001e4: e8 fc 3f 00 00 call 801041e5 <holdingsleep>
801001e9: 83 c4 10 add $0x10,%esp
801001ec: 85 c0 test %eax,%eax
801001ee: 74 6b je 8010025b <brelse+0x86>
panic("brelse");
releasesleep(&b->lock);
801001f0: 83 ec 0c sub $0xc,%esp
801001f3: 56 push %esi
801001f4: e8 b1 3f 00 00 call 801041aa <releasesleep>
acquire(&bcache.lock);
801001f9: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
80100200: e8 6a 41 00 00 call 8010436f <acquire>
b->refcnt--;
80100205: 8b 43 4c mov 0x4c(%ebx),%eax
80100208: 83 e8 01 sub $0x1,%eax
8010020b: 89 43 4c mov %eax,0x4c(%ebx)
if (b->refcnt == 0) {
8010020e: 83 c4 10 add $0x10,%esp
80100211: 85 c0 test %eax,%eax
80100213: 75 2f jne 80100244 <brelse+0x6f>
// no one is waiting for it.
b->next->prev = b->prev;
80100215: 8b 43 54 mov 0x54(%ebx),%eax
80100218: 8b 53 50 mov 0x50(%ebx),%edx
8010021b: 89 50 50 mov %edx,0x50(%eax)
b->prev->next = b->next;
8010021e: 8b 43 50 mov 0x50(%ebx),%eax
80100221: 8b 53 54 mov 0x54(%ebx),%edx
80100224: 89 50 54 mov %edx,0x54(%eax)
b->next = bcache.head.next;
80100227: a1 70 ec 10 80 mov 0x8010ec70,%eax
8010022c: 89 43 54 mov %eax,0x54(%ebx)
b->prev = &bcache.head;
8010022f: c7 43 50 1c ec 10 80 movl $0x8010ec1c,0x50(%ebx)
bcache.head.next->prev = b;
80100236: a1 70 ec 10 80 mov 0x8010ec70,%eax
8010023b: 89 58 50 mov %ebx,0x50(%eax)
bcache.head.next = b;
8010023e: 89 1d 70 ec 10 80 mov %ebx,0x8010ec70
}
release(&bcache.lock);
80100244: 83 ec 0c sub $0xc,%esp
80100247: 68 20 a5 10 80 push $0x8010a520
8010024c: e8 83 41 00 00 call 801043d4 <release>
}
80100251: 83 c4 10 add $0x10,%esp
80100254: 8d 65 f8 lea -0x8(%ebp),%esp
80100257: 5b pop %ebx
80100258: 5e pop %esi
80100259: 5d pop %ebp
8010025a: c3 ret
panic("brelse");
8010025b: 83 ec 0c sub $0xc,%esp
8010025e: 68 66 6f 10 80 push $0x80106f66
80100263: e8 e0 00 00 00 call 80100348 <panic>
80100268 <consoleread>:
}
}
int
consoleread(struct inode *ip, char *dst, int n)
{
80100268: 55 push %ebp
80100269: 89 e5 mov %esp,%ebp
8010026b: 57 push %edi
8010026c: 56 push %esi
8010026d: 53 push %ebx
8010026e: 83 ec 28 sub $0x28,%esp
80100271: 8b 7d 08 mov 0x8(%ebp),%edi
80100274: 8b 75 0c mov 0xc(%ebp),%esi
80100277: 8b 5d 10 mov 0x10(%ebp),%ebx
uint target;
int c;
iunlock(ip);
8010027a: 57 push %edi
8010027b: e8 b1 13 00 00 call 80101631 <iunlock>
target = n;
80100280: 89 5d e4 mov %ebx,-0x1c(%ebp)
acquire(&cons.lock);
80100283: c7 04 24 20 ef 10 80 movl $0x8010ef20,(%esp)
8010028a: e8 e0 40 00 00 call 8010436f <acquire>
while(n > 0){
8010028f: 83 c4 10 add $0x10,%esp
80100292: 85 db test %ebx,%ebx
80100294: 0f 8e 8f 00 00 00 jle 80100329 <consoleread+0xc1>
while(input.r == input.w){
8010029a: a1 00 ef 10 80 mov 0x8010ef00,%eax
8010029f: 3b 05 04 ef 10 80 cmp 0x8010ef04,%eax
801002a5: 75 47 jne 801002ee <consoleread+0x86>
if(myproc()->killed){
801002a7: e8 be 31 00 00 call 8010346a <myproc>
801002ac: 83 78 24 00 cmpl $0x0,0x24(%eax)
801002b0: 75 17 jne 801002c9 <consoleread+0x61>
release(&cons.lock);
ilock(ip);
return -1;
}
sleep(&input.r, &cons.lock);
801002b2: 83 ec 08 sub $0x8,%esp
801002b5: 68 20 ef 10 80 push $0x8010ef20
801002ba: 68 00 ef 10 80 push $0x8010ef00
801002bf: e8 a8 3b 00 00 call 80103e6c <sleep>
801002c4: 83 c4 10 add $0x10,%esp
801002c7: eb d1 jmp 8010029a <consoleread+0x32>
release(&cons.lock);
801002c9: 83 ec 0c sub $0xc,%esp
801002cc: 68 20 ef 10 80 push $0x8010ef20
801002d1: e8 fe 40 00 00 call 801043d4 <release>
ilock(ip);
801002d6: 89 3c 24 mov %edi,(%esp)
801002d9: e8 91 12 00 00 call 8010156f <ilock>
return -1;
801002de: 83 c4 10 add $0x10,%esp
801002e1: b8 ff ff ff ff mov $0xffffffff,%eax
}
release(&cons.lock);
ilock(ip);
return target - n;
}
801002e6: 8d 65 f4 lea -0xc(%ebp),%esp
801002e9: 5b pop %ebx
801002ea: 5e pop %esi
801002eb: 5f pop %edi
801002ec: 5d pop %ebp
801002ed: c3 ret
c = input.buf[input.r++ % INPUT_BUF];
801002ee: 8d 50 01 lea 0x1(%eax),%edx
801002f1: 89 15 00 ef 10 80 mov %edx,0x8010ef00
801002f7: 89 c2 mov %eax,%edx
801002f9: 83 e2 7f and $0x7f,%edx
801002fc: 0f b6 92 80 ee 10 80 movzbl -0x7fef1180(%edx),%edx
80100303: 0f be ca movsbl %dl,%ecx
if(c == C('D')){ // EOF
80100306: 80 fa 04 cmp $0x4,%dl
80100309: 74 14 je 8010031f <consoleread+0xb7>
*dst++ = c;
8010030b: 8d 46 01 lea 0x1(%esi),%eax
8010030e: 88 16 mov %dl,(%esi)
--n;
80100310: 83 eb 01 sub $0x1,%ebx
if(c == '\n')
80100313: 83 f9 0a cmp $0xa,%ecx
80100316: 74 11 je 80100329 <consoleread+0xc1>
*dst++ = c;
80100318: 89 c6 mov %eax,%esi
8010031a: e9 73 ff ff ff jmp 80100292 <consoleread+0x2a>
if(n < target){
8010031f: 3b 5d e4 cmp -0x1c(%ebp),%ebx
80100322: 73 05 jae 80100329 <consoleread+0xc1>
input.r--;
80100324: a3 00 ef 10 80 mov %eax,0x8010ef00
release(&cons.lock);
80100329: 83 ec 0c sub $0xc,%esp
8010032c: 68 20 ef 10 80 push $0x8010ef20
80100331: e8 9e 40 00 00 call 801043d4 <release>
ilock(ip);
80100336: 89 3c 24 mov %edi,(%esp)
80100339: e8 31 12 00 00 call 8010156f <ilock>
return target - n;
8010033e: 8b 45 e4 mov -0x1c(%ebp),%eax
80100341: 29 d8 sub %ebx,%eax
80100343: 83 c4 10 add $0x10,%esp
80100346: eb 9e jmp 801002e6 <consoleread+0x7e>
80100348 <panic>:
{
80100348: 55 push %ebp
80100349: 89 e5 mov %esp,%ebp
8010034b: 53 push %ebx
8010034c: 83 ec 34 sub $0x34,%esp
}
static inline void
cli(void)
{
asm volatile("cli");
8010034f: fa cli
cons.locking = 0;
80100350: c7 05 54 ef 10 80 00 movl $0x0,0x8010ef54
80100357: 00 00 00
cprintf("lapicid %d: panic: ", lapicid());
8010035a: e8 33 20 00 00 call 80102392 <lapicid>
8010035f: 83 ec 08 sub $0x8,%esp
80100362: 50 push %eax
80100363: 68 6d 6f 10 80 push $0x80106f6d
80100368: e8 9a 02 00 00 call 80100607 <cprintf>
cprintf(s);
8010036d: 83 c4 04 add $0x4,%esp
80100370: ff 75 08 push 0x8(%ebp)
80100373: e8 8f 02 00 00 call 80100607 <cprintf>
cprintf("\n");
80100378: c7 04 24 bb 7a 10 80 movl $0x80107abb,(%esp)
8010037f: e8 83 02 00 00 call 80100607 <cprintf>
getcallerpcs(&s, pcs);
80100384: 83 c4 08 add $0x8,%esp
80100387: 8d 45 d0 lea -0x30(%ebp),%eax
8010038a: 50 push %eax
8010038b: 8d 45 08 lea 0x8(%ebp),%eax
8010038e: 50 push %eax
8010038f: e8 ba 3e 00 00 call 8010424e <getcallerpcs>
for(i=0; i<10; i++)
80100394: 83 c4 10 add $0x10,%esp
80100397: bb 00 00 00 00 mov $0x0,%ebx
8010039c: eb 17 jmp 801003b5 <panic+0x6d>
cprintf(" %p", pcs[i]);
8010039e: 83 ec 08 sub $0x8,%esp
801003a1: ff 74 9d d0 push -0x30(%ebp,%ebx,4)
801003a5: 68 81 6f 10 80 push $0x80106f81
801003aa: e8 58 02 00 00 call 80100607 <cprintf>
for(i=0; i<10; i++)
801003af: 83 c3 01 add $0x1,%ebx
801003b2: 83 c4 10 add $0x10,%esp
801003b5: 83 fb 09 cmp $0x9,%ebx
801003b8: 7e e4 jle 8010039e <panic+0x56>
panicked = 1; // freeze other CPU
801003ba: c7 05 58 ef 10 80 01 movl $0x1,0x8010ef58
801003c1: 00 00 00
for(;;)
801003c4: eb fe jmp 801003c4 <panic+0x7c>
801003c6 <cgaputc>:
{
801003c6: 55 push %ebp
801003c7: 89 e5 mov %esp,%ebp
801003c9: 57 push %edi
801003ca: 56 push %esi
801003cb: 53 push %ebx
801003cc: 83 ec 0c sub $0xc,%esp
801003cf: 89 c3 mov %eax,%ebx
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801003d1: bf d4 03 00 00 mov $0x3d4,%edi
801003d6: b8 0e 00 00 00 mov $0xe,%eax
801003db: 89 fa mov %edi,%edx
801003dd: ee out %al,(%dx)
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801003de: b9 d5 03 00 00 mov $0x3d5,%ecx
801003e3: 89 ca mov %ecx,%edx
801003e5: ec in (%dx),%al
pos = inb(CRTPORT+1) << 8;
801003e6: 0f b6 f0 movzbl %al,%esi
801003e9: c1 e6 08 shl $0x8,%esi
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801003ec: b8 0f 00 00 00 mov $0xf,%eax
801003f1: 89 fa mov %edi,%edx
801003f3: ee out %al,(%dx)
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801003f4: 89 ca mov %ecx,%edx
801003f6: ec in (%dx),%al
pos |= inb(CRTPORT+1);
801003f7: 0f b6 c8 movzbl %al,%ecx
801003fa: 09 f1 or %esi,%ecx
if(c == '\n')
801003fc: 83 fb 0a cmp $0xa,%ebx
801003ff: 74 60 je 80100461 <cgaputc+0x9b>
else if(c == BACKSPACE){
80100401: 81 fb 00 01 00 00 cmp $0x100,%ebx
80100407: 74 79 je 80100482 <cgaputc+0xbc>
crt[pos++] = (c&0xff) | 0x0700; // black on white
80100409: 0f b6 c3 movzbl %bl,%eax
8010040c: 8d 59 01 lea 0x1(%ecx),%ebx
8010040f: 80 cc 07 or $0x7,%ah
80100412: 66 89 84 09 00 80 0b mov %ax,-0x7ff48000(%ecx,%ecx,1)
80100419: 80
if(pos < 0 || pos > 25*80)
8010041a: 81 fb d0 07 00 00 cmp $0x7d0,%ebx
80100420: 77 6d ja 8010048f <cgaputc+0xc9>
if((pos/80) >= 24){ // Scroll up.
80100422: 81 fb 7f 07 00 00 cmp $0x77f,%ebx
80100428: 7f 72 jg 8010049c <cgaputc+0xd6>
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010042a: be d4 03 00 00 mov $0x3d4,%esi
8010042f: b8 0e 00 00 00 mov $0xe,%eax
80100434: 89 f2 mov %esi,%edx
80100436: ee out %al,(%dx)
outb(CRTPORT+1, pos>>8);
80100437: 0f b6 c7 movzbl %bh,%eax
8010043a: b9 d5 03 00 00 mov $0x3d5,%ecx
8010043f: 89 ca mov %ecx,%edx
80100441: ee out %al,(%dx)
80100442: b8 0f 00 00 00 mov $0xf,%eax
80100447: 89 f2 mov %esi,%edx
80100449: ee out %al,(%dx)
8010044a: 89 d8 mov %ebx,%eax
8010044c: 89 ca mov %ecx,%edx
8010044e: ee out %al,(%dx)
crt[pos] = ' ' | 0x0700;
8010044f: 66 c7 84 1b 00 80 0b movw $0x720,-0x7ff48000(%ebx,%ebx,1)
80100456: 80 20 07
}
80100459: 8d 65 f4 lea -0xc(%ebp),%esp
8010045c: 5b pop %ebx
8010045d: 5e pop %esi
8010045e: 5f pop %edi
8010045f: 5d pop %ebp
80100460: c3 ret
pos += 80 - pos%80;
80100461: ba 67 66 66 66 mov $0x66666667,%edx
80100466: 89 c8 mov %ecx,%eax
80100468: f7 ea imul %edx
8010046a: c1 fa 05 sar $0x5,%edx
8010046d: 8d 04 92 lea (%edx,%edx,4),%eax
80100470: c1 e0 04 shl $0x4,%eax
80100473: 89 ca mov %ecx,%edx
80100475: 29 c2 sub %eax,%edx
80100477: bb 50 00 00 00 mov $0x50,%ebx
8010047c: 29 d3 sub %edx,%ebx
8010047e: 01 cb add %ecx,%ebx
80100480: eb 98 jmp 8010041a <cgaputc+0x54>
if(pos > 0) --pos;
80100482: 85 c9 test %ecx,%ecx
80100484: 7e 05 jle 8010048b <cgaputc+0xc5>
80100486: 8d 59 ff lea -0x1(%ecx),%ebx
80100489: eb 8f jmp 8010041a <cgaputc+0x54>
pos |= inb(CRTPORT+1);
8010048b: 89 cb mov %ecx,%ebx
8010048d: eb 8b jmp 8010041a <cgaputc+0x54>
panic("pos under/overflow");
8010048f: 83 ec 0c sub $0xc,%esp
80100492: 68 85 6f 10 80 push $0x80106f85
80100497: e8 ac fe ff ff call 80100348 <panic>
memmove(crt, crt+80, sizeof(crt[0])*23*80);
8010049c: 83 ec 04 sub $0x4,%esp
8010049f: 68 60 0e 00 00 push $0xe60
801004a4: 68 a0 80 0b 80 push $0x800b80a0
801004a9: 68 00 80 0b 80 push $0x800b8000
801004ae: e8 e0 3f 00 00 call 80104493 <memmove>
pos -= 80;
801004b3: 83 eb 50 sub $0x50,%ebx
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
801004b6: b8 80 07 00 00 mov $0x780,%eax
801004bb: 29 d8 sub %ebx,%eax
801004bd: 8d 94 1b 00 80 0b 80 lea -0x7ff48000(%ebx,%ebx,1),%edx
801004c4: 83 c4 0c add $0xc,%esp
801004c7: 01 c0 add %eax,%eax
801004c9: 50 push %eax
801004ca: 6a 00 push $0x0
801004cc: 52 push %edx
801004cd: e8 49 3f 00 00 call 8010441b <memset>
801004d2: 83 c4 10 add $0x10,%esp
801004d5: e9 50 ff ff ff jmp 8010042a <cgaputc+0x64>
801004da <consputc>:
if(panicked){
801004da: 83 3d 58 ef 10 80 00 cmpl $0x0,0x8010ef58
801004e1: 74 03 je 801004e6 <consputc+0xc>
asm volatile("cli");
801004e3: fa cli
for(;;)
801004e4: eb fe jmp 801004e4 <consputc+0xa>
{
801004e6: 55 push %ebp
801004e7: 89 e5 mov %esp,%ebp
801004e9: 53 push %ebx
801004ea: 83 ec 04 sub $0x4,%esp
801004ed: 89 c3 mov %eax,%ebx
if(c == BACKSPACE){
801004ef: 3d 00 01 00 00 cmp $0x100,%eax
801004f4: 74 18 je 8010050e <consputc+0x34>
uartputc(c);
801004f6: 83 ec 0c sub $0xc,%esp
801004f9: 50 push %eax
801004fa: e8 c1 53 00 00 call 801058c0 <uartputc>
801004ff: 83 c4 10 add $0x10,%esp
cgaputc(c);
80100502: 89 d8 mov %ebx,%eax
80100504: e8 bd fe ff ff call 801003c6 <cgaputc>
}
80100509: 8b 5d fc mov -0x4(%ebp),%ebx
8010050c: c9 leave
8010050d: c3 ret
uartputc('\b'); uartputc(' '); uartputc('\b');
8010050e: 83 ec 0c sub $0xc,%esp
80100511: 6a 08 push $0x8
80100513: e8 a8 53 00 00 call 801058c0 <uartputc>
80100518: c7 04 24 20 00 00 00 movl $0x20,(%esp)
8010051f: e8 9c 53 00 00 call 801058c0 <uartputc>
80100524: c7 04 24 08 00 00 00 movl $0x8,(%esp)
8010052b: e8 90 53 00 00 call 801058c0 <uartputc>
80100530: 83 c4 10 add $0x10,%esp
80100533: eb cd jmp 80100502 <consputc+0x28>
80100535 <printint>:
{
80100535: 55 push %ebp
80100536: 89 e5 mov %esp,%ebp
80100538: 57 push %edi
80100539: 56 push %esi
8010053a: 53 push %ebx
8010053b: 83 ec 2c sub $0x2c,%esp
8010053e: 89 d6 mov %edx,%esi
80100540: 89 4d d4 mov %ecx,-0x2c(%ebp)
if(sign && (sign = xx < 0))
80100543: 85 c9 test %ecx,%ecx
80100545: 74 0c je 80100553 <printint+0x1e>
80100547: 89 c7 mov %eax,%edi
80100549: c1 ef 1f shr $0x1f,%edi
8010054c: 89 7d d4 mov %edi,-0x2c(%ebp)
8010054f: 85 c0 test %eax,%eax
80100551: 78 38 js 8010058b <printint+0x56>
x = xx;
80100553: 89 c1 mov %eax,%ecx
i = 0;
80100555: bb 00 00 00 00 mov $0x0,%ebx
buf[i++] = digits[x % base];
8010055a: 89 c8 mov %ecx,%eax
8010055c: ba 00 00 00 00 mov $0x0,%edx
80100561: f7 f6 div %esi
80100563: 89 df mov %ebx,%edi
80100565: 83 c3 01 add $0x1,%ebx
80100568: 0f b6 92 b0 6f 10 80 movzbl -0x7fef9050(%edx),%edx
8010056f: 88 54 3d d8 mov %dl,-0x28(%ebp,%edi,1)
}while((x /= base) != 0);
80100573: 89 ca mov %ecx,%edx
80100575: 89 c1 mov %eax,%ecx
80100577: 39 d6 cmp %edx,%esi
80100579: 76 df jbe 8010055a <printint+0x25>
if(sign)
8010057b: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
8010057f: 74 1a je 8010059b <printint+0x66>
buf[i++] = '-';
80100581: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1)
80100586: 8d 5f 02 lea 0x2(%edi),%ebx
80100589: eb 10 jmp 8010059b <printint+0x66>
x = -xx;
8010058b: f7 d8 neg %eax
8010058d: 89 c1 mov %eax,%ecx
8010058f: eb c4 jmp 80100555 <printint+0x20>
consputc(buf[i]);
80100591: 0f be 44 1d d8 movsbl -0x28(%ebp,%ebx,1),%eax
80100596: e8 3f ff ff ff call 801004da <consputc>
while(--i >= 0)
8010059b: 83 eb 01 sub $0x1,%ebx
8010059e: 79 f1 jns 80100591 <printint+0x5c>
}
801005a0: 83 c4 2c add $0x2c,%esp
801005a3: 5b pop %ebx
801005a4: 5e pop %esi
801005a5: 5f pop %edi
801005a6: 5d pop %ebp
801005a7: c3 ret
801005a8 <consolewrite>:
int
consolewrite(struct inode *ip, char *buf, int n)
{
801005a8: 55 push %ebp
801005a9: 89 e5 mov %esp,%ebp
801005ab: 57 push %edi
801005ac: 56 push %esi
801005ad: 53 push %ebx
801005ae: 83 ec 18 sub $0x18,%esp
801005b1: 8b 7d 0c mov 0xc(%ebp),%edi
801005b4: 8b 75 10 mov 0x10(%ebp),%esi
int i;
iunlock(ip);
801005b7: ff 75 08 push 0x8(%ebp)
801005ba: e8 72 10 00 00 call 80101631 <iunlock>
acquire(&cons.lock);
801005bf: c7 04 24 20 ef 10 80 movl $0x8010ef20,(%esp)
801005c6: e8 a4 3d 00 00 call 8010436f <acquire>
for(i = 0; i < n; i++)
801005cb: 83 c4 10 add $0x10,%esp
801005ce: bb 00 00 00 00 mov $0x0,%ebx
801005d3: eb 0c jmp 801005e1 <consolewrite+0x39>
consputc(buf[i] & 0xff);
801005d5: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax
801005d9: e8 fc fe ff ff call 801004da <consputc>
for(i = 0; i < n; i++)
801005de: 83 c3 01 add $0x1,%ebx
801005e1: 39 f3 cmp %esi,%ebx
801005e3: 7c f0 jl 801005d5 <consolewrite+0x2d>
release(&cons.lock);
801005e5: 83 ec 0c sub $0xc,%esp
801005e8: 68 20 ef 10 80 push $0x8010ef20
801005ed: e8 e2 3d 00 00 call 801043d4 <release>
ilock(ip);
801005f2: 83 c4 04 add $0x4,%esp
801005f5: ff 75 08 push 0x8(%ebp)
801005f8: e8 72 0f 00 00 call 8010156f <ilock>
return n;
}
801005fd: 89 f0 mov %esi,%eax
801005ff: 8d 65 f4 lea -0xc(%ebp),%esp
80100602: 5b pop %ebx
80100603: 5e pop %esi
80100604: 5f pop %edi
80100605: 5d pop %ebp
80100606: c3 ret
80100607 <cprintf>:
{
80100607: 55 push %ebp
80100608: 89 e5 mov %esp,%ebp
8010060a: 57 push %edi
8010060b: 56 push %esi
8010060c: 53 push %ebx
8010060d: 83 ec 1c sub $0x1c,%esp
locking = cons.locking;
80100610: a1 54 ef 10 80 mov 0x8010ef54,%eax
80100615: 89 45 e0 mov %eax,-0x20(%ebp)
if(locking)
80100618: 85 c0 test %eax,%eax
8010061a: 75 10 jne 8010062c <cprintf+0x25>
if (fmt == 0)
8010061c: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80100620: 74 1c je 8010063e <cprintf+0x37>
argp = (uint*)(void*)(&fmt + 1);
80100622: 8d 7d 0c lea 0xc(%ebp),%edi
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100625: be 00 00 00 00 mov $0x0,%esi
8010062a: eb 27 jmp 80100653 <cprintf+0x4c>
acquire(&cons.lock);
8010062c: 83 ec 0c sub $0xc,%esp
8010062f: 68 20 ef 10 80 push $0x8010ef20
80100634: e8 36 3d 00 00 call 8010436f <acquire>
80100639: 83 c4 10 add $0x10,%esp
8010063c: eb de jmp 8010061c <cprintf+0x15>
panic("null fmt");
8010063e: 83 ec 0c sub $0xc,%esp
80100641: 68 9f 6f 10 80 push $0x80106f9f
80100646: e8 fd fc ff ff call 80100348 <panic>
consputc(c);
8010064b: e8 8a fe ff ff call 801004da <consputc>
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100650: 83 c6 01 add $0x1,%esi
80100653: 8b 55 08 mov 0x8(%ebp),%edx
80100656: 0f b6 04 32 movzbl (%edx,%esi,1),%eax
8010065a: 85 c0 test %eax,%eax
8010065c: 0f 84 b1 00 00 00 je 80100713 <cprintf+0x10c>
if(c != '%'){
80100662: 83 f8 25 cmp $0x25,%eax
80100665: 75 e4 jne 8010064b <cprintf+0x44>
c = fmt[++i] & 0xff;
80100667: 83 c6 01 add $0x1,%esi
8010066a: 0f b6 1c 32 movzbl (%edx,%esi,1),%ebx
if(c == 0)
8010066e: 85 db test %ebx,%ebx
80100670: 0f 84 9d 00 00 00 je 80100713 <cprintf+0x10c>
switch(c){
80100676: 83 fb 70 cmp $0x70,%ebx
80100679: 74 2e je 801006a9 <cprintf+0xa2>
8010067b: 7f 22 jg 8010069f <cprintf+0x98>
8010067d: 83 fb 25 cmp $0x25,%ebx
80100680: 74 6c je 801006ee <cprintf+0xe7>
80100682: 83 fb 64 cmp $0x64,%ebx
80100685: 75 76 jne 801006fd <cprintf+0xf6>
printint(*argp++, 10, 1);
80100687: 8d 5f 04 lea 0x4(%edi),%ebx
8010068a: 8b 07 mov (%edi),%eax
8010068c: b9 01 00 00 00 mov $0x1,%ecx
80100691: ba 0a 00 00 00 mov $0xa,%edx
80100696: e8 9a fe ff ff call 80100535 <printint>
8010069b: 89 df mov %ebx,%edi
break;
8010069d: eb b1 jmp 80100650 <cprintf+0x49>
switch(c){
8010069f: 83 fb 73 cmp $0x73,%ebx
801006a2: 74 1d je 801006c1 <cprintf+0xba>
801006a4: 83 fb 78 cmp $0x78,%ebx
801006a7: 75 54 jne 801006fd <cprintf+0xf6>
printint(*argp++, 16, 0);
801006a9: 8d 5f 04 lea 0x4(%edi),%ebx
801006ac: 8b 07 mov (%edi),%eax
801006ae: b9 00 00 00 00 mov $0x0,%ecx
801006b3: ba 10 00 00 00 mov $0x10,%edx
801006b8: e8 78 fe ff ff call 80100535 <printint>
801006bd: 89 df mov %ebx,%edi
break;
801006bf: eb 8f jmp 80100650 <cprintf+0x49>
if((s = (char*)*argp++) == 0)
801006c1: 8d 47 04 lea 0x4(%edi),%eax
801006c4: 89 45 e4 mov %eax,-0x1c(%ebp)
801006c7: 8b 1f mov (%edi),%ebx
801006c9: 85 db test %ebx,%ebx
801006cb: 75 12 jne 801006df <cprintf+0xd8>
s = "(null)";
801006cd: bb 98 6f 10 80 mov $0x80106f98,%ebx
801006d2: eb 0b jmp 801006df <cprintf+0xd8>
consputc(*s);
801006d4: 0f be c0 movsbl %al,%eax
801006d7: e8 fe fd ff ff call 801004da <consputc>
for(; *s; s++)
801006dc: 83 c3 01 add $0x1,%ebx
801006df: 0f b6 03 movzbl (%ebx),%eax
801006e2: 84 c0 test %al,%al
801006e4: 75 ee jne 801006d4 <cprintf+0xcd>
if((s = (char*)*argp++) == 0)
801006e6: 8b 7d e4 mov -0x1c(%ebp),%edi
801006e9: e9 62 ff ff ff jmp 80100650 <cprintf+0x49>
consputc('%');
801006ee: b8 25 00 00 00 mov $0x25,%eax
801006f3: e8 e2 fd ff ff call 801004da <consputc>
break;
801006f8: e9 53 ff ff ff jmp 80100650 <cprintf+0x49>
consputc('%');
801006fd: b8 25 00 00 00 mov $0x25,%eax
80100702: e8 d3 fd ff ff call 801004da <consputc>
consputc(c);
80100707: 89 d8 mov %ebx,%eax
80100709: e8 cc fd ff ff call 801004da <consputc>
break;
8010070e: e9 3d ff ff ff jmp 80100650 <cprintf+0x49>
if(locking)
80100713: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
80100717: 75 08 jne 80100721 <cprintf+0x11a>
}
80100719: 8d 65 f4 lea -0xc(%ebp),%esp
8010071c: 5b pop %ebx
8010071d: 5e pop %esi
8010071e: 5f pop %edi
8010071f: 5d pop %ebp
80100720: c3 ret
release(&cons.lock);
80100721: 83 ec 0c sub $0xc,%esp
80100724: 68 20 ef 10 80 push $0x8010ef20
80100729: e8 a6 3c 00 00 call 801043d4 <release>
8010072e: 83 c4 10 add $0x10,%esp
}
80100731: eb e6 jmp 80100719 <cprintf+0x112>
80100733 <consoleintr>:
{
80100733: 55 push %ebp
80100734: 89 e5 mov %esp,%ebp
80100736: 57 push %edi
80100737: 56 push %esi
80100738: 53 push %ebx
80100739: 83 ec 18 sub $0x18,%esp
8010073c: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&cons.lock);
8010073f: 68 20 ef 10 80 push $0x8010ef20
80100744: e8 26 3c 00 00 call 8010436f <acquire>
while((c = getc()) >= 0){
80100749: 83 c4 10 add $0x10,%esp
int c, doprocdump = 0;
8010074c: be 00 00 00 00 mov $0x0,%esi
while((c = getc()) >= 0){
80100751: eb 13 jmp 80100766 <consoleintr+0x33>
switch(c){
80100753: 83 ff 08 cmp $0x8,%edi
80100756: 0f 84 d9 00 00 00 je 80100835 <consoleintr+0x102>
8010075c: 83 ff 10 cmp $0x10,%edi
8010075f: 75 25 jne 80100786 <consoleintr+0x53>
80100761: be 01 00 00 00 mov $0x1,%esi
while((c = getc()) >= 0){
80100766: ff d3 call *%ebx
80100768: 89 c7 mov %eax,%edi
8010076a: 85 c0 test %eax,%eax
8010076c: 0f 88 f5 00 00 00 js 80100867 <consoleintr+0x134>
switch(c){
80100772: 83 ff 15 cmp $0x15,%edi
80100775: 0f 84 93 00 00 00 je 8010080e <consoleintr+0xdb>
8010077b: 7e d6 jle 80100753 <consoleintr+0x20>
8010077d: 83 ff 7f cmp $0x7f,%edi
80100780: 0f 84 af 00 00 00 je 80100835 <consoleintr+0x102>
if(c != 0 && input.e-input.r < INPUT_BUF){
80100786: 85 ff test %edi,%edi
80100788: 74 dc je 80100766 <consoleintr+0x33>
8010078a: a1 08 ef 10 80 mov 0x8010ef08,%eax
8010078f: 89 c2 mov %eax,%edx
80100791: 2b 15 00 ef 10 80 sub 0x8010ef00,%edx
80100797: 83 fa 7f cmp $0x7f,%edx
8010079a: 77 ca ja 80100766 <consoleintr+0x33>
c = (c == '\r') ? '\n' : c;
8010079c: 83 ff 0d cmp $0xd,%edi
8010079f: 0f 84 b8 00 00 00 je 8010085d <consoleintr+0x12a>
input.buf[input.e++ % INPUT_BUF] = c;
801007a5: 8d 50 01 lea 0x1(%eax),%edx
801007a8: 89 15 08 ef 10 80 mov %edx,0x8010ef08
801007ae: 83 e0 7f and $0x7f,%eax
801007b1: 89 f9 mov %edi,%ecx
801007b3: 88 88 80 ee 10 80 mov %cl,-0x7fef1180(%eax)
consputc(c);
801007b9: 89 f8 mov %edi,%eax
801007bb: e8 1a fd ff ff call 801004da <consputc>
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
801007c0: 83 ff 0a cmp $0xa,%edi
801007c3: 0f 94 c0 sete %al
801007c6: 83 ff 04 cmp $0x4,%edi
801007c9: 0f 94 c2 sete %dl
801007cc: 08 d0 or %dl,%al
801007ce: 75 10 jne 801007e0 <consoleintr+0xad>
801007d0: a1 00 ef 10 80 mov 0x8010ef00,%eax
801007d5: 83 e8 80 sub $0xffffff80,%eax
801007d8: 39 05 08 ef 10 80 cmp %eax,0x8010ef08
801007de: 75 86 jne 80100766 <consoleintr+0x33>
input.w = input.e;
801007e0: a1 08 ef 10 80 mov 0x8010ef08,%eax
801007e5: a3 04 ef 10 80 mov %eax,0x8010ef04
wakeup(&input.r);
801007ea: 83 ec 0c sub $0xc,%esp
801007ed: 68 00 ef 10 80 push $0x8010ef00
801007f2: e8 dd 37 00 00 call 80103fd4 <wakeup>
801007f7: 83 c4 10 add $0x10,%esp
801007fa: e9 67 ff ff ff jmp 80100766 <consoleintr+0x33>
input.e--;
801007ff: a3 08 ef 10 80 mov %eax,0x8010ef08
consputc(BACKSPACE);
80100804: b8 00 01 00 00 mov $0x100,%eax
80100809: e8 cc fc ff ff call 801004da <consputc>
while(input.e != input.w &&
8010080e: a1 08 ef 10 80 mov 0x8010ef08,%eax
80100813: 3b 05 04 ef 10 80 cmp 0x8010ef04,%eax
80100819: 0f 84 47 ff ff ff je 80100766 <consoleintr+0x33>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
8010081f: 83 e8 01 sub $0x1,%eax
80100822: 89 c2 mov %eax,%edx
80100824: 83 e2 7f and $0x7f,%edx
while(input.e != input.w &&