Annotation of linux/init/main.s, revision 1.1.1.1

1.1       root        1:        .file   "init/main.c"
                      2: gcc_compiled.:
                      3: .text
                      4: LC0:
                      5:        .ascii "out of memory\12\15\0"
                      6:        .align 2
                      7: _sprintf:
                      8:        movl 4(%esp),%edx
                      9:        leal 12(%esp),%eax
                     10:        pushl %eax
                     11:        pushl 12(%esp)
                     12:        pushl %edx
                     13:        call _vsprintf
                     14:        addl $12,%esp
                     15:        ret
                     16:        .align 2
                     17: _time_init:
                     18:        pushl %ebp
                     19:        movl %esp,%ebp
                     20:        subl $44,%esp
                     21: L65:
                     22:        movl $128,%eax
                     23:        movl $112,%edx
                     24: /APP
                     25:        outb %al,%dx
                     26:        jmp 1f
                     27: 1:     jmp 1f
                     28: 1:
                     29: /NO_APP
                     30:        movl $113,%edx
                     31: /APP
                     32:        inb %dx,%al
                     33:        jmp 1f
                     34: 1:     jmp 1f
                     35: 1:
                     36: /NO_APP
                     37:        movb %al,-40(%ebp)
                     38:        movzbl -40(%ebp),%eax
                     39:        movl %eax,-36(%ebp)
                     40:        movl $130,%eax
                     41:        movl $112,%edx
                     42: /APP
                     43:        outb %al,%dx
                     44:        jmp 1f
                     45: 1:     jmp 1f
                     46: 1:
                     47: /NO_APP
                     48:        movl $113,%edx
                     49: /APP
                     50:        inb %dx,%al
                     51:        jmp 1f
                     52: 1:     jmp 1f
                     53: 1:
                     54: /NO_APP
                     55:        movb %al,-40(%ebp)
                     56:        movzbl -40(%ebp),%eax
                     57:        movl %eax,-32(%ebp)
                     58:        movl $132,%eax
                     59:        movl $112,%edx
                     60: /APP
                     61:        outb %al,%dx
                     62:        jmp 1f
                     63: 1:     jmp 1f
                     64: 1:
                     65: /NO_APP
                     66:        movl $113,%edx
                     67: /APP
                     68:        inb %dx,%al
                     69:        jmp 1f
                     70: 1:     jmp 1f
                     71: 1:
                     72: /NO_APP
                     73:        movb %al,-40(%ebp)
                     74:        movzbl -40(%ebp),%eax
                     75:        movl %eax,-28(%ebp)
                     76:        movl $135,%eax
                     77:        movl $112,%edx
                     78: /APP
                     79:        outb %al,%dx
                     80:        jmp 1f
                     81: 1:     jmp 1f
                     82: 1:
                     83: /NO_APP
                     84:        movl $113,%edx
                     85: /APP
                     86:        inb %dx,%al
                     87:        jmp 1f
                     88: 1:     jmp 1f
                     89: 1:
                     90: /NO_APP
                     91:        movb %al,-40(%ebp)
                     92:        movzbl -40(%ebp),%eax
                     93:        movl %eax,-24(%ebp)
                     94:        movl $136,%eax
                     95:        movl $112,%edx
                     96: /APP
                     97:        outb %al,%dx
                     98:        jmp 1f
                     99: 1:     jmp 1f
                    100: 1:
                    101: /NO_APP
                    102:        movl $113,%edx
                    103: /APP
                    104:        inb %dx,%al
                    105:        jmp 1f
                    106: 1:     jmp 1f
                    107: 1:
                    108: /NO_APP
                    109:        movb %al,-40(%ebp)
                    110:        movzbl -40(%ebp),%eax
                    111:        movl %eax,-20(%ebp)
                    112:        movl $137,%eax
                    113:        movl $112,%edx
                    114: /APP
                    115:        outb %al,%dx
                    116:        jmp 1f
                    117: 1:     jmp 1f
                    118: 1:
                    119: /NO_APP
                    120:        movl $113,%edx
                    121: /APP
                    122:        inb %dx,%al
                    123:        jmp 1f
                    124: 1:     jmp 1f
                    125: 1:
                    126: /NO_APP
                    127:        movb %al,-40(%ebp)
                    128:        movzbl -40(%ebp),%eax
                    129:        movl %eax,-16(%ebp)
                    130:        movl $128,%eax
                    131:        movl $112,%edx
                    132: /APP
                    133:        outb %al,%dx
                    134:        jmp 1f
                    135: 1:     jmp 1f
                    136: 1:
                    137: /NO_APP
                    138:        movl $113,%edx
                    139: /APP
                    140:        inb %dx,%al
                    141:        jmp 1f
                    142: 1:     jmp 1f
                    143: 1:
                    144: /NO_APP
                    145:        movb %al,-40(%ebp)
                    146:        movzbl -40(%ebp),%eax
                    147:        cmpl -36(%ebp),%eax
                    148:        jne L65
                    149:        movl -36(%ebp),%eax
                    150:        andl $15,%eax
                    151:        movl -36(%ebp),%edx
                    152:        sarl $4,%edx
                    153:        leal (%edx,%edx,4),%edx
                    154:        leal (%eax,%edx,2),%eax
                    155:        movl %eax,-36(%ebp)
                    156:        movl -32(%ebp),%eax
                    157:        andl $15,%eax
                    158:        movl -32(%ebp),%edx
                    159:        sarl $4,%edx
                    160:        leal (%edx,%edx,4),%edx
                    161:        leal (%eax,%edx,2),%eax
                    162:        movl %eax,-32(%ebp)
                    163:        movl -28(%ebp),%eax
                    164:        andl $15,%eax
                    165:        movl -28(%ebp),%edx
                    166:        sarl $4,%edx
                    167:        leal (%edx,%edx,4),%edx
                    168:        leal (%eax,%edx,2),%eax
                    169:        movl %eax,-28(%ebp)
                    170:        movl -24(%ebp),%eax
                    171:        andl $15,%eax
                    172:        movl -24(%ebp),%edx
                    173:        sarl $4,%edx
                    174:        leal (%edx,%edx,4),%edx
                    175:        leal (%eax,%edx,2),%eax
                    176:        movl %eax,-24(%ebp)
                    177:        movl -20(%ebp),%eax
                    178:        andl $15,%eax
                    179:        movl -20(%ebp),%edx
                    180:        sarl $4,%edx
                    181:        leal (%edx,%edx,4),%edx
                    182:        leal (%eax,%edx,2),%eax
                    183:        movl %eax,-20(%ebp)
                    184:        movl -16(%ebp),%eax
                    185:        andl $15,%eax
                    186:        movl -16(%ebp),%edx
                    187:        sarl $4,%edx
                    188:        leal (%edx,%edx,4),%edx
                    189:        leal (%eax,%edx,2),%eax
                    190:        movl %eax,-16(%ebp)
                    191:        decl -20(%ebp)
                    192:        leal -36(%ebp),%eax
                    193:        pushl %eax
                    194:        call _kernel_mktime
                    195:        movl %eax,_startup_time
                    196:        leave
                    197:        ret
                    198: .data
                    199:        .align 2
                    200: _memory_end:
                    201:        .long 0
                    202:        .align 2
                    203: _buffer_memory_end:
                    204:        .long 0
                    205:        .align 2
                    206: _main_memory_start:
                    207:        .long 0
                    208: .text
                    209: LC1:
                    210:        .ascii "/bin/sh\0"
                    211: .data
                    212:        .align 2
                    213: _argv_rc:
                    214:        .long LC1
                    215:        .long 0
                    216: .text
                    217: LC2:
                    218:        .ascii "HOME=/\0"
                    219: .data
                    220:        .align 2
                    221: _envp_rc:
                    222:        .long LC2
                    223:        .long 0
                    224:        .long 0
                    225: .text
                    226: LC3:
                    227:        .ascii "-/bin/sh\0"
                    228: .data
                    229:        .align 2
                    230: _argv:
                    231:        .long LC3
                    232:        .long 0
                    233: .text
                    234: LC4:
                    235:        .ascii "HOME=/usr/root\0"
                    236: .data
                    237:        .align 2
                    238: _envp:
                    239:        .long LC4
                    240:        .long 0
                    241:        .long 0
                    242: .text
                    243: LC5:
                    244:        .ascii "TERM=con%dx%d\0"
                    245:        .align 2
                    246: .globl _main
                    247: _main:
                    248:        pushl %ebp
                    249:        movl %esp,%ebp
                    250:        subl $8,%esp
                    251:        pushl %edi
                    252:        pushl %esi
                    253:        movzwl 590332,%eax
                    254:        movl %eax,_ROOT_DEV
                    255:        movzwl 590330,%eax
                    256:        movl %eax,_SWAP_DEV
                    257:        movw 589838,%dx
                    258:        andl $255,%edx
                    259:        pushl %edx
                    260:        movw 589838,%ax
                    261:        andw $65280,%ax
                    262:        shrw $8,%ax
                    263:        movw %ax,-4(%ebp)
                    264:        movzwl -4(%ebp),%eax
                    265:        pushl %eax
                    266:        pushl $LC5
                    267:        pushl $_term
                    268:        call _sprintf
                    269:        movl $_term,_envp+4
                    270:        movl $_term,_envp_rc+4
                    271:        movl $_drive_info,%edi
                    272:        movl $589952,%esi
                    273:        movl $8,%ecx
                    274:        cld
                    275:        rep
                    276:        movsl
                    277:        movzwl 589826,%eax
                    278:        sall $10,%eax
                    279:        addl $1048576,%eax
                    280:        movl %eax,_memory_end
                    281:        andl $-4096,_memory_end
                    282:        addl $16,%esp
                    283:        cmpl $16777216,_memory_end
                    284:        jle L69
                    285:        movl $16777216,_memory_end
                    286: L69:
                    287:        cmpl $12582912,_memory_end
                    288:        jle L70
                    289:        movl $4194304,_buffer_memory_end
                    290:        jmp L71
                    291:        .align 2
                    292: L70:
                    293:        cmpl $6291456,_memory_end
                    294:        jle L72
                    295:        movl $2097152,_buffer_memory_end
                    296:        jmp L71
                    297:        .align 2
                    298: L72:
                    299:        movl $1048576,_buffer_memory_end
                    300: L71:
                    301:        movl _buffer_memory_end,%eax
                    302:        movl %eax,_main_memory_start
                    303:        pushl _memory_end
                    304:        pushl _buffer_memory_end
                    305:        call _mem_init
                    306:        call _trap_init
                    307:        call _blk_dev_init
                    308:        call _chr_dev_init
                    309:        call _tty_init
                    310:        call _time_init
                    311:        call _sched_init
                    312:        pushl _buffer_memory_end
                    313:        call _buffer_init
                    314:        call _hd_init
                    315:        call _floppy_init
                    316: /APP
                    317:        sti
                    318:        movl %esp,%eax
                    319:        pushl $0x17
                    320:        pushl %eax
                    321:        pushfl
                    322:        pushl $0x0f
                    323:        pushl $1f
                    324:        iret
                    325: 1:     movl $0x17,%eax
                    326:        movw %ax,%ds
                    327:        movw %ax,%es
                    328:        movw %ax,%fs
                    329:        movw %ax,%gs
                    330: /NO_APP
                    331:        addl $12,%esp
                    332:        movl $2,%eax
                    333: /APP
                    334:        int $0x80
                    335: /NO_APP
                    336:        movl %eax,%edx
                    337:        testl %edx,%edx
                    338:        jge L75
                    339:        negl %edx
                    340:        movl %edx,_errno
                    341:        movl $-1,%edx
                    342: L75:
                    343:        testl %edx,%edx
                    344:        jne L74
                    345:        call _init
                    346: L74:
                    347: L77:
                    348:        movl $29,%eax
                    349: /APP
                    350:        int $0x80
                    351: /NO_APP
                    352:        jmp L77
                    353:        .align 2
                    354:        leal -16(%ebp),%esp
                    355:        popl %esi
                    356:        popl %edi
                    357:        leave
                    358:        ret
                    359:        .align 2
                    360: _printf:
                    361:        pushl %ebx
                    362:        leal 12(%esp),%eax
                    363:        pushl %eax
                    364:        pushl 12(%esp)
                    365:        pushl $_printbuf
                    366:        call _vsprintf
                    367:        movl %eax,%ebx
                    368:        pushl %ebx
                    369:        pushl $_printbuf
                    370:        pushl $1
                    371:        call _write
                    372:        movl %ebx,%eax
                    373:        addl $24,%esp
                    374:        popl %ebx
                    375:        ret
                    376: LC6:
                    377:        .ascii "/dev/tty1\0"
                    378: LC7:
                    379:        .ascii "%d buffers = %d bytes buffer space\12\15\0"
                    380: LC8:
                    381:        .ascii "Free mem: %d bytes\12\15\0"
                    382: LC9:
                    383:        .ascii "/etc/rc\0"
                    384: LC10:
                    385:        .ascii "Fork failed in init\15\12\0"
                    386: LC11:
                    387:        .ascii "\12\15child %d died with code %04x\12\15\0"
                    388:        .align 2
                    389: .globl _init
                    390: _init:
                    391:        pushl %ebp
                    392:        movl %esp,%ebp
                    393:        subl $4,%esp
                    394:        pushl %edi
                    395:        pushl %esi
                    396:        pushl %ebx
                    397:        xorl %eax,%eax
                    398:        movl $_drive_info,%ebx
                    399: /APP
                    400:        int $0x80
                    401: /NO_APP
                    402:        testl %eax,%eax
                    403:        jge L82
                    404:        negl %eax
                    405:        movl %eax,_errno
                    406: L82:
                    407:        pushl $0
                    408:        pushl $2
                    409:        pushl $LC6
                    410:        call _open
                    411:        pushl $0
                    412:        call _dup
                    413:        pushl $0
                    414:        call _dup
                    415:        movl _nr_buffers,%eax
                    416:        sall $10,%eax
                    417:        pushl %eax
                    418:        pushl _nr_buffers
                    419:        pushl $LC7
                    420:        call _printf
                    421:        addl $32,%esp
                    422:        movl _memory_end,%eax
                    423:        subl _main_memory_start,%eax
                    424:        pushl %eax
                    425:        pushl $LC8
                    426:        call _printf
                    427:        addl $8,%esp
                    428:        movl $2,%eax
                    429: /APP
                    430:        int $0x80
                    431: /NO_APP
                    432:        testl %eax,%eax
                    433:        jl L86
                    434:        movl %eax,%edi
                    435:        jmp L85
                    436:        .align 2
                    437: L86:
                    438:        negl %eax
                    439:        movl %eax,_errno
                    440:        movl $-1,%edi
                    441: L85:
                    442:        testl %edi,%edi
                    443:        jne L84
                    444:        pushl $0
                    445:        call _close
                    446:        pushl $0
                    447:        pushl $0
                    448:        pushl $LC9
                    449:        call _open
                    450:        addl $16,%esp
                    451:        testl %eax,%eax
                    452:        je L87
                    453:        pushl $1
                    454:        call __exit
                    455:        .align 2
                    456: L87:
                    457:        pushl $_envp_rc
                    458:        pushl $_argv_rc
                    459:        pushl $LC1
                    460:        call _execve
                    461:        pushl $2
                    462:        call __exit
                    463:        .align 2
                    464: L84:
                    465:        testl %edi,%edi
                    466:        jle L88
                    467:        leal -4(%ebp),%esi
                    468: L89:
                    469:        pushl %esi
                    470:        call _wait
                    471:        addl $4,%esp
                    472:        cmpl %edi,%eax
                    473:        jne L89
                    474: L88:
                    475:        leal -4(%ebp),%esi
                    476: L91:
                    477:        movl $2,%eax
                    478: /APP
                    479:        int $0x80
                    480: /NO_APP
                    481:        testl %eax,%eax
                    482:        jge L94
                    483:        negl %eax
                    484:        movl %eax,_errno
                    485:        movl $-1,%eax
                    486: L94:
                    487:        movl %eax,%edi
                    488:        testl %edi,%edi
                    489:        jge L93
                    490:        pushl $LC10
                    491:        call _printf
                    492:        addl $4,%esp
                    493:        jmp L91
                    494:        .align 2
                    495: L93:
                    496:        testl %edi,%edi
                    497:        jne L96
                    498:        pushl $0
                    499:        call _close
                    500:        pushl $1
                    501:        call _close
                    502:        pushl $2
                    503:        call _close
                    504:        call _setsid
                    505:        pushl $0
                    506:        pushl $2
                    507:        pushl $LC6
                    508:        call _open
                    509:        pushl $0
                    510:        call _dup
                    511:        pushl $0
                    512:        call _dup
                    513:        addl $32,%esp
                    514:        pushl $_envp
                    515:        pushl $_argv
                    516:        pushl $LC1
                    517:        call _execve
                    518:        pushl %eax
                    519:        call __exit
                    520:        .align 2
                    521: L96:
                    522: L97:
                    523:        pushl %esi
                    524:        call _wait
                    525:        addl $4,%esp
                    526:        cmpl %edi,%eax
                    527:        jne L97
                    528:        pushl -4(%ebp)
                    529:        pushl %edi
                    530:        pushl $LC11
                    531:        call _printf
                    532:        addl $12,%esp
                    533:        movl $36,%eax
                    534: /APP
                    535:        int $0x80
                    536: /NO_APP
                    537:        testl %eax,%eax
                    538:        jge L91
                    539:        negl %eax
                    540:        movl %eax,_errno
                    541:        jmp L91
                    542:        .align 2
                    543:        leal -16(%ebp),%esp
                    544:        popl %ebx
                    545:        popl %esi
                    546:        popl %edi
                    547:        leave
                    548:        ret
                    549: .comm _drive_info,32
                    550: .lcomm _term,32
                    551: .lcomm _printbuf,1024

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.