hexsha stringlengths 40 40 | size int64 6 1.05M | ext stringclasses 3 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 4 232 | max_stars_repo_name stringlengths 7 106 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 7 | max_stars_count int64 1 33.5k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 232 | max_issues_repo_name stringlengths 7 106 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 7 | max_issues_count int64 1 37.5k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 232 | max_forks_repo_name stringlengths 7 106 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 7 | max_forks_count int64 1 12.6k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 6 1.05M | avg_line_length float64 1.16 19.7k | max_line_length int64 2 938k | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
878174b9683e24d28c205e605e325365e4b02797 | 703,278 | asm | Assembly | kernel.asm | sleep2144985/xv6-public | 83ab35e95996b4240b62346c28078b579fb7f8c8 | [
"MIT-0"
] | null | null | null | kernel.asm | sleep2144985/xv6-public | 83ab35e95996b4240b62346c28078b579fb7f8c8 | [
"MIT-0"
] | null | null | null | kernel.asm | sleep2144985/xv6-public | 83ab35e95996b4240b62346c28078b579fb7f8c8 | [
"MIT-0"
] | null | null | null |
kernel: 檔案格式 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 c0 b5 10 80 mov $0x8010b5c0,%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 e0 2e 10 80 mov $0x80102ee0,%eax
jmp *%eax
80100032: ff e0 jmp *%eax
80100034: 66 90 xchg %ax,%ax
80100036: 66 90 xchg %ax,%ax
80100038: 66 90 xchg %ax,%ax
8010003a: 66 90 xchg %ax,%ax
8010003c: 66 90 xchg %ax,%ax
8010003e: 66 90 xchg %ax,%ax
80100040 <binit>:
struct buf head;
} bcache;
void
binit(void)
{
80100040: 55 push %ebp
80100041: 89 e5 mov %esp,%ebp
80100043: 53 push %ebx
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100044: bb f4 b5 10 80 mov $0x8010b5f4,%ebx
struct buf head;
} bcache;
void
binit(void)
{
80100049: 83 ec 0c sub $0xc,%esp
struct buf *b;
initlock(&bcache.lock, "bcache");
8010004c: 68 60 6f 10 80 push $0x80106f60
80100051: 68 c0 b5 10 80 push $0x8010b5c0
80100056: e8 e5 41 00 00 call 80104240 <initlock>
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
8010005b: c7 05 0c fd 10 80 bc movl $0x8010fcbc,0x8010fd0c
80100062: fc 10 80
bcache.head.next = &bcache.head;
80100065: c7 05 10 fd 10 80 bc movl $0x8010fcbc,0x8010fd10
8010006c: fc 10 80
8010006f: 83 c4 10 add $0x10,%esp
80100072: ba bc fc 10 80 mov $0x8010fcbc,%edx
80100077: eb 09 jmp 80100082 <binit+0x42>
80100079: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80100080: 89 c3 mov %eax,%ebx
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
b->next = bcache.head.next;
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
80100082: 8d 43 0c lea 0xc(%ebx),%eax
80100085: 83 ec 08 sub $0x8,%esp
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
b->next = bcache.head.next;
80100088: 89 53 54 mov %edx,0x54(%ebx)
b->prev = &bcache.head;
8010008b: c7 43 50 bc fc 10 80 movl $0x8010fcbc,0x50(%ebx)
initsleeplock(&b->lock, "buffer");
80100092: 68 67 6f 10 80 push $0x80106f67
80100097: 50 push %eax
80100098: e8 73 40 00 00 call 80104110 <initsleeplock>
bcache.head.next->prev = b;
8010009d: a1 10 fd 10 80 mov 0x8010fd10,%eax
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
801000a2: 83 c4 10 add $0x10,%esp
801000a5: 89 da mov %ebx,%edx
b->next = bcache.head.next;
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
bcache.head.next->prev = b;
801000a7: 89 58 50 mov %ebx,0x50(%eax)
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
801000aa: 8d 83 5c 02 00 00 lea 0x25c(%ebx),%eax
b->next = bcache.head.next;
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
bcache.head.next->prev = b;
bcache.head.next = b;
801000b0: 89 1d 10 fd 10 80 mov %ebx,0x8010fd10
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
801000b6: 3d bc fc 10 80 cmp $0x8010fcbc,%eax
801000bb: 75 c3 jne 80100080 <binit+0x40>
b->prev = &bcache.head;
initsleeplock(&b->lock, "buffer");
bcache.head.next->prev = b;
bcache.head.next = b;
}
}
801000bd: 8b 5d fc mov -0x4(%ebp),%ebx
801000c0: c9 leave
801000c1: c3 ret
801000c2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801000c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801000d0 <bread>:
}
// Return a locked buf with the contents of the indicated block.
struct buf*
bread(uint dev, uint blockno)
{
801000d0: 55 push %ebp
801000d1: 89 e5 mov %esp,%ebp
801000d3: 57 push %edi
801000d4: 56 push %esi
801000d5: 53 push %ebx
801000d6: 83 ec 18 sub $0x18,%esp
801000d9: 8b 75 08 mov 0x8(%ebp),%esi
801000dc: 8b 7d 0c mov 0xc(%ebp),%edi
static struct buf*
bget(uint dev, uint blockno)
{
struct buf *b;
acquire(&bcache.lock);
801000df: 68 c0 b5 10 80 push $0x8010b5c0
801000e4: e8 b7 42 00 00 call 801043a0 <acquire>
// Is the block already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000e9: 8b 1d 10 fd 10 80 mov 0x8010fd10,%ebx
801000ef: 83 c4 10 add $0x10,%esp
801000f2: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx
801000f8: 75 11 jne 8010010b <bread+0x3b>
801000fa: eb 24 jmp 80100120 <bread+0x50>
801000fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100100: 8b 5b 54 mov 0x54(%ebx),%ebx
80100103: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx
80100109: 74 15 je 80100120 <bread+0x50>
if(b->dev == dev && b->blockno == blockno){
8010010b: 3b 73 04 cmp 0x4(%ebx),%esi
8010010e: 75 f0 jne 80100100 <bread+0x30>
80100110: 3b 7b 08 cmp 0x8(%ebx),%edi
80100113: 75 eb jne 80100100 <bread+0x30>
b->refcnt++;
80100115: 83 43 4c 01 addl $0x1,0x4c(%ebx)
80100119: eb 3f jmp 8010015a <bread+0x8a>
8010011b: 90 nop
8010011c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
// 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){
80100120: 8b 1d 0c fd 10 80 mov 0x8010fd0c,%ebx
80100126: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx
8010012c: 75 0d jne 8010013b <bread+0x6b>
8010012e: eb 60 jmp 80100190 <bread+0xc0>
80100130: 8b 5b 50 mov 0x50(%ebx),%ebx
80100133: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx
80100139: 74 55 je 80100190 <bread+0xc0>
if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) {
8010013b: 8b 43 4c mov 0x4c(%ebx),%eax
8010013e: 85 c0 test %eax,%eax
80100140: 75 ee jne 80100130 <bread+0x60>
80100142: f6 03 04 testb $0x4,(%ebx)
80100145: 75 e9 jne 80100130 <bread+0x60>
b->dev = dev;
80100147: 89 73 04 mov %esi,0x4(%ebx)
b->blockno = blockno;
8010014a: 89 7b 08 mov %edi,0x8(%ebx)
b->flags = 0;
8010014d: c7 03 00 00 00 00 movl $0x0,(%ebx)
b->refcnt = 1;
80100153: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx)
release(&bcache.lock);
8010015a: 83 ec 0c sub $0xc,%esp
8010015d: 68 c0 b5 10 80 push $0x8010b5c0
80100162: e8 e9 42 00 00 call 80104450 <release>
acquiresleep(&b->lock);
80100167: 8d 43 0c lea 0xc(%ebx),%eax
8010016a: 89 04 24 mov %eax,(%esp)
8010016d: e8 de 3f 00 00 call 80104150 <acquiresleep>
80100172: 83 c4 10 add $0x10,%esp
bread(uint dev, uint blockno)
{
struct buf *b;
b = bget(dev, blockno);
if((b->flags & B_VALID) == 0) {
80100175: f6 03 02 testb $0x2,(%ebx)
80100178: 75 0c jne 80100186 <bread+0xb6>
iderw(b);
8010017a: 83 ec 0c sub $0xc,%esp
8010017d: 53 push %ebx
8010017e: e8 ed 1f 00 00 call 80102170 <iderw>
80100183: 83 c4 10 add $0x10,%esp
}
return b;
}
80100186: 8d 65 f4 lea -0xc(%ebp),%esp
80100189: 89 d8 mov %ebx,%eax
8010018b: 5b pop %ebx
8010018c: 5e pop %esi
8010018d: 5f pop %edi
8010018e: 5d pop %ebp
8010018f: c3 ret
release(&bcache.lock);
acquiresleep(&b->lock);
return b;
}
}
panic("bget: no buffers");
80100190: 83 ec 0c sub $0xc,%esp
80100193: 68 6e 6f 10 80 push $0x80106f6e
80100198: e8 d3 01 00 00 call 80100370 <panic>
8010019d: 8d 76 00 lea 0x0(%esi),%esi
801001a0 <bwrite>:
}
// Write b's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
801001a0: 55 push %ebp
801001a1: 89 e5 mov %esp,%ebp
801001a3: 53 push %ebx
801001a4: 83 ec 10 sub $0x10,%esp
801001a7: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holdingsleep(&b->lock))
801001aa: 8d 43 0c lea 0xc(%ebx),%eax
801001ad: 50 push %eax
801001ae: e8 3d 40 00 00 call 801041f0 <holdingsleep>
801001b3: 83 c4 10 add $0x10,%esp
801001b6: 85 c0 test %eax,%eax
801001b8: 74 0f je 801001c9 <bwrite+0x29>
panic("bwrite");
b->flags |= B_DIRTY;
801001ba: 83 0b 04 orl $0x4,(%ebx)
iderw(b);
801001bd: 89 5d 08 mov %ebx,0x8(%ebp)
}
801001c0: 8b 5d fc mov -0x4(%ebp),%ebx
801001c3: c9 leave
bwrite(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("bwrite");
b->flags |= B_DIRTY;
iderw(b);
801001c4: e9 a7 1f 00 00 jmp 80102170 <iderw>
// Write b's contents to disk. Must be locked.
void
bwrite(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("bwrite");
801001c9: 83 ec 0c sub $0xc,%esp
801001cc: 68 7f 6f 10 80 push $0x80106f7f
801001d1: e8 9a 01 00 00 call 80100370 <panic>
801001d6: 8d 76 00 lea 0x0(%esi),%esi
801001d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801001e0 <brelse>:
// Release a locked buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
801001e0: 55 push %ebp
801001e1: 89 e5 mov %esp,%ebp
801001e3: 56 push %esi
801001e4: 53 push %ebx
801001e5: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holdingsleep(&b->lock))
801001e8: 83 ec 0c sub $0xc,%esp
801001eb: 8d 73 0c lea 0xc(%ebx),%esi
801001ee: 56 push %esi
801001ef: e8 fc 3f 00 00 call 801041f0 <holdingsleep>
801001f4: 83 c4 10 add $0x10,%esp
801001f7: 85 c0 test %eax,%eax
801001f9: 74 66 je 80100261 <brelse+0x81>
panic("brelse");
releasesleep(&b->lock);
801001fb: 83 ec 0c sub $0xc,%esp
801001fe: 56 push %esi
801001ff: e8 ac 3f 00 00 call 801041b0 <releasesleep>
acquire(&bcache.lock);
80100204: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp)
8010020b: e8 90 41 00 00 call 801043a0 <acquire>
b->refcnt--;
80100210: 8b 43 4c mov 0x4c(%ebx),%eax
if (b->refcnt == 0) {
80100213: 83 c4 10 add $0x10,%esp
panic("brelse");
releasesleep(&b->lock);
acquire(&bcache.lock);
b->refcnt--;
80100216: 83 e8 01 sub $0x1,%eax
if (b->refcnt == 0) {
80100219: 85 c0 test %eax,%eax
panic("brelse");
releasesleep(&b->lock);
acquire(&bcache.lock);
b->refcnt--;
8010021b: 89 43 4c mov %eax,0x4c(%ebx)
if (b->refcnt == 0) {
8010021e: 75 2f jne 8010024f <brelse+0x6f>
// no one is waiting for it.
b->next->prev = b->prev;
80100220: 8b 43 54 mov 0x54(%ebx),%eax
80100223: 8b 53 50 mov 0x50(%ebx),%edx
80100226: 89 50 50 mov %edx,0x50(%eax)
b->prev->next = b->next;
80100229: 8b 43 50 mov 0x50(%ebx),%eax
8010022c: 8b 53 54 mov 0x54(%ebx),%edx
8010022f: 89 50 54 mov %edx,0x54(%eax)
b->next = bcache.head.next;
80100232: a1 10 fd 10 80 mov 0x8010fd10,%eax
b->prev = &bcache.head;
80100237: c7 43 50 bc fc 10 80 movl $0x8010fcbc,0x50(%ebx)
b->refcnt--;
if (b->refcnt == 0) {
// no one is waiting for it.
b->next->prev = b->prev;
b->prev->next = b->next;
b->next = bcache.head.next;
8010023e: 89 43 54 mov %eax,0x54(%ebx)
b->prev = &bcache.head;
bcache.head.next->prev = b;
80100241: a1 10 fd 10 80 mov 0x8010fd10,%eax
80100246: 89 58 50 mov %ebx,0x50(%eax)
bcache.head.next = b;
80100249: 89 1d 10 fd 10 80 mov %ebx,0x8010fd10
}
release(&bcache.lock);
8010024f: c7 45 08 c0 b5 10 80 movl $0x8010b5c0,0x8(%ebp)
}
80100256: 8d 65 f8 lea -0x8(%ebp),%esp
80100259: 5b pop %ebx
8010025a: 5e pop %esi
8010025b: 5d pop %ebp
b->prev = &bcache.head;
bcache.head.next->prev = b;
bcache.head.next = b;
}
release(&bcache.lock);
8010025c: e9 ef 41 00 00 jmp 80104450 <release>
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
if(!holdingsleep(&b->lock))
panic("brelse");
80100261: 83 ec 0c sub $0xc,%esp
80100264: 68 86 6f 10 80 push $0x80106f86
80100269: e8 02 01 00 00 call 80100370 <panic>
8010026e: 66 90 xchg %ax,%ax
80100270 <consoleread>:
}
}
int
consoleread(struct inode *ip, char *dst, int n)
{
80100270: 55 push %ebp
80100271: 89 e5 mov %esp,%ebp
80100273: 57 push %edi
80100274: 56 push %esi
80100275: 53 push %ebx
80100276: 83 ec 28 sub $0x28,%esp
80100279: 8b 7d 08 mov 0x8(%ebp),%edi
8010027c: 8b 75 0c mov 0xc(%ebp),%esi
uint target;
int c;
iunlock(ip);
8010027f: 57 push %edi
80100280: e8 2b 15 00 00 call 801017b0 <iunlock>
target = n;
acquire(&cons.lock);
80100285: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010028c: e8 0f 41 00 00 call 801043a0 <acquire>
while(n > 0){
80100291: 8b 5d 10 mov 0x10(%ebp),%ebx
80100294: 83 c4 10 add $0x10,%esp
80100297: 31 c0 xor %eax,%eax
80100299: 85 db test %ebx,%ebx
8010029b: 0f 8e 9a 00 00 00 jle 8010033b <consoleread+0xcb>
while(input.r == input.w){
801002a1: a1 a0 ff 10 80 mov 0x8010ffa0,%eax
801002a6: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax
801002ac: 74 24 je 801002d2 <consoleread+0x62>
801002ae: eb 58 jmp 80100308 <consoleread+0x98>
if(myproc()->killed){
release(&cons.lock);
ilock(ip);
return -1;
}
sleep(&input.r, &cons.lock);
801002b0: 83 ec 08 sub $0x8,%esp
801002b3: 68 20 a5 10 80 push $0x8010a520
801002b8: 68 a0 ff 10 80 push $0x8010ffa0
801002bd: e8 ee 3a 00 00 call 80103db0 <sleep>
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
while(input.r == input.w){
801002c2: a1 a0 ff 10 80 mov 0x8010ffa0,%eax
801002c7: 83 c4 10 add $0x10,%esp
801002ca: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax
801002d0: 75 36 jne 80100308 <consoleread+0x98>
if(myproc()->killed){
801002d2: e8 29 35 00 00 call 80103800 <myproc>
801002d7: 8b 40 24 mov 0x24(%eax),%eax
801002da: 85 c0 test %eax,%eax
801002dc: 74 d2 je 801002b0 <consoleread+0x40>
release(&cons.lock);
801002de: 83 ec 0c sub $0xc,%esp
801002e1: 68 20 a5 10 80 push $0x8010a520
801002e6: e8 65 41 00 00 call 80104450 <release>
ilock(ip);
801002eb: 89 3c 24 mov %edi,(%esp)
801002ee: e8 bd 13 00 00 call 801016b0 <ilock>
return -1;
801002f3: 83 c4 10 add $0x10,%esp
801002f6: b8 ff ff ff ff mov $0xffffffff,%eax
}
release(&cons.lock);
ilock(ip);
return target - n;
}
801002fb: 8d 65 f4 lea -0xc(%ebp),%esp
801002fe: 5b pop %ebx
801002ff: 5e pop %esi
80100300: 5f pop %edi
80100301: 5d pop %ebp
80100302: c3 ret
80100303: 90 nop
80100304: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ilock(ip);
return -1;
}
sleep(&input.r, &cons.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
80100308: 8d 50 01 lea 0x1(%eax),%edx
8010030b: 89 15 a0 ff 10 80 mov %edx,0x8010ffa0
80100311: 89 c2 mov %eax,%edx
80100313: 83 e2 7f and $0x7f,%edx
80100316: 0f be 92 20 ff 10 80 movsbl -0x7fef00e0(%edx),%edx
if(c == C('D')){ // EOF
8010031d: 83 fa 04 cmp $0x4,%edx
80100320: 74 39 je 8010035b <consoleread+0xeb>
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
80100322: 83 c6 01 add $0x1,%esi
--n;
80100325: 83 eb 01 sub $0x1,%ebx
if(c == '\n')
80100328: 83 fa 0a cmp $0xa,%edx
// caller gets a 0-byte result.
input.r--;
}
break;
}
*dst++ = c;
8010032b: 88 56 ff mov %dl,-0x1(%esi)
--n;
if(c == '\n')
8010032e: 74 35 je 80100365 <consoleread+0xf5>
int c;
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
80100330: 85 db test %ebx,%ebx
80100332: 0f 85 69 ff ff ff jne 801002a1 <consoleread+0x31>
80100338: 8b 45 10 mov 0x10(%ebp),%eax
*dst++ = c;
--n;
if(c == '\n')
break;
}
release(&cons.lock);
8010033b: 83 ec 0c sub $0xc,%esp
8010033e: 89 45 e4 mov %eax,-0x1c(%ebp)
80100341: 68 20 a5 10 80 push $0x8010a520
80100346: e8 05 41 00 00 call 80104450 <release>
ilock(ip);
8010034b: 89 3c 24 mov %edi,(%esp)
8010034e: e8 5d 13 00 00 call 801016b0 <ilock>
return target - n;
80100353: 83 c4 10 add $0x10,%esp
80100356: 8b 45 e4 mov -0x1c(%ebp),%eax
80100359: eb a0 jmp 801002fb <consoleread+0x8b>
}
sleep(&input.r, &cons.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
if(c == C('D')){ // EOF
if(n < target){
8010035b: 39 5d 10 cmp %ebx,0x10(%ebp)
8010035e: 76 05 jbe 80100365 <consoleread+0xf5>
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
80100360: a3 a0 ff 10 80 mov %eax,0x8010ffa0
80100365: 8b 45 10 mov 0x10(%ebp),%eax
80100368: 29 d8 sub %ebx,%eax
8010036a: eb cf jmp 8010033b <consoleread+0xcb>
8010036c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100370 <panic>:
release(&cons.lock);
}
void
panic(char *s)
{
80100370: 55 push %ebp
80100371: 89 e5 mov %esp,%ebp
80100373: 56 push %esi
80100374: 53 push %ebx
80100375: 83 ec 30 sub $0x30,%esp
}
static inline void
cli(void)
{
asm volatile("cli");
80100378: fa cli
int i;
uint pcs[10];
cli();
cons.locking = 0;
80100379: c7 05 54 a5 10 80 00 movl $0x0,0x8010a554
80100380: 00 00 00
// use lapiccpunum so that we can call panic from mycpu()
cprintf("lapicid %d: panic: ", lapicid());
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
80100383: 8d 5d d0 lea -0x30(%ebp),%ebx
80100386: 8d 75 f8 lea -0x8(%ebp),%esi
uint pcs[10];
cli();
cons.locking = 0;
// use lapiccpunum so that we can call panic from mycpu()
cprintf("lapicid %d: panic: ", lapicid());
80100389: e8 e2 23 00 00 call 80102770 <lapicid>
8010038e: 83 ec 08 sub $0x8,%esp
80100391: 50 push %eax
80100392: 68 8d 6f 10 80 push $0x80106f8d
80100397: e8 c4 02 00 00 call 80100660 <cprintf>
cprintf(s);
8010039c: 58 pop %eax
8010039d: ff 75 08 pushl 0x8(%ebp)
801003a0: e8 bb 02 00 00 call 80100660 <cprintf>
cprintf("\n");
801003a5: c7 04 24 d7 78 10 80 movl $0x801078d7,(%esp)
801003ac: e8 af 02 00 00 call 80100660 <cprintf>
getcallerpcs(&s, pcs);
801003b1: 5a pop %edx
801003b2: 8d 45 08 lea 0x8(%ebp),%eax
801003b5: 59 pop %ecx
801003b6: 53 push %ebx
801003b7: 50 push %eax
801003b8: e8 a3 3e 00 00 call 80104260 <getcallerpcs>
801003bd: 83 c4 10 add $0x10,%esp
for(i=0; i<10; i++)
cprintf(" %p", pcs[i]);
801003c0: 83 ec 08 sub $0x8,%esp
801003c3: ff 33 pushl (%ebx)
801003c5: 83 c3 04 add $0x4,%ebx
801003c8: 68 a1 6f 10 80 push $0x80106fa1
801003cd: e8 8e 02 00 00 call 80100660 <cprintf>
// use lapiccpunum so that we can call panic from mycpu()
cprintf("lapicid %d: panic: ", lapicid());
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
for(i=0; i<10; i++)
801003d2: 83 c4 10 add $0x10,%esp
801003d5: 39 f3 cmp %esi,%ebx
801003d7: 75 e7 jne 801003c0 <panic+0x50>
cprintf(" %p", pcs[i]);
panicked = 1; // freeze other CPU
801003d9: c7 05 58 a5 10 80 01 movl $0x1,0x8010a558
801003e0: 00 00 00
801003e3: eb fe jmp 801003e3 <panic+0x73>
801003e5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801003e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801003f0 <consputc>:
}
void
consputc(int c)
{
if(panicked){
801003f0: 8b 15 58 a5 10 80 mov 0x8010a558,%edx
801003f6: 85 d2 test %edx,%edx
801003f8: 74 06 je 80100400 <consputc+0x10>
801003fa: fa cli
801003fb: eb fe jmp 801003fb <consputc+0xb>
801003fd: 8d 76 00 lea 0x0(%esi),%esi
crt[pos] = ' ' | 0x0700;
}
void
consputc(int c)
{
80100400: 55 push %ebp
80100401: 89 e5 mov %esp,%ebp
80100403: 57 push %edi
80100404: 56 push %esi
80100405: 53 push %ebx
80100406: 89 c3 mov %eax,%ebx
80100408: 83 ec 0c sub $0xc,%esp
cli();
for(;;)
;
}
if(c == BACKSPACE){
8010040b: 3d 00 01 00 00 cmp $0x100,%eax
80100410: 0f 84 b8 00 00 00 je 801004ce <consputc+0xde>
uartputc('\b'); uartputc(' '); uartputc('\b');
} else
uartputc(c);
80100416: 83 ec 0c sub $0xc,%esp
80100419: 50 push %eax
8010041a: e8 f1 56 00 00 call 80105b10 <uartputc>
8010041f: 83 c4 10 add $0x10,%esp
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80100422: bf d4 03 00 00 mov $0x3d4,%edi
80100427: b8 0e 00 00 00 mov $0xe,%eax
8010042c: 89 fa mov %edi,%edx
8010042e: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010042f: be d5 03 00 00 mov $0x3d5,%esi
80100434: 89 f2 mov %esi,%edx
80100436: ec in (%dx),%al
{
int pos;
// Cursor position: col + 80*row.
outb(CRTPORT, 14);
pos = inb(CRTPORT+1) << 8;
80100437: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010043a: 89 fa mov %edi,%edx
8010043c: c1 e0 08 shl $0x8,%eax
8010043f: 89 c1 mov %eax,%ecx
80100441: b8 0f 00 00 00 mov $0xf,%eax
80100446: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80100447: 89 f2 mov %esi,%edx
80100449: ec in (%dx),%al
outb(CRTPORT, 15);
pos |= inb(CRTPORT+1);
8010044a: 0f b6 c0 movzbl %al,%eax
8010044d: 09 c8 or %ecx,%eax
if(c == '\n')
8010044f: 83 fb 0a cmp $0xa,%ebx
80100452: 0f 84 0b 01 00 00 je 80100563 <consputc+0x173>
pos += 80 - pos%80;
else if(c == BACKSPACE){
80100458: 81 fb 00 01 00 00 cmp $0x100,%ebx
8010045e: 0f 84 e6 00 00 00 je 8010054a <consputc+0x15a>
if(pos > 0) --pos;
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
80100464: 0f b6 d3 movzbl %bl,%edx
80100467: 8d 78 01 lea 0x1(%eax),%edi
8010046a: 80 ce 07 or $0x7,%dh
8010046d: 66 89 94 00 00 80 0b mov %dx,-0x7ff48000(%eax,%eax,1)
80100474: 80
if(pos < 0 || pos > 25*80)
80100475: 81 ff d0 07 00 00 cmp $0x7d0,%edi
8010047b: 0f 8f bc 00 00 00 jg 8010053d <consputc+0x14d>
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
80100481: 81 ff 7f 07 00 00 cmp $0x77f,%edi
80100487: 7f 6f jg 801004f8 <consputc+0x108>
80100489: 89 f8 mov %edi,%eax
8010048b: 8d 8c 3f 00 80 0b 80 lea -0x7ff48000(%edi,%edi,1),%ecx
80100492: 89 fb mov %edi,%ebx
80100494: c1 e8 08 shr $0x8,%eax
80100497: 89 c6 mov %eax,%esi
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80100499: bf d4 03 00 00 mov $0x3d4,%edi
8010049e: b8 0e 00 00 00 mov $0xe,%eax
801004a3: 89 fa mov %edi,%edx
801004a5: ee out %al,(%dx)
801004a6: ba d5 03 00 00 mov $0x3d5,%edx
801004ab: 89 f0 mov %esi,%eax
801004ad: ee out %al,(%dx)
801004ae: b8 0f 00 00 00 mov $0xf,%eax
801004b3: 89 fa mov %edi,%edx
801004b5: ee out %al,(%dx)
801004b6: ba d5 03 00 00 mov $0x3d5,%edx
801004bb: 89 d8 mov %ebx,%eax
801004bd: ee out %al,(%dx)
outb(CRTPORT, 14);
outb(CRTPORT+1, pos>>8);
outb(CRTPORT, 15);
outb(CRTPORT+1, pos);
crt[pos] = ' ' | 0x0700;
801004be: b8 20 07 00 00 mov $0x720,%eax
801004c3: 66 89 01 mov %ax,(%ecx)
if(c == BACKSPACE){
uartputc('\b'); uartputc(' '); uartputc('\b');
} else
uartputc(c);
cgaputc(c);
}
801004c6: 8d 65 f4 lea -0xc(%ebp),%esp
801004c9: 5b pop %ebx
801004ca: 5e pop %esi
801004cb: 5f pop %edi
801004cc: 5d pop %ebp
801004cd: c3 ret
for(;;)
;
}
if(c == BACKSPACE){
uartputc('\b'); uartputc(' '); uartputc('\b');
801004ce: 83 ec 0c sub $0xc,%esp
801004d1: 6a 08 push $0x8
801004d3: e8 38 56 00 00 call 80105b10 <uartputc>
801004d8: c7 04 24 20 00 00 00 movl $0x20,(%esp)
801004df: e8 2c 56 00 00 call 80105b10 <uartputc>
801004e4: c7 04 24 08 00 00 00 movl $0x8,(%esp)
801004eb: e8 20 56 00 00 call 80105b10 <uartputc>
801004f0: 83 c4 10 add $0x10,%esp
801004f3: e9 2a ff ff ff jmp 80100422 <consputc+0x32>
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
801004f8: 83 ec 04 sub $0x4,%esp
pos -= 80;
801004fb: 8d 5f b0 lea -0x50(%edi),%ebx
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
801004fe: 68 60 0e 00 00 push $0xe60
80100503: 68 a0 80 0b 80 push $0x800b80a0
80100508: 68 00 80 0b 80 push $0x800b8000
pos -= 80;
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
8010050d: 8d b4 1b 00 80 0b 80 lea -0x7ff48000(%ebx,%ebx,1),%esi
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
80100514: e8 37 40 00 00 call 80104550 <memmove>
pos -= 80;
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
80100519: b8 80 07 00 00 mov $0x780,%eax
8010051e: 83 c4 0c add $0xc,%esp
80100521: 29 d8 sub %ebx,%eax
80100523: 01 c0 add %eax,%eax
80100525: 50 push %eax
80100526: 6a 00 push $0x0
80100528: 56 push %esi
80100529: e8 72 3f 00 00 call 801044a0 <memset>
8010052e: 89 f1 mov %esi,%ecx
80100530: 83 c4 10 add $0x10,%esp
80100533: be 07 00 00 00 mov $0x7,%esi
80100538: e9 5c ff ff ff jmp 80100499 <consputc+0xa9>
if(pos > 0) --pos;
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
if(pos < 0 || pos > 25*80)
panic("pos under/overflow");
8010053d: 83 ec 0c sub $0xc,%esp
80100540: 68 a5 6f 10 80 push $0x80106fa5
80100545: e8 26 fe ff ff call 80100370 <panic>
pos |= inb(CRTPORT+1);
if(c == '\n')
pos += 80 - pos%80;
else if(c == BACKSPACE){
if(pos > 0) --pos;
8010054a: 85 c0 test %eax,%eax
8010054c: 8d 78 ff lea -0x1(%eax),%edi
8010054f: 0f 85 20 ff ff ff jne 80100475 <consputc+0x85>
80100555: b9 00 80 0b 80 mov $0x800b8000,%ecx
8010055a: 31 db xor %ebx,%ebx
8010055c: 31 f6 xor %esi,%esi
8010055e: e9 36 ff ff ff jmp 80100499 <consputc+0xa9>
pos = inb(CRTPORT+1) << 8;
outb(CRTPORT, 15);
pos |= inb(CRTPORT+1);
if(c == '\n')
pos += 80 - pos%80;
80100563: ba 67 66 66 66 mov $0x66666667,%edx
80100568: f7 ea imul %edx
8010056a: 89 d0 mov %edx,%eax
8010056c: c1 e8 05 shr $0x5,%eax
8010056f: 8d 04 80 lea (%eax,%eax,4),%eax
80100572: c1 e0 04 shl $0x4,%eax
80100575: 8d 78 50 lea 0x50(%eax),%edi
80100578: e9 f8 fe ff ff jmp 80100475 <consputc+0x85>
8010057d: 8d 76 00 lea 0x0(%esi),%esi
80100580 <printint>:
int locking;
} cons;
static void
printint(int xx, int base, int sign)
{
80100580: 55 push %ebp
80100581: 89 e5 mov %esp,%ebp
80100583: 57 push %edi
80100584: 56 push %esi
80100585: 53 push %ebx
80100586: 89 d6 mov %edx,%esi
80100588: 83 ec 2c sub $0x2c,%esp
static char digits[] = "0123456789abcdef";
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
8010058b: 85 c9 test %ecx,%ecx
int locking;
} cons;
static void
printint(int xx, int base, int sign)
{
8010058d: 89 4d d4 mov %ecx,-0x2c(%ebp)
static char digits[] = "0123456789abcdef";
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
80100590: 74 0c je 8010059e <printint+0x1e>
80100592: 89 c7 mov %eax,%edi
80100594: c1 ef 1f shr $0x1f,%edi
80100597: 85 c0 test %eax,%eax
80100599: 89 7d d4 mov %edi,-0x2c(%ebp)
8010059c: 78 51 js 801005ef <printint+0x6f>
x = -xx;
else
x = xx;
i = 0;
8010059e: 31 ff xor %edi,%edi
801005a0: 8d 5d d7 lea -0x29(%ebp),%ebx
801005a3: eb 05 jmp 801005aa <printint+0x2a>
801005a5: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
801005a8: 89 cf mov %ecx,%edi
801005aa: 31 d2 xor %edx,%edx
801005ac: 8d 4f 01 lea 0x1(%edi),%ecx
801005af: f7 f6 div %esi
801005b1: 0f b6 92 d0 6f 10 80 movzbl -0x7fef9030(%edx),%edx
}while((x /= base) != 0);
801005b8: 85 c0 test %eax,%eax
else
x = xx;
i = 0;
do{
buf[i++] = digits[x % base];
801005ba: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
801005bd: 75 e9 jne 801005a8 <printint+0x28>
if(sign)
801005bf: 8b 45 d4 mov -0x2c(%ebp),%eax
801005c2: 85 c0 test %eax,%eax
801005c4: 74 08 je 801005ce <printint+0x4e>
buf[i++] = '-';
801005c6: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
801005cb: 8d 4f 02 lea 0x2(%edi),%ecx
801005ce: 8d 74 0d d7 lea -0x29(%ebp,%ecx,1),%esi
801005d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
while(--i >= 0)
consputc(buf[i]);
801005d8: 0f be 06 movsbl (%esi),%eax
801005db: 83 ee 01 sub $0x1,%esi
801005de: e8 0d fe ff ff call 801003f0 <consputc>
}while((x /= base) != 0);
if(sign)
buf[i++] = '-';
while(--i >= 0)
801005e3: 39 de cmp %ebx,%esi
801005e5: 75 f1 jne 801005d8 <printint+0x58>
consputc(buf[i]);
}
801005e7: 83 c4 2c add $0x2c,%esp
801005ea: 5b pop %ebx
801005eb: 5e pop %esi
801005ec: 5f pop %edi
801005ed: 5d pop %ebp
801005ee: c3 ret
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
x = -xx;
801005ef: f7 d8 neg %eax
801005f1: eb ab jmp 8010059e <printint+0x1e>
801005f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801005f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80100600 <consolewrite>:
return target - n;
}
int
consolewrite(struct inode *ip, char *buf, int n)
{
80100600: 55 push %ebp
80100601: 89 e5 mov %esp,%ebp
80100603: 57 push %edi
80100604: 56 push %esi
80100605: 53 push %ebx
80100606: 83 ec 18 sub $0x18,%esp
int i;
iunlock(ip);
80100609: ff 75 08 pushl 0x8(%ebp)
return target - n;
}
int
consolewrite(struct inode *ip, char *buf, int n)
{
8010060c: 8b 75 10 mov 0x10(%ebp),%esi
int i;
iunlock(ip);
8010060f: e8 9c 11 00 00 call 801017b0 <iunlock>
acquire(&cons.lock);
80100614: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp)
8010061b: e8 80 3d 00 00 call 801043a0 <acquire>
80100620: 8b 7d 0c mov 0xc(%ebp),%edi
for(i = 0; i < n; i++)
80100623: 83 c4 10 add $0x10,%esp
80100626: 85 f6 test %esi,%esi
80100628: 8d 1c 37 lea (%edi,%esi,1),%ebx
8010062b: 7e 12 jle 8010063f <consolewrite+0x3f>
8010062d: 8d 76 00 lea 0x0(%esi),%esi
consputc(buf[i] & 0xff);
80100630: 0f b6 07 movzbl (%edi),%eax
80100633: 83 c7 01 add $0x1,%edi
80100636: e8 b5 fd ff ff call 801003f0 <consputc>
{
int i;
iunlock(ip);
acquire(&cons.lock);
for(i = 0; i < n; i++)
8010063b: 39 df cmp %ebx,%edi
8010063d: 75 f1 jne 80100630 <consolewrite+0x30>
consputc(buf[i] & 0xff);
release(&cons.lock);
8010063f: 83 ec 0c sub $0xc,%esp
80100642: 68 20 a5 10 80 push $0x8010a520
80100647: e8 04 3e 00 00 call 80104450 <release>
ilock(ip);
8010064c: 58 pop %eax
8010064d: ff 75 08 pushl 0x8(%ebp)
80100650: e8 5b 10 00 00 call 801016b0 <ilock>
return n;
}
80100655: 8d 65 f4 lea -0xc(%ebp),%esp
80100658: 89 f0 mov %esi,%eax
8010065a: 5b pop %ebx
8010065b: 5e pop %esi
8010065c: 5f pop %edi
8010065d: 5d pop %ebp
8010065e: c3 ret
8010065f: 90 nop
80100660 <cprintf>:
//PAGEBREAK: 50
// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
80100660: 55 push %ebp
80100661: 89 e5 mov %esp,%ebp
80100663: 57 push %edi
80100664: 56 push %esi
80100665: 53 push %ebx
80100666: 83 ec 1c sub $0x1c,%esp
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
80100669: a1 54 a5 10 80 mov 0x8010a554,%eax
if(locking)
8010066e: 85 c0 test %eax,%eax
{
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
80100670: 89 45 e0 mov %eax,-0x20(%ebp)
if(locking)
80100673: 0f 85 47 01 00 00 jne 801007c0 <cprintf+0x160>
acquire(&cons.lock);
if (fmt == 0)
80100679: 8b 45 08 mov 0x8(%ebp),%eax
8010067c: 85 c0 test %eax,%eax
8010067e: 89 c1 mov %eax,%ecx
80100680: 0f 84 4f 01 00 00 je 801007d5 <cprintf+0x175>
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100686: 0f b6 00 movzbl (%eax),%eax
80100689: 31 db xor %ebx,%ebx
8010068b: 8d 75 0c lea 0xc(%ebp),%esi
8010068e: 89 cf mov %ecx,%edi
80100690: 85 c0 test %eax,%eax
80100692: 75 55 jne 801006e9 <cprintf+0x89>
80100694: eb 68 jmp 801006fe <cprintf+0x9e>
80100696: 8d 76 00 lea 0x0(%esi),%esi
80100699: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(c != '%'){
consputc(c);
continue;
}
c = fmt[++i] & 0xff;
801006a0: 83 c3 01 add $0x1,%ebx
801006a3: 0f b6 14 1f movzbl (%edi,%ebx,1),%edx
if(c == 0)
801006a7: 85 d2 test %edx,%edx
801006a9: 74 53 je 801006fe <cprintf+0x9e>
break;
switch(c){
801006ab: 83 fa 70 cmp $0x70,%edx
801006ae: 74 7a je 8010072a <cprintf+0xca>
801006b0: 7f 6e jg 80100720 <cprintf+0xc0>
801006b2: 83 fa 25 cmp $0x25,%edx
801006b5: 0f 84 ad 00 00 00 je 80100768 <cprintf+0x108>
801006bb: 83 fa 64 cmp $0x64,%edx
801006be: 0f 85 84 00 00 00 jne 80100748 <cprintf+0xe8>
case 'd':
printint(*argp++, 10, 1);
801006c4: 8d 46 04 lea 0x4(%esi),%eax
801006c7: b9 01 00 00 00 mov $0x1,%ecx
801006cc: ba 0a 00 00 00 mov $0xa,%edx
801006d1: 89 45 e4 mov %eax,-0x1c(%ebp)
801006d4: 8b 06 mov (%esi),%eax
801006d6: e8 a5 fe ff ff call 80100580 <printint>
801006db: 8b 75 e4 mov -0x1c(%ebp),%esi
if (fmt == 0)
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801006de: 83 c3 01 add $0x1,%ebx
801006e1: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax
801006e5: 85 c0 test %eax,%eax
801006e7: 74 15 je 801006fe <cprintf+0x9e>
if(c != '%'){
801006e9: 83 f8 25 cmp $0x25,%eax
801006ec: 74 b2 je 801006a0 <cprintf+0x40>
s = "(null)";
for(; *s; s++)
consputc(*s);
break;
case '%':
consputc('%');
801006ee: e8 fd fc ff ff call 801003f0 <consputc>
if (fmt == 0)
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801006f3: 83 c3 01 add $0x1,%ebx
801006f6: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax
801006fa: 85 c0 test %eax,%eax
801006fc: 75 eb jne 801006e9 <cprintf+0x89>
consputc(c);
break;
}
}
if(locking)
801006fe: 8b 45 e0 mov -0x20(%ebp),%eax
80100701: 85 c0 test %eax,%eax
80100703: 74 10 je 80100715 <cprintf+0xb5>
release(&cons.lock);
80100705: 83 ec 0c sub $0xc,%esp
80100708: 68 20 a5 10 80 push $0x8010a520
8010070d: e8 3e 3d 00 00 call 80104450 <release>
80100712: 83 c4 10 add $0x10,%esp
}
80100715: 8d 65 f4 lea -0xc(%ebp),%esp
80100718: 5b pop %ebx
80100719: 5e pop %esi
8010071a: 5f pop %edi
8010071b: 5d pop %ebp
8010071c: c3 ret
8010071d: 8d 76 00 lea 0x0(%esi),%esi
continue;
}
c = fmt[++i] & 0xff;
if(c == 0)
break;
switch(c){
80100720: 83 fa 73 cmp $0x73,%edx
80100723: 74 5b je 80100780 <cprintf+0x120>
80100725: 83 fa 78 cmp $0x78,%edx
80100728: 75 1e jne 80100748 <cprintf+0xe8>
case 'd':
printint(*argp++, 10, 1);
break;
case 'x':
case 'p':
printint(*argp++, 16, 0);
8010072a: 8d 46 04 lea 0x4(%esi),%eax
8010072d: 31 c9 xor %ecx,%ecx
8010072f: ba 10 00 00 00 mov $0x10,%edx
80100734: 89 45 e4 mov %eax,-0x1c(%ebp)
80100737: 8b 06 mov (%esi),%eax
80100739: e8 42 fe ff ff call 80100580 <printint>
8010073e: 8b 75 e4 mov -0x1c(%ebp),%esi
break;
80100741: eb 9b jmp 801006de <cprintf+0x7e>
80100743: 90 nop
80100744: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case '%':
consputc('%');
break;
default:
// Print unknown % sequence to draw attention.
consputc('%');
80100748: b8 25 00 00 00 mov $0x25,%eax
8010074d: 89 55 e4 mov %edx,-0x1c(%ebp)
80100750: e8 9b fc ff ff call 801003f0 <consputc>
consputc(c);
80100755: 8b 55 e4 mov -0x1c(%ebp),%edx
80100758: 89 d0 mov %edx,%eax
8010075a: e8 91 fc ff ff call 801003f0 <consputc>
break;
8010075f: e9 7a ff ff ff jmp 801006de <cprintf+0x7e>
80100764: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s = "(null)";
for(; *s; s++)
consputc(*s);
break;
case '%':
consputc('%');
80100768: b8 25 00 00 00 mov $0x25,%eax
8010076d: e8 7e fc ff ff call 801003f0 <consputc>
80100772: e9 7c ff ff ff jmp 801006f3 <cprintf+0x93>
80100777: 89 f6 mov %esi,%esi
80100779: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
case 'x':
case 'p':
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
80100780: 8d 46 04 lea 0x4(%esi),%eax
80100783: 8b 36 mov (%esi),%esi
80100785: 89 45 e4 mov %eax,-0x1c(%ebp)
s = "(null)";
80100788: b8 b8 6f 10 80 mov $0x80106fb8,%eax
8010078d: 85 f6 test %esi,%esi
8010078f: 0f 44 f0 cmove %eax,%esi
for(; *s; s++)
80100792: 0f be 06 movsbl (%esi),%eax
80100795: 84 c0 test %al,%al
80100797: 74 16 je 801007af <cprintf+0x14f>
80100799: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801007a0: 83 c6 01 add $0x1,%esi
consputc(*s);
801007a3: e8 48 fc ff ff call 801003f0 <consputc>
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
s = "(null)";
for(; *s; s++)
801007a8: 0f be 06 movsbl (%esi),%eax
801007ab: 84 c0 test %al,%al
801007ad: 75 f1 jne 801007a0 <cprintf+0x140>
case 'x':
case 'p':
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
801007af: 8b 75 e4 mov -0x1c(%ebp),%esi
801007b2: e9 27 ff ff ff jmp 801006de <cprintf+0x7e>
801007b7: 89 f6 mov %esi,%esi
801007b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
uint *argp;
char *s;
locking = cons.locking;
if(locking)
acquire(&cons.lock);
801007c0: 83 ec 0c sub $0xc,%esp
801007c3: 68 20 a5 10 80 push $0x8010a520
801007c8: e8 d3 3b 00 00 call 801043a0 <acquire>
801007cd: 83 c4 10 add $0x10,%esp
801007d0: e9 a4 fe ff ff jmp 80100679 <cprintf+0x19>
if (fmt == 0)
panic("null fmt");
801007d5: 83 ec 0c sub $0xc,%esp
801007d8: 68 bf 6f 10 80 push $0x80106fbf
801007dd: e8 8e fb ff ff call 80100370 <panic>
801007e2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801007e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801007f0 <consoleintr>:
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007f0: 55 push %ebp
801007f1: 89 e5 mov %esp,%ebp
801007f3: 57 push %edi
801007f4: 56 push %esi
801007f5: 53 push %ebx
int c, doprocdump = 0;
801007f6: 31 f6 xor %esi,%esi
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007f8: 83 ec 18 sub $0x18,%esp
801007fb: 8b 5d 08 mov 0x8(%ebp),%ebx
int c, doprocdump = 0;
acquire(&cons.lock);
801007fe: 68 20 a5 10 80 push $0x8010a520
80100803: e8 98 3b 00 00 call 801043a0 <acquire>
while((c = getc()) >= 0){
80100808: 83 c4 10 add $0x10,%esp
8010080b: 90 nop
8010080c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100810: ff d3 call *%ebx
80100812: 85 c0 test %eax,%eax
80100814: 89 c7 mov %eax,%edi
80100816: 78 48 js 80100860 <consoleintr+0x70>
switch(c){
80100818: 83 ff 10 cmp $0x10,%edi
8010081b: 0f 84 3f 01 00 00 je 80100960 <consoleintr+0x170>
80100821: 7e 5d jle 80100880 <consoleintr+0x90>
80100823: 83 ff 15 cmp $0x15,%edi
80100826: 0f 84 dc 00 00 00 je 80100908 <consoleintr+0x118>
8010082c: 83 ff 7f cmp $0x7f,%edi
8010082f: 75 54 jne 80100885 <consoleintr+0x95>
input.e--;
consputc(BACKSPACE);
}
break;
case C('H'): case '\x7f': // Backspace
if(input.e != input.w){
80100831: a1 a8 ff 10 80 mov 0x8010ffa8,%eax
80100836: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax
8010083c: 74 d2 je 80100810 <consoleintr+0x20>
input.e--;
8010083e: 83 e8 01 sub $0x1,%eax
80100841: a3 a8 ff 10 80 mov %eax,0x8010ffa8
consputc(BACKSPACE);
80100846: b8 00 01 00 00 mov $0x100,%eax
8010084b: e8 a0 fb ff ff call 801003f0 <consputc>
consoleintr(int (*getc)(void))
{
int c, doprocdump = 0;
acquire(&cons.lock);
while((c = getc()) >= 0){
80100850: ff d3 call *%ebx
80100852: 85 c0 test %eax,%eax
80100854: 89 c7 mov %eax,%edi
80100856: 79 c0 jns 80100818 <consoleintr+0x28>
80100858: 90 nop
80100859: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
}
break;
}
}
release(&cons.lock);
80100860: 83 ec 0c sub $0xc,%esp
80100863: 68 20 a5 10 80 push $0x8010a520
80100868: e8 e3 3b 00 00 call 80104450 <release>
if(doprocdump) {
8010086d: 83 c4 10 add $0x10,%esp
80100870: 85 f6 test %esi,%esi
80100872: 0f 85 f8 00 00 00 jne 80100970 <consoleintr+0x180>
procdump(); // now call procdump() wo. cons.lock held
}
}
80100878: 8d 65 f4 lea -0xc(%ebp),%esp
8010087b: 5b pop %ebx
8010087c: 5e pop %esi
8010087d: 5f pop %edi
8010087e: 5d pop %ebp
8010087f: c3 ret
{
int c, doprocdump = 0;
acquire(&cons.lock);
while((c = getc()) >= 0){
switch(c){
80100880: 83 ff 08 cmp $0x8,%edi
80100883: 74 ac je 80100831 <consoleintr+0x41>
input.e--;
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
80100885: 85 ff test %edi,%edi
80100887: 74 87 je 80100810 <consoleintr+0x20>
80100889: a1 a8 ff 10 80 mov 0x8010ffa8,%eax
8010088e: 89 c2 mov %eax,%edx
80100890: 2b 15 a0 ff 10 80 sub 0x8010ffa0,%edx
80100896: 83 fa 7f cmp $0x7f,%edx
80100899: 0f 87 71 ff ff ff ja 80100810 <consoleintr+0x20>
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
8010089f: 8d 50 01 lea 0x1(%eax),%edx
801008a2: 83 e0 7f and $0x7f,%eax
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
801008a5: 83 ff 0d cmp $0xd,%edi
input.buf[input.e++ % INPUT_BUF] = c;
801008a8: 89 15 a8 ff 10 80 mov %edx,0x8010ffa8
consputc(BACKSPACE);
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
801008ae: 0f 84 c8 00 00 00 je 8010097c <consoleintr+0x18c>
input.buf[input.e++ % INPUT_BUF] = c;
801008b4: 89 f9 mov %edi,%ecx
801008b6: 88 88 20 ff 10 80 mov %cl,-0x7fef00e0(%eax)
consputc(c);
801008bc: 89 f8 mov %edi,%eax
801008be: e8 2d fb ff ff call 801003f0 <consputc>
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
801008c3: 83 ff 0a cmp $0xa,%edi
801008c6: 0f 84 c1 00 00 00 je 8010098d <consoleintr+0x19d>
801008cc: 83 ff 04 cmp $0x4,%edi
801008cf: 0f 84 b8 00 00 00 je 8010098d <consoleintr+0x19d>
801008d5: a1 a0 ff 10 80 mov 0x8010ffa0,%eax
801008da: 83 e8 80 sub $0xffffff80,%eax
801008dd: 39 05 a8 ff 10 80 cmp %eax,0x8010ffa8
801008e3: 0f 85 27 ff ff ff jne 80100810 <consoleintr+0x20>
input.w = input.e;
wakeup(&input.r);
801008e9: 83 ec 0c sub $0xc,%esp
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
consputc(c);
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
input.w = input.e;
801008ec: a3 a4 ff 10 80 mov %eax,0x8010ffa4
wakeup(&input.r);
801008f1: 68 a0 ff 10 80 push $0x8010ffa0
801008f6: e8 65 36 00 00 call 80103f60 <wakeup>
801008fb: 83 c4 10 add $0x10,%esp
801008fe: e9 0d ff ff ff jmp 80100810 <consoleintr+0x20>
80100903: 90 nop
80100904: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
80100908: a1 a8 ff 10 80 mov 0x8010ffa8,%eax
8010090d: 39 05 a4 ff 10 80 cmp %eax,0x8010ffa4
80100913: 75 2b jne 80100940 <consoleintr+0x150>
80100915: e9 f6 fe ff ff jmp 80100810 <consoleintr+0x20>
8010091a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
80100920: a3 a8 ff 10 80 mov %eax,0x8010ffa8
consputc(BACKSPACE);
80100925: b8 00 01 00 00 mov $0x100,%eax
8010092a: e8 c1 fa ff ff call 801003f0 <consputc>
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
8010092f: a1 a8 ff 10 80 mov 0x8010ffa8,%eax
80100934: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax
8010093a: 0f 84 d0 fe ff ff je 80100810 <consoleintr+0x20>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
80100940: 83 e8 01 sub $0x1,%eax
80100943: 89 c2 mov %eax,%edx
80100945: 83 e2 7f and $0x7f,%edx
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
break;
case C('U'): // Kill line.
while(input.e != input.w &&
80100948: 80 ba 20 ff 10 80 0a cmpb $0xa,-0x7fef00e0(%edx)
8010094f: 75 cf jne 80100920 <consoleintr+0x130>
80100951: e9 ba fe ff ff jmp 80100810 <consoleintr+0x20>
80100956: 8d 76 00 lea 0x0(%esi),%esi
80100959: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
acquire(&cons.lock);
while((c = getc()) >= 0){
switch(c){
case C('P'): // Process listing.
// procdump() locks cons.lock indirectly; invoke later
doprocdump = 1;
80100960: be 01 00 00 00 mov $0x1,%esi
80100965: e9 a6 fe ff ff jmp 80100810 <consoleintr+0x20>
8010096a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
release(&cons.lock);
if(doprocdump) {
procdump(); // now call procdump() wo. cons.lock held
}
}
80100970: 8d 65 f4 lea -0xc(%ebp),%esp
80100973: 5b pop %ebx
80100974: 5e pop %esi
80100975: 5f pop %edi
80100976: 5d pop %ebp
break;
}
}
release(&cons.lock);
if(doprocdump) {
procdump(); // now call procdump() wo. cons.lock held
80100977: e9 d4 36 00 00 jmp 80104050 <procdump>
}
break;
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
c = (c == '\r') ? '\n' : c;
input.buf[input.e++ % INPUT_BUF] = c;
8010097c: c6 80 20 ff 10 80 0a movb $0xa,-0x7fef00e0(%eax)
consputc(c);
80100983: b8 0a 00 00 00 mov $0xa,%eax
80100988: e8 63 fa ff ff call 801003f0 <consputc>
8010098d: a1 a8 ff 10 80 mov 0x8010ffa8,%eax
80100992: e9 52 ff ff ff jmp 801008e9 <consoleintr+0xf9>
80100997: 89 f6 mov %esi,%esi
80100999: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801009a0 <consoleinit>:
return n;
}
void
consoleinit(void)
{
801009a0: 55 push %ebp
801009a1: 89 e5 mov %esp,%ebp
801009a3: 83 ec 10 sub $0x10,%esp
initlock(&cons.lock, "console");
801009a6: 68 c8 6f 10 80 push $0x80106fc8
801009ab: 68 20 a5 10 80 push $0x8010a520
801009b0: e8 8b 38 00 00 call 80104240 <initlock>
devsw[CONSOLE].write = consolewrite;
devsw[CONSOLE].read = consoleread;
cons.locking = 1;
ioapicenable(IRQ_KBD, 0);
801009b5: 58 pop %eax
801009b6: 5a pop %edx
801009b7: 6a 00 push $0x0
801009b9: 6a 01 push $0x1
void
consoleinit(void)
{
initlock(&cons.lock, "console");
devsw[CONSOLE].write = consolewrite;
801009bb: c7 05 6c 09 11 80 00 movl $0x80100600,0x8011096c
801009c2: 06 10 80
devsw[CONSOLE].read = consoleread;
801009c5: c7 05 68 09 11 80 70 movl $0x80100270,0x80110968
801009cc: 02 10 80
cons.locking = 1;
801009cf: c7 05 54 a5 10 80 01 movl $0x1,0x8010a554
801009d6: 00 00 00
ioapicenable(IRQ_KBD, 0);
801009d9: e8 42 19 00 00 call 80102320 <ioapicenable>
}
801009de: 83 c4 10 add $0x10,%esp
801009e1: c9 leave
801009e2: c3 ret
801009e3: 66 90 xchg %ax,%ax
801009e5: 66 90 xchg %ax,%ax
801009e7: 66 90 xchg %ax,%ax
801009e9: 66 90 xchg %ax,%ax
801009eb: 66 90 xchg %ax,%ax
801009ed: 66 90 xchg %ax,%ax
801009ef: 90 nop
801009f0 <exec>:
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
{
801009f0: 55 push %ebp
801009f1: 89 e5 mov %esp,%ebp
801009f3: 57 push %edi
801009f4: 56 push %esi
801009f5: 53 push %ebx
801009f6: 81 ec 0c 01 00 00 sub $0x10c,%esp
uint argc, sz, sp, ustack[3+MAXARG+1];
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
pde_t *pgdir, *oldpgdir;
struct proc *curproc = myproc();
801009fc: e8 ff 2d 00 00 call 80103800 <myproc>
80100a01: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp)
begin_op();
80100a07: e8 c4 21 00 00 call 80102bd0 <begin_op>
if((ip = namei(path)) == 0){
80100a0c: 83 ec 0c sub $0xc,%esp
80100a0f: ff 75 08 pushl 0x8(%ebp)
80100a12: e8 29 15 00 00 call 80101f40 <namei>
80100a17: 83 c4 10 add $0x10,%esp
80100a1a: 85 c0 test %eax,%eax
80100a1c: 0f 84 9c 01 00 00 je 80100bbe <exec+0x1ce>
end_op();
cprintf("exec: fail\n");
return -1;
}
ilock(ip);
80100a22: 83 ec 0c sub $0xc,%esp
80100a25: 89 c3 mov %eax,%ebx
80100a27: 50 push %eax
80100a28: e8 83 0c 00 00 call 801016b0 <ilock>
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
80100a2d: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax
80100a33: 6a 34 push $0x34
80100a35: 6a 00 push $0x0
80100a37: 50 push %eax
80100a38: 53 push %ebx
80100a39: e8 92 0f 00 00 call 801019d0 <readi>
80100a3e: 83 c4 20 add $0x20,%esp
80100a41: 83 f8 34 cmp $0x34,%eax
80100a44: 74 22 je 80100a68 <exec+0x78>
bad:
if(pgdir)
freevm(pgdir);
if(ip){
iunlockput(ip);
80100a46: 83 ec 0c sub $0xc,%esp
80100a49: 53 push %ebx
80100a4a: e8 11 0f 00 00 call 80101960 <iunlockput>
end_op();
80100a4f: e8 ec 21 00 00 call 80102c40 <end_op>
80100a54: 83 c4 10 add $0x10,%esp
}
return -1;
80100a57: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100a5c: 8d 65 f4 lea -0xc(%ebp),%esp
80100a5f: 5b pop %ebx
80100a60: 5e pop %esi
80100a61: 5f pop %edi
80100a62: 5d pop %ebp
80100a63: c3 ret
80100a64: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
goto bad;
if(elf.magic != ELF_MAGIC)
80100a68: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp)
80100a6f: 45 4c 46
80100a72: 75 d2 jne 80100a46 <exec+0x56>
goto bad;
if((pgdir = setupkvm()) == 0)
80100a74: e8 27 62 00 00 call 80106ca0 <setupkvm>
80100a79: 85 c0 test %eax,%eax
80100a7b: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp)
80100a81: 74 c3 je 80100a46 <exec+0x56>
goto bad;
// Load program into memory.
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100a83: 66 83 bd 50 ff ff ff cmpw $0x0,-0xb0(%ebp)
80100a8a: 00
80100a8b: 8b b5 40 ff ff ff mov -0xc0(%ebp),%esi
80100a91: c7 85 ec fe ff ff 00 movl $0x0,-0x114(%ebp)
80100a98: 00 00 00
80100a9b: 0f 84 c5 00 00 00 je 80100b66 <exec+0x176>
80100aa1: 31 ff xor %edi,%edi
80100aa3: eb 18 jmp 80100abd <exec+0xcd>
80100aa5: 8d 76 00 lea 0x0(%esi),%esi
80100aa8: 0f b7 85 50 ff ff ff movzwl -0xb0(%ebp),%eax
80100aaf: 83 c7 01 add $0x1,%edi
80100ab2: 83 c6 20 add $0x20,%esi
80100ab5: 39 f8 cmp %edi,%eax
80100ab7: 0f 8e a9 00 00 00 jle 80100b66 <exec+0x176>
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100abd: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax
80100ac3: 6a 20 push $0x20
80100ac5: 56 push %esi
80100ac6: 50 push %eax
80100ac7: 53 push %ebx
80100ac8: e8 03 0f 00 00 call 801019d0 <readi>
80100acd: 83 c4 10 add $0x10,%esp
80100ad0: 83 f8 20 cmp $0x20,%eax
80100ad3: 75 7b jne 80100b50 <exec+0x160>
goto bad;
if(ph.type != ELF_PROG_LOAD)
80100ad5: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp)
80100adc: 75 ca jne 80100aa8 <exec+0xb8>
continue;
if(ph.memsz < ph.filesz)
80100ade: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax
80100ae4: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax
80100aea: 72 64 jb 80100b50 <exec+0x160>
goto bad;
if(ph.vaddr + ph.memsz < ph.vaddr)
80100aec: 03 85 0c ff ff ff add -0xf4(%ebp),%eax
80100af2: 72 5c jb 80100b50 <exec+0x160>
goto bad;
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100af4: 83 ec 04 sub $0x4,%esp
80100af7: 50 push %eax
80100af8: ff b5 ec fe ff ff pushl -0x114(%ebp)
80100afe: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100b04: e8 e7 5f 00 00 call 80106af0 <allocuvm>
80100b09: 83 c4 10 add $0x10,%esp
80100b0c: 85 c0 test %eax,%eax
80100b0e: 89 85 ec fe ff ff mov %eax,-0x114(%ebp)
80100b14: 74 3a je 80100b50 <exec+0x160>
goto bad;
if(ph.vaddr % PGSIZE != 0)
80100b16: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax
80100b1c: a9 ff 0f 00 00 test $0xfff,%eax
80100b21: 75 2d jne 80100b50 <exec+0x160>
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100b23: 83 ec 0c sub $0xc,%esp
80100b26: ff b5 14 ff ff ff pushl -0xec(%ebp)
80100b2c: ff b5 08 ff ff ff pushl -0xf8(%ebp)
80100b32: 53 push %ebx
80100b33: 50 push %eax
80100b34: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100b3a: e8 f1 5e 00 00 call 80106a30 <loaduvm>
80100b3f: 83 c4 20 add $0x20,%esp
80100b42: 85 c0 test %eax,%eax
80100b44: 0f 89 5e ff ff ff jns 80100aa8 <exec+0xb8>
80100b4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
freevm(pgdir);
80100b50: 83 ec 0c sub $0xc,%esp
80100b53: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100b59: e8 c2 60 00 00 call 80106c20 <freevm>
80100b5e: 83 c4 10 add $0x10,%esp
80100b61: e9 e0 fe ff ff jmp 80100a46 <exec+0x56>
if(ph.vaddr % PGSIZE != 0)
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
}
iunlockput(ip);
80100b66: 83 ec 0c sub $0xc,%esp
80100b69: 53 push %ebx
80100b6a: e8 f1 0d 00 00 call 80101960 <iunlockput>
end_op();
80100b6f: e8 cc 20 00 00 call 80102c40 <end_op>
ip = 0;
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
80100b74: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100b7a: 83 c4 0c add $0xc,%esp
end_op();
ip = 0;
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
80100b7d: 05 ff 0f 00 00 add $0xfff,%eax
80100b82: 25 00 f0 ff ff and $0xfffff000,%eax
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100b87: 8d 90 00 20 00 00 lea 0x2000(%eax),%edx
80100b8d: 52 push %edx
80100b8e: 50 push %eax
80100b8f: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100b95: e8 56 5f 00 00 call 80106af0 <allocuvm>
80100b9a: 83 c4 10 add $0x10,%esp
80100b9d: 85 c0 test %eax,%eax
80100b9f: 89 c6 mov %eax,%esi
80100ba1: 75 3a jne 80100bdd <exec+0x1ed>
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
freevm(pgdir);
80100ba3: 83 ec 0c sub $0xc,%esp
80100ba6: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100bac: e8 6f 60 00 00 call 80106c20 <freevm>
80100bb1: 83 c4 10 add $0x10,%esp
if(ip){
iunlockput(ip);
end_op();
}
return -1;
80100bb4: b8 ff ff ff ff mov $0xffffffff,%eax
80100bb9: e9 9e fe ff ff jmp 80100a5c <exec+0x6c>
struct proc *curproc = myproc();
begin_op();
if((ip = namei(path)) == 0){
end_op();
80100bbe: e8 7d 20 00 00 call 80102c40 <end_op>
cprintf("exec: fail\n");
80100bc3: 83 ec 0c sub $0xc,%esp
80100bc6: 68 e1 6f 10 80 push $0x80106fe1
80100bcb: e8 90 fa ff ff call 80100660 <cprintf>
return -1;
80100bd0: 83 c4 10 add $0x10,%esp
80100bd3: b8 ff ff ff ff mov $0xffffffff,%eax
80100bd8: e9 7f fe ff ff jmp 80100a5c <exec+0x6c>
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100bdd: 8d 80 00 e0 ff ff lea -0x2000(%eax),%eax
80100be3: 83 ec 08 sub $0x8,%esp
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100be6: 31 ff xor %edi,%edi
80100be8: 89 f3 mov %esi,%ebx
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100bea: 50 push %eax
80100beb: ff b5 f0 fe ff ff pushl -0x110(%ebp)
80100bf1: e8 4a 61 00 00 call 80106d40 <clearpteu>
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100bf6: 8b 45 0c mov 0xc(%ebp),%eax
80100bf9: 83 c4 10 add $0x10,%esp
80100bfc: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx
80100c02: 8b 00 mov (%eax),%eax
80100c04: 85 c0 test %eax,%eax
80100c06: 74 79 je 80100c81 <exec+0x291>
80100c08: 89 b5 ec fe ff ff mov %esi,-0x114(%ebp)
80100c0e: 8b b5 f0 fe ff ff mov -0x110(%ebp),%esi
80100c14: eb 13 jmp 80100c29 <exec+0x239>
80100c16: 8d 76 00 lea 0x0(%esi),%esi
80100c19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(argc >= MAXARG)
80100c20: 83 ff 20 cmp $0x20,%edi
80100c23: 0f 84 7a ff ff ff je 80100ba3 <exec+0x1b3>
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100c29: 83 ec 0c sub $0xc,%esp
80100c2c: 50 push %eax
80100c2d: e8 ae 3a 00 00 call 801046e0 <strlen>
80100c32: f7 d0 not %eax
80100c34: 01 c3 add %eax,%ebx
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100c36: 8b 45 0c mov 0xc(%ebp),%eax
80100c39: 5a pop %edx
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
if(argc >= MAXARG)
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100c3a: 83 e3 fc and $0xfffffffc,%ebx
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100c3d: ff 34 b8 pushl (%eax,%edi,4)
80100c40: e8 9b 3a 00 00 call 801046e0 <strlen>
80100c45: 83 c0 01 add $0x1,%eax
80100c48: 50 push %eax
80100c49: 8b 45 0c mov 0xc(%ebp),%eax
80100c4c: ff 34 b8 pushl (%eax,%edi,4)
80100c4f: 53 push %ebx
80100c50: 56 push %esi
80100c51: e8 5a 62 00 00 call 80106eb0 <copyout>
80100c56: 83 c4 20 add $0x20,%esp
80100c59: 85 c0 test %eax,%eax
80100c5b: 0f 88 42 ff ff ff js 80100ba3 <exec+0x1b3>
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100c61: 8b 45 0c mov 0xc(%ebp),%eax
if(argc >= MAXARG)
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
ustack[3+argc] = sp;
80100c64: 89 9c bd 64 ff ff ff mov %ebx,-0x9c(%ebp,%edi,4)
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100c6b: 83 c7 01 add $0x1,%edi
if(argc >= MAXARG)
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
ustack[3+argc] = sp;
80100c6e: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100c74: 8b 04 b8 mov (%eax,%edi,4),%eax
80100c77: 85 c0 test %eax,%eax
80100c79: 75 a5 jne 80100c20 <exec+0x230>
80100c7b: 8b b5 ec fe ff ff mov -0x114(%ebp),%esi
}
ustack[3+argc] = 0;
ustack[0] = 0xffffffff; // fake return PC
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
80100c81: 8d 04 bd 04 00 00 00 lea 0x4(,%edi,4),%eax
80100c88: 89 d9 mov %ebx,%ecx
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
ustack[3+argc] = sp;
}
ustack[3+argc] = 0;
80100c8a: c7 84 bd 64 ff ff ff movl $0x0,-0x9c(%ebp,%edi,4)
80100c91: 00 00 00 00
ustack[0] = 0xffffffff; // fake return PC
80100c95: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp)
80100c9c: ff ff ff
ustack[1] = argc;
80100c9f: 89 bd 5c ff ff ff mov %edi,-0xa4(%ebp)
ustack[2] = sp - (argc+1)*4; // argv pointer
80100ca5: 29 c1 sub %eax,%ecx
sp -= (3+argc+1) * 4;
80100ca7: 83 c0 0c add $0xc,%eax
80100caa: 29 c3 sub %eax,%ebx
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100cac: 50 push %eax
80100cad: 52 push %edx
80100cae: 53 push %ebx
80100caf: ff b5 f0 fe ff ff pushl -0x110(%ebp)
}
ustack[3+argc] = 0;
ustack[0] = 0xffffffff; // fake return PC
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
80100cb5: 89 8d 60 ff ff ff mov %ecx,-0xa0(%ebp)
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100cbb: e8 f0 61 00 00 call 80106eb0 <copyout>
80100cc0: 83 c4 10 add $0x10,%esp
80100cc3: 85 c0 test %eax,%eax
80100cc5: 0f 88 d8 fe ff ff js 80100ba3 <exec+0x1b3>
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100ccb: 8b 45 08 mov 0x8(%ebp),%eax
80100cce: 0f b6 10 movzbl (%eax),%edx
80100cd1: 84 d2 test %dl,%dl
80100cd3: 74 19 je 80100cee <exec+0x2fe>
80100cd5: 8b 4d 08 mov 0x8(%ebp),%ecx
80100cd8: 83 c0 01 add $0x1,%eax
if(*s == '/')
last = s+1;
80100cdb: 80 fa 2f cmp $0x2f,%dl
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100cde: 0f b6 10 movzbl (%eax),%edx
if(*s == '/')
last = s+1;
80100ce1: 0f 44 c8 cmove %eax,%ecx
80100ce4: 83 c0 01 add $0x1,%eax
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100ce7: 84 d2 test %dl,%dl
80100ce9: 75 f0 jne 80100cdb <exec+0x2eb>
80100ceb: 89 4d 08 mov %ecx,0x8(%ebp)
if(*s == '/')
last = s+1;
safestrcpy(curproc->name, last, sizeof(curproc->name));
80100cee: 8b bd f4 fe ff ff mov -0x10c(%ebp),%edi
80100cf4: 50 push %eax
80100cf5: 6a 10 push $0x10
80100cf7: ff 75 08 pushl 0x8(%ebp)
80100cfa: 89 f8 mov %edi,%eax
80100cfc: 83 c0 6c add $0x6c,%eax
80100cff: 50 push %eax
80100d00: e8 9b 39 00 00 call 801046a0 <safestrcpy>
// Commit to the user image.
oldpgdir = curproc->pgdir;
curproc->pgdir = pgdir;
80100d05: 8b 8d f0 fe ff ff mov -0x110(%ebp),%ecx
if(*s == '/')
last = s+1;
safestrcpy(curproc->name, last, sizeof(curproc->name));
// Commit to the user image.
oldpgdir = curproc->pgdir;
80100d0b: 89 f8 mov %edi,%eax
80100d0d: 8b 7f 04 mov 0x4(%edi),%edi
curproc->pgdir = pgdir;
curproc->sz = sz;
80100d10: 89 30 mov %esi,(%eax)
last = s+1;
safestrcpy(curproc->name, last, sizeof(curproc->name));
// Commit to the user image.
oldpgdir = curproc->pgdir;
curproc->pgdir = pgdir;
80100d12: 89 48 04 mov %ecx,0x4(%eax)
curproc->sz = sz;
curproc->tf->eip = elf.entry; // main
80100d15: 89 c1 mov %eax,%ecx
80100d17: 8b 95 3c ff ff ff mov -0xc4(%ebp),%edx
80100d1d: 8b 40 18 mov 0x18(%eax),%eax
80100d20: 89 50 38 mov %edx,0x38(%eax)
curproc->tf->esp = sp;
80100d23: 8b 41 18 mov 0x18(%ecx),%eax
80100d26: 89 58 44 mov %ebx,0x44(%eax)
switchuvm(curproc);
80100d29: 89 0c 24 mov %ecx,(%esp)
80100d2c: e8 6f 5b 00 00 call 801068a0 <switchuvm>
freevm(oldpgdir);
80100d31: 89 3c 24 mov %edi,(%esp)
80100d34: e8 e7 5e 00 00 call 80106c20 <freevm>
return 0;
80100d39: 83 c4 10 add $0x10,%esp
80100d3c: 31 c0 xor %eax,%eax
80100d3e: e9 19 fd ff ff jmp 80100a5c <exec+0x6c>
80100d43: 66 90 xchg %ax,%ax
80100d45: 66 90 xchg %ax,%ax
80100d47: 66 90 xchg %ax,%ax
80100d49: 66 90 xchg %ax,%ax
80100d4b: 66 90 xchg %ax,%ax
80100d4d: 66 90 xchg %ax,%ax
80100d4f: 90 nop
80100d50 <fileinit>:
struct file file[NFILE];
} ftable;
void
fileinit(void)
{
80100d50: 55 push %ebp
80100d51: 89 e5 mov %esp,%ebp
80100d53: 83 ec 10 sub $0x10,%esp
initlock(&ftable.lock, "ftable");
80100d56: 68 ed 6f 10 80 push $0x80106fed
80100d5b: 68 c0 ff 10 80 push $0x8010ffc0
80100d60: e8 db 34 00 00 call 80104240 <initlock>
}
80100d65: 83 c4 10 add $0x10,%esp
80100d68: c9 leave
80100d69: c3 ret
80100d6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100d70 <filealloc>:
// Allocate a file structure.
struct file*
filealloc(void)
{
80100d70: 55 push %ebp
80100d71: 89 e5 mov %esp,%ebp
80100d73: 53 push %ebx
struct file *f;
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100d74: bb f4 ff 10 80 mov $0x8010fff4,%ebx
}
// Allocate a file structure.
struct file*
filealloc(void)
{
80100d79: 83 ec 10 sub $0x10,%esp
struct file *f;
acquire(&ftable.lock);
80100d7c: 68 c0 ff 10 80 push $0x8010ffc0
80100d81: e8 1a 36 00 00 call 801043a0 <acquire>
80100d86: 83 c4 10 add $0x10,%esp
80100d89: eb 10 jmp 80100d9b <filealloc+0x2b>
80100d8b: 90 nop
80100d8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100d90: 83 c3 18 add $0x18,%ebx
80100d93: 81 fb 54 09 11 80 cmp $0x80110954,%ebx
80100d99: 74 25 je 80100dc0 <filealloc+0x50>
if(f->ref == 0){
80100d9b: 8b 43 04 mov 0x4(%ebx),%eax
80100d9e: 85 c0 test %eax,%eax
80100da0: 75 ee jne 80100d90 <filealloc+0x20>
f->ref = 1;
release(&ftable.lock);
80100da2: 83 ec 0c sub $0xc,%esp
struct file *f;
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
if(f->ref == 0){
f->ref = 1;
80100da5: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx)
release(&ftable.lock);
80100dac: 68 c0 ff 10 80 push $0x8010ffc0
80100db1: e8 9a 36 00 00 call 80104450 <release>
return f;
80100db6: 89 d8 mov %ebx,%eax
80100db8: 83 c4 10 add $0x10,%esp
}
}
release(&ftable.lock);
return 0;
}
80100dbb: 8b 5d fc mov -0x4(%ebp),%ebx
80100dbe: c9 leave
80100dbf: c3 ret
f->ref = 1;
release(&ftable.lock);
return f;
}
}
release(&ftable.lock);
80100dc0: 83 ec 0c sub $0xc,%esp
80100dc3: 68 c0 ff 10 80 push $0x8010ffc0
80100dc8: e8 83 36 00 00 call 80104450 <release>
return 0;
80100dcd: 83 c4 10 add $0x10,%esp
80100dd0: 31 c0 xor %eax,%eax
}
80100dd2: 8b 5d fc mov -0x4(%ebp),%ebx
80100dd5: c9 leave
80100dd6: c3 ret
80100dd7: 89 f6 mov %esi,%esi
80100dd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80100de0 <filedup>:
// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
80100de0: 55 push %ebp
80100de1: 89 e5 mov %esp,%ebp
80100de3: 53 push %ebx
80100de4: 83 ec 10 sub $0x10,%esp
80100de7: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&ftable.lock);
80100dea: 68 c0 ff 10 80 push $0x8010ffc0
80100def: e8 ac 35 00 00 call 801043a0 <acquire>
if(f->ref < 1)
80100df4: 8b 43 04 mov 0x4(%ebx),%eax
80100df7: 83 c4 10 add $0x10,%esp
80100dfa: 85 c0 test %eax,%eax
80100dfc: 7e 1a jle 80100e18 <filedup+0x38>
panic("filedup");
f->ref++;
80100dfe: 83 c0 01 add $0x1,%eax
release(&ftable.lock);
80100e01: 83 ec 0c sub $0xc,%esp
filedup(struct file *f)
{
acquire(&ftable.lock);
if(f->ref < 1)
panic("filedup");
f->ref++;
80100e04: 89 43 04 mov %eax,0x4(%ebx)
release(&ftable.lock);
80100e07: 68 c0 ff 10 80 push $0x8010ffc0
80100e0c: e8 3f 36 00 00 call 80104450 <release>
return f;
}
80100e11: 89 d8 mov %ebx,%eax
80100e13: 8b 5d fc mov -0x4(%ebp),%ebx
80100e16: c9 leave
80100e17: c3 ret
struct file*
filedup(struct file *f)
{
acquire(&ftable.lock);
if(f->ref < 1)
panic("filedup");
80100e18: 83 ec 0c sub $0xc,%esp
80100e1b: 68 f4 6f 10 80 push $0x80106ff4
80100e20: e8 4b f5 ff ff call 80100370 <panic>
80100e25: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100e29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80100e30 <fileclose>:
}
// Close file f. (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
80100e30: 55 push %ebp
80100e31: 89 e5 mov %esp,%ebp
80100e33: 57 push %edi
80100e34: 56 push %esi
80100e35: 53 push %ebx
80100e36: 83 ec 28 sub $0x28,%esp
80100e39: 8b 7d 08 mov 0x8(%ebp),%edi
struct file ff;
acquire(&ftable.lock);
80100e3c: 68 c0 ff 10 80 push $0x8010ffc0
80100e41: e8 5a 35 00 00 call 801043a0 <acquire>
if(f->ref < 1)
80100e46: 8b 47 04 mov 0x4(%edi),%eax
80100e49: 83 c4 10 add $0x10,%esp
80100e4c: 85 c0 test %eax,%eax
80100e4e: 0f 8e 9b 00 00 00 jle 80100eef <fileclose+0xbf>
panic("fileclose");
if(--f->ref > 0){
80100e54: 83 e8 01 sub $0x1,%eax
80100e57: 85 c0 test %eax,%eax
80100e59: 89 47 04 mov %eax,0x4(%edi)
80100e5c: 74 1a je 80100e78 <fileclose+0x48>
release(&ftable.lock);
80100e5e: c7 45 08 c0 ff 10 80 movl $0x8010ffc0,0x8(%ebp)
else if(ff.type == FD_INODE){
begin_op();
iput(ff.ip);
end_op();
}
}
80100e65: 8d 65 f4 lea -0xc(%ebp),%esp
80100e68: 5b pop %ebx
80100e69: 5e pop %esi
80100e6a: 5f pop %edi
80100e6b: 5d pop %ebp
acquire(&ftable.lock);
if(f->ref < 1)
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
80100e6c: e9 df 35 00 00 jmp 80104450 <release>
80100e71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return;
}
ff = *f;
80100e78: 0f b6 47 09 movzbl 0x9(%edi),%eax
80100e7c: 8b 1f mov (%edi),%ebx
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
80100e7e: 83 ec 0c sub $0xc,%esp
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
return;
}
ff = *f;
80100e81: 8b 77 0c mov 0xc(%edi),%esi
f->ref = 0;
f->type = FD_NONE;
80100e84: c7 07 00 00 00 00 movl $0x0,(%edi)
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
return;
}
ff = *f;
80100e8a: 88 45 e7 mov %al,-0x19(%ebp)
80100e8d: 8b 47 10 mov 0x10(%edi),%eax
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
80100e90: 68 c0 ff 10 80 push $0x8010ffc0
panic("fileclose");
if(--f->ref > 0){
release(&ftable.lock);
return;
}
ff = *f;
80100e95: 89 45 e0 mov %eax,-0x20(%ebp)
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
80100e98: e8 b3 35 00 00 call 80104450 <release>
if(ff.type == FD_PIPE)
80100e9d: 83 c4 10 add $0x10,%esp
80100ea0: 83 fb 01 cmp $0x1,%ebx
80100ea3: 74 13 je 80100eb8 <fileclose+0x88>
pipeclose(ff.pipe, ff.writable);
else if(ff.type == FD_INODE){
80100ea5: 83 fb 02 cmp $0x2,%ebx
80100ea8: 74 26 je 80100ed0 <fileclose+0xa0>
begin_op();
iput(ff.ip);
end_op();
}
}
80100eaa: 8d 65 f4 lea -0xc(%ebp),%esp
80100ead: 5b pop %ebx
80100eae: 5e pop %esi
80100eaf: 5f pop %edi
80100eb0: 5d pop %ebp
80100eb1: c3 ret
80100eb2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
f->ref = 0;
f->type = FD_NONE;
release(&ftable.lock);
if(ff.type == FD_PIPE)
pipeclose(ff.pipe, ff.writable);
80100eb8: 0f be 5d e7 movsbl -0x19(%ebp),%ebx
80100ebc: 83 ec 08 sub $0x8,%esp
80100ebf: 53 push %ebx
80100ec0: 56 push %esi
80100ec1: e8 aa 24 00 00 call 80103370 <pipeclose>
80100ec6: 83 c4 10 add $0x10,%esp
80100ec9: eb df jmp 80100eaa <fileclose+0x7a>
80100ecb: 90 nop
80100ecc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
else if(ff.type == FD_INODE){
begin_op();
80100ed0: e8 fb 1c 00 00 call 80102bd0 <begin_op>
iput(ff.ip);
80100ed5: 83 ec 0c sub $0xc,%esp
80100ed8: ff 75 e0 pushl -0x20(%ebp)
80100edb: e8 20 09 00 00 call 80101800 <iput>
end_op();
80100ee0: 83 c4 10 add $0x10,%esp
}
}
80100ee3: 8d 65 f4 lea -0xc(%ebp),%esp
80100ee6: 5b pop %ebx
80100ee7: 5e pop %esi
80100ee8: 5f pop %edi
80100ee9: 5d pop %ebp
if(ff.type == FD_PIPE)
pipeclose(ff.pipe, ff.writable);
else if(ff.type == FD_INODE){
begin_op();
iput(ff.ip);
end_op();
80100eea: e9 51 1d 00 00 jmp 80102c40 <end_op>
{
struct file ff;
acquire(&ftable.lock);
if(f->ref < 1)
panic("fileclose");
80100eef: 83 ec 0c sub $0xc,%esp
80100ef2: 68 fc 6f 10 80 push $0x80106ffc
80100ef7: e8 74 f4 ff ff call 80100370 <panic>
80100efc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100f00 <filestat>:
}
// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
80100f00: 55 push %ebp
80100f01: 89 e5 mov %esp,%ebp
80100f03: 53 push %ebx
80100f04: 83 ec 04 sub $0x4,%esp
80100f07: 8b 5d 08 mov 0x8(%ebp),%ebx
if(f->type == FD_INODE){
80100f0a: 83 3b 02 cmpl $0x2,(%ebx)
80100f0d: 75 31 jne 80100f40 <filestat+0x40>
ilock(f->ip);
80100f0f: 83 ec 0c sub $0xc,%esp
80100f12: ff 73 10 pushl 0x10(%ebx)
80100f15: e8 96 07 00 00 call 801016b0 <ilock>
stati(f->ip, st);
80100f1a: 58 pop %eax
80100f1b: 5a pop %edx
80100f1c: ff 75 0c pushl 0xc(%ebp)
80100f1f: ff 73 10 pushl 0x10(%ebx)
80100f22: e8 59 0a 00 00 call 80101980 <stati>
iunlock(f->ip);
80100f27: 59 pop %ecx
80100f28: ff 73 10 pushl 0x10(%ebx)
80100f2b: e8 80 08 00 00 call 801017b0 <iunlock>
return 0;
80100f30: 83 c4 10 add $0x10,%esp
80100f33: 31 c0 xor %eax,%eax
}
return -1;
}
80100f35: 8b 5d fc mov -0x4(%ebp),%ebx
80100f38: c9 leave
80100f39: c3 ret
80100f3a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
ilock(f->ip);
stati(f->ip, st);
iunlock(f->ip);
return 0;
}
return -1;
80100f40: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100f45: 8b 5d fc mov -0x4(%ebp),%ebx
80100f48: c9 leave
80100f49: c3 ret
80100f4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80100f50 <fileread>:
// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
80100f50: 55 push %ebp
80100f51: 89 e5 mov %esp,%ebp
80100f53: 57 push %edi
80100f54: 56 push %esi
80100f55: 53 push %ebx
80100f56: 83 ec 0c sub $0xc,%esp
80100f59: 8b 5d 08 mov 0x8(%ebp),%ebx
80100f5c: 8b 75 0c mov 0xc(%ebp),%esi
80100f5f: 8b 7d 10 mov 0x10(%ebp),%edi
int r;
if(f->readable == 0)
80100f62: 80 7b 08 00 cmpb $0x0,0x8(%ebx)
80100f66: 74 60 je 80100fc8 <fileread+0x78>
return -1;
if(f->type == FD_PIPE)
80100f68: 8b 03 mov (%ebx),%eax
80100f6a: 83 f8 01 cmp $0x1,%eax
80100f6d: 74 41 je 80100fb0 <fileread+0x60>
return piperead(f->pipe, addr, n);
if(f->type == FD_INODE){
80100f6f: 83 f8 02 cmp $0x2,%eax
80100f72: 75 5b jne 80100fcf <fileread+0x7f>
ilock(f->ip);
80100f74: 83 ec 0c sub $0xc,%esp
80100f77: ff 73 10 pushl 0x10(%ebx)
80100f7a: e8 31 07 00 00 call 801016b0 <ilock>
if((r = readi(f->ip, addr, f->off, n)) > 0)
80100f7f: 57 push %edi
80100f80: ff 73 14 pushl 0x14(%ebx)
80100f83: 56 push %esi
80100f84: ff 73 10 pushl 0x10(%ebx)
80100f87: e8 44 0a 00 00 call 801019d0 <readi>
80100f8c: 83 c4 20 add $0x20,%esp
80100f8f: 85 c0 test %eax,%eax
80100f91: 89 c6 mov %eax,%esi
80100f93: 7e 03 jle 80100f98 <fileread+0x48>
f->off += r;
80100f95: 01 43 14 add %eax,0x14(%ebx)
iunlock(f->ip);
80100f98: 83 ec 0c sub $0xc,%esp
80100f9b: ff 73 10 pushl 0x10(%ebx)
80100f9e: e8 0d 08 00 00 call 801017b0 <iunlock>
return r;
80100fa3: 83 c4 10 add $0x10,%esp
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
if(f->type == FD_INODE){
ilock(f->ip);
if((r = readi(f->ip, addr, f->off, n)) > 0)
80100fa6: 89 f0 mov %esi,%eax
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
}
80100fa8: 8d 65 f4 lea -0xc(%ebp),%esp
80100fab: 5b pop %ebx
80100fac: 5e pop %esi
80100fad: 5f pop %edi
80100fae: 5d pop %ebp
80100faf: c3 ret
int r;
if(f->readable == 0)
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
80100fb0: 8b 43 0c mov 0xc(%ebx),%eax
80100fb3: 89 45 08 mov %eax,0x8(%ebp)
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
}
80100fb6: 8d 65 f4 lea -0xc(%ebp),%esp
80100fb9: 5b pop %ebx
80100fba: 5e pop %esi
80100fbb: 5f pop %edi
80100fbc: 5d pop %ebp
int r;
if(f->readable == 0)
return -1;
if(f->type == FD_PIPE)
return piperead(f->pipe, addr, n);
80100fbd: e9 4e 25 00 00 jmp 80103510 <piperead>
80100fc2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
fileread(struct file *f, char *addr, int n)
{
int r;
if(f->readable == 0)
return -1;
80100fc8: b8 ff ff ff ff mov $0xffffffff,%eax
80100fcd: eb d9 jmp 80100fa8 <fileread+0x58>
if((r = readi(f->ip, addr, f->off, n)) > 0)
f->off += r;
iunlock(f->ip);
return r;
}
panic("fileread");
80100fcf: 83 ec 0c sub $0xc,%esp
80100fd2: 68 06 70 10 80 push $0x80107006
80100fd7: e8 94 f3 ff ff call 80100370 <panic>
80100fdc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80100fe0 <filewrite>:
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
80100fe0: 55 push %ebp
80100fe1: 89 e5 mov %esp,%ebp
80100fe3: 57 push %edi
80100fe4: 56 push %esi
80100fe5: 53 push %ebx
80100fe6: 83 ec 1c sub $0x1c,%esp
80100fe9: 8b 75 08 mov 0x8(%ebp),%esi
80100fec: 8b 45 0c mov 0xc(%ebp),%eax
int r;
if(f->writable == 0)
80100fef: 80 7e 09 00 cmpb $0x0,0x9(%esi)
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
80100ff3: 89 45 dc mov %eax,-0x24(%ebp)
80100ff6: 8b 45 10 mov 0x10(%ebp),%eax
80100ff9: 89 45 e4 mov %eax,-0x1c(%ebp)
int r;
if(f->writable == 0)
80100ffc: 0f 84 aa 00 00 00 je 801010ac <filewrite+0xcc>
return -1;
if(f->type == FD_PIPE)
80101002: 8b 06 mov (%esi),%eax
80101004: 83 f8 01 cmp $0x1,%eax
80101007: 0f 84 c2 00 00 00 je 801010cf <filewrite+0xef>
return pipewrite(f->pipe, addr, n);
if(f->type == FD_INODE){
8010100d: 83 f8 02 cmp $0x2,%eax
80101010: 0f 85 d8 00 00 00 jne 801010ee <filewrite+0x10e>
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((MAXOPBLOCKS-1-1-2) / 2) * 512;
int i = 0;
while(i < n){
80101016: 8b 45 e4 mov -0x1c(%ebp),%eax
80101019: 31 ff xor %edi,%edi
8010101b: 85 c0 test %eax,%eax
8010101d: 7f 34 jg 80101053 <filewrite+0x73>
8010101f: e9 9c 00 00 00 jmp 801010c0 <filewrite+0xe0>
80101024: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n1 = max;
begin_op();
ilock(f->ip);
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
f->off += r;
80101028: 01 46 14 add %eax,0x14(%esi)
iunlock(f->ip);
8010102b: 83 ec 0c sub $0xc,%esp
8010102e: ff 76 10 pushl 0x10(%esi)
n1 = max;
begin_op();
ilock(f->ip);
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
f->off += r;
80101031: 89 45 e0 mov %eax,-0x20(%ebp)
iunlock(f->ip);
80101034: e8 77 07 00 00 call 801017b0 <iunlock>
end_op();
80101039: e8 02 1c 00 00 call 80102c40 <end_op>
8010103e: 8b 45 e0 mov -0x20(%ebp),%eax
80101041: 83 c4 10 add $0x10,%esp
if(r < 0)
break;
if(r != n1)
80101044: 39 d8 cmp %ebx,%eax
80101046: 0f 85 95 00 00 00 jne 801010e1 <filewrite+0x101>
panic("short filewrite");
i += r;
8010104c: 01 c7 add %eax,%edi
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((MAXOPBLOCKS-1-1-2) / 2) * 512;
int i = 0;
while(i < n){
8010104e: 39 7d e4 cmp %edi,-0x1c(%ebp)
80101051: 7e 6d jle 801010c0 <filewrite+0xe0>
int n1 = n - i;
80101053: 8b 5d e4 mov -0x1c(%ebp),%ebx
80101056: b8 00 06 00 00 mov $0x600,%eax
8010105b: 29 fb sub %edi,%ebx
8010105d: 81 fb 00 06 00 00 cmp $0x600,%ebx
80101063: 0f 4f d8 cmovg %eax,%ebx
if(n1 > max)
n1 = max;
begin_op();
80101066: e8 65 1b 00 00 call 80102bd0 <begin_op>
ilock(f->ip);
8010106b: 83 ec 0c sub $0xc,%esp
8010106e: ff 76 10 pushl 0x10(%esi)
80101071: e8 3a 06 00 00 call 801016b0 <ilock>
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
80101076: 8b 45 dc mov -0x24(%ebp),%eax
80101079: 53 push %ebx
8010107a: ff 76 14 pushl 0x14(%esi)
8010107d: 01 f8 add %edi,%eax
8010107f: 50 push %eax
80101080: ff 76 10 pushl 0x10(%esi)
80101083: e8 48 0a 00 00 call 80101ad0 <writei>
80101088: 83 c4 20 add $0x20,%esp
8010108b: 85 c0 test %eax,%eax
8010108d: 7f 99 jg 80101028 <filewrite+0x48>
f->off += r;
iunlock(f->ip);
8010108f: 83 ec 0c sub $0xc,%esp
80101092: ff 76 10 pushl 0x10(%esi)
80101095: 89 45 e0 mov %eax,-0x20(%ebp)
80101098: e8 13 07 00 00 call 801017b0 <iunlock>
end_op();
8010109d: e8 9e 1b 00 00 call 80102c40 <end_op>
if(r < 0)
801010a2: 8b 45 e0 mov -0x20(%ebp),%eax
801010a5: 83 c4 10 add $0x10,%esp
801010a8: 85 c0 test %eax,%eax
801010aa: 74 98 je 80101044 <filewrite+0x64>
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
}
801010ac: 8d 65 f4 lea -0xc(%ebp),%esp
break;
if(r != n1)
panic("short filewrite");
i += r;
}
return i == n ? n : -1;
801010af: b8 ff ff ff ff mov $0xffffffff,%eax
}
panic("filewrite");
}
801010b4: 5b pop %ebx
801010b5: 5e pop %esi
801010b6: 5f pop %edi
801010b7: 5d pop %ebp
801010b8: c3 ret
801010b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(r != n1)
panic("short filewrite");
i += r;
}
return i == n ? n : -1;
801010c0: 3b 7d e4 cmp -0x1c(%ebp),%edi
801010c3: 75 e7 jne 801010ac <filewrite+0xcc>
}
panic("filewrite");
}
801010c5: 8d 65 f4 lea -0xc(%ebp),%esp
801010c8: 89 f8 mov %edi,%eax
801010ca: 5b pop %ebx
801010cb: 5e pop %esi
801010cc: 5f pop %edi
801010cd: 5d pop %ebp
801010ce: c3 ret
int r;
if(f->writable == 0)
return -1;
if(f->type == FD_PIPE)
return pipewrite(f->pipe, addr, n);
801010cf: 8b 46 0c mov 0xc(%esi),%eax
801010d2: 89 45 08 mov %eax,0x8(%ebp)
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
}
801010d5: 8d 65 f4 lea -0xc(%ebp),%esp
801010d8: 5b pop %ebx
801010d9: 5e pop %esi
801010da: 5f pop %edi
801010db: 5d pop %ebp
int r;
if(f->writable == 0)
return -1;
if(f->type == FD_PIPE)
return pipewrite(f->pipe, addr, n);
801010dc: e9 2f 23 00 00 jmp 80103410 <pipewrite>
end_op();
if(r < 0)
break;
if(r != n1)
panic("short filewrite");
801010e1: 83 ec 0c sub $0xc,%esp
801010e4: 68 0f 70 10 80 push $0x8010700f
801010e9: e8 82 f2 ff ff call 80100370 <panic>
i += r;
}
return i == n ? n : -1;
}
panic("filewrite");
801010ee: 83 ec 0c sub $0xc,%esp
801010f1: 68 15 70 10 80 push $0x80107015
801010f6: e8 75 f2 ff ff call 80100370 <panic>
801010fb: 66 90 xchg %ax,%ax
801010fd: 66 90 xchg %ax,%ax
801010ff: 90 nop
80101100 <balloc>:
// Blocks.
// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
80101100: 55 push %ebp
80101101: 89 e5 mov %esp,%ebp
80101103: 57 push %edi
80101104: 56 push %esi
80101105: 53 push %ebx
80101106: 83 ec 1c sub $0x1c,%esp
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
80101109: 8b 0d c0 09 11 80 mov 0x801109c0,%ecx
// Blocks.
// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
8010110f: 89 45 d8 mov %eax,-0x28(%ebp)
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
80101112: 85 c9 test %ecx,%ecx
80101114: 0f 84 85 00 00 00 je 8010119f <balloc+0x9f>
8010111a: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
bp = bread(dev, BBLOCK(b, sb));
80101121: 8b 75 dc mov -0x24(%ebp),%esi
80101124: 83 ec 08 sub $0x8,%esp
80101127: 89 f0 mov %esi,%eax
80101129: c1 f8 0c sar $0xc,%eax
8010112c: 03 05 d8 09 11 80 add 0x801109d8,%eax
80101132: 50 push %eax
80101133: ff 75 d8 pushl -0x28(%ebp)
80101136: e8 95 ef ff ff call 801000d0 <bread>
8010113b: 89 45 e4 mov %eax,-0x1c(%ebp)
8010113e: a1 c0 09 11 80 mov 0x801109c0,%eax
80101143: 83 c4 10 add $0x10,%esp
80101146: 89 45 e0 mov %eax,-0x20(%ebp)
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
80101149: 31 c0 xor %eax,%eax
8010114b: eb 2d jmp 8010117a <balloc+0x7a>
8010114d: 8d 76 00 lea 0x0(%esi),%esi
m = 1 << (bi % 8);
80101150: 89 c1 mov %eax,%ecx
80101152: ba 01 00 00 00 mov $0x1,%edx
if((bp->data[bi/8] & m) == 0){ // Is block free?
80101157: 8b 5d e4 mov -0x1c(%ebp),%ebx
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
8010115a: 83 e1 07 and $0x7,%ecx
8010115d: d3 e2 shl %cl,%edx
if((bp->data[bi/8] & m) == 0){ // Is block free?
8010115f: 89 c1 mov %eax,%ecx
80101161: c1 f9 03 sar $0x3,%ecx
80101164: 0f b6 7c 0b 5c movzbl 0x5c(%ebx,%ecx,1),%edi
80101169: 85 d7 test %edx,%edi
8010116b: 74 43 je 801011b0 <balloc+0xb0>
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
8010116d: 83 c0 01 add $0x1,%eax
80101170: 83 c6 01 add $0x1,%esi
80101173: 3d 00 10 00 00 cmp $0x1000,%eax
80101178: 74 05 je 8010117f <balloc+0x7f>
8010117a: 3b 75 e0 cmp -0x20(%ebp),%esi
8010117d: 72 d1 jb 80101150 <balloc+0x50>
brelse(bp);
bzero(dev, b + bi);
return b + bi;
}
}
brelse(bp);
8010117f: 83 ec 0c sub $0xc,%esp
80101182: ff 75 e4 pushl -0x1c(%ebp)
80101185: e8 56 f0 ff ff call 801001e0 <brelse>
{
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
8010118a: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp)
80101191: 83 c4 10 add $0x10,%esp
80101194: 8b 45 dc mov -0x24(%ebp),%eax
80101197: 39 05 c0 09 11 80 cmp %eax,0x801109c0
8010119d: 77 82 ja 80101121 <balloc+0x21>
return b + bi;
}
}
brelse(bp);
}
panic("balloc: out of blocks");
8010119f: 83 ec 0c sub $0xc,%esp
801011a2: 68 1f 70 10 80 push $0x8010701f
801011a7: e8 c4 f1 ff ff call 80100370 <panic>
801011ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0){ // Is block free?
bp->data[bi/8] |= m; // Mark block in use.
801011b0: 09 fa or %edi,%edx
801011b2: 8b 7d e4 mov -0x1c(%ebp),%edi
log_write(bp);
801011b5: 83 ec 0c sub $0xc,%esp
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0){ // Is block free?
bp->data[bi/8] |= m; // Mark block in use.
801011b8: 88 54 0f 5c mov %dl,0x5c(%edi,%ecx,1)
log_write(bp);
801011bc: 57 push %edi
801011bd: e8 ee 1b 00 00 call 80102db0 <log_write>
brelse(bp);
801011c2: 89 3c 24 mov %edi,(%esp)
801011c5: e8 16 f0 ff ff call 801001e0 <brelse>
static void
bzero(int dev, int bno)
{
struct buf *bp;
bp = bread(dev, bno);
801011ca: 58 pop %eax
801011cb: 5a pop %edx
801011cc: 56 push %esi
801011cd: ff 75 d8 pushl -0x28(%ebp)
801011d0: e8 fb ee ff ff call 801000d0 <bread>
801011d5: 89 c3 mov %eax,%ebx
memset(bp->data, 0, BSIZE);
801011d7: 8d 40 5c lea 0x5c(%eax),%eax
801011da: 83 c4 0c add $0xc,%esp
801011dd: 68 00 02 00 00 push $0x200
801011e2: 6a 00 push $0x0
801011e4: 50 push %eax
801011e5: e8 b6 32 00 00 call 801044a0 <memset>
log_write(bp);
801011ea: 89 1c 24 mov %ebx,(%esp)
801011ed: e8 be 1b 00 00 call 80102db0 <log_write>
brelse(bp);
801011f2: 89 1c 24 mov %ebx,(%esp)
801011f5: e8 e6 ef ff ff call 801001e0 <brelse>
}
}
brelse(bp);
}
panic("balloc: out of blocks");
}
801011fa: 8d 65 f4 lea -0xc(%ebp),%esp
801011fd: 89 f0 mov %esi,%eax
801011ff: 5b pop %ebx
80101200: 5e pop %esi
80101201: 5f pop %edi
80101202: 5d pop %ebp
80101203: c3 ret
80101204: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010120a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80101210 <iget>:
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
80101210: 55 push %ebp
80101211: 89 e5 mov %esp,%ebp
80101213: 57 push %edi
80101214: 56 push %esi
80101215: 53 push %ebx
80101216: 89 c7 mov %eax,%edi
struct inode *ip, *empty;
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
80101218: 31 f6 xor %esi,%esi
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010121a: bb 14 0a 11 80 mov $0x80110a14,%ebx
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
8010121f: 83 ec 28 sub $0x28,%esp
80101222: 89 55 e4 mov %edx,-0x1c(%ebp)
struct inode *ip, *empty;
acquire(&icache.lock);
80101225: 68 e0 09 11 80 push $0x801109e0
8010122a: e8 71 31 00 00 call 801043a0 <acquire>
8010122f: 83 c4 10 add $0x10,%esp
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
80101232: 8b 55 e4 mov -0x1c(%ebp),%edx
80101235: eb 1b jmp 80101252 <iget+0x42>
80101237: 89 f6 mov %esi,%esi
80101239: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
release(&icache.lock);
return ip;
}
if(empty == 0 && ip->ref == 0) // Remember empty slot.
80101240: 85 f6 test %esi,%esi
80101242: 74 44 je 80101288 <iget+0x78>
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
80101244: 81 c3 90 00 00 00 add $0x90,%ebx
8010124a: 81 fb 34 26 11 80 cmp $0x80112634,%ebx
80101250: 74 4e je 801012a0 <iget+0x90>
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
80101252: 8b 4b 08 mov 0x8(%ebx),%ecx
80101255: 85 c9 test %ecx,%ecx
80101257: 7e e7 jle 80101240 <iget+0x30>
80101259: 39 3b cmp %edi,(%ebx)
8010125b: 75 e3 jne 80101240 <iget+0x30>
8010125d: 39 53 04 cmp %edx,0x4(%ebx)
80101260: 75 de jne 80101240 <iget+0x30>
ip->ref++;
release(&icache.lock);
80101262: 83 ec 0c sub $0xc,%esp
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
80101265: 83 c1 01 add $0x1,%ecx
release(&icache.lock);
return ip;
80101268: 89 de mov %ebx,%esi
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
release(&icache.lock);
8010126a: 68 e0 09 11 80 push $0x801109e0
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
8010126f: 89 4b 08 mov %ecx,0x8(%ebx)
release(&icache.lock);
80101272: e8 d9 31 00 00 call 80104450 <release>
return ip;
80101277: 83 c4 10 add $0x10,%esp
ip->ref = 1;
ip->valid = 0;
release(&icache.lock);
return ip;
}
8010127a: 8d 65 f4 lea -0xc(%ebp),%esp
8010127d: 89 f0 mov %esi,%eax
8010127f: 5b pop %ebx
80101280: 5e pop %esi
80101281: 5f pop %edi
80101282: 5d pop %ebp
80101283: c3 ret
80101284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
ip->ref++;
release(&icache.lock);
return ip;
}
if(empty == 0 && ip->ref == 0) // Remember empty slot.
80101288: 85 c9 test %ecx,%ecx
8010128a: 0f 44 f3 cmove %ebx,%esi
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010128d: 81 c3 90 00 00 00 add $0x90,%ebx
80101293: 81 fb 34 26 11 80 cmp $0x80112634,%ebx
80101299: 75 b7 jne 80101252 <iget+0x42>
8010129b: 90 nop
8010129c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(empty == 0 && ip->ref == 0) // Remember empty slot.
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
801012a0: 85 f6 test %esi,%esi
801012a2: 74 2d je 801012d1 <iget+0xc1>
ip = empty;
ip->dev = dev;
ip->inum = inum;
ip->ref = 1;
ip->valid = 0;
release(&icache.lock);
801012a4: 83 ec 0c sub $0xc,%esp
// Recycle an inode cache entry.
if(empty == 0)
panic("iget: no inodes");
ip = empty;
ip->dev = dev;
801012a7: 89 3e mov %edi,(%esi)
ip->inum = inum;
801012a9: 89 56 04 mov %edx,0x4(%esi)
ip->ref = 1;
801012ac: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi)
ip->valid = 0;
801012b3: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi)
release(&icache.lock);
801012ba: 68 e0 09 11 80 push $0x801109e0
801012bf: e8 8c 31 00 00 call 80104450 <release>
return ip;
801012c4: 83 c4 10 add $0x10,%esp
}
801012c7: 8d 65 f4 lea -0xc(%ebp),%esp
801012ca: 89 f0 mov %esi,%eax
801012cc: 5b pop %ebx
801012cd: 5e pop %esi
801012ce: 5f pop %edi
801012cf: 5d pop %ebp
801012d0: c3 ret
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
panic("iget: no inodes");
801012d1: 83 ec 0c sub $0xc,%esp
801012d4: 68 35 70 10 80 push $0x80107035
801012d9: e8 92 f0 ff ff call 80100370 <panic>
801012de: 66 90 xchg %ax,%ax
801012e0 <bmap>:
// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
801012e0: 55 push %ebp
801012e1: 89 e5 mov %esp,%ebp
801012e3: 57 push %edi
801012e4: 56 push %esi
801012e5: 53 push %ebx
801012e6: 89 c6 mov %eax,%esi
801012e8: 83 ec 1c sub $0x1c,%esp
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
801012eb: 83 fa 09 cmp $0x9,%edx
801012ee: 77 18 ja 80101308 <bmap+0x28>
801012f0: 8d 1c 90 lea (%eax,%edx,4),%ebx
if((addr = ip->addrs[bn]) == 0)
801012f3: 8b 43 5c mov 0x5c(%ebx),%eax
801012f6: 85 c0 test %eax,%eax
801012f8: 74 76 je 80101370 <bmap+0x90>
brelse(bp);
return addr;
}
panic("bmap: out of range");
}
801012fa: 8d 65 f4 lea -0xc(%ebp),%esp
801012fd: 5b pop %ebx
801012fe: 5e pop %esi
801012ff: 5f pop %edi
80101300: 5d pop %ebp
80101301: c3 ret
80101302: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(bn < NDIRECT){
if((addr = ip->addrs[bn]) == 0)
ip->addrs[bn] = addr = balloc(ip->dev);
return addr;
}
bn -= NDIRECT;
80101308: 8d 5a f6 lea -0xa(%edx),%ebx
if(bn < NINDIRECT){
8010130b: 83 fb 7f cmp $0x7f,%ebx
8010130e: 0f 87 83 00 00 00 ja 80101397 <bmap+0xb7>
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
80101314: 8b 80 84 00 00 00 mov 0x84(%eax),%eax
8010131a: 85 c0 test %eax,%eax
8010131c: 74 6a je 80101388 <bmap+0xa8>
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
bp = bread(ip->dev, addr);
8010131e: 83 ec 08 sub $0x8,%esp
80101321: 50 push %eax
80101322: ff 36 pushl (%esi)
80101324: e8 a7 ed ff ff call 801000d0 <bread>
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
80101329: 8d 54 98 5c lea 0x5c(%eax,%ebx,4),%edx
8010132d: 83 c4 10 add $0x10,%esp
if(bn < NINDIRECT){
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
bp = bread(ip->dev, addr);
80101330: 89 c7 mov %eax,%edi
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
80101332: 8b 1a mov (%edx),%ebx
80101334: 85 db test %ebx,%ebx
80101336: 75 1d jne 80101355 <bmap+0x75>
a[bn] = addr = balloc(ip->dev);
80101338: 8b 06 mov (%esi),%eax
8010133a: 89 55 e4 mov %edx,-0x1c(%ebp)
8010133d: e8 be fd ff ff call 80101100 <balloc>
80101342: 8b 55 e4 mov -0x1c(%ebp),%edx
log_write(bp);
80101345: 83 ec 0c sub $0xc,%esp
if((addr = ip->addrs[NDIRECT]) == 0)
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
bp = bread(ip->dev, addr);
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
a[bn] = addr = balloc(ip->dev);
80101348: 89 c3 mov %eax,%ebx
8010134a: 89 02 mov %eax,(%edx)
log_write(bp);
8010134c: 57 push %edi
8010134d: e8 5e 1a 00 00 call 80102db0 <log_write>
80101352: 83 c4 10 add $0x10,%esp
}
brelse(bp);
80101355: 83 ec 0c sub $0xc,%esp
80101358: 57 push %edi
80101359: e8 82 ee ff ff call 801001e0 <brelse>
8010135e: 83 c4 10 add $0x10,%esp
return addr;
}
panic("bmap: out of range");
}
80101361: 8d 65 f4 lea -0xc(%ebp),%esp
a = (uint*)bp->data;
if((addr = a[bn]) == 0){
a[bn] = addr = balloc(ip->dev);
log_write(bp);
}
brelse(bp);
80101364: 89 d8 mov %ebx,%eax
return addr;
}
panic("bmap: out of range");
}
80101366: 5b pop %ebx
80101367: 5e pop %esi
80101368: 5f pop %edi
80101369: 5d pop %ebp
8010136a: c3 ret
8010136b: 90 nop
8010136c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
if((addr = ip->addrs[bn]) == 0)
ip->addrs[bn] = addr = balloc(ip->dev);
80101370: 8b 06 mov (%esi),%eax
80101372: e8 89 fd ff ff call 80101100 <balloc>
80101377: 89 43 5c mov %eax,0x5c(%ebx)
brelse(bp);
return addr;
}
panic("bmap: out of range");
}
8010137a: 8d 65 f4 lea -0xc(%ebp),%esp
8010137d: 5b pop %ebx
8010137e: 5e pop %esi
8010137f: 5f pop %edi
80101380: 5d pop %ebp
80101381: c3 ret
80101382: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
bn -= NDIRECT;
if(bn < NINDIRECT){
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101388: 8b 06 mov (%esi),%eax
8010138a: e8 71 fd ff ff call 80101100 <balloc>
8010138f: 89 86 84 00 00 00 mov %eax,0x84(%esi)
80101395: eb 87 jmp 8010131e <bmap+0x3e>
}
brelse(bp);
return addr;
}
panic("bmap: out of range");
80101397: 83 ec 0c sub $0xc,%esp
8010139a: 68 45 70 10 80 push $0x80107045
8010139f: e8 cc ef ff ff call 80100370 <panic>
801013a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801013aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
801013b0 <readsb>:
struct superblock sb;
// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
801013b0: 55 push %ebp
801013b1: 89 e5 mov %esp,%ebp
801013b3: 56 push %esi
801013b4: 53 push %ebx
801013b5: 8b 75 0c mov 0xc(%ebp),%esi
struct buf *bp;
bp = bread(dev, 1);
801013b8: 83 ec 08 sub $0x8,%esp
801013bb: 6a 01 push $0x1
801013bd: ff 75 08 pushl 0x8(%ebp)
801013c0: e8 0b ed ff ff call 801000d0 <bread>
801013c5: 89 c3 mov %eax,%ebx
memmove(sb, bp->data, sizeof(*sb));
801013c7: 8d 40 5c lea 0x5c(%eax),%eax
801013ca: 83 c4 0c add $0xc,%esp
801013cd: 6a 1c push $0x1c
801013cf: 50 push %eax
801013d0: 56 push %esi
801013d1: e8 7a 31 00 00 call 80104550 <memmove>
brelse(bp);
801013d6: 89 5d 08 mov %ebx,0x8(%ebp)
801013d9: 83 c4 10 add $0x10,%esp
}
801013dc: 8d 65 f8 lea -0x8(%ebp),%esp
801013df: 5b pop %ebx
801013e0: 5e pop %esi
801013e1: 5d pop %ebp
{
struct buf *bp;
bp = bread(dev, 1);
memmove(sb, bp->data, sizeof(*sb));
brelse(bp);
801013e2: e9 f9 ed ff ff jmp 801001e0 <brelse>
801013e7: 89 f6 mov %esi,%esi
801013e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801013f0 <bfree>:
}
// Free a disk block.
static void
bfree(int dev, uint b)
{
801013f0: 55 push %ebp
801013f1: 89 e5 mov %esp,%ebp
801013f3: 56 push %esi
801013f4: 53 push %ebx
801013f5: 89 d3 mov %edx,%ebx
801013f7: 89 c6 mov %eax,%esi
struct buf *bp;
int bi, m;
readsb(dev, &sb);
801013f9: 83 ec 08 sub $0x8,%esp
801013fc: 68 c0 09 11 80 push $0x801109c0
80101401: 50 push %eax
80101402: e8 a9 ff ff ff call 801013b0 <readsb>
bp = bread(dev, BBLOCK(b, sb));
80101407: 58 pop %eax
80101408: 5a pop %edx
80101409: 89 da mov %ebx,%edx
8010140b: c1 ea 0c shr $0xc,%edx
8010140e: 03 15 d8 09 11 80 add 0x801109d8,%edx
80101414: 52 push %edx
80101415: 56 push %esi
80101416: e8 b5 ec ff ff call 801000d0 <bread>
bi = b % BPB;
m = 1 << (bi % 8);
8010141b: 89 d9 mov %ebx,%ecx
if((bp->data[bi/8] & m) == 0)
8010141d: 81 e3 ff 0f 00 00 and $0xfff,%ebx
int bi, m;
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
80101423: ba 01 00 00 00 mov $0x1,%edx
80101428: 83 e1 07 and $0x7,%ecx
if((bp->data[bi/8] & m) == 0)
8010142b: c1 fb 03 sar $0x3,%ebx
8010142e: 83 c4 10 add $0x10,%esp
int bi, m;
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
80101431: d3 e2 shl %cl,%edx
if((bp->data[bi/8] & m) == 0)
80101433: 0f b6 4c 18 5c movzbl 0x5c(%eax,%ebx,1),%ecx
80101438: 85 d1 test %edx,%ecx
8010143a: 74 27 je 80101463 <bfree+0x73>
8010143c: 89 c6 mov %eax,%esi
panic("freeing free block");
bp->data[bi/8] &= ~m;
8010143e: f7 d2 not %edx
80101440: 89 c8 mov %ecx,%eax
log_write(bp);
80101442: 83 ec 0c sub $0xc,%esp
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0)
panic("freeing free block");
bp->data[bi/8] &= ~m;
80101445: 21 d0 and %edx,%eax
80101447: 88 44 1e 5c mov %al,0x5c(%esi,%ebx,1)
log_write(bp);
8010144b: 56 push %esi
8010144c: e8 5f 19 00 00 call 80102db0 <log_write>
brelse(bp);
80101451: 89 34 24 mov %esi,(%esp)
80101454: e8 87 ed ff ff call 801001e0 <brelse>
}
80101459: 83 c4 10 add $0x10,%esp
8010145c: 8d 65 f8 lea -0x8(%ebp),%esp
8010145f: 5b pop %ebx
80101460: 5e pop %esi
80101461: 5d pop %ebp
80101462: c3 ret
readsb(dev, &sb);
bp = bread(dev, BBLOCK(b, sb));
bi = b % BPB;
m = 1 << (bi % 8);
if((bp->data[bi/8] & m) == 0)
panic("freeing free block");
80101463: 83 ec 0c sub $0xc,%esp
80101466: 68 58 70 10 80 push $0x80107058
8010146b: e8 00 ef ff ff call 80100370 <panic>
80101470 <iinit>:
struct inode inode[NINODE];
} icache;
void
iinit(int dev)
{
80101470: 55 push %ebp
80101471: 89 e5 mov %esp,%ebp
80101473: 53 push %ebx
80101474: bb 20 0a 11 80 mov $0x80110a20,%ebx
80101479: 83 ec 0c sub $0xc,%esp
int i = 0;
initlock(&icache.lock, "icache");
8010147c: 68 6b 70 10 80 push $0x8010706b
80101481: 68 e0 09 11 80 push $0x801109e0
80101486: e8 b5 2d 00 00 call 80104240 <initlock>
8010148b: 83 c4 10 add $0x10,%esp
8010148e: 66 90 xchg %ax,%ax
for(i = 0; i < NINODE; i++) {
initsleeplock(&icache.inode[i].lock, "inode");
80101490: 83 ec 08 sub $0x8,%esp
80101493: 68 72 70 10 80 push $0x80107072
80101498: 53 push %ebx
80101499: 81 c3 90 00 00 00 add $0x90,%ebx
8010149f: e8 6c 2c 00 00 call 80104110 <initsleeplock>
iinit(int dev)
{
int i = 0;
initlock(&icache.lock, "icache");
for(i = 0; i < NINODE; i++) {
801014a4: 83 c4 10 add $0x10,%esp
801014a7: 81 fb 40 26 11 80 cmp $0x80112640,%ebx
801014ad: 75 e1 jne 80101490 <iinit+0x20>
initsleeplock(&icache.inode[i].lock, "inode");
}
readsb(dev, &sb);
801014af: 83 ec 08 sub $0x8,%esp
801014b2: 68 c0 09 11 80 push $0x801109c0
801014b7: ff 75 08 pushl 0x8(%ebp)
801014ba: e8 f1 fe ff ff call 801013b0 <readsb>
cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\
801014bf: ff 35 d8 09 11 80 pushl 0x801109d8
801014c5: ff 35 d4 09 11 80 pushl 0x801109d4
801014cb: ff 35 d0 09 11 80 pushl 0x801109d0
801014d1: ff 35 cc 09 11 80 pushl 0x801109cc
801014d7: ff 35 c8 09 11 80 pushl 0x801109c8
801014dd: ff 35 c4 09 11 80 pushl 0x801109c4
801014e3: ff 35 c0 09 11 80 pushl 0x801109c0
801014e9: 68 d8 70 10 80 push $0x801070d8
801014ee: e8 6d f1 ff ff call 80100660 <cprintf>
inodestart %d bmap start %d\n", sb.size, sb.nblocks,
sb.ninodes, sb.nlog, sb.logstart, sb.inodestart,
sb.bmapstart);
}
801014f3: 83 c4 30 add $0x30,%esp
801014f6: 8b 5d fc mov -0x4(%ebp),%ebx
801014f9: c9 leave
801014fa: c3 ret
801014fb: 90 nop
801014fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101500 <ialloc>:
// Allocate an inode on device dev.
// Mark it as allocated by giving it type type.
// Returns an unlocked but allocated and referenced inode.
struct inode*
ialloc(uint dev, short type)
{
80101500: 55 push %ebp
80101501: 89 e5 mov %esp,%ebp
80101503: 57 push %edi
80101504: 56 push %esi
80101505: 53 push %ebx
80101506: 83 ec 1c sub $0x1c,%esp
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
80101509: 83 3d c8 09 11 80 01 cmpl $0x1,0x801109c8
// Allocate an inode on device dev.
// Mark it as allocated by giving it type type.
// Returns an unlocked but allocated and referenced inode.
struct inode*
ialloc(uint dev, short type)
{
80101510: 8b 45 0c mov 0xc(%ebp),%eax
80101513: 8b 75 08 mov 0x8(%ebp),%esi
80101516: 89 45 e4 mov %eax,-0x1c(%ebp)
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
80101519: 0f 86 b0 00 00 00 jbe 801015cf <ialloc+0xcf>
8010151f: bb 01 00 00 00 mov $0x1,%ebx
80101524: eb 25 jmp 8010154b <ialloc+0x4b>
80101526: 8d 76 00 lea 0x0(%esi),%esi
80101529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
dip->group = 1;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
80101530: 83 ec 0c sub $0xc,%esp
{
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
80101533: 83 c3 01 add $0x1,%ebx
dip->group = 1;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
80101536: 57 push %edi
80101537: e8 a4 ec ff ff call 801001e0 <brelse>
{
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
8010153c: 83 c4 10 add $0x10,%esp
8010153f: 39 1d c8 09 11 80 cmp %ebx,0x801109c8
80101545: 0f 86 84 00 00 00 jbe 801015cf <ialloc+0xcf>
bp = bread(dev, IBLOCK(inum, sb));
8010154b: 89 d8 mov %ebx,%eax
8010154d: 83 ec 08 sub $0x8,%esp
80101550: c1 e8 03 shr $0x3,%eax
80101553: 03 05 d4 09 11 80 add 0x801109d4,%eax
80101559: 50 push %eax
8010155a: 56 push %esi
8010155b: e8 70 eb ff ff call 801000d0 <bread>
80101560: 89 c7 mov %eax,%edi
dip = (struct dinode*)bp->data + inum%IPB;
80101562: 89 d8 mov %ebx,%eax
if(dip->type == 0){ // a free inode
80101564: 83 c4 10 add $0x10,%esp
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
bp = bread(dev, IBLOCK(inum, sb));
dip = (struct dinode*)bp->data + inum%IPB;
80101567: 83 e0 07 and $0x7,%eax
8010156a: c1 e0 06 shl $0x6,%eax
8010156d: 8d 4c 07 5c lea 0x5c(%edi,%eax,1),%ecx
if(dip->type == 0){ // a free inode
80101571: 66 83 39 00 cmpw $0x0,(%ecx)
80101575: 75 b9 jne 80101530 <ialloc+0x30>
memset(dip, 0, sizeof(*dip));
80101577: 83 ec 04 sub $0x4,%esp
8010157a: 89 4d e0 mov %ecx,-0x20(%ebp)
8010157d: 6a 40 push $0x40
8010157f: 6a 00 push $0x0
80101581: 51 push %ecx
80101582: e8 19 2f 00 00 call 801044a0 <memset>
dip->type = type;
80101587: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax
8010158b: 8b 4d e0 mov -0x20(%ebp),%ecx
dip->permission = 0x700;
dip->owner = 99;
8010158e: ba 63 00 00 00 mov $0x63,%edx
80101593: 66 89 51 38 mov %dx,0x38(%ecx)
for(inum = 1; inum < sb.ninodes; inum++){
bp = bread(dev, IBLOCK(inum, sb));
dip = (struct dinode*)bp->data + inum%IPB;
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
80101597: 66 89 01 mov %ax,(%ecx)
dip->permission = 0x700;
8010159a: b8 00 07 00 00 mov $0x700,%eax
8010159f: 66 89 41 3c mov %ax,0x3c(%ecx)
dip->owner = 99;
dip->group = 1;
801015a3: b8 01 00 00 00 mov $0x1,%eax
801015a8: 66 89 41 3a mov %ax,0x3a(%ecx)
log_write(bp); // mark it allocated on the disk
801015ac: 89 3c 24 mov %edi,(%esp)
801015af: e8 fc 17 00 00 call 80102db0 <log_write>
brelse(bp);
801015b4: 89 3c 24 mov %edi,(%esp)
801015b7: e8 24 ec ff ff call 801001e0 <brelse>
return iget(dev, inum);
801015bc: 83 c4 10 add $0x10,%esp
}
brelse(bp);
}
panic("ialloc: no inodes");
}
801015bf: 8d 65 f4 lea -0xc(%ebp),%esp
dip->permission = 0x700;
dip->owner = 99;
dip->group = 1;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
801015c2: 89 da mov %ebx,%edx
801015c4: 89 f0 mov %esi,%eax
}
brelse(bp);
}
panic("ialloc: no inodes");
}
801015c6: 5b pop %ebx
801015c7: 5e pop %esi
801015c8: 5f pop %edi
801015c9: 5d pop %ebp
dip->permission = 0x700;
dip->owner = 99;
dip->group = 1;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
801015ca: e9 41 fc ff ff jmp 80101210 <iget>
}
brelse(bp);
}
panic("ialloc: no inodes");
801015cf: 83 ec 0c sub $0xc,%esp
801015d2: 68 78 70 10 80 push $0x80107078
801015d7: e8 94 ed ff ff call 80100370 <panic>
801015dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801015e0 <iupdate>:
// Must be called after every change to an ip->xxx field
// that lives on disk, since i-node cache is write-through.
// Caller must hold ip->lock.
void
iupdate(struct inode *ip)
{
801015e0: 55 push %ebp
801015e1: 89 e5 mov %esp,%ebp
801015e3: 56 push %esi
801015e4: 53 push %ebx
801015e5: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
801015e8: 83 ec 08 sub $0x8,%esp
801015eb: 8b 43 04 mov 0x4(%ebx),%eax
dip->size = ip->size;
dip->owner = ip->owner;
dip->group = ip->group;
dip->permission = ip->permission;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
801015ee: 83 c3 5c add $0x5c,%ebx
iupdate(struct inode *ip)
{
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
801015f1: c1 e8 03 shr $0x3,%eax
801015f4: 03 05 d4 09 11 80 add 0x801109d4,%eax
801015fa: 50 push %eax
801015fb: ff 73 a4 pushl -0x5c(%ebx)
801015fe: e8 cd ea ff ff call 801000d0 <bread>
80101603: 89 c6 mov %eax,%esi
dip = (struct dinode*)bp->data + ip->inum%IPB;
80101605: 8b 43 a8 mov -0x58(%ebx),%eax
dip->type = ip->type;
80101608: 0f b7 53 f4 movzwl -0xc(%ebx),%edx
dip->size = ip->size;
dip->owner = ip->owner;
dip->group = ip->group;
dip->permission = ip->permission;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
8010160c: 83 c4 0c add $0xc,%esp
{
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
8010160f: 83 e0 07 and $0x7,%eax
80101612: c1 e0 06 shl $0x6,%eax
80101615: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax
dip->type = ip->type;
80101619: 66 89 10 mov %dx,(%eax)
dip->major = ip->major;
8010161c: 0f b7 53 f6 movzwl -0xa(%ebx),%edx
dip->size = ip->size;
dip->owner = ip->owner;
dip->group = ip->group;
dip->permission = ip->permission;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
80101620: 83 c0 0c add $0xc,%eax
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
dip->type = ip->type;
dip->major = ip->major;
80101623: 66 89 50 f6 mov %dx,-0xa(%eax)
dip->minor = ip->minor;
80101627: 0f b7 53 f8 movzwl -0x8(%ebx),%edx
8010162b: 66 89 50 f8 mov %dx,-0x8(%eax)
dip->nlink = ip->nlink;
8010162f: 0f b7 53 fa movzwl -0x6(%ebx),%edx
80101633: 66 89 50 fa mov %dx,-0x6(%eax)
dip->size = ip->size;
80101637: 8b 53 fc mov -0x4(%ebx),%edx
8010163a: 89 50 fc mov %edx,-0x4(%eax)
dip->owner = ip->owner;
8010163d: 0f b7 53 2c movzwl 0x2c(%ebx),%edx
80101641: 66 89 50 2c mov %dx,0x2c(%eax)
dip->group = ip->group;
80101645: 0f b7 53 2e movzwl 0x2e(%ebx),%edx
80101649: 66 89 50 2e mov %dx,0x2e(%eax)
dip->permission = ip->permission;
8010164d: 0f b7 53 30 movzwl 0x30(%ebx),%edx
80101651: 66 89 50 30 mov %dx,0x30(%eax)
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
80101655: 6a 2c push $0x2c
80101657: 53 push %ebx
80101658: 50 push %eax
80101659: e8 f2 2e 00 00 call 80104550 <memmove>
log_write(bp);
8010165e: 89 34 24 mov %esi,(%esp)
80101661: e8 4a 17 00 00 call 80102db0 <log_write>
brelse(bp);
80101666: 89 75 08 mov %esi,0x8(%ebp)
80101669: 83 c4 10 add $0x10,%esp
}
8010166c: 8d 65 f8 lea -0x8(%ebp),%esp
8010166f: 5b pop %ebx
80101670: 5e pop %esi
80101671: 5d pop %ebp
dip->owner = ip->owner;
dip->group = ip->group;
dip->permission = ip->permission;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
log_write(bp);
brelse(bp);
80101672: e9 69 eb ff ff jmp 801001e0 <brelse>
80101677: 89 f6 mov %esi,%esi
80101679: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101680 <idup>:
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
80101680: 55 push %ebp
80101681: 89 e5 mov %esp,%ebp
80101683: 53 push %ebx
80101684: 83 ec 10 sub $0x10,%esp
80101687: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&icache.lock);
8010168a: 68 e0 09 11 80 push $0x801109e0
8010168f: e8 0c 2d 00 00 call 801043a0 <acquire>
ip->ref++;
80101694: 83 43 08 01 addl $0x1,0x8(%ebx)
release(&icache.lock);
80101698: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp)
8010169f: e8 ac 2d 00 00 call 80104450 <release>
return ip;
}
801016a4: 89 d8 mov %ebx,%eax
801016a6: 8b 5d fc mov -0x4(%ebp),%ebx
801016a9: c9 leave
801016aa: c3 ret
801016ab: 90 nop
801016ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801016b0 <ilock>:
// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
801016b0: 55 push %ebp
801016b1: 89 e5 mov %esp,%ebp
801016b3: 56 push %esi
801016b4: 53 push %ebx
801016b5: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
801016b8: 85 db test %ebx,%ebx
801016ba: 0f 84 d8 00 00 00 je 80101798 <ilock+0xe8>
801016c0: 8b 53 08 mov 0x8(%ebx),%edx
801016c3: 85 d2 test %edx,%edx
801016c5: 0f 8e cd 00 00 00 jle 80101798 <ilock+0xe8>
panic("ilock");
acquiresleep(&ip->lock);
801016cb: 8d 43 0c lea 0xc(%ebx),%eax
801016ce: 83 ec 0c sub $0xc,%esp
801016d1: 50 push %eax
801016d2: e8 79 2a 00 00 call 80104150 <acquiresleep>
if(ip->valid == 0){
801016d7: 8b 43 4c mov 0x4c(%ebx),%eax
801016da: 83 c4 10 add $0x10,%esp
801016dd: 85 c0 test %eax,%eax
801016df: 74 0f je 801016f0 <ilock+0x40>
brelse(bp);
ip->valid = 1;
if(ip->type == 0)
panic("ilock: no type");
}
}
801016e1: 8d 65 f8 lea -0x8(%ebp),%esp
801016e4: 5b pop %ebx
801016e5: 5e pop %esi
801016e6: 5d pop %ebp
801016e7: c3 ret
801016e8: 90 nop
801016e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
panic("ilock");
acquiresleep(&ip->lock);
if(ip->valid == 0){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
801016f0: 8b 43 04 mov 0x4(%ebx),%eax
801016f3: 83 ec 08 sub $0x8,%esp
801016f6: c1 e8 03 shr $0x3,%eax
801016f9: 03 05 d4 09 11 80 add 0x801109d4,%eax
801016ff: 50 push %eax
80101700: ff 33 pushl (%ebx)
80101702: e8 c9 e9 ff ff call 801000d0 <bread>
80101707: 89 c6 mov %eax,%esi
dip = (struct dinode*)bp->data + ip->inum%IPB;
80101709: 8b 43 04 mov 0x4(%ebx),%eax
ip->size = dip->size;
ip->owner = dip->owner;
ip->group = dip->group;
ip->permission = dip->permission;
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
8010170c: 83 c4 0c add $0xc,%esp
acquiresleep(&ip->lock);
if(ip->valid == 0){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
8010170f: 83 e0 07 and $0x7,%eax
80101712: c1 e0 06 shl $0x6,%eax
80101715: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax
ip->type = dip->type;
80101719: 0f b7 10 movzwl (%eax),%edx
ip->size = dip->size;
ip->owner = dip->owner;
ip->group = dip->group;
ip->permission = dip->permission;
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
8010171c: 83 c0 0c add $0xc,%eax
acquiresleep(&ip->lock);
if(ip->valid == 0){
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum%IPB;
ip->type = dip->type;
8010171f: 66 89 53 50 mov %dx,0x50(%ebx)
ip->major = dip->major;
80101723: 0f b7 50 f6 movzwl -0xa(%eax),%edx
80101727: 66 89 53 52 mov %dx,0x52(%ebx)
ip->minor = dip->minor;
8010172b: 0f b7 50 f8 movzwl -0x8(%eax),%edx
8010172f: 66 89 53 54 mov %dx,0x54(%ebx)
ip->nlink = dip->nlink;
80101733: 0f b7 50 fa movzwl -0x6(%eax),%edx
80101737: 66 89 53 56 mov %dx,0x56(%ebx)
ip->size = dip->size;
8010173b: 8b 50 fc mov -0x4(%eax),%edx
8010173e: 89 53 58 mov %edx,0x58(%ebx)
ip->owner = dip->owner;
80101741: 0f b7 50 2c movzwl 0x2c(%eax),%edx
80101745: 66 89 93 88 00 00 00 mov %dx,0x88(%ebx)
ip->group = dip->group;
8010174c: 0f b7 50 2e movzwl 0x2e(%eax),%edx
80101750: 66 89 93 8a 00 00 00 mov %dx,0x8a(%ebx)
ip->permission = dip->permission;
80101757: 0f b7 50 30 movzwl 0x30(%eax),%edx
8010175b: 66 89 93 8c 00 00 00 mov %dx,0x8c(%ebx)
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
80101762: 6a 2c push $0x2c
80101764: 50 push %eax
80101765: 8d 43 5c lea 0x5c(%ebx),%eax
80101768: 50 push %eax
80101769: e8 e2 2d 00 00 call 80104550 <memmove>
brelse(bp);
8010176e: 89 34 24 mov %esi,(%esp)
80101771: e8 6a ea ff ff call 801001e0 <brelse>
ip->valid = 1;
if(ip->type == 0)
80101776: 83 c4 10 add $0x10,%esp
80101779: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx)
ip->owner = dip->owner;
ip->group = dip->group;
ip->permission = dip->permission;
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
brelse(bp);
ip->valid = 1;
8010177e: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx)
if(ip->type == 0)
80101785: 0f 85 56 ff ff ff jne 801016e1 <ilock+0x31>
panic("ilock: no type");
8010178b: 83 ec 0c sub $0xc,%esp
8010178e: 68 90 70 10 80 push $0x80107090
80101793: e8 d8 eb ff ff call 80100370 <panic>
{
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
panic("ilock");
80101798: 83 ec 0c sub $0xc,%esp
8010179b: 68 8a 70 10 80 push $0x8010708a
801017a0: e8 cb eb ff ff call 80100370 <panic>
801017a5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801017a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801017b0 <iunlock>:
}
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
801017b0: 55 push %ebp
801017b1: 89 e5 mov %esp,%ebp
801017b3: 56 push %esi
801017b4: 53 push %ebx
801017b5: 8b 5d 08 mov 0x8(%ebp),%ebx
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
801017b8: 85 db test %ebx,%ebx
801017ba: 74 28 je 801017e4 <iunlock+0x34>
801017bc: 8d 73 0c lea 0xc(%ebx),%esi
801017bf: 83 ec 0c sub $0xc,%esp
801017c2: 56 push %esi
801017c3: e8 28 2a 00 00 call 801041f0 <holdingsleep>
801017c8: 83 c4 10 add $0x10,%esp
801017cb: 85 c0 test %eax,%eax
801017cd: 74 15 je 801017e4 <iunlock+0x34>
801017cf: 8b 43 08 mov 0x8(%ebx),%eax
801017d2: 85 c0 test %eax,%eax
801017d4: 7e 0e jle 801017e4 <iunlock+0x34>
panic("iunlock");
releasesleep(&ip->lock);
801017d6: 89 75 08 mov %esi,0x8(%ebp)
}
801017d9: 8d 65 f8 lea -0x8(%ebp),%esp
801017dc: 5b pop %ebx
801017dd: 5e pop %esi
801017de: 5d pop %ebp
iunlock(struct inode *ip)
{
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
panic("iunlock");
releasesleep(&ip->lock);
801017df: e9 cc 29 00 00 jmp 801041b0 <releasesleep>
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1)
panic("iunlock");
801017e4: 83 ec 0c sub $0xc,%esp
801017e7: 68 9f 70 10 80 push $0x8010709f
801017ec: e8 7f eb ff ff call 80100370 <panic>
801017f1: eb 0d jmp 80101800 <iput>
801017f3: 90 nop
801017f4: 90 nop
801017f5: 90 nop
801017f6: 90 nop
801017f7: 90 nop
801017f8: 90 nop
801017f9: 90 nop
801017fa: 90 nop
801017fb: 90 nop
801017fc: 90 nop
801017fd: 90 nop
801017fe: 90 nop
801017ff: 90 nop
80101800 <iput>:
// to it, free the inode (and its content) on disk.
// All calls to iput() must be inside a transaction in
// case it has to free the inode.
void
iput(struct inode *ip)
{
80101800: 55 push %ebp
80101801: 89 e5 mov %esp,%ebp
80101803: 57 push %edi
80101804: 56 push %esi
80101805: 53 push %ebx
80101806: 83 ec 28 sub $0x28,%esp
80101809: 8b 75 08 mov 0x8(%ebp),%esi
acquiresleep(&ip->lock);
8010180c: 8d 7e 0c lea 0xc(%esi),%edi
8010180f: 57 push %edi
80101810: e8 3b 29 00 00 call 80104150 <acquiresleep>
if(ip->valid && ip->nlink == 0){
80101815: 8b 56 4c mov 0x4c(%esi),%edx
80101818: 83 c4 10 add $0x10,%esp
8010181b: 85 d2 test %edx,%edx
8010181d: 74 07 je 80101826 <iput+0x26>
8010181f: 66 83 7e 56 00 cmpw $0x0,0x56(%esi)
80101824: 74 32 je 80101858 <iput+0x58>
ip->type = 0;
iupdate(ip);
ip->valid = 0;
}
}
releasesleep(&ip->lock);
80101826: 83 ec 0c sub $0xc,%esp
80101829: 57 push %edi
8010182a: e8 81 29 00 00 call 801041b0 <releasesleep>
acquire(&icache.lock);
8010182f: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp)
80101836: e8 65 2b 00 00 call 801043a0 <acquire>
ip->ref--;
8010183b: 83 6e 08 01 subl $0x1,0x8(%esi)
release(&icache.lock);
8010183f: 83 c4 10 add $0x10,%esp
80101842: c7 45 08 e0 09 11 80 movl $0x801109e0,0x8(%ebp)
}
80101849: 8d 65 f4 lea -0xc(%ebp),%esp
8010184c: 5b pop %ebx
8010184d: 5e pop %esi
8010184e: 5f pop %edi
8010184f: 5d pop %ebp
}
releasesleep(&ip->lock);
acquire(&icache.lock);
ip->ref--;
release(&icache.lock);
80101850: e9 fb 2b 00 00 jmp 80104450 <release>
80101855: 8d 76 00 lea 0x0(%esi),%esi
void
iput(struct inode *ip)
{
acquiresleep(&ip->lock);
if(ip->valid && ip->nlink == 0){
acquire(&icache.lock);
80101858: 83 ec 0c sub $0xc,%esp
8010185b: 68 e0 09 11 80 push $0x801109e0
80101860: e8 3b 2b 00 00 call 801043a0 <acquire>
int r = ip->ref;
80101865: 8b 5e 08 mov 0x8(%esi),%ebx
release(&icache.lock);
80101868: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp)
8010186f: e8 dc 2b 00 00 call 80104450 <release>
if(r == 1){
80101874: 83 c4 10 add $0x10,%esp
80101877: 83 fb 01 cmp $0x1,%ebx
8010187a: 75 aa jne 80101826 <iput+0x26>
8010187c: 8d 8e 84 00 00 00 lea 0x84(%esi),%ecx
80101882: 89 7d e4 mov %edi,-0x1c(%ebp)
80101885: 8d 5e 5c lea 0x5c(%esi),%ebx
80101888: 89 cf mov %ecx,%edi
8010188a: eb 0b jmp 80101897 <iput+0x97>
8010188c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101890: 83 c3 04 add $0x4,%ebx
{
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101893: 39 fb cmp %edi,%ebx
80101895: 74 19 je 801018b0 <iput+0xb0>
if(ip->addrs[i]){
80101897: 8b 13 mov (%ebx),%edx
80101899: 85 d2 test %edx,%edx
8010189b: 74 f3 je 80101890 <iput+0x90>
bfree(ip->dev, ip->addrs[i]);
8010189d: 8b 06 mov (%esi),%eax
8010189f: e8 4c fb ff ff call 801013f0 <bfree>
ip->addrs[i] = 0;
801018a4: c7 03 00 00 00 00 movl $0x0,(%ebx)
801018aa: eb e4 jmp 80101890 <iput+0x90>
801018ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
}
if(ip->addrs[NDIRECT]){
801018b0: 8b 86 84 00 00 00 mov 0x84(%esi),%eax
801018b6: 8b 7d e4 mov -0x1c(%ebp),%edi
801018b9: 85 c0 test %eax,%eax
801018bb: 75 33 jne 801018f0 <iput+0xf0>
bfree(ip->dev, ip->addrs[NDIRECT]);
ip->addrs[NDIRECT] = 0;
}
ip->size = 0;
iupdate(ip);
801018bd: 83 ec 0c sub $0xc,%esp
brelse(bp);
bfree(ip->dev, ip->addrs[NDIRECT]);
ip->addrs[NDIRECT] = 0;
}
ip->size = 0;
801018c0: c7 46 58 00 00 00 00 movl $0x0,0x58(%esi)
iupdate(ip);
801018c7: 56 push %esi
801018c8: e8 13 fd ff ff call 801015e0 <iupdate>
int r = ip->ref;
release(&icache.lock);
if(r == 1){
// inode has no links and no other references: truncate and free.
itrunc(ip);
ip->type = 0;
801018cd: 31 c0 xor %eax,%eax
801018cf: 66 89 46 50 mov %ax,0x50(%esi)
iupdate(ip);
801018d3: 89 34 24 mov %esi,(%esp)
801018d6: e8 05 fd ff ff call 801015e0 <iupdate>
ip->valid = 0;
801018db: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi)
801018e2: 83 c4 10 add $0x10,%esp
801018e5: e9 3c ff ff ff jmp 80101826 <iput+0x26>
801018ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
ip->addrs[i] = 0;
}
}
if(ip->addrs[NDIRECT]){
bp = bread(ip->dev, ip->addrs[NDIRECT]);
801018f0: 83 ec 08 sub $0x8,%esp
801018f3: 50 push %eax
801018f4: ff 36 pushl (%esi)
801018f6: e8 d5 e7 ff ff call 801000d0 <bread>
801018fb: 8d 88 5c 02 00 00 lea 0x25c(%eax),%ecx
80101901: 89 7d e0 mov %edi,-0x20(%ebp)
80101904: 89 45 e4 mov %eax,-0x1c(%ebp)
a = (uint*)bp->data;
80101907: 8d 58 5c lea 0x5c(%eax),%ebx
8010190a: 83 c4 10 add $0x10,%esp
8010190d: 89 cf mov %ecx,%edi
8010190f: eb 0e jmp 8010191f <iput+0x11f>
80101911: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101918: 83 c3 04 add $0x4,%ebx
for(j = 0; j < NINDIRECT; j++){
8010191b: 39 fb cmp %edi,%ebx
8010191d: 74 0f je 8010192e <iput+0x12e>
if(a[j])
8010191f: 8b 13 mov (%ebx),%edx
80101921: 85 d2 test %edx,%edx
80101923: 74 f3 je 80101918 <iput+0x118>
bfree(ip->dev, a[j]);
80101925: 8b 06 mov (%esi),%eax
80101927: e8 c4 fa ff ff call 801013f0 <bfree>
8010192c: eb ea jmp 80101918 <iput+0x118>
}
brelse(bp);
8010192e: 83 ec 0c sub $0xc,%esp
80101931: ff 75 e4 pushl -0x1c(%ebp)
80101934: 8b 7d e0 mov -0x20(%ebp),%edi
80101937: e8 a4 e8 ff ff call 801001e0 <brelse>
bfree(ip->dev, ip->addrs[NDIRECT]);
8010193c: 8b 96 84 00 00 00 mov 0x84(%esi),%edx
80101942: 8b 06 mov (%esi),%eax
80101944: e8 a7 fa ff ff call 801013f0 <bfree>
ip->addrs[NDIRECT] = 0;
80101949: c7 86 84 00 00 00 00 movl $0x0,0x84(%esi)
80101950: 00 00 00
80101953: 83 c4 10 add $0x10,%esp
80101956: e9 62 ff ff ff jmp 801018bd <iput+0xbd>
8010195b: 90 nop
8010195c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101960 <iunlockput>:
}
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101960: 55 push %ebp
80101961: 89 e5 mov %esp,%ebp
80101963: 53 push %ebx
80101964: 83 ec 10 sub $0x10,%esp
80101967: 8b 5d 08 mov 0x8(%ebp),%ebx
iunlock(ip);
8010196a: 53 push %ebx
8010196b: e8 40 fe ff ff call 801017b0 <iunlock>
iput(ip);
80101970: 89 5d 08 mov %ebx,0x8(%ebp)
80101973: 83 c4 10 add $0x10,%esp
}
80101976: 8b 5d fc mov -0x4(%ebp),%ebx
80101979: c9 leave
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
iput(ip);
8010197a: e9 81 fe ff ff jmp 80101800 <iput>
8010197f: 90 nop
80101980 <stati>:
// Copy stat information from inode.
// Caller must hold ip->lock.
void
stati(struct inode *ip, struct stat *st)
{
80101980: 55 push %ebp
80101981: 89 e5 mov %esp,%ebp
80101983: 8b 55 08 mov 0x8(%ebp),%edx
80101986: 8b 45 0c mov 0xc(%ebp),%eax
st->dev = ip->dev;
80101989: 8b 0a mov (%edx),%ecx
8010198b: 89 48 04 mov %ecx,0x4(%eax)
st->ino = ip->inum;
8010198e: 8b 4a 04 mov 0x4(%edx),%ecx
80101991: 89 48 08 mov %ecx,0x8(%eax)
st->type = ip->type;
80101994: 0f b7 4a 50 movzwl 0x50(%edx),%ecx
80101998: 66 89 08 mov %cx,(%eax)
st->nlink = ip->nlink;
8010199b: 0f b7 4a 56 movzwl 0x56(%edx),%ecx
8010199f: 66 89 48 0c mov %cx,0xc(%eax)
st->size = ip->size;
801019a3: 8b 4a 58 mov 0x58(%edx),%ecx
801019a6: 89 48 10 mov %ecx,0x10(%eax)
st->owner = ip->owner;
801019a9: 0f b7 8a 88 00 00 00 movzwl 0x88(%edx),%ecx
801019b0: 66 89 48 14 mov %cx,0x14(%eax)
st->group = ip->group;
801019b4: 0f b7 8a 8a 00 00 00 movzwl 0x8a(%edx),%ecx
801019bb: 66 89 48 16 mov %cx,0x16(%eax)
st->permission = ip->permission;
801019bf: 0f b7 92 8c 00 00 00 movzwl 0x8c(%edx),%edx
801019c6: 66 89 50 18 mov %dx,0x18(%eax)
}
801019ca: 5d pop %ebp
801019cb: c3 ret
801019cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801019d0 <readi>:
//PAGEBREAK!
// Read data from inode.
// Caller must hold ip->lock.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
801019d0: 55 push %ebp
801019d1: 89 e5 mov %esp,%ebp
801019d3: 57 push %edi
801019d4: 56 push %esi
801019d5: 53 push %ebx
801019d6: 83 ec 1c sub $0x1c,%esp
801019d9: 8b 45 08 mov 0x8(%ebp),%eax
801019dc: 8b 7d 0c mov 0xc(%ebp),%edi
801019df: 8b 75 10 mov 0x10(%ebp),%esi
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
801019e2: 66 83 78 50 03 cmpw $0x3,0x50(%eax)
//PAGEBREAK!
// Read data from inode.
// Caller must hold ip->lock.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
801019e7: 89 7d e0 mov %edi,-0x20(%ebp)
801019ea: 8b 7d 14 mov 0x14(%ebp),%edi
801019ed: 89 45 d8 mov %eax,-0x28(%ebp)
801019f0: 89 7d e4 mov %edi,-0x1c(%ebp)
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
801019f3: 0f 84 a7 00 00 00 je 80101aa0 <readi+0xd0>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
return -1;
return devsw[ip->major].read(ip, dst, n);
}
if(off > ip->size || off + n < off)
801019f9: 8b 45 d8 mov -0x28(%ebp),%eax
801019fc: 8b 40 58 mov 0x58(%eax),%eax
801019ff: 39 f0 cmp %esi,%eax
80101a01: 0f 82 c1 00 00 00 jb 80101ac8 <readi+0xf8>
80101a07: 8b 7d e4 mov -0x1c(%ebp),%edi
80101a0a: 89 fa mov %edi,%edx
80101a0c: 01 f2 add %esi,%edx
80101a0e: 0f 82 b4 00 00 00 jb 80101ac8 <readi+0xf8>
return -1;
if(off + n > ip->size)
n = ip->size - off;
80101a14: 89 c1 mov %eax,%ecx
80101a16: 29 f1 sub %esi,%ecx
80101a18: 39 d0 cmp %edx,%eax
80101a1a: 0f 43 cf cmovae %edi,%ecx
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101a1d: 31 ff xor %edi,%edi
80101a1f: 85 c9 test %ecx,%ecx
}
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
80101a21: 89 4d e4 mov %ecx,-0x1c(%ebp)
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101a24: 74 6d je 80101a93 <readi+0xc3>
80101a26: 8d 76 00 lea 0x0(%esi),%esi
80101a29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101a30: 8b 5d d8 mov -0x28(%ebp),%ebx
80101a33: 89 f2 mov %esi,%edx
80101a35: c1 ea 09 shr $0x9,%edx
80101a38: 89 d8 mov %ebx,%eax
80101a3a: e8 a1 f8 ff ff call 801012e0 <bmap>
80101a3f: 83 ec 08 sub $0x8,%esp
80101a42: 50 push %eax
80101a43: ff 33 pushl (%ebx)
m = min(n - tot, BSIZE - off%BSIZE);
80101a45: bb 00 02 00 00 mov $0x200,%ebx
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101a4a: e8 81 e6 ff ff call 801000d0 <bread>
80101a4f: 89 c2 mov %eax,%edx
m = min(n - tot, BSIZE - off%BSIZE);
80101a51: 8b 45 e4 mov -0x1c(%ebp),%eax
80101a54: 89 f1 mov %esi,%ecx
80101a56: 81 e1 ff 01 00 00 and $0x1ff,%ecx
80101a5c: 83 c4 0c add $0xc,%esp
memmove(dst, bp->data + off%BSIZE, m);
80101a5f: 89 55 dc mov %edx,-0x24(%ebp)
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
80101a62: 29 cb sub %ecx,%ebx
80101a64: 29 f8 sub %edi,%eax
80101a66: 39 c3 cmp %eax,%ebx
80101a68: 0f 47 d8 cmova %eax,%ebx
memmove(dst, bp->data + off%BSIZE, m);
80101a6b: 8d 44 0a 5c lea 0x5c(%edx,%ecx,1),%eax
80101a6f: 53 push %ebx
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101a70: 01 df add %ebx,%edi
80101a72: 01 de add %ebx,%esi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
memmove(dst, bp->data + off%BSIZE, m);
80101a74: 50 push %eax
80101a75: ff 75 e0 pushl -0x20(%ebp)
80101a78: e8 d3 2a 00 00 call 80104550 <memmove>
brelse(bp);
80101a7d: 8b 55 dc mov -0x24(%ebp),%edx
80101a80: 89 14 24 mov %edx,(%esp)
80101a83: e8 58 e7 ff ff call 801001e0 <brelse>
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101a88: 01 5d e0 add %ebx,-0x20(%ebp)
80101a8b: 83 c4 10 add $0x10,%esp
80101a8e: 39 7d e4 cmp %edi,-0x1c(%ebp)
80101a91: 77 9d ja 80101a30 <readi+0x60>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
80101a93: 8b 45 e4 mov -0x1c(%ebp),%eax
}
80101a96: 8d 65 f4 lea -0xc(%ebp),%esp
80101a99: 5b pop %ebx
80101a9a: 5e pop %esi
80101a9b: 5f pop %edi
80101a9c: 5d pop %ebp
80101a9d: c3 ret
80101a9e: 66 90 xchg %ax,%ax
{
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101aa0: 0f bf 40 52 movswl 0x52(%eax),%eax
80101aa4: 66 83 f8 09 cmp $0x9,%ax
80101aa8: 77 1e ja 80101ac8 <readi+0xf8>
80101aaa: 8b 04 c5 60 09 11 80 mov -0x7feef6a0(,%eax,8),%eax
80101ab1: 85 c0 test %eax,%eax
80101ab3: 74 13 je 80101ac8 <readi+0xf8>
return -1;
return devsw[ip->major].read(ip, dst, n);
80101ab5: 89 7d 10 mov %edi,0x10(%ebp)
m = min(n - tot, BSIZE - off%BSIZE);
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
}
80101ab8: 8d 65 f4 lea -0xc(%ebp),%esp
80101abb: 5b pop %ebx
80101abc: 5e pop %esi
80101abd: 5f pop %edi
80101abe: 5d pop %ebp
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
return -1;
return devsw[ip->major].read(ip, dst, n);
80101abf: ff e0 jmp *%eax
80101ac1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
return -1;
80101ac8: b8 ff ff ff ff mov $0xffffffff,%eax
80101acd: eb c7 jmp 80101a96 <readi+0xc6>
80101acf: 90 nop
80101ad0 <writei>:
// PAGEBREAK!
// Write data to inode.
// Caller must hold ip->lock.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101ad0: 55 push %ebp
80101ad1: 89 e5 mov %esp,%ebp
80101ad3: 57 push %edi
80101ad4: 56 push %esi
80101ad5: 53 push %ebx
80101ad6: 83 ec 1c sub $0x1c,%esp
80101ad9: 8b 45 08 mov 0x8(%ebp),%eax
80101adc: 8b 75 0c mov 0xc(%ebp),%esi
80101adf: 8b 7d 14 mov 0x14(%ebp),%edi
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101ae2: 66 83 78 50 03 cmpw $0x3,0x50(%eax)
// PAGEBREAK!
// Write data to inode.
// Caller must hold ip->lock.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101ae7: 89 75 dc mov %esi,-0x24(%ebp)
80101aea: 89 45 d8 mov %eax,-0x28(%ebp)
80101aed: 8b 75 10 mov 0x10(%ebp),%esi
80101af0: 89 7d e0 mov %edi,-0x20(%ebp)
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101af3: 0f 84 b7 00 00 00 je 80101bb0 <writei+0xe0>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
return -1;
return devsw[ip->major].write(ip, src, n);
}
if(off > ip->size || off + n < off)
80101af9: 8b 45 d8 mov -0x28(%ebp),%eax
80101afc: 39 70 58 cmp %esi,0x58(%eax)
80101aff: 0f 82 eb 00 00 00 jb 80101bf0 <writei+0x120>
80101b05: 8b 7d e0 mov -0x20(%ebp),%edi
80101b08: 89 f8 mov %edi,%eax
80101b0a: 01 f0 add %esi,%eax
return -1;
if(off + n > MAXFILE*BSIZE)
80101b0c: 3d 00 14 01 00 cmp $0x11400,%eax
80101b11: 0f 87 d9 00 00 00 ja 80101bf0 <writei+0x120>
80101b17: 39 c6 cmp %eax,%esi
80101b19: 0f 87 d1 00 00 00 ja 80101bf0 <writei+0x120>
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101b1f: 85 ff test %edi,%edi
80101b21: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80101b28: 74 78 je 80101ba2 <writei+0xd2>
80101b2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101b30: 8b 7d d8 mov -0x28(%ebp),%edi
80101b33: 89 f2 mov %esi,%edx
m = min(n - tot, BSIZE - off%BSIZE);
80101b35: bb 00 02 00 00 mov $0x200,%ebx
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101b3a: c1 ea 09 shr $0x9,%edx
80101b3d: 89 f8 mov %edi,%eax
80101b3f: e8 9c f7 ff ff call 801012e0 <bmap>
80101b44: 83 ec 08 sub $0x8,%esp
80101b47: 50 push %eax
80101b48: ff 37 pushl (%edi)
80101b4a: e8 81 e5 ff ff call 801000d0 <bread>
80101b4f: 89 c7 mov %eax,%edi
m = min(n - tot, BSIZE - off%BSIZE);
80101b51: 8b 45 e0 mov -0x20(%ebp),%eax
80101b54: 2b 45 e4 sub -0x1c(%ebp),%eax
80101b57: 89 f1 mov %esi,%ecx
80101b59: 83 c4 0c add $0xc,%esp
80101b5c: 81 e1 ff 01 00 00 and $0x1ff,%ecx
80101b62: 29 cb sub %ecx,%ebx
80101b64: 39 c3 cmp %eax,%ebx
80101b66: 0f 47 d8 cmova %eax,%ebx
memmove(bp->data + off%BSIZE, src, m);
80101b69: 8d 44 0f 5c lea 0x5c(%edi,%ecx,1),%eax
80101b6d: 53 push %ebx
80101b6e: ff 75 dc pushl -0x24(%ebp)
if(off > ip->size || off + n < off)
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101b71: 01 de add %ebx,%esi
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
memmove(bp->data + off%BSIZE, src, m);
80101b73: 50 push %eax
80101b74: e8 d7 29 00 00 call 80104550 <memmove>
log_write(bp);
80101b79: 89 3c 24 mov %edi,(%esp)
80101b7c: e8 2f 12 00 00 call 80102db0 <log_write>
brelse(bp);
80101b81: 89 3c 24 mov %edi,(%esp)
80101b84: e8 57 e6 ff ff call 801001e0 <brelse>
if(off > ip->size || off + n < off)
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101b89: 01 5d e4 add %ebx,-0x1c(%ebp)
80101b8c: 01 5d dc add %ebx,-0x24(%ebp)
80101b8f: 83 c4 10 add $0x10,%esp
80101b92: 8b 55 e4 mov -0x1c(%ebp),%edx
80101b95: 39 55 e0 cmp %edx,-0x20(%ebp)
80101b98: 77 96 ja 80101b30 <writei+0x60>
memmove(bp->data + off%BSIZE, src, m);
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
80101b9a: 8b 45 d8 mov -0x28(%ebp),%eax
80101b9d: 3b 70 58 cmp 0x58(%eax),%esi
80101ba0: 77 36 ja 80101bd8 <writei+0x108>
ip->size = off;
iupdate(ip);
}
return n;
80101ba2: 8b 45 e0 mov -0x20(%ebp),%eax
}
80101ba5: 8d 65 f4 lea -0xc(%ebp),%esp
80101ba8: 5b pop %ebx
80101ba9: 5e pop %esi
80101baa: 5f pop %edi
80101bab: 5d pop %ebp
80101bac: c3 ret
80101bad: 8d 76 00 lea 0x0(%esi),%esi
{
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80101bb0: 0f bf 40 52 movswl 0x52(%eax),%eax
80101bb4: 66 83 f8 09 cmp $0x9,%ax
80101bb8: 77 36 ja 80101bf0 <writei+0x120>
80101bba: 8b 04 c5 64 09 11 80 mov -0x7feef69c(,%eax,8),%eax
80101bc1: 85 c0 test %eax,%eax
80101bc3: 74 2b je 80101bf0 <writei+0x120>
return -1;
return devsw[ip->major].write(ip, src, n);
80101bc5: 89 7d 10 mov %edi,0x10(%ebp)
if(n > 0 && off > ip->size){
ip->size = off;
iupdate(ip);
}
return n;
}
80101bc8: 8d 65 f4 lea -0xc(%ebp),%esp
80101bcb: 5b pop %ebx
80101bcc: 5e pop %esi
80101bcd: 5f pop %edi
80101bce: 5d pop %ebp
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
return -1;
return devsw[ip->major].write(ip, src, n);
80101bcf: ff e0 jmp *%eax
80101bd1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
ip->size = off;
80101bd8: 8b 45 d8 mov -0x28(%ebp),%eax
iupdate(ip);
80101bdb: 83 ec 0c sub $0xc,%esp
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
ip->size = off;
80101bde: 89 70 58 mov %esi,0x58(%eax)
iupdate(ip);
80101be1: 50 push %eax
80101be2: e8 f9 f9 ff ff call 801015e0 <iupdate>
80101be7: 83 c4 10 add $0x10,%esp
80101bea: eb b6 jmp 80101ba2 <writei+0xd2>
80101bec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
return -1;
80101bf0: b8 ff ff ff ff mov $0xffffffff,%eax
80101bf5: eb ae jmp 80101ba5 <writei+0xd5>
80101bf7: 89 f6 mov %esi,%esi
80101bf9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101c00 <namecmp>:
//PAGEBREAK!
// Directories
int
namecmp(const char *s, const char *t)
{
80101c00: 55 push %ebp
80101c01: 89 e5 mov %esp,%ebp
80101c03: 83 ec 0c sub $0xc,%esp
return strncmp(s, t, DIRSIZ);
80101c06: 6a 0e push $0xe
80101c08: ff 75 0c pushl 0xc(%ebp)
80101c0b: ff 75 08 pushl 0x8(%ebp)
80101c0e: e8 bd 29 00 00 call 801045d0 <strncmp>
}
80101c13: c9 leave
80101c14: c3 ret
80101c15: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101c19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101c20 <dirlookup>:
// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
80101c20: 55 push %ebp
80101c21: 89 e5 mov %esp,%ebp
80101c23: 57 push %edi
80101c24: 56 push %esi
80101c25: 53 push %ebx
80101c26: 83 ec 1c sub $0x1c,%esp
80101c29: 8b 5d 08 mov 0x8(%ebp),%ebx
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
80101c2c: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80101c31: 0f 85 80 00 00 00 jne 80101cb7 <dirlookup+0x97>
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
80101c37: 8b 53 58 mov 0x58(%ebx),%edx
80101c3a: 31 ff xor %edi,%edi
80101c3c: 8d 75 d8 lea -0x28(%ebp),%esi
80101c3f: 85 d2 test %edx,%edx
80101c41: 75 0d jne 80101c50 <dirlookup+0x30>
80101c43: eb 5b jmp 80101ca0 <dirlookup+0x80>
80101c45: 8d 76 00 lea 0x0(%esi),%esi
80101c48: 83 c7 10 add $0x10,%edi
80101c4b: 39 7b 58 cmp %edi,0x58(%ebx)
80101c4e: 76 50 jbe 80101ca0 <dirlookup+0x80>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101c50: 6a 10 push $0x10
80101c52: 57 push %edi
80101c53: 56 push %esi
80101c54: 53 push %ebx
80101c55: e8 76 fd ff ff call 801019d0 <readi>
80101c5a: 83 c4 10 add $0x10,%esp
80101c5d: 83 f8 10 cmp $0x10,%eax
80101c60: 75 48 jne 80101caa <dirlookup+0x8a>
panic("dirlookup read");
if(de.inum == 0)
80101c62: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80101c67: 74 df je 80101c48 <dirlookup+0x28>
// Directories
int
namecmp(const char *s, const char *t)
{
return strncmp(s, t, DIRSIZ);
80101c69: 8d 45 da lea -0x26(%ebp),%eax
80101c6c: 83 ec 04 sub $0x4,%esp
80101c6f: 6a 0e push $0xe
80101c71: 50 push %eax
80101c72: ff 75 0c pushl 0xc(%ebp)
80101c75: e8 56 29 00 00 call 801045d0 <strncmp>
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlookup read");
if(de.inum == 0)
continue;
if(namecmp(name, de.name) == 0){
80101c7a: 83 c4 10 add $0x10,%esp
80101c7d: 85 c0 test %eax,%eax
80101c7f: 75 c7 jne 80101c48 <dirlookup+0x28>
// entry matches path element
if(poff)
80101c81: 8b 45 10 mov 0x10(%ebp),%eax
80101c84: 85 c0 test %eax,%eax
80101c86: 74 05 je 80101c8d <dirlookup+0x6d>
*poff = off;
80101c88: 8b 45 10 mov 0x10(%ebp),%eax
80101c8b: 89 38 mov %edi,(%eax)
inum = de.inum;
return iget(dp->dev, inum);
80101c8d: 0f b7 55 d8 movzwl -0x28(%ebp),%edx
80101c91: 8b 03 mov (%ebx),%eax
80101c93: e8 78 f5 ff ff call 80101210 <iget>
}
}
return 0;
}
80101c98: 8d 65 f4 lea -0xc(%ebp),%esp
80101c9b: 5b pop %ebx
80101c9c: 5e pop %esi
80101c9d: 5f pop %edi
80101c9e: 5d pop %ebp
80101c9f: c3 ret
80101ca0: 8d 65 f4 lea -0xc(%ebp),%esp
inum = de.inum;
return iget(dp->dev, inum);
}
}
return 0;
80101ca3: 31 c0 xor %eax,%eax
}
80101ca5: 5b pop %ebx
80101ca6: 5e pop %esi
80101ca7: 5f pop %edi
80101ca8: 5d pop %ebp
80101ca9: c3 ret
if(dp->type != T_DIR)
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlookup read");
80101caa: 83 ec 0c sub $0xc,%esp
80101cad: 68 b9 70 10 80 push $0x801070b9
80101cb2: e8 b9 e6 ff ff call 80100370 <panic>
{
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
panic("dirlookup not DIR");
80101cb7: 83 ec 0c sub $0xc,%esp
80101cba: 68 a7 70 10 80 push $0x801070a7
80101cbf: e8 ac e6 ff ff call 80100370 <panic>
80101cc4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80101cca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80101cd0 <namex>:
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
// Must be called inside a transaction since it calls iput().
static struct inode*
namex(char *path, int nameiparent, char *name)
{
80101cd0: 55 push %ebp
80101cd1: 89 e5 mov %esp,%ebp
80101cd3: 57 push %edi
80101cd4: 56 push %esi
80101cd5: 53 push %ebx
80101cd6: 89 cf mov %ecx,%edi
80101cd8: 89 c3 mov %eax,%ebx
80101cda: 83 ec 1c sub $0x1c,%esp
struct inode *ip, *next;
if(*path == '/')
80101cdd: 80 38 2f cmpb $0x2f,(%eax)
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
// Must be called inside a transaction since it calls iput().
static struct inode*
namex(char *path, int nameiparent, char *name)
{
80101ce0: 89 55 e0 mov %edx,-0x20(%ebp)
struct inode *ip, *next;
if(*path == '/')
80101ce3: 0f 84 53 01 00 00 je 80101e3c <namex+0x16c>
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(myproc()->cwd);
80101ce9: e8 12 1b 00 00 call 80103800 <myproc>
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
acquire(&icache.lock);
80101cee: 83 ec 0c sub $0xc,%esp
struct inode *ip, *next;
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(myproc()->cwd);
80101cf1: 8b 70 68 mov 0x68(%eax),%esi
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
acquire(&icache.lock);
80101cf4: 68 e0 09 11 80 push $0x801109e0
80101cf9: e8 a2 26 00 00 call 801043a0 <acquire>
ip->ref++;
80101cfe: 83 46 08 01 addl $0x1,0x8(%esi)
release(&icache.lock);
80101d02: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp)
80101d09: e8 42 27 00 00 call 80104450 <release>
80101d0e: 83 c4 10 add $0x10,%esp
80101d11: eb 08 jmp 80101d1b <namex+0x4b>
80101d13: 90 nop
80101d14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
{
char *s;
int len;
while(*path == '/')
path++;
80101d18: 83 c3 01 add $0x1,%ebx
skipelem(char *path, char *name)
{
char *s;
int len;
while(*path == '/')
80101d1b: 0f b6 03 movzbl (%ebx),%eax
80101d1e: 3c 2f cmp $0x2f,%al
80101d20: 74 f6 je 80101d18 <namex+0x48>
path++;
if(*path == 0)
80101d22: 84 c0 test %al,%al
80101d24: 0f 84 e3 00 00 00 je 80101e0d <namex+0x13d>
return 0;
s = path;
while(*path != '/' && *path != 0)
80101d2a: 0f b6 03 movzbl (%ebx),%eax
80101d2d: 89 da mov %ebx,%edx
80101d2f: 84 c0 test %al,%al
80101d31: 0f 84 ac 00 00 00 je 80101de3 <namex+0x113>
80101d37: 3c 2f cmp $0x2f,%al
80101d39: 75 09 jne 80101d44 <namex+0x74>
80101d3b: e9 a3 00 00 00 jmp 80101de3 <namex+0x113>
80101d40: 84 c0 test %al,%al
80101d42: 74 0a je 80101d4e <namex+0x7e>
path++;
80101d44: 83 c2 01 add $0x1,%edx
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
80101d47: 0f b6 02 movzbl (%edx),%eax
80101d4a: 3c 2f cmp $0x2f,%al
80101d4c: 75 f2 jne 80101d40 <namex+0x70>
80101d4e: 89 d1 mov %edx,%ecx
80101d50: 29 d9 sub %ebx,%ecx
path++;
len = path - s;
if(len >= DIRSIZ)
80101d52: 83 f9 0d cmp $0xd,%ecx
80101d55: 0f 8e 8d 00 00 00 jle 80101de8 <namex+0x118>
memmove(name, s, DIRSIZ);
80101d5b: 83 ec 04 sub $0x4,%esp
80101d5e: 89 55 e4 mov %edx,-0x1c(%ebp)
80101d61: 6a 0e push $0xe
80101d63: 53 push %ebx
80101d64: 57 push %edi
80101d65: e8 e6 27 00 00 call 80104550 <memmove>
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
path++;
80101d6a: 8b 55 e4 mov -0x1c(%ebp),%edx
len = path - s;
if(len >= DIRSIZ)
memmove(name, s, DIRSIZ);
80101d6d: 83 c4 10 add $0x10,%esp
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
path++;
80101d70: 89 d3 mov %edx,%ebx
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
80101d72: 80 3a 2f cmpb $0x2f,(%edx)
80101d75: 75 11 jne 80101d88 <namex+0xb8>
80101d77: 89 f6 mov %esi,%esi
80101d79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
path++;
80101d80: 83 c3 01 add $0x1,%ebx
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
80101d83: 80 3b 2f cmpb $0x2f,(%ebx)
80101d86: 74 f8 je 80101d80 <namex+0xb0>
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(myproc()->cwd);
while((path = skipelem(path, name)) != 0){
ilock(ip);
80101d88: 83 ec 0c sub $0xc,%esp
80101d8b: 56 push %esi
80101d8c: e8 1f f9 ff ff call 801016b0 <ilock>
if(ip->type != T_DIR){
80101d91: 83 c4 10 add $0x10,%esp
80101d94: 66 83 7e 50 01 cmpw $0x1,0x50(%esi)
80101d99: 0f 85 7f 00 00 00 jne 80101e1e <namex+0x14e>
iunlockput(ip);
return 0;
}
if(nameiparent && *path == '\0'){
80101d9f: 8b 55 e0 mov -0x20(%ebp),%edx
80101da2: 85 d2 test %edx,%edx
80101da4: 74 09 je 80101daf <namex+0xdf>
80101da6: 80 3b 00 cmpb $0x0,(%ebx)
80101da9: 0f 84 a3 00 00 00 je 80101e52 <namex+0x182>
// Stop one level early.
iunlock(ip);
return ip;
}
if((next = dirlookup(ip, name, 0)) == 0){
80101daf: 83 ec 04 sub $0x4,%esp
80101db2: 6a 00 push $0x0
80101db4: 57 push %edi
80101db5: 56 push %esi
80101db6: e8 65 fe ff ff call 80101c20 <dirlookup>
80101dbb: 83 c4 10 add $0x10,%esp
80101dbe: 85 c0 test %eax,%eax
80101dc0: 74 5c je 80101e1e <namex+0x14e>
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
80101dc2: 83 ec 0c sub $0xc,%esp
80101dc5: 89 45 e4 mov %eax,-0x1c(%ebp)
80101dc8: 56 push %esi
80101dc9: e8 e2 f9 ff ff call 801017b0 <iunlock>
iput(ip);
80101dce: 89 34 24 mov %esi,(%esp)
80101dd1: e8 2a fa ff ff call 80101800 <iput>
80101dd6: 8b 45 e4 mov -0x1c(%ebp),%eax
80101dd9: 83 c4 10 add $0x10,%esp
80101ddc: 89 c6 mov %eax,%esi
80101dde: e9 38 ff ff ff jmp 80101d1b <namex+0x4b>
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
80101de3: 31 c9 xor %ecx,%ecx
80101de5: 8d 76 00 lea 0x0(%esi),%esi
path++;
len = path - s;
if(len >= DIRSIZ)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
80101de8: 83 ec 04 sub $0x4,%esp
80101deb: 89 55 dc mov %edx,-0x24(%ebp)
80101dee: 89 4d e4 mov %ecx,-0x1c(%ebp)
80101df1: 51 push %ecx
80101df2: 53 push %ebx
80101df3: 57 push %edi
80101df4: e8 57 27 00 00 call 80104550 <memmove>
name[len] = 0;
80101df9: 8b 4d e4 mov -0x1c(%ebp),%ecx
80101dfc: 8b 55 dc mov -0x24(%ebp),%edx
80101dff: 83 c4 10 add $0x10,%esp
80101e02: c6 04 0f 00 movb $0x0,(%edi,%ecx,1)
80101e06: 89 d3 mov %edx,%ebx
80101e08: e9 65 ff ff ff jmp 80101d72 <namex+0xa2>
return 0;
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
80101e0d: 8b 45 e0 mov -0x20(%ebp),%eax
80101e10: 85 c0 test %eax,%eax
80101e12: 75 54 jne 80101e68 <namex+0x198>
80101e14: 89 f0 mov %esi,%eax
iput(ip);
return 0;
}
return ip;
}
80101e16: 8d 65 f4 lea -0xc(%ebp),%esp
80101e19: 5b pop %ebx
80101e1a: 5e pop %esi
80101e1b: 5f pop %edi
80101e1c: 5d pop %ebp
80101e1d: c3 ret
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
iunlock(ip);
80101e1e: 83 ec 0c sub $0xc,%esp
80101e21: 56 push %esi
80101e22: e8 89 f9 ff ff call 801017b0 <iunlock>
iput(ip);
80101e27: 89 34 24 mov %esi,(%esp)
80101e2a: e8 d1 f9 ff ff call 80101800 <iput>
iunlock(ip);
return ip;
}
if((next = dirlookup(ip, name, 0)) == 0){
iunlockput(ip);
return 0;
80101e2f: 83 c4 10 add $0x10,%esp
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101e32: 8d 65 f4 lea -0xc(%ebp),%esp
iunlock(ip);
return ip;
}
if((next = dirlookup(ip, name, 0)) == 0){
iunlockput(ip);
return 0;
80101e35: 31 c0 xor %eax,%eax
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101e37: 5b pop %ebx
80101e38: 5e pop %esi
80101e39: 5f pop %edi
80101e3a: 5d pop %ebp
80101e3b: c3 ret
namex(char *path, int nameiparent, char *name)
{
struct inode *ip, *next;
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
80101e3c: ba 01 00 00 00 mov $0x1,%edx
80101e41: b8 01 00 00 00 mov $0x1,%eax
80101e46: e8 c5 f3 ff ff call 80101210 <iget>
80101e4b: 89 c6 mov %eax,%esi
80101e4d: e9 c9 fe ff ff jmp 80101d1b <namex+0x4b>
iunlockput(ip);
return 0;
}
if(nameiparent && *path == '\0'){
// Stop one level early.
iunlock(ip);
80101e52: 83 ec 0c sub $0xc,%esp
80101e55: 56 push %esi
80101e56: e8 55 f9 ff ff call 801017b0 <iunlock>
return ip;
80101e5b: 83 c4 10 add $0x10,%esp
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101e5e: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
}
if(nameiparent && *path == '\0'){
// Stop one level early.
iunlock(ip);
return ip;
80101e61: 89 f0 mov %esi,%eax
if(nameiparent){
iput(ip);
return 0;
}
return ip;
}
80101e63: 5b pop %ebx
80101e64: 5e pop %esi
80101e65: 5f pop %edi
80101e66: 5d pop %ebp
80101e67: c3 ret
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
iput(ip);
80101e68: 83 ec 0c sub $0xc,%esp
80101e6b: 56 push %esi
80101e6c: e8 8f f9 ff ff call 80101800 <iput>
return 0;
80101e71: 83 c4 10 add $0x10,%esp
80101e74: 31 c0 xor %eax,%eax
80101e76: eb 9e jmp 80101e16 <namex+0x146>
80101e78: 90 nop
80101e79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101e80 <dirlink>:
}
// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
80101e80: 55 push %ebp
80101e81: 89 e5 mov %esp,%ebp
80101e83: 57 push %edi
80101e84: 56 push %esi
80101e85: 53 push %ebx
80101e86: 83 ec 20 sub $0x20,%esp
80101e89: 8b 5d 08 mov 0x8(%ebp),%ebx
int off;
struct dirent de;
struct inode *ip;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
80101e8c: 6a 00 push $0x0
80101e8e: ff 75 0c pushl 0xc(%ebp)
80101e91: 53 push %ebx
80101e92: e8 89 fd ff ff call 80101c20 <dirlookup>
80101e97: 83 c4 10 add $0x10,%esp
80101e9a: 85 c0 test %eax,%eax
80101e9c: 75 67 jne 80101f05 <dirlink+0x85>
iput(ip);
return -1;
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
80101e9e: 8b 7b 58 mov 0x58(%ebx),%edi
80101ea1: 8d 75 d8 lea -0x28(%ebp),%esi
80101ea4: 85 ff test %edi,%edi
80101ea6: 74 29 je 80101ed1 <dirlink+0x51>
80101ea8: 31 ff xor %edi,%edi
80101eaa: 8d 75 d8 lea -0x28(%ebp),%esi
80101ead: eb 09 jmp 80101eb8 <dirlink+0x38>
80101eaf: 90 nop
80101eb0: 83 c7 10 add $0x10,%edi
80101eb3: 39 7b 58 cmp %edi,0x58(%ebx)
80101eb6: 76 19 jbe 80101ed1 <dirlink+0x51>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101eb8: 6a 10 push $0x10
80101eba: 57 push %edi
80101ebb: 56 push %esi
80101ebc: 53 push %ebx
80101ebd: e8 0e fb ff ff call 801019d0 <readi>
80101ec2: 83 c4 10 add $0x10,%esp
80101ec5: 83 f8 10 cmp $0x10,%eax
80101ec8: 75 4e jne 80101f18 <dirlink+0x98>
panic("dirlink read");
if(de.inum == 0)
80101eca: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80101ecf: 75 df jne 80101eb0 <dirlink+0x30>
break;
}
strncpy(de.name, name, DIRSIZ);
80101ed1: 8d 45 da lea -0x26(%ebp),%eax
80101ed4: 83 ec 04 sub $0x4,%esp
80101ed7: 6a 0e push $0xe
80101ed9: ff 75 0c pushl 0xc(%ebp)
80101edc: 50 push %eax
80101edd: e8 5e 27 00 00 call 80104640 <strncpy>
de.inum = inum;
80101ee2: 8b 45 10 mov 0x10(%ebp),%eax
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101ee5: 6a 10 push $0x10
80101ee7: 57 push %edi
80101ee8: 56 push %esi
80101ee9: 53 push %ebx
if(de.inum == 0)
break;
}
strncpy(de.name, name, DIRSIZ);
de.inum = inum;
80101eea: 66 89 45 d8 mov %ax,-0x28(%ebp)
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80101eee: e8 dd fb ff ff call 80101ad0 <writei>
80101ef3: 83 c4 20 add $0x20,%esp
80101ef6: 83 f8 10 cmp $0x10,%eax
80101ef9: 75 2a jne 80101f25 <dirlink+0xa5>
panic("dirlink");
return 0;
80101efb: 31 c0 xor %eax,%eax
}
80101efd: 8d 65 f4 lea -0xc(%ebp),%esp
80101f00: 5b pop %ebx
80101f01: 5e pop %esi
80101f02: 5f pop %edi
80101f03: 5d pop %ebp
80101f04: c3 ret
struct dirent de;
struct inode *ip;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
iput(ip);
80101f05: 83 ec 0c sub $0xc,%esp
80101f08: 50 push %eax
80101f09: e8 f2 f8 ff ff call 80101800 <iput>
return -1;
80101f0e: 83 c4 10 add $0x10,%esp
80101f11: b8 ff ff ff ff mov $0xffffffff,%eax
80101f16: eb e5 jmp 80101efd <dirlink+0x7d>
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
80101f18: 83 ec 0c sub $0xc,%esp
80101f1b: 68 c8 70 10 80 push $0x801070c8
80101f20: e8 4b e4 ff ff call 80100370 <panic>
}
strncpy(de.name, name, DIRSIZ);
de.inum = inum;
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink");
80101f25: 83 ec 0c sub $0xc,%esp
80101f28: 68 be 76 10 80 push $0x801076be
80101f2d: e8 3e e4 ff ff call 80100370 <panic>
80101f32: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80101f39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101f40 <namei>:
return ip;
}
struct inode*
namei(char *path)
{
80101f40: 55 push %ebp
char name[DIRSIZ];
return namex(path, 0, name);
80101f41: 31 d2 xor %edx,%edx
return ip;
}
struct inode*
namei(char *path)
{
80101f43: 89 e5 mov %esp,%ebp
80101f45: 83 ec 18 sub $0x18,%esp
char name[DIRSIZ];
return namex(path, 0, name);
80101f48: 8b 45 08 mov 0x8(%ebp),%eax
80101f4b: 8d 4d ea lea -0x16(%ebp),%ecx
80101f4e: e8 7d fd ff ff call 80101cd0 <namex>
}
80101f53: c9 leave
80101f54: c3 ret
80101f55: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101f59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80101f60 <nameiparent>:
struct inode*
nameiparent(char *path, char *name)
{
80101f60: 55 push %ebp
return namex(path, 1, name);
80101f61: ba 01 00 00 00 mov $0x1,%edx
return namex(path, 0, name);
}
struct inode*
nameiparent(char *path, char *name)
{
80101f66: 89 e5 mov %esp,%ebp
return namex(path, 1, name);
80101f68: 8b 4d 0c mov 0xc(%ebp),%ecx
80101f6b: 8b 45 08 mov 0x8(%ebp),%eax
}
80101f6e: 5d pop %ebp
}
struct inode*
nameiparent(char *path, char *name)
{
return namex(path, 1, name);
80101f6f: e9 5c fd ff ff jmp 80101cd0 <namex>
80101f74: 66 90 xchg %ax,%ax
80101f76: 66 90 xchg %ax,%ax
80101f78: 66 90 xchg %ax,%ax
80101f7a: 66 90 xchg %ax,%ax
80101f7c: 66 90 xchg %ax,%ax
80101f7e: 66 90 xchg %ax,%ax
80101f80 <idestart>:
}
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
80101f80: 55 push %ebp
if(b == 0)
80101f81: 85 c0 test %eax,%eax
}
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
80101f83: 89 e5 mov %esp,%ebp
80101f85: 56 push %esi
80101f86: 53 push %ebx
if(b == 0)
80101f87: 0f 84 ad 00 00 00 je 8010203a <idestart+0xba>
panic("idestart");
if(b->blockno >= FSSIZE)
80101f8d: 8b 58 08 mov 0x8(%eax),%ebx
80101f90: 89 c1 mov %eax,%ecx
80101f92: 81 fb e7 03 00 00 cmp $0x3e7,%ebx
80101f98: 0f 87 8f 00 00 00 ja 8010202d <idestart+0xad>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80101f9e: ba f7 01 00 00 mov $0x1f7,%edx
80101fa3: 90 nop
80101fa4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80101fa8: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
80101fa9: 83 e0 c0 and $0xffffffc0,%eax
80101fac: 3c 40 cmp $0x40,%al
80101fae: 75 f8 jne 80101fa8 <idestart+0x28>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80101fb0: 31 f6 xor %esi,%esi
80101fb2: ba f6 03 00 00 mov $0x3f6,%edx
80101fb7: 89 f0 mov %esi,%eax
80101fb9: ee out %al,(%dx)
80101fba: ba f2 01 00 00 mov $0x1f2,%edx
80101fbf: b8 01 00 00 00 mov $0x1,%eax
80101fc4: ee out %al,(%dx)
80101fc5: ba f3 01 00 00 mov $0x1f3,%edx
80101fca: 89 d8 mov %ebx,%eax
80101fcc: ee out %al,(%dx)
80101fcd: 89 d8 mov %ebx,%eax
80101fcf: ba f4 01 00 00 mov $0x1f4,%edx
80101fd4: c1 f8 08 sar $0x8,%eax
80101fd7: ee out %al,(%dx)
80101fd8: ba f5 01 00 00 mov $0x1f5,%edx
80101fdd: 89 f0 mov %esi,%eax
80101fdf: ee out %al,(%dx)
80101fe0: 0f b6 41 04 movzbl 0x4(%ecx),%eax
80101fe4: ba f6 01 00 00 mov $0x1f6,%edx
80101fe9: 83 e0 01 and $0x1,%eax
80101fec: c1 e0 04 shl $0x4,%eax
80101fef: 83 c8 e0 or $0xffffffe0,%eax
80101ff2: ee out %al,(%dx)
outb(0x1f2, sector_per_block); // number of sectors
outb(0x1f3, sector & 0xff);
outb(0x1f4, (sector >> 8) & 0xff);
outb(0x1f5, (sector >> 16) & 0xff);
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f));
if(b->flags & B_DIRTY){
80101ff3: f6 01 04 testb $0x4,(%ecx)
80101ff6: ba f7 01 00 00 mov $0x1f7,%edx
80101ffb: 75 13 jne 80102010 <idestart+0x90>
80101ffd: b8 20 00 00 00 mov $0x20,%eax
80102002: ee out %al,(%dx)
outb(0x1f7, write_cmd);
outsl(0x1f0, b->data, BSIZE/4);
} else {
outb(0x1f7, read_cmd);
}
}
80102003: 8d 65 f8 lea -0x8(%ebp),%esp
80102006: 5b pop %ebx
80102007: 5e pop %esi
80102008: 5d pop %ebp
80102009: c3 ret
8010200a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102010: b8 30 00 00 00 mov $0x30,%eax
80102015: ee out %al,(%dx)
}
static inline void
outsl(int port, const void *addr, int cnt)
{
asm volatile("cld; rep outsl" :
80102016: ba f0 01 00 00 mov $0x1f0,%edx
outb(0x1f4, (sector >> 8) & 0xff);
outb(0x1f5, (sector >> 16) & 0xff);
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f));
if(b->flags & B_DIRTY){
outb(0x1f7, write_cmd);
outsl(0x1f0, b->data, BSIZE/4);
8010201b: 8d 71 5c lea 0x5c(%ecx),%esi
8010201e: b9 80 00 00 00 mov $0x80,%ecx
80102023: fc cld
80102024: f3 6f rep outsl %ds:(%esi),(%dx)
} else {
outb(0x1f7, read_cmd);
}
}
80102026: 8d 65 f8 lea -0x8(%ebp),%esp
80102029: 5b pop %ebx
8010202a: 5e pop %esi
8010202b: 5d pop %ebp
8010202c: c3 ret
idestart(struct buf *b)
{
if(b == 0)
panic("idestart");
if(b->blockno >= FSSIZE)
panic("incorrect blockno");
8010202d: 83 ec 0c sub $0xc,%esp
80102030: 68 34 71 10 80 push $0x80107134
80102035: e8 36 e3 ff ff call 80100370 <panic>
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
if(b == 0)
panic("idestart");
8010203a: 83 ec 0c sub $0xc,%esp
8010203d: 68 2b 71 10 80 push $0x8010712b
80102042: e8 29 e3 ff ff call 80100370 <panic>
80102047: 89 f6 mov %esi,%esi
80102049: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102050 <ideinit>:
return 0;
}
void
ideinit(void)
{
80102050: 55 push %ebp
80102051: 89 e5 mov %esp,%ebp
80102053: 83 ec 10 sub $0x10,%esp
int i;
initlock(&idelock, "ide");
80102056: 68 46 71 10 80 push $0x80107146
8010205b: 68 80 a5 10 80 push $0x8010a580
80102060: e8 db 21 00 00 call 80104240 <initlock>
ioapicenable(IRQ_IDE, ncpu - 1);
80102065: 58 pop %eax
80102066: a1 00 2d 11 80 mov 0x80112d00,%eax
8010206b: 5a pop %edx
8010206c: 83 e8 01 sub $0x1,%eax
8010206f: 50 push %eax
80102070: 6a 0e push $0xe
80102072: e8 a9 02 00 00 call 80102320 <ioapicenable>
80102077: 83 c4 10 add $0x10,%esp
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010207a: ba f7 01 00 00 mov $0x1f7,%edx
8010207f: 90 nop
80102080: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
80102081: 83 e0 c0 and $0xffffffc0,%eax
80102084: 3c 40 cmp $0x40,%al
80102086: 75 f8 jne 80102080 <ideinit+0x30>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102088: ba f6 01 00 00 mov $0x1f6,%edx
8010208d: b8 f0 ff ff ff mov $0xfffffff0,%eax
80102092: ee out %al,(%dx)
80102093: b9 e8 03 00 00 mov $0x3e8,%ecx
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102098: ba f7 01 00 00 mov $0x1f7,%edx
8010209d: eb 06 jmp 801020a5 <ideinit+0x55>
8010209f: 90 nop
ioapicenable(IRQ_IDE, ncpu - 1);
idewait(0);
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
for(i=0; i<1000; i++){
801020a0: 83 e9 01 sub $0x1,%ecx
801020a3: 74 0f je 801020b4 <ideinit+0x64>
801020a5: ec in (%dx),%al
if(inb(0x1f7) != 0){
801020a6: 84 c0 test %al,%al
801020a8: 74 f6 je 801020a0 <ideinit+0x50>
havedisk1 = 1;
801020aa: c7 05 60 a5 10 80 01 movl $0x1,0x8010a560
801020b1: 00 00 00
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801020b4: ba f6 01 00 00 mov $0x1f6,%edx
801020b9: b8 e0 ff ff ff mov $0xffffffe0,%eax
801020be: ee out %al,(%dx)
}
}
// Switch back to disk 0.
outb(0x1f6, 0xe0 | (0<<4));
}
801020bf: c9 leave
801020c0: c3 ret
801020c1: eb 0d jmp 801020d0 <ideintr>
801020c3: 90 nop
801020c4: 90 nop
801020c5: 90 nop
801020c6: 90 nop
801020c7: 90 nop
801020c8: 90 nop
801020c9: 90 nop
801020ca: 90 nop
801020cb: 90 nop
801020cc: 90 nop
801020cd: 90 nop
801020ce: 90 nop
801020cf: 90 nop
801020d0 <ideintr>:
}
// Interrupt handler.
void
ideintr(void)
{
801020d0: 55 push %ebp
801020d1: 89 e5 mov %esp,%ebp
801020d3: 57 push %edi
801020d4: 56 push %esi
801020d5: 53 push %ebx
801020d6: 83 ec 18 sub $0x18,%esp
struct buf *b;
// First queued buffer is the active request.
acquire(&idelock);
801020d9: 68 80 a5 10 80 push $0x8010a580
801020de: e8 bd 22 00 00 call 801043a0 <acquire>
if((b = idequeue) == 0){
801020e3: 8b 1d 64 a5 10 80 mov 0x8010a564,%ebx
801020e9: 83 c4 10 add $0x10,%esp
801020ec: 85 db test %ebx,%ebx
801020ee: 74 34 je 80102124 <ideintr+0x54>
release(&idelock);
return;
}
idequeue = b->qnext;
801020f0: 8b 43 58 mov 0x58(%ebx),%eax
801020f3: a3 64 a5 10 80 mov %eax,0x8010a564
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
801020f8: 8b 33 mov (%ebx),%esi
801020fa: f7 c6 04 00 00 00 test $0x4,%esi
80102100: 74 3e je 80102140 <ideintr+0x70>
insl(0x1f0, b->data, BSIZE/4);
// Wake process waiting for this buf.
b->flags |= B_VALID;
b->flags &= ~B_DIRTY;
80102102: 83 e6 fb and $0xfffffffb,%esi
wakeup(b);
80102105: 83 ec 0c sub $0xc,%esp
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
insl(0x1f0, b->data, BSIZE/4);
// Wake process waiting for this buf.
b->flags |= B_VALID;
b->flags &= ~B_DIRTY;
80102108: 83 ce 02 or $0x2,%esi
8010210b: 89 33 mov %esi,(%ebx)
wakeup(b);
8010210d: 53 push %ebx
8010210e: e8 4d 1e 00 00 call 80103f60 <wakeup>
// Start disk on next buf in queue.
if(idequeue != 0)
80102113: a1 64 a5 10 80 mov 0x8010a564,%eax
80102118: 83 c4 10 add $0x10,%esp
8010211b: 85 c0 test %eax,%eax
8010211d: 74 05 je 80102124 <ideintr+0x54>
idestart(idequeue);
8010211f: e8 5c fe ff ff call 80101f80 <idestart>
// First queued buffer is the active request.
acquire(&idelock);
if((b = idequeue) == 0){
release(&idelock);
80102124: 83 ec 0c sub $0xc,%esp
80102127: 68 80 a5 10 80 push $0x8010a580
8010212c: e8 1f 23 00 00 call 80104450 <release>
// Start disk on next buf in queue.
if(idequeue != 0)
idestart(idequeue);
release(&idelock);
}
80102131: 8d 65 f4 lea -0xc(%ebp),%esp
80102134: 5b pop %ebx
80102135: 5e pop %esi
80102136: 5f pop %edi
80102137: 5d pop %ebp
80102138: c3 ret
80102139: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102140: ba f7 01 00 00 mov $0x1f7,%edx
80102145: 8d 76 00 lea 0x0(%esi),%esi
80102148: ec in (%dx),%al
static int
idewait(int checkerr)
{
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
80102149: 89 c1 mov %eax,%ecx
8010214b: 83 e1 c0 and $0xffffffc0,%ecx
8010214e: 80 f9 40 cmp $0x40,%cl
80102151: 75 f5 jne 80102148 <ideintr+0x78>
;
if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
80102153: a8 21 test $0x21,%al
80102155: 75 ab jne 80102102 <ideintr+0x32>
}
idequeue = b->qnext;
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
insl(0x1f0, b->data, BSIZE/4);
80102157: 8d 7b 5c lea 0x5c(%ebx),%edi
}
static inline void
insl(int port, void *addr, int cnt)
{
asm volatile("cld; rep insl" :
8010215a: b9 80 00 00 00 mov $0x80,%ecx
8010215f: ba f0 01 00 00 mov $0x1f0,%edx
80102164: fc cld
80102165: f3 6d rep insl (%dx),%es:(%edi)
80102167: 8b 33 mov (%ebx),%esi
80102169: eb 97 jmp 80102102 <ideintr+0x32>
8010216b: 90 nop
8010216c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102170 <iderw>:
// Sync buf with disk.
// If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
// Else if B_VALID is not set, read buf from disk, set B_VALID.
void
iderw(struct buf *b)
{
80102170: 55 push %ebp
80102171: 89 e5 mov %esp,%ebp
80102173: 53 push %ebx
80102174: 83 ec 10 sub $0x10,%esp
80102177: 8b 5d 08 mov 0x8(%ebp),%ebx
struct buf **pp;
if(!holdingsleep(&b->lock))
8010217a: 8d 43 0c lea 0xc(%ebx),%eax
8010217d: 50 push %eax
8010217e: e8 6d 20 00 00 call 801041f0 <holdingsleep>
80102183: 83 c4 10 add $0x10,%esp
80102186: 85 c0 test %eax,%eax
80102188: 0f 84 ad 00 00 00 je 8010223b <iderw+0xcb>
panic("iderw: buf not locked");
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
8010218e: 8b 03 mov (%ebx),%eax
80102190: 83 e0 06 and $0x6,%eax
80102193: 83 f8 02 cmp $0x2,%eax
80102196: 0f 84 b9 00 00 00 je 80102255 <iderw+0xe5>
panic("iderw: nothing to do");
if(b->dev != 0 && !havedisk1)
8010219c: 8b 53 04 mov 0x4(%ebx),%edx
8010219f: 85 d2 test %edx,%edx
801021a1: 74 0d je 801021b0 <iderw+0x40>
801021a3: a1 60 a5 10 80 mov 0x8010a560,%eax
801021a8: 85 c0 test %eax,%eax
801021aa: 0f 84 98 00 00 00 je 80102248 <iderw+0xd8>
panic("iderw: ide disk 1 not present");
acquire(&idelock); //DOC:acquire-lock
801021b0: 83 ec 0c sub $0xc,%esp
801021b3: 68 80 a5 10 80 push $0x8010a580
801021b8: e8 e3 21 00 00 call 801043a0 <acquire>
// Append b to idequeue.
b->qnext = 0;
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
801021bd: 8b 15 64 a5 10 80 mov 0x8010a564,%edx
801021c3: 83 c4 10 add $0x10,%esp
panic("iderw: ide disk 1 not present");
acquire(&idelock); //DOC:acquire-lock
// Append b to idequeue.
b->qnext = 0;
801021c6: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx)
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
801021cd: 85 d2 test %edx,%edx
801021cf: 75 09 jne 801021da <iderw+0x6a>
801021d1: eb 58 jmp 8010222b <iderw+0xbb>
801021d3: 90 nop
801021d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801021d8: 89 c2 mov %eax,%edx
801021da: 8b 42 58 mov 0x58(%edx),%eax
801021dd: 85 c0 test %eax,%eax
801021df: 75 f7 jne 801021d8 <iderw+0x68>
801021e1: 83 c2 58 add $0x58,%edx
;
*pp = b;
801021e4: 89 1a mov %ebx,(%edx)
// Start disk if necessary.
if(idequeue == b)
801021e6: 3b 1d 64 a5 10 80 cmp 0x8010a564,%ebx
801021ec: 74 44 je 80102232 <iderw+0xc2>
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
801021ee: 8b 03 mov (%ebx),%eax
801021f0: 83 e0 06 and $0x6,%eax
801021f3: 83 f8 02 cmp $0x2,%eax
801021f6: 74 23 je 8010221b <iderw+0xab>
801021f8: 90 nop
801021f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
sleep(b, &idelock);
80102200: 83 ec 08 sub $0x8,%esp
80102203: 68 80 a5 10 80 push $0x8010a580
80102208: 53 push %ebx
80102209: e8 a2 1b 00 00 call 80103db0 <sleep>
// Start disk if necessary.
if(idequeue == b)
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
8010220e: 8b 03 mov (%ebx),%eax
80102210: 83 c4 10 add $0x10,%esp
80102213: 83 e0 06 and $0x6,%eax
80102216: 83 f8 02 cmp $0x2,%eax
80102219: 75 e5 jne 80102200 <iderw+0x90>
sleep(b, &idelock);
}
release(&idelock);
8010221b: c7 45 08 80 a5 10 80 movl $0x8010a580,0x8(%ebp)
}
80102222: 8b 5d fc mov -0x4(%ebp),%ebx
80102225: c9 leave
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
sleep(b, &idelock);
}
release(&idelock);
80102226: e9 25 22 00 00 jmp 80104450 <release>
acquire(&idelock); //DOC:acquire-lock
// Append b to idequeue.
b->qnext = 0;
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
8010222b: ba 64 a5 10 80 mov $0x8010a564,%edx
80102230: eb b2 jmp 801021e4 <iderw+0x74>
;
*pp = b;
// Start disk if necessary.
if(idequeue == b)
idestart(b);
80102232: 89 d8 mov %ebx,%eax
80102234: e8 47 fd ff ff call 80101f80 <idestart>
80102239: eb b3 jmp 801021ee <iderw+0x7e>
iderw(struct buf *b)
{
struct buf **pp;
if(!holdingsleep(&b->lock))
panic("iderw: buf not locked");
8010223b: 83 ec 0c sub $0xc,%esp
8010223e: 68 4a 71 10 80 push $0x8010714a
80102243: e8 28 e1 ff ff call 80100370 <panic>
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
panic("iderw: nothing to do");
if(b->dev != 0 && !havedisk1)
panic("iderw: ide disk 1 not present");
80102248: 83 ec 0c sub $0xc,%esp
8010224b: 68 75 71 10 80 push $0x80107175
80102250: e8 1b e1 ff ff call 80100370 <panic>
struct buf **pp;
if(!holdingsleep(&b->lock))
panic("iderw: buf not locked");
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
panic("iderw: nothing to do");
80102255: 83 ec 0c sub $0xc,%esp
80102258: 68 60 71 10 80 push $0x80107160
8010225d: e8 0e e1 ff ff call 80100370 <panic>
80102262: 66 90 xchg %ax,%ax
80102264: 66 90 xchg %ax,%ax
80102266: 66 90 xchg %ax,%ax
80102268: 66 90 xchg %ax,%ax
8010226a: 66 90 xchg %ax,%ax
8010226c: 66 90 xchg %ax,%ax
8010226e: 66 90 xchg %ax,%ax
80102270 <ioapicinit>:
ioapic->data = data;
}
void
ioapicinit(void)
{
80102270: 55 push %ebp
int i, id, maxintr;
ioapic = (volatile struct ioapic*)IOAPIC;
80102271: c7 05 34 26 11 80 00 movl $0xfec00000,0x80112634
80102278: 00 c0 fe
ioapic->data = data;
}
void
ioapicinit(void)
{
8010227b: 89 e5 mov %esp,%ebp
8010227d: 56 push %esi
8010227e: 53 push %ebx
};
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
8010227f: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000
80102286: 00 00 00
return ioapic->data;
80102289: 8b 15 34 26 11 80 mov 0x80112634,%edx
8010228f: 8b 72 10 mov 0x10(%edx),%esi
};
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
80102292: c7 02 00 00 00 00 movl $0x0,(%edx)
return ioapic->data;
80102298: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
int i, id, maxintr;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
id = ioapicread(REG_ID) >> 24;
if(id != ioapicid)
8010229e: 0f b6 15 60 27 11 80 movzbl 0x80112760,%edx
ioapicinit(void)
{
int i, id, maxintr;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
801022a5: 89 f0 mov %esi,%eax
801022a7: c1 e8 10 shr $0x10,%eax
801022aa: 0f b6 f0 movzbl %al,%esi
static uint
ioapicread(int reg)
{
ioapic->reg = reg;
return ioapic->data;
801022ad: 8b 41 10 mov 0x10(%ecx),%eax
int i, id, maxintr;
ioapic = (volatile struct ioapic*)IOAPIC;
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
id = ioapicread(REG_ID) >> 24;
if(id != ioapicid)
801022b0: c1 e8 18 shr $0x18,%eax
801022b3: 39 d0 cmp %edx,%eax
801022b5: 74 16 je 801022cd <ioapicinit+0x5d>
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
801022b7: 83 ec 0c sub $0xc,%esp
801022ba: 68 94 71 10 80 push $0x80107194
801022bf: e8 9c e3 ff ff call 80100660 <cprintf>
801022c4: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
801022ca: 83 c4 10 add $0x10,%esp
801022cd: 83 c6 21 add $0x21,%esi
ioapic->data = data;
}
void
ioapicinit(void)
{
801022d0: ba 10 00 00 00 mov $0x10,%edx
801022d5: b8 20 00 00 00 mov $0x20,%eax
801022da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
801022e0: 89 11 mov %edx,(%ecx)
ioapic->data = data;
801022e2: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
801022e8: 89 c3 mov %eax,%ebx
801022ea: 81 cb 00 00 01 00 or $0x10000,%ebx
801022f0: 83 c0 01 add $0x1,%eax
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
801022f3: 89 59 10 mov %ebx,0x10(%ecx)
801022f6: 8d 5a 01 lea 0x1(%edx),%ebx
801022f9: 83 c2 02 add $0x2,%edx
if(id != ioapicid)
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
801022fc: 39 f0 cmp %esi,%eax
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
801022fe: 89 19 mov %ebx,(%ecx)
ioapic->data = data;
80102300: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
80102306: c7 41 10 00 00 00 00 movl $0x0,0x10(%ecx)
if(id != ioapicid)
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
8010230d: 75 d1 jne 801022e0 <ioapicinit+0x70>
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
ioapicwrite(REG_TABLE+2*i+1, 0);
}
}
8010230f: 8d 65 f8 lea -0x8(%ebp),%esp
80102312: 5b pop %ebx
80102313: 5e pop %esi
80102314: 5d pop %ebp
80102315: c3 ret
80102316: 8d 76 00 lea 0x0(%esi),%esi
80102319: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102320 <ioapicenable>:
void
ioapicenable(int irq, int cpunum)
{
80102320: 55 push %ebp
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
80102321: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
}
}
void
ioapicenable(int irq, int cpunum)
{
80102327: 89 e5 mov %esp,%ebp
80102329: 8b 45 08 mov 0x8(%ebp),%eax
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
8010232c: 8d 50 20 lea 0x20(%eax),%edx
8010232f: 8d 44 00 10 lea 0x10(%eax,%eax,1),%eax
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
80102333: 89 01 mov %eax,(%ecx)
ioapic->data = data;
80102335: 8b 0d 34 26 11 80 mov 0x80112634,%ecx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
8010233b: 83 c0 01 add $0x1,%eax
ioapic->data = data;
8010233e: 89 51 10 mov %edx,0x10(%ecx)
{
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
80102341: 8b 55 0c mov 0xc(%ebp),%edx
}
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
80102344: 89 01 mov %eax,(%ecx)
ioapic->data = data;
80102346: a1 34 26 11 80 mov 0x80112634,%eax
{
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
8010234b: c1 e2 18 shl $0x18,%edx
static void
ioapicwrite(int reg, uint data)
{
ioapic->reg = reg;
ioapic->data = data;
8010234e: 89 50 10 mov %edx,0x10(%eax)
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
}
80102351: 5d pop %ebp
80102352: c3 ret
80102353: 66 90 xchg %ax,%ax
80102355: 66 90 xchg %ax,%ax
80102357: 66 90 xchg %ax,%ax
80102359: 66 90 xchg %ax,%ax
8010235b: 66 90 xchg %ax,%ax
8010235d: 66 90 xchg %ax,%ax
8010235f: 90 nop
80102360 <kfree>:
// which normally should have been returned by a
// call to kalloc(). (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(char *v)
{
80102360: 55 push %ebp
80102361: 89 e5 mov %esp,%ebp
80102363: 53 push %ebx
80102364: 83 ec 04 sub $0x4,%esp
80102367: 8b 5d 08 mov 0x8(%ebp),%ebx
struct run *r;
if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
8010236a: f7 c3 ff 0f 00 00 test $0xfff,%ebx
80102370: 75 70 jne 801023e2 <kfree+0x82>
80102372: 81 fb a8 54 11 80 cmp $0x801154a8,%ebx
80102378: 72 68 jb 801023e2 <kfree+0x82>
8010237a: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax
80102380: 3d ff ff ff 0d cmp $0xdffffff,%eax
80102385: 77 5b ja 801023e2 <kfree+0x82>
panic("kfree");
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
80102387: 83 ec 04 sub $0x4,%esp
8010238a: 68 00 10 00 00 push $0x1000
8010238f: 6a 01 push $0x1
80102391: 53 push %ebx
80102392: e8 09 21 00 00 call 801044a0 <memset>
if(kmem.use_lock)
80102397: 8b 15 74 26 11 80 mov 0x80112674,%edx
8010239d: 83 c4 10 add $0x10,%esp
801023a0: 85 d2 test %edx,%edx
801023a2: 75 2c jne 801023d0 <kfree+0x70>
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
801023a4: a1 78 26 11 80 mov 0x80112678,%eax
801023a9: 89 03 mov %eax,(%ebx)
kmem.freelist = r;
if(kmem.use_lock)
801023ab: a1 74 26 11 80 mov 0x80112674,%eax
if(kmem.use_lock)
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
801023b0: 89 1d 78 26 11 80 mov %ebx,0x80112678
if(kmem.use_lock)
801023b6: 85 c0 test %eax,%eax
801023b8: 75 06 jne 801023c0 <kfree+0x60>
release(&kmem.lock);
}
801023ba: 8b 5d fc mov -0x4(%ebp),%ebx
801023bd: c9 leave
801023be: c3 ret
801023bf: 90 nop
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
if(kmem.use_lock)
release(&kmem.lock);
801023c0: c7 45 08 40 26 11 80 movl $0x80112640,0x8(%ebp)
}
801023c7: 8b 5d fc mov -0x4(%ebp),%ebx
801023ca: c9 leave
acquire(&kmem.lock);
r = (struct run*)v;
r->next = kmem.freelist;
kmem.freelist = r;
if(kmem.use_lock)
release(&kmem.lock);
801023cb: e9 80 20 00 00 jmp 80104450 <release>
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
if(kmem.use_lock)
acquire(&kmem.lock);
801023d0: 83 ec 0c sub $0xc,%esp
801023d3: 68 40 26 11 80 push $0x80112640
801023d8: e8 c3 1f 00 00 call 801043a0 <acquire>
801023dd: 83 c4 10 add $0x10,%esp
801023e0: eb c2 jmp 801023a4 <kfree+0x44>
kfree(char *v)
{
struct run *r;
if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP)
panic("kfree");
801023e2: 83 ec 0c sub $0xc,%esp
801023e5: 68 c6 71 10 80 push $0x801071c6
801023ea: e8 81 df ff ff call 80100370 <panic>
801023ef: 90 nop
801023f0 <freerange>:
kmem.use_lock = 1;
}
void
freerange(void *vstart, void *vend)
{
801023f0: 55 push %ebp
801023f1: 89 e5 mov %esp,%ebp
801023f3: 56 push %esi
801023f4: 53 push %ebx
char *p;
p = (char*)PGROUNDUP((uint)vstart);
801023f5: 8b 45 08 mov 0x8(%ebp),%eax
kmem.use_lock = 1;
}
void
freerange(void *vstart, void *vend)
{
801023f8: 8b 75 0c mov 0xc(%ebp),%esi
char *p;
p = (char*)PGROUNDUP((uint)vstart);
801023fb: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx
80102401: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102407: 81 c3 00 10 00 00 add $0x1000,%ebx
8010240d: 39 de cmp %ebx,%esi
8010240f: 72 23 jb 80102434 <freerange+0x44>
80102411: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
kfree(p);
80102418: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax
8010241e: 83 ec 0c sub $0xc,%esp
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102421: 81 c3 00 10 00 00 add $0x1000,%ebx
kfree(p);
80102427: 50 push %eax
80102428: e8 33 ff ff ff call 80102360 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
8010242d: 83 c4 10 add $0x10,%esp
80102430: 39 f3 cmp %esi,%ebx
80102432: 76 e4 jbe 80102418 <freerange+0x28>
kfree(p);
}
80102434: 8d 65 f8 lea -0x8(%ebp),%esp
80102437: 5b pop %ebx
80102438: 5e pop %esi
80102439: 5d pop %ebp
8010243a: c3 ret
8010243b: 90 nop
8010243c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102440 <kinit1>:
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
80102440: 55 push %ebp
80102441: 89 e5 mov %esp,%ebp
80102443: 56 push %esi
80102444: 53 push %ebx
80102445: 8b 75 0c mov 0xc(%ebp),%esi
initlock(&kmem.lock, "kmem");
80102448: 83 ec 08 sub $0x8,%esp
8010244b: 68 cc 71 10 80 push $0x801071cc
80102450: 68 40 26 11 80 push $0x80112640
80102455: e8 e6 1d 00 00 call 80104240 <initlock>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
8010245a: 8b 45 08 mov 0x8(%ebp),%eax
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
8010245d: 83 c4 10 add $0x10,%esp
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
initlock(&kmem.lock, "kmem");
kmem.use_lock = 0;
80102460: c7 05 74 26 11 80 00 movl $0x0,0x80112674
80102467: 00 00 00
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
8010246a: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx
80102470: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102476: 81 c3 00 10 00 00 add $0x1000,%ebx
8010247c: 39 de cmp %ebx,%esi
8010247e: 72 1c jb 8010249c <kinit1+0x5c>
kfree(p);
80102480: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax
80102486: 83 ec 0c sub $0xc,%esp
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102489: 81 c3 00 10 00 00 add $0x1000,%ebx
kfree(p);
8010248f: 50 push %eax
80102490: e8 cb fe ff ff call 80102360 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102495: 83 c4 10 add $0x10,%esp
80102498: 39 de cmp %ebx,%esi
8010249a: 73 e4 jae 80102480 <kinit1+0x40>
kinit1(void *vstart, void *vend)
{
initlock(&kmem.lock, "kmem");
kmem.use_lock = 0;
freerange(vstart, vend);
}
8010249c: 8d 65 f8 lea -0x8(%ebp),%esp
8010249f: 5b pop %ebx
801024a0: 5e pop %esi
801024a1: 5d pop %ebp
801024a2: c3 ret
801024a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801024a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801024b0 <kinit2>:
void
kinit2(void *vstart, void *vend)
{
801024b0: 55 push %ebp
801024b1: 89 e5 mov %esp,%ebp
801024b3: 56 push %esi
801024b4: 53 push %ebx
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
801024b5: 8b 45 08 mov 0x8(%ebp),%eax
freerange(vstart, vend);
}
void
kinit2(void *vstart, void *vend)
{
801024b8: 8b 75 0c mov 0xc(%ebp),%esi
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
801024bb: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx
801024c1: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
801024c7: 81 c3 00 10 00 00 add $0x1000,%ebx
801024cd: 39 de cmp %ebx,%esi
801024cf: 72 23 jb 801024f4 <kinit2+0x44>
801024d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
kfree(p);
801024d8: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax
801024de: 83 ec 0c sub $0xc,%esp
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
801024e1: 81 c3 00 10 00 00 add $0x1000,%ebx
kfree(p);
801024e7: 50 push %eax
801024e8: e8 73 fe ff ff call 80102360 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
801024ed: 83 c4 10 add $0x10,%esp
801024f0: 39 de cmp %ebx,%esi
801024f2: 73 e4 jae 801024d8 <kinit2+0x28>
void
kinit2(void *vstart, void *vend)
{
freerange(vstart, vend);
kmem.use_lock = 1;
801024f4: c7 05 74 26 11 80 01 movl $0x1,0x80112674
801024fb: 00 00 00
}
801024fe: 8d 65 f8 lea -0x8(%ebp),%esp
80102501: 5b pop %ebx
80102502: 5e pop %esi
80102503: 5d pop %ebp
80102504: c3 ret
80102505: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102509: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102510 <kalloc>:
// Allocate one 4096-byte page of physical memory.
// Returns a pointer that the kernel can use.
// Returns 0 if the memory cannot be allocated.
char*
kalloc(void)
{
80102510: 55 push %ebp
80102511: 89 e5 mov %esp,%ebp
80102513: 53 push %ebx
80102514: 83 ec 04 sub $0x4,%esp
struct run *r;
if(kmem.use_lock)
80102517: a1 74 26 11 80 mov 0x80112674,%eax
8010251c: 85 c0 test %eax,%eax
8010251e: 75 30 jne 80102550 <kalloc+0x40>
acquire(&kmem.lock);
r = kmem.freelist;
80102520: 8b 1d 78 26 11 80 mov 0x80112678,%ebx
if(r)
80102526: 85 db test %ebx,%ebx
80102528: 74 1c je 80102546 <kalloc+0x36>
kmem.freelist = r->next;
8010252a: 8b 13 mov (%ebx),%edx
8010252c: 89 15 78 26 11 80 mov %edx,0x80112678
if(kmem.use_lock)
80102532: 85 c0 test %eax,%eax
80102534: 74 10 je 80102546 <kalloc+0x36>
release(&kmem.lock);
80102536: 83 ec 0c sub $0xc,%esp
80102539: 68 40 26 11 80 push $0x80112640
8010253e: e8 0d 1f 00 00 call 80104450 <release>
80102543: 83 c4 10 add $0x10,%esp
return (char*)r;
}
80102546: 89 d8 mov %ebx,%eax
80102548: 8b 5d fc mov -0x4(%ebp),%ebx
8010254b: c9 leave
8010254c: c3 ret
8010254d: 8d 76 00 lea 0x0(%esi),%esi
kalloc(void)
{
struct run *r;
if(kmem.use_lock)
acquire(&kmem.lock);
80102550: 83 ec 0c sub $0xc,%esp
80102553: 68 40 26 11 80 push $0x80112640
80102558: e8 43 1e 00 00 call 801043a0 <acquire>
r = kmem.freelist;
8010255d: 8b 1d 78 26 11 80 mov 0x80112678,%ebx
if(r)
80102563: 83 c4 10 add $0x10,%esp
80102566: a1 74 26 11 80 mov 0x80112674,%eax
8010256b: 85 db test %ebx,%ebx
8010256d: 75 bb jne 8010252a <kalloc+0x1a>
8010256f: eb c1 jmp 80102532 <kalloc+0x22>
80102571: 66 90 xchg %ax,%ax
80102573: 66 90 xchg %ax,%ax
80102575: 66 90 xchg %ax,%ax
80102577: 66 90 xchg %ax,%ax
80102579: 66 90 xchg %ax,%ax
8010257b: 66 90 xchg %ax,%ax
8010257d: 66 90 xchg %ax,%ax
8010257f: 90 nop
80102580 <kbdgetc>:
#include "defs.h"
#include "kbd.h"
int
kbdgetc(void)
{
80102580: 55 push %ebp
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102581: ba 64 00 00 00 mov $0x64,%edx
80102586: 89 e5 mov %esp,%ebp
80102588: ec in (%dx),%al
normalmap, shiftmap, ctlmap, ctlmap
};
uint st, data, c;
st = inb(KBSTATP);
if((st & KBS_DIB) == 0)
80102589: a8 01 test $0x1,%al
8010258b: 0f 84 af 00 00 00 je 80102640 <kbdgetc+0xc0>
80102591: ba 60 00 00 00 mov $0x60,%edx
80102596: ec in (%dx),%al
return -1;
data = inb(KBDATAP);
80102597: 0f b6 d0 movzbl %al,%edx
if(data == 0xE0){
8010259a: 81 fa e0 00 00 00 cmp $0xe0,%edx
801025a0: 74 7e je 80102620 <kbdgetc+0xa0>
shift |= E0ESC;
return 0;
} else if(data & 0x80){
801025a2: 84 c0 test %al,%al
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
801025a4: 8b 0d b4 a5 10 80 mov 0x8010a5b4,%ecx
data = inb(KBDATAP);
if(data == 0xE0){
shift |= E0ESC;
return 0;
} else if(data & 0x80){
801025aa: 79 24 jns 801025d0 <kbdgetc+0x50>
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
801025ac: f6 c1 40 test $0x40,%cl
801025af: 75 05 jne 801025b6 <kbdgetc+0x36>
801025b1: 89 c2 mov %eax,%edx
801025b3: 83 e2 7f and $0x7f,%edx
shift &= ~(shiftcode[data] | E0ESC);
801025b6: 0f b6 82 00 73 10 80 movzbl -0x7fef8d00(%edx),%eax
801025bd: 83 c8 40 or $0x40,%eax
801025c0: 0f b6 c0 movzbl %al,%eax
801025c3: f7 d0 not %eax
801025c5: 21 c8 and %ecx,%eax
801025c7: a3 b4 a5 10 80 mov %eax,0x8010a5b4
return 0;
801025cc: 31 c0 xor %eax,%eax
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
}
return c;
}
801025ce: 5d pop %ebp
801025cf: c3 ret
} else if(data & 0x80){
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
shift &= ~(shiftcode[data] | E0ESC);
return 0;
} else if(shift & E0ESC){
801025d0: f6 c1 40 test $0x40,%cl
801025d3: 74 09 je 801025de <kbdgetc+0x5e>
// Last character was an E0 escape; or with 0x80
data |= 0x80;
801025d5: 83 c8 80 or $0xffffff80,%eax
shift &= ~E0ESC;
801025d8: 83 e1 bf and $0xffffffbf,%ecx
data = (shift & E0ESC ? data : data & 0x7F);
shift &= ~(shiftcode[data] | E0ESC);
return 0;
} else if(shift & E0ESC){
// Last character was an E0 escape; or with 0x80
data |= 0x80;
801025db: 0f b6 d0 movzbl %al,%edx
shift &= ~E0ESC;
}
shift |= shiftcode[data];
shift ^= togglecode[data];
801025de: 0f b6 82 00 73 10 80 movzbl -0x7fef8d00(%edx),%eax
801025e5: 09 c1 or %eax,%ecx
801025e7: 0f b6 82 00 72 10 80 movzbl -0x7fef8e00(%edx),%eax
801025ee: 31 c1 xor %eax,%ecx
c = charcode[shift & (CTL | SHIFT)][data];
801025f0: 89 c8 mov %ecx,%eax
data |= 0x80;
shift &= ~E0ESC;
}
shift |= shiftcode[data];
shift ^= togglecode[data];
801025f2: 89 0d b4 a5 10 80 mov %ecx,0x8010a5b4
c = charcode[shift & (CTL | SHIFT)][data];
801025f8: 83 e0 03 and $0x3,%eax
if(shift & CAPSLOCK){
801025fb: 83 e1 08 and $0x8,%ecx
shift &= ~E0ESC;
}
shift |= shiftcode[data];
shift ^= togglecode[data];
c = charcode[shift & (CTL | SHIFT)][data];
801025fe: 8b 04 85 e0 71 10 80 mov -0x7fef8e20(,%eax,4),%eax
80102605: 0f b6 04 10 movzbl (%eax,%edx,1),%eax
if(shift & CAPSLOCK){
80102609: 74 c3 je 801025ce <kbdgetc+0x4e>
if('a' <= c && c <= 'z')
8010260b: 8d 50 9f lea -0x61(%eax),%edx
8010260e: 83 fa 19 cmp $0x19,%edx
80102611: 77 1d ja 80102630 <kbdgetc+0xb0>
c += 'A' - 'a';
80102613: 83 e8 20 sub $0x20,%eax
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
}
return c;
}
80102616: 5d pop %ebp
80102617: c3 ret
80102618: 90 nop
80102619: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
data = inb(KBDATAP);
if(data == 0xE0){
shift |= E0ESC;
return 0;
80102620: 31 c0 xor %eax,%eax
if((st & KBS_DIB) == 0)
return -1;
data = inb(KBDATAP);
if(data == 0xE0){
shift |= E0ESC;
80102622: 83 0d b4 a5 10 80 40 orl $0x40,0x8010a5b4
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
}
return c;
}
80102629: 5d pop %ebp
8010262a: c3 ret
8010262b: 90 nop
8010262c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
shift ^= togglecode[data];
c = charcode[shift & (CTL | SHIFT)][data];
if(shift & CAPSLOCK){
if('a' <= c && c <= 'z')
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
80102630: 8d 48 bf lea -0x41(%eax),%ecx
c += 'a' - 'A';
80102633: 8d 50 20 lea 0x20(%eax),%edx
}
return c;
}
80102636: 5d pop %ebp
c = charcode[shift & (CTL | SHIFT)][data];
if(shift & CAPSLOCK){
if('a' <= c && c <= 'z')
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
80102637: 83 f9 19 cmp $0x19,%ecx
8010263a: 0f 46 c2 cmovbe %edx,%eax
}
return c;
}
8010263d: c3 ret
8010263e: 66 90 xchg %ax,%ax
};
uint st, data, c;
st = inb(KBSTATP);
if((st & KBS_DIB) == 0)
return -1;
80102640: b8 ff ff ff ff mov $0xffffffff,%eax
c += 'A' - 'a';
else if('A' <= c && c <= 'Z')
c += 'a' - 'A';
}
return c;
}
80102645: 5d pop %ebp
80102646: c3 ret
80102647: 89 f6 mov %esi,%esi
80102649: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102650 <kbdintr>:
void
kbdintr(void)
{
80102650: 55 push %ebp
80102651: 89 e5 mov %esp,%ebp
80102653: 83 ec 14 sub $0x14,%esp
consoleintr(kbdgetc);
80102656: 68 80 25 10 80 push $0x80102580
8010265b: e8 90 e1 ff ff call 801007f0 <consoleintr>
}
80102660: 83 c4 10 add $0x10,%esp
80102663: c9 leave
80102664: c3 ret
80102665: 66 90 xchg %ax,%ax
80102667: 66 90 xchg %ax,%ax
80102669: 66 90 xchg %ax,%ax
8010266b: 66 90 xchg %ax,%ax
8010266d: 66 90 xchg %ax,%ax
8010266f: 90 nop
80102670 <lapicinit>:
}
void
lapicinit(void)
{
if(!lapic)
80102670: a1 7c 26 11 80 mov 0x8011267c,%eax
lapic[ID]; // wait for write to finish, by reading
}
void
lapicinit(void)
{
80102675: 55 push %ebp
80102676: 89 e5 mov %esp,%ebp
if(!lapic)
80102678: 85 c0 test %eax,%eax
8010267a: 0f 84 c8 00 00 00 je 80102748 <lapicinit+0xd8>
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102680: c7 80 f0 00 00 00 3f movl $0x13f,0xf0(%eax)
80102687: 01 00 00
lapic[ID]; // wait for write to finish, by reading
8010268a: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010268d: c7 80 e0 03 00 00 0b movl $0xb,0x3e0(%eax)
80102694: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102697: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010269a: c7 80 20 03 00 00 20 movl $0x20020,0x320(%eax)
801026a1: 00 02 00
lapic[ID]; // wait for write to finish, by reading
801026a4: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026a7: c7 80 80 03 00 00 80 movl $0x989680,0x380(%eax)
801026ae: 96 98 00
lapic[ID]; // wait for write to finish, by reading
801026b1: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026b4: c7 80 50 03 00 00 00 movl $0x10000,0x350(%eax)
801026bb: 00 01 00
lapic[ID]; // wait for write to finish, by reading
801026be: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026c1: c7 80 60 03 00 00 00 movl $0x10000,0x360(%eax)
801026c8: 00 01 00
lapic[ID]; // wait for write to finish, by reading
801026cb: 8b 50 20 mov 0x20(%eax),%edx
lapicw(LINT0, MASKED);
lapicw(LINT1, MASKED);
// Disable performance counter overflow interrupts
// on machines that provide that interrupt entry.
if(((lapic[VER]>>16) & 0xFF) >= 4)
801026ce: 8b 50 30 mov 0x30(%eax),%edx
801026d1: c1 ea 10 shr $0x10,%edx
801026d4: 80 fa 03 cmp $0x3,%dl
801026d7: 77 77 ja 80102750 <lapicinit+0xe0>
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026d9: c7 80 70 03 00 00 33 movl $0x33,0x370(%eax)
801026e0: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801026e3: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026e6: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax)
801026ed: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801026f0: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801026f3: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax)
801026fa: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801026fd: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102700: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax)
80102707: 00 00 00
lapic[ID]; // wait for write to finish, by reading
8010270a: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010270d: c7 80 10 03 00 00 00 movl $0x0,0x310(%eax)
80102714: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102717: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010271a: c7 80 00 03 00 00 00 movl $0x88500,0x300(%eax)
80102721: 85 08 00
lapic[ID]; // wait for write to finish, by reading
80102724: 8b 50 20 mov 0x20(%eax),%edx
80102727: 89 f6 mov %esi,%esi
80102729: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
lapicw(EOI, 0);
// Send an Init Level De-Assert to synchronise arbitration ID's.
lapicw(ICRHI, 0);
lapicw(ICRLO, BCAST | INIT | LEVEL);
while(lapic[ICRLO] & DELIVS)
80102730: 8b 90 00 03 00 00 mov 0x300(%eax),%edx
80102736: 80 e6 10 and $0x10,%dh
80102739: 75 f5 jne 80102730 <lapicinit+0xc0>
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010273b: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax)
80102742: 00 00 00
lapic[ID]; // wait for write to finish, by reading
80102745: 8b 40 20 mov 0x20(%eax),%eax
while(lapic[ICRLO] & DELIVS)
;
// Enable interrupts on the APIC (but not on the processor).
lapicw(TPR, 0);
}
80102748: 5d pop %ebp
80102749: c3 ret
8010274a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102750: c7 80 40 03 00 00 00 movl $0x10000,0x340(%eax)
80102757: 00 01 00
lapic[ID]; // wait for write to finish, by reading
8010275a: 8b 50 20 mov 0x20(%eax),%edx
8010275d: e9 77 ff ff ff jmp 801026d9 <lapicinit+0x69>
80102762: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80102769: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102770 <lapicid>:
}
int
lapicid(void)
{
if (!lapic)
80102770: a1 7c 26 11 80 mov 0x8011267c,%eax
lapicw(TPR, 0);
}
int
lapicid(void)
{
80102775: 55 push %ebp
80102776: 89 e5 mov %esp,%ebp
if (!lapic)
80102778: 85 c0 test %eax,%eax
8010277a: 74 0c je 80102788 <lapicid+0x18>
return 0;
return lapic[ID] >> 24;
8010277c: 8b 40 20 mov 0x20(%eax),%eax
}
8010277f: 5d pop %ebp
int
lapicid(void)
{
if (!lapic)
return 0;
return lapic[ID] >> 24;
80102780: c1 e8 18 shr $0x18,%eax
}
80102783: c3 ret
80102784: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int
lapicid(void)
{
if (!lapic)
return 0;
80102788: 31 c0 xor %eax,%eax
return lapic[ID] >> 24;
}
8010278a: 5d pop %ebp
8010278b: c3 ret
8010278c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102790 <lapiceoi>:
// Acknowledge interrupt.
void
lapiceoi(void)
{
if(lapic)
80102790: a1 7c 26 11 80 mov 0x8011267c,%eax
}
// Acknowledge interrupt.
void
lapiceoi(void)
{
80102795: 55 push %ebp
80102796: 89 e5 mov %esp,%ebp
if(lapic)
80102798: 85 c0 test %eax,%eax
8010279a: 74 0d je 801027a9 <lapiceoi+0x19>
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010279c: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax)
801027a3: 00 00 00
lapic[ID]; // wait for write to finish, by reading
801027a6: 8b 40 20 mov 0x20(%eax),%eax
void
lapiceoi(void)
{
if(lapic)
lapicw(EOI, 0);
}
801027a9: 5d pop %ebp
801027aa: c3 ret
801027ab: 90 nop
801027ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801027b0 <microdelay>:
// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
801027b0: 55 push %ebp
801027b1: 89 e5 mov %esp,%ebp
}
801027b3: 5d pop %ebp
801027b4: c3 ret
801027b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801027b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801027c0 <lapicstartap>:
// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
801027c0: 55 push %ebp
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801027c1: ba 70 00 00 00 mov $0x70,%edx
801027c6: b8 0f 00 00 00 mov $0xf,%eax
801027cb: 89 e5 mov %esp,%ebp
801027cd: 53 push %ebx
801027ce: 8b 4d 0c mov 0xc(%ebp),%ecx
801027d1: 8b 5d 08 mov 0x8(%ebp),%ebx
801027d4: ee out %al,(%dx)
801027d5: ba 71 00 00 00 mov $0x71,%edx
801027da: b8 0a 00 00 00 mov $0xa,%eax
801027df: ee out %al,(%dx)
// and the warm reset vector (DWORD based at 40:67) to point at
// the AP startup code prior to the [universal startup algorithm]."
outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code
outb(CMOS_PORT+1, 0x0A);
wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector
wrv[0] = 0;
801027e0: 31 c0 xor %eax,%eax
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801027e2: c1 e3 18 shl $0x18,%ebx
// and the warm reset vector (DWORD based at 40:67) to point at
// the AP startup code prior to the [universal startup algorithm]."
outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code
outb(CMOS_PORT+1, 0x0A);
wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector
wrv[0] = 0;
801027e5: 66 a3 67 04 00 80 mov %ax,0x80000467
wrv[1] = addr >> 4;
801027eb: 89 c8 mov %ecx,%eax
// when it is in the halted state due to an INIT. So the second
// should be ignored, but it is part of the official Intel algorithm.
// Bochs complains about the second one. Too bad for Bochs.
for(i = 0; i < 2; i++){
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
801027ed: c1 e9 0c shr $0xc,%ecx
// the AP startup code prior to the [universal startup algorithm]."
outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code
outb(CMOS_PORT+1, 0x0A);
wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector
wrv[0] = 0;
wrv[1] = addr >> 4;
801027f0: c1 e8 04 shr $0x4,%eax
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801027f3: 89 da mov %ebx,%edx
// when it is in the halted state due to an INIT. So the second
// should be ignored, but it is part of the official Intel algorithm.
// Bochs complains about the second one. Too bad for Bochs.
for(i = 0; i < 2; i++){
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
801027f5: 80 cd 06 or $0x6,%ch
// the AP startup code prior to the [universal startup algorithm]."
outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code
outb(CMOS_PORT+1, 0x0A);
wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector
wrv[0] = 0;
wrv[1] = addr >> 4;
801027f8: 66 a3 69 04 00 80 mov %ax,0x80000469
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
801027fe: a1 7c 26 11 80 mov 0x8011267c,%eax
80102803: 89 98 10 03 00 00 mov %ebx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
80102809: 8b 58 20 mov 0x20(%eax),%ebx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010280c: c7 80 00 03 00 00 00 movl $0xc500,0x300(%eax)
80102813: c5 00 00
lapic[ID]; // wait for write to finish, by reading
80102816: 8b 58 20 mov 0x20(%eax),%ebx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102819: c7 80 00 03 00 00 00 movl $0x8500,0x300(%eax)
80102820: 85 00 00
lapic[ID]; // wait for write to finish, by reading
80102823: 8b 58 20 mov 0x20(%eax),%ebx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102826: 89 90 10 03 00 00 mov %edx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
8010282c: 8b 58 20 mov 0x20(%eax),%ebx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
8010282f: 89 88 00 03 00 00 mov %ecx,0x300(%eax)
lapic[ID]; // wait for write to finish, by reading
80102835: 8b 58 20 mov 0x20(%eax),%ebx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102838: 89 90 10 03 00 00 mov %edx,0x310(%eax)
lapic[ID]; // wait for write to finish, by reading
8010283e: 8b 50 20 mov 0x20(%eax),%edx
//PAGEBREAK!
static void
lapicw(int index, int value)
{
lapic[index] = value;
80102841: 89 88 00 03 00 00 mov %ecx,0x300(%eax)
lapic[ID]; // wait for write to finish, by reading
80102847: 8b 40 20 mov 0x20(%eax),%eax
for(i = 0; i < 2; i++){
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
microdelay(200);
}
}
8010284a: 5b pop %ebx
8010284b: 5d pop %ebp
8010284c: c3 ret
8010284d: 8d 76 00 lea 0x0(%esi),%esi
80102850 <cmostime>:
}
// qemu seems to use 24-hour GWT and the values are BCD encoded
void
cmostime(struct rtcdate *r)
{
80102850: 55 push %ebp
80102851: ba 70 00 00 00 mov $0x70,%edx
80102856: b8 0b 00 00 00 mov $0xb,%eax
8010285b: 89 e5 mov %esp,%ebp
8010285d: 57 push %edi
8010285e: 56 push %esi
8010285f: 53 push %ebx
80102860: 83 ec 4c sub $0x4c,%esp
80102863: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102864: ba 71 00 00 00 mov $0x71,%edx
80102869: ec in (%dx),%al
8010286a: 83 e0 04 and $0x4,%eax
8010286d: 8d 75 d0 lea -0x30(%ebp),%esi
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102870: 31 db xor %ebx,%ebx
80102872: 88 45 b7 mov %al,-0x49(%ebp)
80102875: bf 70 00 00 00 mov $0x70,%edi
8010287a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102880: 89 d8 mov %ebx,%eax
80102882: 89 fa mov %edi,%edx
80102884: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102885: b9 71 00 00 00 mov $0x71,%ecx
8010288a: 89 ca mov %ecx,%edx
8010288c: ec in (%dx),%al
}
static void
fill_rtcdate(struct rtcdate *r)
{
r->second = cmos_read(SECS);
8010288d: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102890: 89 fa mov %edi,%edx
80102892: 89 45 b8 mov %eax,-0x48(%ebp)
80102895: b8 02 00 00 00 mov $0x2,%eax
8010289a: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010289b: 89 ca mov %ecx,%edx
8010289d: ec in (%dx),%al
r->minute = cmos_read(MINS);
8010289e: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801028a1: 89 fa mov %edi,%edx
801028a3: 89 45 bc mov %eax,-0x44(%ebp)
801028a6: b8 04 00 00 00 mov $0x4,%eax
801028ab: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028ac: 89 ca mov %ecx,%edx
801028ae: ec in (%dx),%al
r->hour = cmos_read(HOURS);
801028af: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801028b2: 89 fa mov %edi,%edx
801028b4: 89 45 c0 mov %eax,-0x40(%ebp)
801028b7: b8 07 00 00 00 mov $0x7,%eax
801028bc: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028bd: 89 ca mov %ecx,%edx
801028bf: ec in (%dx),%al
r->day = cmos_read(DAY);
801028c0: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801028c3: 89 fa mov %edi,%edx
801028c5: 89 45 c4 mov %eax,-0x3c(%ebp)
801028c8: b8 08 00 00 00 mov $0x8,%eax
801028cd: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028ce: 89 ca mov %ecx,%edx
801028d0: ec in (%dx),%al
r->month = cmos_read(MONTH);
801028d1: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801028d4: 89 fa mov %edi,%edx
801028d6: 89 45 c8 mov %eax,-0x38(%ebp)
801028d9: b8 09 00 00 00 mov $0x9,%eax
801028de: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028df: 89 ca mov %ecx,%edx
801028e1: ec in (%dx),%al
r->year = cmos_read(YEAR);
801028e2: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801028e5: 89 fa mov %edi,%edx
801028e7: 89 45 cc mov %eax,-0x34(%ebp)
801028ea: b8 0a 00 00 00 mov $0xa,%eax
801028ef: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028f0: 89 ca mov %ecx,%edx
801028f2: ec in (%dx),%al
bcd = (sb & (1 << 2)) == 0;
// make sure CMOS doesn't modify time while we read it
for(;;) {
fill_rtcdate(&t1);
if(cmos_read(CMOS_STATA) & CMOS_UIP)
801028f3: 84 c0 test %al,%al
801028f5: 78 89 js 80102880 <cmostime+0x30>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801028f7: 89 d8 mov %ebx,%eax
801028f9: 89 fa mov %edi,%edx
801028fb: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801028fc: 89 ca mov %ecx,%edx
801028fe: ec in (%dx),%al
}
static void
fill_rtcdate(struct rtcdate *r)
{
r->second = cmos_read(SECS);
801028ff: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102902: 89 fa mov %edi,%edx
80102904: 89 45 d0 mov %eax,-0x30(%ebp)
80102907: b8 02 00 00 00 mov $0x2,%eax
8010290c: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010290d: 89 ca mov %ecx,%edx
8010290f: ec in (%dx),%al
r->minute = cmos_read(MINS);
80102910: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102913: 89 fa mov %edi,%edx
80102915: 89 45 d4 mov %eax,-0x2c(%ebp)
80102918: b8 04 00 00 00 mov $0x4,%eax
8010291d: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010291e: 89 ca mov %ecx,%edx
80102920: ec in (%dx),%al
r->hour = cmos_read(HOURS);
80102921: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102924: 89 fa mov %edi,%edx
80102926: 89 45 d8 mov %eax,-0x28(%ebp)
80102929: b8 07 00 00 00 mov $0x7,%eax
8010292e: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010292f: 89 ca mov %ecx,%edx
80102931: ec in (%dx),%al
r->day = cmos_read(DAY);
80102932: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102935: 89 fa mov %edi,%edx
80102937: 89 45 dc mov %eax,-0x24(%ebp)
8010293a: b8 08 00 00 00 mov $0x8,%eax
8010293f: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102940: 89 ca mov %ecx,%edx
80102942: ec in (%dx),%al
r->month = cmos_read(MONTH);
80102943: 0f b6 c0 movzbl %al,%eax
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102946: 89 fa mov %edi,%edx
80102948: 89 45 e0 mov %eax,-0x20(%ebp)
8010294b: b8 09 00 00 00 mov $0x9,%eax
80102950: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102951: 89 ca mov %ecx,%edx
80102953: ec in (%dx),%al
r->year = cmos_read(YEAR);
80102954: 0f b6 c0 movzbl %al,%eax
for(;;) {
fill_rtcdate(&t1);
if(cmos_read(CMOS_STATA) & CMOS_UIP)
continue;
fill_rtcdate(&t2);
if(memcmp(&t1, &t2, sizeof(t1)) == 0)
80102957: 83 ec 04 sub $0x4,%esp
r->second = cmos_read(SECS);
r->minute = cmos_read(MINS);
r->hour = cmos_read(HOURS);
r->day = cmos_read(DAY);
r->month = cmos_read(MONTH);
r->year = cmos_read(YEAR);
8010295a: 89 45 e4 mov %eax,-0x1c(%ebp)
for(;;) {
fill_rtcdate(&t1);
if(cmos_read(CMOS_STATA) & CMOS_UIP)
continue;
fill_rtcdate(&t2);
if(memcmp(&t1, &t2, sizeof(t1)) == 0)
8010295d: 8d 45 b8 lea -0x48(%ebp),%eax
80102960: 6a 18 push $0x18
80102962: 56 push %esi
80102963: 50 push %eax
80102964: e8 87 1b 00 00 call 801044f0 <memcmp>
80102969: 83 c4 10 add $0x10,%esp
8010296c: 85 c0 test %eax,%eax
8010296e: 0f 85 0c ff ff ff jne 80102880 <cmostime+0x30>
break;
}
// convert
if(bcd) {
80102974: 80 7d b7 00 cmpb $0x0,-0x49(%ebp)
80102978: 75 78 jne 801029f2 <cmostime+0x1a2>
#define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf))
CONV(second);
8010297a: 8b 45 b8 mov -0x48(%ebp),%eax
8010297d: 89 c2 mov %eax,%edx
8010297f: 83 e0 0f and $0xf,%eax
80102982: c1 ea 04 shr $0x4,%edx
80102985: 8d 14 92 lea (%edx,%edx,4),%edx
80102988: 8d 04 50 lea (%eax,%edx,2),%eax
8010298b: 89 45 b8 mov %eax,-0x48(%ebp)
CONV(minute);
8010298e: 8b 45 bc mov -0x44(%ebp),%eax
80102991: 89 c2 mov %eax,%edx
80102993: 83 e0 0f and $0xf,%eax
80102996: c1 ea 04 shr $0x4,%edx
80102999: 8d 14 92 lea (%edx,%edx,4),%edx
8010299c: 8d 04 50 lea (%eax,%edx,2),%eax
8010299f: 89 45 bc mov %eax,-0x44(%ebp)
CONV(hour );
801029a2: 8b 45 c0 mov -0x40(%ebp),%eax
801029a5: 89 c2 mov %eax,%edx
801029a7: 83 e0 0f and $0xf,%eax
801029aa: c1 ea 04 shr $0x4,%edx
801029ad: 8d 14 92 lea (%edx,%edx,4),%edx
801029b0: 8d 04 50 lea (%eax,%edx,2),%eax
801029b3: 89 45 c0 mov %eax,-0x40(%ebp)
CONV(day );
801029b6: 8b 45 c4 mov -0x3c(%ebp),%eax
801029b9: 89 c2 mov %eax,%edx
801029bb: 83 e0 0f and $0xf,%eax
801029be: c1 ea 04 shr $0x4,%edx
801029c1: 8d 14 92 lea (%edx,%edx,4),%edx
801029c4: 8d 04 50 lea (%eax,%edx,2),%eax
801029c7: 89 45 c4 mov %eax,-0x3c(%ebp)
CONV(month );
801029ca: 8b 45 c8 mov -0x38(%ebp),%eax
801029cd: 89 c2 mov %eax,%edx
801029cf: 83 e0 0f and $0xf,%eax
801029d2: c1 ea 04 shr $0x4,%edx
801029d5: 8d 14 92 lea (%edx,%edx,4),%edx
801029d8: 8d 04 50 lea (%eax,%edx,2),%eax
801029db: 89 45 c8 mov %eax,-0x38(%ebp)
CONV(year );
801029de: 8b 45 cc mov -0x34(%ebp),%eax
801029e1: 89 c2 mov %eax,%edx
801029e3: 83 e0 0f and $0xf,%eax
801029e6: c1 ea 04 shr $0x4,%edx
801029e9: 8d 14 92 lea (%edx,%edx,4),%edx
801029ec: 8d 04 50 lea (%eax,%edx,2),%eax
801029ef: 89 45 cc mov %eax,-0x34(%ebp)
#undef CONV
}
*r = t1;
801029f2: 8b 75 08 mov 0x8(%ebp),%esi
801029f5: 8b 45 b8 mov -0x48(%ebp),%eax
801029f8: 89 06 mov %eax,(%esi)
801029fa: 8b 45 bc mov -0x44(%ebp),%eax
801029fd: 89 46 04 mov %eax,0x4(%esi)
80102a00: 8b 45 c0 mov -0x40(%ebp),%eax
80102a03: 89 46 08 mov %eax,0x8(%esi)
80102a06: 8b 45 c4 mov -0x3c(%ebp),%eax
80102a09: 89 46 0c mov %eax,0xc(%esi)
80102a0c: 8b 45 c8 mov -0x38(%ebp),%eax
80102a0f: 89 46 10 mov %eax,0x10(%esi)
80102a12: 8b 45 cc mov -0x34(%ebp),%eax
80102a15: 89 46 14 mov %eax,0x14(%esi)
r->year += 2000;
80102a18: 81 46 14 d0 07 00 00 addl $0x7d0,0x14(%esi)
}
80102a1f: 8d 65 f4 lea -0xc(%ebp),%esp
80102a22: 5b pop %ebx
80102a23: 5e pop %esi
80102a24: 5f pop %edi
80102a25: 5d pop %ebp
80102a26: c3 ret
80102a27: 66 90 xchg %ax,%ax
80102a29: 66 90 xchg %ax,%ax
80102a2b: 66 90 xchg %ax,%ax
80102a2d: 66 90 xchg %ax,%ax
80102a2f: 90 nop
80102a30 <install_trans>:
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102a30: 8b 0d c8 26 11 80 mov 0x801126c8,%ecx
80102a36: 85 c9 test %ecx,%ecx
80102a38: 0f 8e 85 00 00 00 jle 80102ac3 <install_trans+0x93>
}
// Copy committed blocks from log to their home location
static void
install_trans(void)
{
80102a3e: 55 push %ebp
80102a3f: 89 e5 mov %esp,%ebp
80102a41: 57 push %edi
80102a42: 56 push %esi
80102a43: 53 push %ebx
80102a44: 31 db xor %ebx,%ebx
80102a46: 83 ec 0c sub $0xc,%esp
80102a49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
80102a50: a1 b4 26 11 80 mov 0x801126b4,%eax
80102a55: 83 ec 08 sub $0x8,%esp
80102a58: 01 d8 add %ebx,%eax
80102a5a: 83 c0 01 add $0x1,%eax
80102a5d: 50 push %eax
80102a5e: ff 35 c4 26 11 80 pushl 0x801126c4
80102a64: e8 67 d6 ff ff call 801000d0 <bread>
80102a69: 89 c7 mov %eax,%edi
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
80102a6b: 58 pop %eax
80102a6c: 5a pop %edx
80102a6d: ff 34 9d cc 26 11 80 pushl -0x7feed934(,%ebx,4)
80102a74: ff 35 c4 26 11 80 pushl 0x801126c4
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102a7a: 83 c3 01 add $0x1,%ebx
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
80102a7d: e8 4e d6 ff ff call 801000d0 <bread>
80102a82: 89 c6 mov %eax,%esi
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
80102a84: 8d 47 5c lea 0x5c(%edi),%eax
80102a87: 83 c4 0c add $0xc,%esp
80102a8a: 68 00 02 00 00 push $0x200
80102a8f: 50 push %eax
80102a90: 8d 46 5c lea 0x5c(%esi),%eax
80102a93: 50 push %eax
80102a94: e8 b7 1a 00 00 call 80104550 <memmove>
bwrite(dbuf); // write dst to disk
80102a99: 89 34 24 mov %esi,(%esp)
80102a9c: e8 ff d6 ff ff call 801001a0 <bwrite>
brelse(lbuf);
80102aa1: 89 3c 24 mov %edi,(%esp)
80102aa4: e8 37 d7 ff ff call 801001e0 <brelse>
brelse(dbuf);
80102aa9: 89 34 24 mov %esi,(%esp)
80102aac: e8 2f d7 ff ff call 801001e0 <brelse>
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102ab1: 83 c4 10 add $0x10,%esp
80102ab4: 39 1d c8 26 11 80 cmp %ebx,0x801126c8
80102aba: 7f 94 jg 80102a50 <install_trans+0x20>
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
bwrite(dbuf); // write dst to disk
brelse(lbuf);
brelse(dbuf);
}
}
80102abc: 8d 65 f4 lea -0xc(%ebp),%esp
80102abf: 5b pop %ebx
80102ac0: 5e pop %esi
80102ac1: 5f pop %edi
80102ac2: 5d pop %ebp
80102ac3: f3 c3 repz ret
80102ac5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80102ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102ad0 <write_head>:
// Write in-memory log header to disk.
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
80102ad0: 55 push %ebp
80102ad1: 89 e5 mov %esp,%ebp
80102ad3: 53 push %ebx
80102ad4: 83 ec 0c sub $0xc,%esp
struct buf *buf = bread(log.dev, log.start);
80102ad7: ff 35 b4 26 11 80 pushl 0x801126b4
80102add: ff 35 c4 26 11 80 pushl 0x801126c4
80102ae3: e8 e8 d5 ff ff call 801000d0 <bread>
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
80102ae8: 8b 0d c8 26 11 80 mov 0x801126c8,%ecx
for (i = 0; i < log.lh.n; i++) {
80102aee: 83 c4 10 add $0x10,%esp
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102af1: 89 c3 mov %eax,%ebx
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
for (i = 0; i < log.lh.n; i++) {
80102af3: 85 c9 test %ecx,%ecx
write_head(void)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
80102af5: 89 48 5c mov %ecx,0x5c(%eax)
for (i = 0; i < log.lh.n; i++) {
80102af8: 7e 1f jle 80102b19 <write_head+0x49>
80102afa: 8d 04 8d 00 00 00 00 lea 0x0(,%ecx,4),%eax
80102b01: 31 d2 xor %edx,%edx
80102b03: 90 nop
80102b04: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
hb->block[i] = log.lh.block[i];
80102b08: 8b 8a cc 26 11 80 mov -0x7feed934(%edx),%ecx
80102b0e: 89 4c 13 60 mov %ecx,0x60(%ebx,%edx,1)
80102b12: 83 c2 04 add $0x4,%edx
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
for (i = 0; i < log.lh.n; i++) {
80102b15: 39 c2 cmp %eax,%edx
80102b17: 75 ef jne 80102b08 <write_head+0x38>
hb->block[i] = log.lh.block[i];
}
bwrite(buf);
80102b19: 83 ec 0c sub $0xc,%esp
80102b1c: 53 push %ebx
80102b1d: e8 7e d6 ff ff call 801001a0 <bwrite>
brelse(buf);
80102b22: 89 1c 24 mov %ebx,(%esp)
80102b25: e8 b6 d6 ff ff call 801001e0 <brelse>
}
80102b2a: 8b 5d fc mov -0x4(%ebp),%ebx
80102b2d: c9 leave
80102b2e: c3 ret
80102b2f: 90 nop
80102b30 <initlog>:
static void recover_from_log(void);
static void commit();
void
initlog(int dev)
{
80102b30: 55 push %ebp
80102b31: 89 e5 mov %esp,%ebp
80102b33: 53 push %ebx
80102b34: 83 ec 2c sub $0x2c,%esp
80102b37: 8b 5d 08 mov 0x8(%ebp),%ebx
if (sizeof(struct logheader) >= BSIZE)
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
80102b3a: 68 00 74 10 80 push $0x80107400
80102b3f: 68 80 26 11 80 push $0x80112680
80102b44: e8 f7 16 00 00 call 80104240 <initlock>
readsb(dev, &sb);
80102b49: 58 pop %eax
80102b4a: 8d 45 dc lea -0x24(%ebp),%eax
80102b4d: 5a pop %edx
80102b4e: 50 push %eax
80102b4f: 53 push %ebx
80102b50: e8 5b e8 ff ff call 801013b0 <readsb>
log.start = sb.logstart;
log.size = sb.nlog;
80102b55: 8b 55 e8 mov -0x18(%ebp),%edx
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
80102b58: 8b 45 ec mov -0x14(%ebp),%eax
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102b5b: 59 pop %ecx
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
log.dev = dev;
80102b5c: 89 1d c4 26 11 80 mov %ebx,0x801126c4
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
80102b62: 89 15 b8 26 11 80 mov %edx,0x801126b8
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
readsb(dev, &sb);
log.start = sb.logstart;
80102b68: a3 b4 26 11 80 mov %eax,0x801126b4
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
80102b6d: 5a pop %edx
80102b6e: 50 push %eax
80102b6f: 53 push %ebx
80102b70: e8 5b d5 ff ff call 801000d0 <bread>
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
80102b75: 8b 48 5c mov 0x5c(%eax),%ecx
for (i = 0; i < log.lh.n; i++) {
80102b78: 83 c4 10 add $0x10,%esp
80102b7b: 85 c9 test %ecx,%ecx
read_head(void)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
80102b7d: 89 0d c8 26 11 80 mov %ecx,0x801126c8
for (i = 0; i < log.lh.n; i++) {
80102b83: 7e 1c jle 80102ba1 <initlog+0x71>
80102b85: 8d 1c 8d 00 00 00 00 lea 0x0(,%ecx,4),%ebx
80102b8c: 31 d2 xor %edx,%edx
80102b8e: 66 90 xchg %ax,%ax
log.lh.block[i] = lh->block[i];
80102b90: 8b 4c 10 60 mov 0x60(%eax,%edx,1),%ecx
80102b94: 83 c2 04 add $0x4,%edx
80102b97: 89 8a c8 26 11 80 mov %ecx,-0x7feed938(%edx)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
for (i = 0; i < log.lh.n; i++) {
80102b9d: 39 da cmp %ebx,%edx
80102b9f: 75 ef jne 80102b90 <initlog+0x60>
log.lh.block[i] = lh->block[i];
}
brelse(buf);
80102ba1: 83 ec 0c sub $0xc,%esp
80102ba4: 50 push %eax
80102ba5: e8 36 d6 ff ff call 801001e0 <brelse>
static void
recover_from_log(void)
{
read_head();
install_trans(); // if committed, copy from log to disk
80102baa: e8 81 fe ff ff call 80102a30 <install_trans>
log.lh.n = 0;
80102baf: c7 05 c8 26 11 80 00 movl $0x0,0x801126c8
80102bb6: 00 00 00
write_head(); // clear the log
80102bb9: e8 12 ff ff ff call 80102ad0 <write_head>
readsb(dev, &sb);
log.start = sb.logstart;
log.size = sb.nlog;
log.dev = dev;
recover_from_log();
}
80102bbe: 8b 5d fc mov -0x4(%ebp),%ebx
80102bc1: c9 leave
80102bc2: c3 ret
80102bc3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80102bc9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102bd0 <begin_op>:
}
// called at the start of each FS system call.
void
begin_op(void)
{
80102bd0: 55 push %ebp
80102bd1: 89 e5 mov %esp,%ebp
80102bd3: 83 ec 14 sub $0x14,%esp
acquire(&log.lock);
80102bd6: 68 80 26 11 80 push $0x80112680
80102bdb: e8 c0 17 00 00 call 801043a0 <acquire>
80102be0: 83 c4 10 add $0x10,%esp
80102be3: eb 18 jmp 80102bfd <begin_op+0x2d>
80102be5: 8d 76 00 lea 0x0(%esi),%esi
while(1){
if(log.committing){
sleep(&log, &log.lock);
80102be8: 83 ec 08 sub $0x8,%esp
80102beb: 68 80 26 11 80 push $0x80112680
80102bf0: 68 80 26 11 80 push $0x80112680
80102bf5: e8 b6 11 00 00 call 80103db0 <sleep>
80102bfa: 83 c4 10 add $0x10,%esp
void
begin_op(void)
{
acquire(&log.lock);
while(1){
if(log.committing){
80102bfd: a1 c0 26 11 80 mov 0x801126c0,%eax
80102c02: 85 c0 test %eax,%eax
80102c04: 75 e2 jne 80102be8 <begin_op+0x18>
sleep(&log, &log.lock);
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
80102c06: a1 bc 26 11 80 mov 0x801126bc,%eax
80102c0b: 8b 15 c8 26 11 80 mov 0x801126c8,%edx
80102c11: 83 c0 01 add $0x1,%eax
80102c14: 8d 0c 80 lea (%eax,%eax,4),%ecx
80102c17: 8d 14 4a lea (%edx,%ecx,2),%edx
80102c1a: 83 fa 1e cmp $0x1e,%edx
80102c1d: 7f c9 jg 80102be8 <begin_op+0x18>
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
} else {
log.outstanding += 1;
release(&log.lock);
80102c1f: 83 ec 0c sub $0xc,%esp
sleep(&log, &log.lock);
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
} else {
log.outstanding += 1;
80102c22: a3 bc 26 11 80 mov %eax,0x801126bc
release(&log.lock);
80102c27: 68 80 26 11 80 push $0x80112680
80102c2c: e8 1f 18 00 00 call 80104450 <release>
break;
}
}
}
80102c31: 83 c4 10 add $0x10,%esp
80102c34: c9 leave
80102c35: c3 ret
80102c36: 8d 76 00 lea 0x0(%esi),%esi
80102c39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80102c40 <end_op>:
// called at the end of each FS system call.
// commits if this was the last outstanding operation.
void
end_op(void)
{
80102c40: 55 push %ebp
80102c41: 89 e5 mov %esp,%ebp
80102c43: 57 push %edi
80102c44: 56 push %esi
80102c45: 53 push %ebx
80102c46: 83 ec 18 sub $0x18,%esp
int do_commit = 0;
acquire(&log.lock);
80102c49: 68 80 26 11 80 push $0x80112680
80102c4e: e8 4d 17 00 00 call 801043a0 <acquire>
log.outstanding -= 1;
80102c53: a1 bc 26 11 80 mov 0x801126bc,%eax
if(log.committing)
80102c58: 8b 1d c0 26 11 80 mov 0x801126c0,%ebx
80102c5e: 83 c4 10 add $0x10,%esp
end_op(void)
{
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
80102c61: 83 e8 01 sub $0x1,%eax
if(log.committing)
80102c64: 85 db test %ebx,%ebx
end_op(void)
{
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
80102c66: a3 bc 26 11 80 mov %eax,0x801126bc
if(log.committing)
80102c6b: 0f 85 23 01 00 00 jne 80102d94 <end_op+0x154>
panic("log.committing");
if(log.outstanding == 0){
80102c71: 85 c0 test %eax,%eax
80102c73: 0f 85 f7 00 00 00 jne 80102d70 <end_op+0x130>
// begin_op() may be waiting for log space,
// and decrementing log.outstanding has decreased
// the amount of reserved space.
wakeup(&log);
}
release(&log.lock);
80102c79: 83 ec 0c sub $0xc,%esp
log.outstanding -= 1;
if(log.committing)
panic("log.committing");
if(log.outstanding == 0){
do_commit = 1;
log.committing = 1;
80102c7c: c7 05 c0 26 11 80 01 movl $0x1,0x801126c0
80102c83: 00 00 00
}
static void
commit()
{
if (log.lh.n > 0) {
80102c86: 31 db xor %ebx,%ebx
// begin_op() may be waiting for log space,
// and decrementing log.outstanding has decreased
// the amount of reserved space.
wakeup(&log);
}
release(&log.lock);
80102c88: 68 80 26 11 80 push $0x80112680
80102c8d: e8 be 17 00 00 call 80104450 <release>
}
static void
commit()
{
if (log.lh.n > 0) {
80102c92: 8b 0d c8 26 11 80 mov 0x801126c8,%ecx
80102c98: 83 c4 10 add $0x10,%esp
80102c9b: 85 c9 test %ecx,%ecx
80102c9d: 0f 8e 8a 00 00 00 jle 80102d2d <end_op+0xed>
80102ca3: 90 nop
80102ca4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
struct buf *to = bread(log.dev, log.start+tail+1); // log block
80102ca8: a1 b4 26 11 80 mov 0x801126b4,%eax
80102cad: 83 ec 08 sub $0x8,%esp
80102cb0: 01 d8 add %ebx,%eax
80102cb2: 83 c0 01 add $0x1,%eax
80102cb5: 50 push %eax
80102cb6: ff 35 c4 26 11 80 pushl 0x801126c4
80102cbc: e8 0f d4 ff ff call 801000d0 <bread>
80102cc1: 89 c6 mov %eax,%esi
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
80102cc3: 58 pop %eax
80102cc4: 5a pop %edx
80102cc5: ff 34 9d cc 26 11 80 pushl -0x7feed934(,%ebx,4)
80102ccc: ff 35 c4 26 11 80 pushl 0x801126c4
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102cd2: 83 c3 01 add $0x1,%ebx
struct buf *to = bread(log.dev, log.start+tail+1); // log block
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
80102cd5: e8 f6 d3 ff ff call 801000d0 <bread>
80102cda: 89 c7 mov %eax,%edi
memmove(to->data, from->data, BSIZE);
80102cdc: 8d 40 5c lea 0x5c(%eax),%eax
80102cdf: 83 c4 0c add $0xc,%esp
80102ce2: 68 00 02 00 00 push $0x200
80102ce7: 50 push %eax
80102ce8: 8d 46 5c lea 0x5c(%esi),%eax
80102ceb: 50 push %eax
80102cec: e8 5f 18 00 00 call 80104550 <memmove>
bwrite(to); // write the log
80102cf1: 89 34 24 mov %esi,(%esp)
80102cf4: e8 a7 d4 ff ff call 801001a0 <bwrite>
brelse(from);
80102cf9: 89 3c 24 mov %edi,(%esp)
80102cfc: e8 df d4 ff ff call 801001e0 <brelse>
brelse(to);
80102d01: 89 34 24 mov %esi,(%esp)
80102d04: e8 d7 d4 ff ff call 801001e0 <brelse>
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80102d09: 83 c4 10 add $0x10,%esp
80102d0c: 3b 1d c8 26 11 80 cmp 0x801126c8,%ebx
80102d12: 7c 94 jl 80102ca8 <end_op+0x68>
static void
commit()
{
if (log.lh.n > 0) {
write_log(); // Write modified blocks from cache to log
write_head(); // Write header to disk -- the real commit
80102d14: e8 b7 fd ff ff call 80102ad0 <write_head>
install_trans(); // Now install writes to home locations
80102d19: e8 12 fd ff ff call 80102a30 <install_trans>
log.lh.n = 0;
80102d1e: c7 05 c8 26 11 80 00 movl $0x0,0x801126c8
80102d25: 00 00 00
write_head(); // Erase the transaction from the log
80102d28: e8 a3 fd ff ff call 80102ad0 <write_head>
if(do_commit){
// call commit w/o holding locks, since not allowed
// to sleep with locks.
commit();
acquire(&log.lock);
80102d2d: 83 ec 0c sub $0xc,%esp
80102d30: 68 80 26 11 80 push $0x80112680
80102d35: e8 66 16 00 00 call 801043a0 <acquire>
log.committing = 0;
wakeup(&log);
80102d3a: c7 04 24 80 26 11 80 movl $0x80112680,(%esp)
if(do_commit){
// call commit w/o holding locks, since not allowed
// to sleep with locks.
commit();
acquire(&log.lock);
log.committing = 0;
80102d41: c7 05 c0 26 11 80 00 movl $0x0,0x801126c0
80102d48: 00 00 00
wakeup(&log);
80102d4b: e8 10 12 00 00 call 80103f60 <wakeup>
release(&log.lock);
80102d50: c7 04 24 80 26 11 80 movl $0x80112680,(%esp)
80102d57: e8 f4 16 00 00 call 80104450 <release>
80102d5c: 83 c4 10 add $0x10,%esp
}
}
80102d5f: 8d 65 f4 lea -0xc(%ebp),%esp
80102d62: 5b pop %ebx
80102d63: 5e pop %esi
80102d64: 5f pop %edi
80102d65: 5d pop %ebp
80102d66: c3 ret
80102d67: 89 f6 mov %esi,%esi
80102d69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
log.committing = 1;
} else {
// begin_op() may be waiting for log space,
// and decrementing log.outstanding has decreased
// the amount of reserved space.
wakeup(&log);
80102d70: 83 ec 0c sub $0xc,%esp
80102d73: 68 80 26 11 80 push $0x80112680
80102d78: e8 e3 11 00 00 call 80103f60 <wakeup>
}
release(&log.lock);
80102d7d: c7 04 24 80 26 11 80 movl $0x80112680,(%esp)
80102d84: e8 c7 16 00 00 call 80104450 <release>
80102d89: 83 c4 10 add $0x10,%esp
acquire(&log.lock);
log.committing = 0;
wakeup(&log);
release(&log.lock);
}
}
80102d8c: 8d 65 f4 lea -0xc(%ebp),%esp
80102d8f: 5b pop %ebx
80102d90: 5e pop %esi
80102d91: 5f pop %edi
80102d92: 5d pop %ebp
80102d93: c3 ret
int do_commit = 0;
acquire(&log.lock);
log.outstanding -= 1;
if(log.committing)
panic("log.committing");
80102d94: 83 ec 0c sub $0xc,%esp
80102d97: 68 04 74 10 80 push $0x80107404
80102d9c: e8 cf d5 ff ff call 80100370 <panic>
80102da1: eb 0d jmp 80102db0 <log_write>
80102da3: 90 nop
80102da4: 90 nop
80102da5: 90 nop
80102da6: 90 nop
80102da7: 90 nop
80102da8: 90 nop
80102da9: 90 nop
80102daa: 90 nop
80102dab: 90 nop
80102dac: 90 nop
80102dad: 90 nop
80102dae: 90 nop
80102daf: 90 nop
80102db0 <log_write>:
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80102db0: 55 push %ebp
80102db1: 89 e5 mov %esp,%ebp
80102db3: 53 push %ebx
80102db4: 83 ec 04 sub $0x4,%esp
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80102db7: 8b 15 c8 26 11 80 mov 0x801126c8,%edx
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80102dbd: 8b 5d 08 mov 0x8(%ebp),%ebx
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80102dc0: 83 fa 1d cmp $0x1d,%edx
80102dc3: 0f 8f 97 00 00 00 jg 80102e60 <log_write+0xb0>
80102dc9: a1 b8 26 11 80 mov 0x801126b8,%eax
80102dce: 83 e8 01 sub $0x1,%eax
80102dd1: 39 c2 cmp %eax,%edx
80102dd3: 0f 8d 87 00 00 00 jge 80102e60 <log_write+0xb0>
panic("too big a transaction");
if (log.outstanding < 1)
80102dd9: a1 bc 26 11 80 mov 0x801126bc,%eax
80102dde: 85 c0 test %eax,%eax
80102de0: 0f 8e 87 00 00 00 jle 80102e6d <log_write+0xbd>
panic("log_write outside of trans");
acquire(&log.lock);
80102de6: 83 ec 0c sub $0xc,%esp
80102de9: 68 80 26 11 80 push $0x80112680
80102dee: e8 ad 15 00 00 call 801043a0 <acquire>
for (i = 0; i < log.lh.n; i++) {
80102df3: 8b 15 c8 26 11 80 mov 0x801126c8,%edx
80102df9: 83 c4 10 add $0x10,%esp
80102dfc: 83 fa 00 cmp $0x0,%edx
80102dff: 7e 50 jle 80102e51 <log_write+0xa1>
if (log.lh.block[i] == b->blockno) // log absorbtion
80102e01: 8b 4b 08 mov 0x8(%ebx),%ecx
panic("too big a transaction");
if (log.outstanding < 1)
panic("log_write outside of trans");
acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
80102e04: 31 c0 xor %eax,%eax
if (log.lh.block[i] == b->blockno) // log absorbtion
80102e06: 3b 0d cc 26 11 80 cmp 0x801126cc,%ecx
80102e0c: 75 0b jne 80102e19 <log_write+0x69>
80102e0e: eb 38 jmp 80102e48 <log_write+0x98>
80102e10: 39 0c 85 cc 26 11 80 cmp %ecx,-0x7feed934(,%eax,4)
80102e17: 74 2f je 80102e48 <log_write+0x98>
panic("too big a transaction");
if (log.outstanding < 1)
panic("log_write outside of trans");
acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
80102e19: 83 c0 01 add $0x1,%eax
80102e1c: 39 d0 cmp %edx,%eax
80102e1e: 75 f0 jne 80102e10 <log_write+0x60>
if (log.lh.block[i] == b->blockno) // log absorbtion
break;
}
log.lh.block[i] = b->blockno;
80102e20: 89 0c 95 cc 26 11 80 mov %ecx,-0x7feed934(,%edx,4)
if (i == log.lh.n)
log.lh.n++;
80102e27: 83 c2 01 add $0x1,%edx
80102e2a: 89 15 c8 26 11 80 mov %edx,0x801126c8
b->flags |= B_DIRTY; // prevent eviction
80102e30: 83 0b 04 orl $0x4,(%ebx)
release(&log.lock);
80102e33: c7 45 08 80 26 11 80 movl $0x80112680,0x8(%ebp)
}
80102e3a: 8b 5d fc mov -0x4(%ebp),%ebx
80102e3d: c9 leave
}
log.lh.block[i] = b->blockno;
if (i == log.lh.n)
log.lh.n++;
b->flags |= B_DIRTY; // prevent eviction
release(&log.lock);
80102e3e: e9 0d 16 00 00 jmp 80104450 <release>
80102e43: 90 nop
80102e44: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
if (log.lh.block[i] == b->blockno) // log absorbtion
break;
}
log.lh.block[i] = b->blockno;
80102e48: 89 0c 85 cc 26 11 80 mov %ecx,-0x7feed934(,%eax,4)
80102e4f: eb df jmp 80102e30 <log_write+0x80>
80102e51: 8b 43 08 mov 0x8(%ebx),%eax
80102e54: a3 cc 26 11 80 mov %eax,0x801126cc
if (i == log.lh.n)
80102e59: 75 d5 jne 80102e30 <log_write+0x80>
80102e5b: eb ca jmp 80102e27 <log_write+0x77>
80102e5d: 8d 76 00 lea 0x0(%esi),%esi
log_write(struct buf *b)
{
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
panic("too big a transaction");
80102e60: 83 ec 0c sub $0xc,%esp
80102e63: 68 13 74 10 80 push $0x80107413
80102e68: e8 03 d5 ff ff call 80100370 <panic>
if (log.outstanding < 1)
panic("log_write outside of trans");
80102e6d: 83 ec 0c sub $0xc,%esp
80102e70: 68 29 74 10 80 push $0x80107429
80102e75: e8 f6 d4 ff ff call 80100370 <panic>
80102e7a: 66 90 xchg %ax,%ax
80102e7c: 66 90 xchg %ax,%ax
80102e7e: 66 90 xchg %ax,%ax
80102e80 <mpmain>:
}
// Common CPU setup code.
static void
mpmain(void)
{
80102e80: 55 push %ebp
80102e81: 89 e5 mov %esp,%ebp
80102e83: 53 push %ebx
80102e84: 83 ec 04 sub $0x4,%esp
cprintf("cpu%d: starting %d\n", cpuid(), cpuid());
80102e87: e8 54 09 00 00 call 801037e0 <cpuid>
80102e8c: 89 c3 mov %eax,%ebx
80102e8e: e8 4d 09 00 00 call 801037e0 <cpuid>
80102e93: 83 ec 04 sub $0x4,%esp
80102e96: 53 push %ebx
80102e97: 50 push %eax
80102e98: 68 44 74 10 80 push $0x80107444
80102e9d: e8 be d7 ff ff call 80100660 <cprintf>
idtinit(); // load idt register
80102ea2: e8 b9 28 00 00 call 80105760 <idtinit>
xchg(&(mycpu()->started), 1); // tell startothers() we're up
80102ea7: e8 b4 08 00 00 call 80103760 <mycpu>
80102eac: 89 c2 mov %eax,%edx
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
80102eae: b8 01 00 00 00 mov $0x1,%eax
80102eb3: f0 87 82 a0 00 00 00 lock xchg %eax,0xa0(%edx)
scheduler(); // start running processes
80102eba: e8 01 0c 00 00 call 80103ac0 <scheduler>
80102ebf: 90 nop
80102ec0 <mpenter>:
}
// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
80102ec0: 55 push %ebp
80102ec1: 89 e5 mov %esp,%ebp
80102ec3: 83 ec 08 sub $0x8,%esp
switchkvm();
80102ec6: e8 b5 39 00 00 call 80106880 <switchkvm>
seginit();
80102ecb: e8 b0 38 00 00 call 80106780 <seginit>
lapicinit();
80102ed0: e8 9b f7 ff ff call 80102670 <lapicinit>
mpmain();
80102ed5: e8 a6 ff ff ff call 80102e80 <mpmain>
80102eda: 66 90 xchg %ax,%ax
80102edc: 66 90 xchg %ax,%ax
80102ede: 66 90 xchg %ax,%ax
80102ee0 <main>:
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
80102ee0: 8d 4c 24 04 lea 0x4(%esp),%ecx
80102ee4: 83 e4 f0 and $0xfffffff0,%esp
80102ee7: ff 71 fc pushl -0x4(%ecx)
80102eea: 55 push %ebp
80102eeb: 89 e5 mov %esp,%ebp
80102eed: 53 push %ebx
80102eee: 51 push %ecx
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = P2V(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
for(c = cpus; c < cpus+ncpu; c++){
80102eef: bb 80 27 11 80 mov $0x80112780,%ebx
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
kinit1(end, P2V(4*1024*1024)); // phys page allocator
80102ef4: 83 ec 08 sub $0x8,%esp
80102ef7: 68 00 00 40 80 push $0x80400000
80102efc: 68 a8 54 11 80 push $0x801154a8
80102f01: e8 3a f5 ff ff call 80102440 <kinit1>
kvmalloc(); // kernel page table
80102f06: e8 15 3e 00 00 call 80106d20 <kvmalloc>
mpinit(); // detect other processors
80102f0b: e8 70 01 00 00 call 80103080 <mpinit>
lapicinit(); // interrupt controller
80102f10: e8 5b f7 ff ff call 80102670 <lapicinit>
seginit(); // segment descriptors
80102f15: e8 66 38 00 00 call 80106780 <seginit>
picinit(); // disable pic
80102f1a: e8 31 03 00 00 call 80103250 <picinit>
ioapicinit(); // another interrupt controller
80102f1f: e8 4c f3 ff ff call 80102270 <ioapicinit>
consoleinit(); // console hardware
80102f24: e8 77 da ff ff call 801009a0 <consoleinit>
uartinit(); // serial port
80102f29: e8 22 2b 00 00 call 80105a50 <uartinit>
pinit(); // process table
80102f2e: e8 0d 08 00 00 call 80103740 <pinit>
tvinit(); // trap vectors
80102f33: e8 88 27 00 00 call 801056c0 <tvinit>
binit(); // buffer cache
80102f38: e8 03 d1 ff ff call 80100040 <binit>
fileinit(); // file table
80102f3d: e8 0e de ff ff call 80100d50 <fileinit>
ideinit(); // disk
80102f42: e8 09 f1 ff ff call 80102050 <ideinit>
// Write entry code to unused memory at 0x7000.
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = P2V(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
80102f47: 83 c4 0c add $0xc,%esp
80102f4a: 68 8a 00 00 00 push $0x8a
80102f4f: 68 8c a4 10 80 push $0x8010a48c
80102f54: 68 00 70 00 80 push $0x80007000
80102f59: e8 f2 15 00 00 call 80104550 <memmove>
for(c = cpus; c < cpus+ncpu; c++){
80102f5e: 69 05 00 2d 11 80 b0 imul $0xb0,0x80112d00,%eax
80102f65: 00 00 00
80102f68: 83 c4 10 add $0x10,%esp
80102f6b: 05 80 27 11 80 add $0x80112780,%eax
80102f70: 39 d8 cmp %ebx,%eax
80102f72: 76 6f jbe 80102fe3 <main+0x103>
80102f74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(c == mycpu()) // We've started already.
80102f78: e8 e3 07 00 00 call 80103760 <mycpu>
80102f7d: 39 d8 cmp %ebx,%eax
80102f7f: 74 49 je 80102fca <main+0xea>
continue;
// Tell entryother.S what stack to use, where to enter, and what
// pgdir to use. We cannot use kpgdir yet, because the AP processor
// is running in low memory, so we use entrypgdir for the APs too.
stack = kalloc();
80102f81: e8 8a f5 ff ff call 80102510 <kalloc>
*(void**)(code-4) = stack + KSTACKSIZE;
80102f86: 05 00 10 00 00 add $0x1000,%eax
*(void(**)(void))(code-8) = mpenter;
80102f8b: c7 05 f8 6f 00 80 c0 movl $0x80102ec0,0x80006ff8
80102f92: 2e 10 80
*(int**)(code-12) = (void *) V2P(entrypgdir);
80102f95: c7 05 f4 6f 00 80 00 movl $0x109000,0x80006ff4
80102f9c: 90 10 00
// Tell entryother.S what stack to use, where to enter, and what
// pgdir to use. We cannot use kpgdir yet, because the AP processor
// is running in low memory, so we use entrypgdir for the APs too.
stack = kalloc();
*(void**)(code-4) = stack + KSTACKSIZE;
80102f9f: a3 fc 6f 00 80 mov %eax,0x80006ffc
*(void(**)(void))(code-8) = mpenter;
*(int**)(code-12) = (void *) V2P(entrypgdir);
lapicstartap(c->apicid, V2P(code));
80102fa4: 0f b6 03 movzbl (%ebx),%eax
80102fa7: 83 ec 08 sub $0x8,%esp
80102faa: 68 00 70 00 00 push $0x7000
80102faf: 50 push %eax
80102fb0: e8 0b f8 ff ff call 801027c0 <lapicstartap>
80102fb5: 83 c4 10 add $0x10,%esp
80102fb8: 90 nop
80102fb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
// wait for cpu to finish mpmain()
while(c->started == 0)
80102fc0: 8b 83 a0 00 00 00 mov 0xa0(%ebx),%eax
80102fc6: 85 c0 test %eax,%eax
80102fc8: 74 f6 je 80102fc0 <main+0xe0>
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = P2V(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
for(c = cpus; c < cpus+ncpu; c++){
80102fca: 69 05 00 2d 11 80 b0 imul $0xb0,0x80112d00,%eax
80102fd1: 00 00 00
80102fd4: 81 c3 b0 00 00 00 add $0xb0,%ebx
80102fda: 05 80 27 11 80 add $0x80112780,%eax
80102fdf: 39 c3 cmp %eax,%ebx
80102fe1: 72 95 jb 80102f78 <main+0x98>
tvinit(); // trap vectors
binit(); // buffer cache
fileinit(); // file table
ideinit(); // disk
startothers(); // start other processors
kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
80102fe3: 83 ec 08 sub $0x8,%esp
80102fe6: 68 00 00 00 8e push $0x8e000000
80102feb: 68 00 00 40 80 push $0x80400000
80102ff0: e8 bb f4 ff ff call 801024b0 <kinit2>
userinit(); // first user process
80102ff5: e8 36 08 00 00 call 80103830 <userinit>
mpmain(); // finish this processor's setup
80102ffa: e8 81 fe ff ff call 80102e80 <mpmain>
80102fff: 90 nop
80103000 <mpsearch1>:
}
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80103000: 55 push %ebp
80103001: 89 e5 mov %esp,%ebp
80103003: 57 push %edi
80103004: 56 push %esi
uchar *e, *p, *addr;
addr = P2V(a);
80103005: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi
}
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
8010300b: 53 push %ebx
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
8010300c: 8d 1c 16 lea (%esi,%edx,1),%ebx
}
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
8010300f: 83 ec 0c sub $0xc,%esp
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
80103012: 39 de cmp %ebx,%esi
80103014: 73 48 jae 8010305e <mpsearch1+0x5e>
80103016: 8d 76 00 lea 0x0(%esi),%esi
80103019: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80103020: 83 ec 04 sub $0x4,%esp
80103023: 8d 7e 10 lea 0x10(%esi),%edi
80103026: 6a 04 push $0x4
80103028: 68 58 74 10 80 push $0x80107458
8010302d: 56 push %esi
8010302e: e8 bd 14 00 00 call 801044f0 <memcmp>
80103033: 83 c4 10 add $0x10,%esp
80103036: 85 c0 test %eax,%eax
80103038: 75 1e jne 80103058 <mpsearch1+0x58>
8010303a: 8d 7e 10 lea 0x10(%esi),%edi
8010303d: 89 f2 mov %esi,%edx
8010303f: 31 c9 xor %ecx,%ecx
80103041: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
sum += addr[i];
80103048: 0f b6 02 movzbl (%edx),%eax
8010304b: 83 c2 01 add $0x1,%edx
8010304e: 01 c1 add %eax,%ecx
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
80103050: 39 fa cmp %edi,%edx
80103052: 75 f4 jne 80103048 <mpsearch1+0x48>
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80103054: 84 c9 test %cl,%cl
80103056: 74 10 je 80103068 <mpsearch1+0x68>
{
uchar *e, *p, *addr;
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
80103058: 39 fb cmp %edi,%ebx
8010305a: 89 fe mov %edi,%esi
8010305c: 77 c2 ja 80103020 <mpsearch1+0x20>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
}
8010305e: 8d 65 f4 lea -0xc(%ebp),%esp
addr = P2V(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
80103061: 31 c0 xor %eax,%eax
}
80103063: 5b pop %ebx
80103064: 5e pop %esi
80103065: 5f pop %edi
80103066: 5d pop %ebp
80103067: c3 ret
80103068: 8d 65 f4 lea -0xc(%ebp),%esp
8010306b: 89 f0 mov %esi,%eax
8010306d: 5b pop %ebx
8010306e: 5e pop %esi
8010306f: 5f pop %edi
80103070: 5d pop %ebp
80103071: c3 ret
80103072: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103079: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103080 <mpinit>:
return conf;
}
void
mpinit(void)
{
80103080: 55 push %ebp
80103081: 89 e5 mov %esp,%ebp
80103083: 57 push %edi
80103084: 56 push %esi
80103085: 53 push %ebx
80103086: 83 ec 1c sub $0x1c,%esp
uchar *bda;
uint p;
struct mp *mp;
bda = (uchar *) P2V(0x400);
if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
80103089: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax
80103090: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx
80103097: c1 e0 08 shl $0x8,%eax
8010309a: 09 d0 or %edx,%eax
8010309c: c1 e0 04 shl $0x4,%eax
8010309f: 85 c0 test %eax,%eax
801030a1: 75 1b jne 801030be <mpinit+0x3e>
if((mp = mpsearch1(p, 1024)))
return mp;
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
if((mp = mpsearch1(p-1024, 1024)))
801030a3: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax
801030aa: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx
801030b1: c1 e0 08 shl $0x8,%eax
801030b4: 09 d0 or %edx,%eax
801030b6: c1 e0 0a shl $0xa,%eax
801030b9: 2d 00 04 00 00 sub $0x400,%eax
uint p;
struct mp *mp;
bda = (uchar *) P2V(0x400);
if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
if((mp = mpsearch1(p, 1024)))
801030be: ba 00 04 00 00 mov $0x400,%edx
801030c3: e8 38 ff ff ff call 80103000 <mpsearch1>
801030c8: 85 c0 test %eax,%eax
801030ca: 89 45 e4 mov %eax,-0x1c(%ebp)
801030cd: 0f 84 37 01 00 00 je 8010320a <mpinit+0x18a>
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
801030d3: 8b 45 e4 mov -0x1c(%ebp),%eax
801030d6: 8b 58 04 mov 0x4(%eax),%ebx
801030d9: 85 db test %ebx,%ebx
801030db: 0f 84 43 01 00 00 je 80103224 <mpinit+0x1a4>
return 0;
conf = (struct mpconf*) P2V((uint) mp->physaddr);
801030e1: 8d b3 00 00 00 80 lea -0x80000000(%ebx),%esi
if(memcmp(conf, "PCMP", 4) != 0)
801030e7: 83 ec 04 sub $0x4,%esp
801030ea: 6a 04 push $0x4
801030ec: 68 5d 74 10 80 push $0x8010745d
801030f1: 56 push %esi
801030f2: e8 f9 13 00 00 call 801044f0 <memcmp>
801030f7: 83 c4 10 add $0x10,%esp
801030fa: 85 c0 test %eax,%eax
801030fc: 0f 85 22 01 00 00 jne 80103224 <mpinit+0x1a4>
return 0;
if(conf->version != 1 && conf->version != 4)
80103102: 0f b6 83 06 00 00 80 movzbl -0x7ffffffa(%ebx),%eax
80103109: 3c 01 cmp $0x1,%al
8010310b: 74 08 je 80103115 <mpinit+0x95>
8010310d: 3c 04 cmp $0x4,%al
8010310f: 0f 85 0f 01 00 00 jne 80103224 <mpinit+0x1a4>
return 0;
if(sum((uchar*)conf, conf->length) != 0)
80103115: 0f b7 bb 04 00 00 80 movzwl -0x7ffffffc(%ebx),%edi
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
8010311c: 85 ff test %edi,%edi
8010311e: 74 21 je 80103141 <mpinit+0xc1>
80103120: 31 d2 xor %edx,%edx
80103122: 31 c0 xor %eax,%eax
80103124: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
sum += addr[i];
80103128: 0f b6 8c 03 00 00 00 movzbl -0x80000000(%ebx,%eax,1),%ecx
8010312f: 80
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
80103130: 83 c0 01 add $0x1,%eax
sum += addr[i];
80103133: 01 ca add %ecx,%edx
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
80103135: 39 c7 cmp %eax,%edi
80103137: 75 ef jne 80103128 <mpinit+0xa8>
conf = (struct mpconf*) P2V((uint) mp->physaddr);
if(memcmp(conf, "PCMP", 4) != 0)
return 0;
if(conf->version != 1 && conf->version != 4)
return 0;
if(sum((uchar*)conf, conf->length) != 0)
80103139: 84 d2 test %dl,%dl
8010313b: 0f 85 e3 00 00 00 jne 80103224 <mpinit+0x1a4>
struct mp *mp;
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
if((conf = mpconfig(&mp)) == 0)
80103141: 85 f6 test %esi,%esi
80103143: 0f 84 db 00 00 00 je 80103224 <mpinit+0x1a4>
panic("Expect to run on an SMP");
ismp = 1;
lapic = (uint*)conf->lapicaddr;
80103149: 8b 83 24 00 00 80 mov -0x7fffffdc(%ebx),%eax
8010314f: a3 7c 26 11 80 mov %eax,0x8011267c
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103154: 0f b7 93 04 00 00 80 movzwl -0x7ffffffc(%ebx),%edx
8010315b: 8d 83 2c 00 00 80 lea -0x7fffffd4(%ebx),%eax
struct mpproc *proc;
struct mpioapic *ioapic;
if((conf = mpconfig(&mp)) == 0)
panic("Expect to run on an SMP");
ismp = 1;
80103161: bb 01 00 00 00 mov $0x1,%ebx
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103166: 01 d6 add %edx,%esi
80103168: 90 nop
80103169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103170: 39 c6 cmp %eax,%esi
80103172: 76 23 jbe 80103197 <mpinit+0x117>
80103174: 0f b6 10 movzbl (%eax),%edx
switch(*p){
80103177: 80 fa 04 cmp $0x4,%dl
8010317a: 0f 87 c0 00 00 00 ja 80103240 <mpinit+0x1c0>
80103180: ff 24 95 9c 74 10 80 jmp *-0x7fef8b64(,%edx,4)
80103187: 89 f6 mov %esi,%esi
80103189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p += sizeof(struct mpioapic);
continue;
case MPBUS:
case MPIOINTR:
case MPLINTR:
p += 8;
80103190: 83 c0 08 add $0x8,%eax
if((conf = mpconfig(&mp)) == 0)
panic("Expect to run on an SMP");
ismp = 1;
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103193: 39 c6 cmp %eax,%esi
80103195: 77 dd ja 80103174 <mpinit+0xf4>
default:
ismp = 0;
break;
}
}
if(!ismp)
80103197: 85 db test %ebx,%ebx
80103199: 0f 84 92 00 00 00 je 80103231 <mpinit+0x1b1>
panic("Didn't find a suitable machine");
if(mp->imcrp){
8010319f: 8b 45 e4 mov -0x1c(%ebp),%eax
801031a2: 80 78 0c 00 cmpb $0x0,0xc(%eax)
801031a6: 74 15 je 801031bd <mpinit+0x13d>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801031a8: ba 22 00 00 00 mov $0x22,%edx
801031ad: b8 70 00 00 00 mov $0x70,%eax
801031b2: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801031b3: ba 23 00 00 00 mov $0x23,%edx
801031b8: ec in (%dx),%al
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801031b9: 83 c8 01 or $0x1,%eax
801031bc: ee out %al,(%dx)
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
}
}
801031bd: 8d 65 f4 lea -0xc(%ebp),%esp
801031c0: 5b pop %ebx
801031c1: 5e pop %esi
801031c2: 5f pop %edi
801031c3: 5d pop %ebp
801031c4: c3 ret
801031c5: 8d 76 00 lea 0x0(%esi),%esi
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
switch(*p){
case MPPROC:
proc = (struct mpproc*)p;
if(ncpu < NCPU) {
801031c8: 8b 0d 00 2d 11 80 mov 0x80112d00,%ecx
801031ce: 83 f9 07 cmp $0x7,%ecx
801031d1: 7f 19 jg 801031ec <mpinit+0x16c>
cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu
801031d3: 0f b6 50 01 movzbl 0x1(%eax),%edx
801031d7: 69 f9 b0 00 00 00 imul $0xb0,%ecx,%edi
ncpu++;
801031dd: 83 c1 01 add $0x1,%ecx
801031e0: 89 0d 00 2d 11 80 mov %ecx,0x80112d00
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
switch(*p){
case MPPROC:
proc = (struct mpproc*)p;
if(ncpu < NCPU) {
cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu
801031e6: 88 97 80 27 11 80 mov %dl,-0x7feed880(%edi)
ncpu++;
}
p += sizeof(struct mpproc);
801031ec: 83 c0 14 add $0x14,%eax
continue;
801031ef: e9 7c ff ff ff jmp 80103170 <mpinit+0xf0>
801031f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
ioapicid = ioapic->apicno;
801031f8: 0f b6 50 01 movzbl 0x1(%eax),%edx
p += sizeof(struct mpioapic);
801031fc: 83 c0 08 add $0x8,%eax
}
p += sizeof(struct mpproc);
continue;
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
ioapicid = ioapic->apicno;
801031ff: 88 15 60 27 11 80 mov %dl,0x80112760
p += sizeof(struct mpioapic);
continue;
80103205: e9 66 ff ff ff jmp 80103170 <mpinit+0xf0>
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
if((mp = mpsearch1(p-1024, 1024)))
return mp;
}
return mpsearch1(0xF0000, 0x10000);
8010320a: ba 00 00 01 00 mov $0x10000,%edx
8010320f: b8 00 00 0f 00 mov $0xf0000,%eax
80103214: e8 e7 fd ff ff call 80103000 <mpsearch1>
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103219: 85 c0 test %eax,%eax
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
if((mp = mpsearch1(p-1024, 1024)))
return mp;
}
return mpsearch1(0xF0000, 0x10000);
8010321b: 89 45 e4 mov %eax,-0x1c(%ebp)
mpconfig(struct mp **pmp)
{
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
8010321e: 0f 85 af fe ff ff jne 801030d3 <mpinit+0x53>
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
if((conf = mpconfig(&mp)) == 0)
panic("Expect to run on an SMP");
80103224: 83 ec 0c sub $0xc,%esp
80103227: 68 62 74 10 80 push $0x80107462
8010322c: e8 3f d1 ff ff call 80100370 <panic>
ismp = 0;
break;
}
}
if(!ismp)
panic("Didn't find a suitable machine");
80103231: 83 ec 0c sub $0xc,%esp
80103234: 68 7c 74 10 80 push $0x8010747c
80103239: e8 32 d1 ff ff call 80100370 <panic>
8010323e: 66 90 xchg %ax,%ax
case MPIOINTR:
case MPLINTR:
p += 8;
continue;
default:
ismp = 0;
80103240: 31 db xor %ebx,%ebx
80103242: e9 30 ff ff ff jmp 80103177 <mpinit+0xf7>
80103247: 66 90 xchg %ax,%ax
80103249: 66 90 xchg %ax,%ax
8010324b: 66 90 xchg %ax,%ax
8010324d: 66 90 xchg %ax,%ax
8010324f: 90 nop
80103250 <picinit>:
#define IO_PIC2 0xA0 // Slave (IRQs 8-15)
// Don't use the 8259A interrupt controllers. Xv6 assumes SMP hardware.
void
picinit(void)
{
80103250: 55 push %ebp
80103251: ba 21 00 00 00 mov $0x21,%edx
80103256: b8 ff ff ff ff mov $0xffffffff,%eax
8010325b: 89 e5 mov %esp,%ebp
8010325d: ee out %al,(%dx)
8010325e: ba a1 00 00 00 mov $0xa1,%edx
80103263: ee out %al,(%dx)
// mask all interrupts
outb(IO_PIC1+1, 0xFF);
outb(IO_PIC2+1, 0xFF);
}
80103264: 5d pop %ebp
80103265: c3 ret
80103266: 66 90 xchg %ax,%ax
80103268: 66 90 xchg %ax,%ax
8010326a: 66 90 xchg %ax,%ax
8010326c: 66 90 xchg %ax,%ax
8010326e: 66 90 xchg %ax,%ax
80103270 <pipealloc>:
int writeopen; // write fd is still open
};
int
pipealloc(struct file **f0, struct file **f1)
{
80103270: 55 push %ebp
80103271: 89 e5 mov %esp,%ebp
80103273: 57 push %edi
80103274: 56 push %esi
80103275: 53 push %ebx
80103276: 83 ec 0c sub $0xc,%esp
80103279: 8b 75 08 mov 0x8(%ebp),%esi
8010327c: 8b 5d 0c mov 0xc(%ebp),%ebx
struct pipe *p;
p = 0;
*f0 = *f1 = 0;
8010327f: c7 03 00 00 00 00 movl $0x0,(%ebx)
80103285: c7 06 00 00 00 00 movl $0x0,(%esi)
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
8010328b: e8 e0 da ff ff call 80100d70 <filealloc>
80103290: 85 c0 test %eax,%eax
80103292: 89 06 mov %eax,(%esi)
80103294: 0f 84 a8 00 00 00 je 80103342 <pipealloc+0xd2>
8010329a: e8 d1 da ff ff call 80100d70 <filealloc>
8010329f: 85 c0 test %eax,%eax
801032a1: 89 03 mov %eax,(%ebx)
801032a3: 0f 84 87 00 00 00 je 80103330 <pipealloc+0xc0>
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
801032a9: e8 62 f2 ff ff call 80102510 <kalloc>
801032ae: 85 c0 test %eax,%eax
801032b0: 89 c7 mov %eax,%edi
801032b2: 0f 84 b0 00 00 00 je 80103368 <pipealloc+0xf8>
goto bad;
p->readopen = 1;
p->writeopen = 1;
p->nwrite = 0;
p->nread = 0;
initlock(&p->lock, "pipe");
801032b8: 83 ec 08 sub $0x8,%esp
*f0 = *f1 = 0;
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
goto bad;
p->readopen = 1;
801032bb: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax)
801032c2: 00 00 00
p->writeopen = 1;
801032c5: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax)
801032cc: 00 00 00
p->nwrite = 0;
801032cf: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax)
801032d6: 00 00 00
p->nread = 0;
801032d9: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax)
801032e0: 00 00 00
initlock(&p->lock, "pipe");
801032e3: 68 b0 74 10 80 push $0x801074b0
801032e8: 50 push %eax
801032e9: e8 52 0f 00 00 call 80104240 <initlock>
(*f0)->type = FD_PIPE;
801032ee: 8b 06 mov (%esi),%eax
(*f0)->pipe = p;
(*f1)->type = FD_PIPE;
(*f1)->readable = 0;
(*f1)->writable = 1;
(*f1)->pipe = p;
return 0;
801032f0: 83 c4 10 add $0x10,%esp
p->readopen = 1;
p->writeopen = 1;
p->nwrite = 0;
p->nread = 0;
initlock(&p->lock, "pipe");
(*f0)->type = FD_PIPE;
801032f3: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f0)->readable = 1;
801032f9: 8b 06 mov (%esi),%eax
801032fb: c6 40 08 01 movb $0x1,0x8(%eax)
(*f0)->writable = 0;
801032ff: 8b 06 mov (%esi),%eax
80103301: c6 40 09 00 movb $0x0,0x9(%eax)
(*f0)->pipe = p;
80103305: 8b 06 mov (%esi),%eax
80103307: 89 78 0c mov %edi,0xc(%eax)
(*f1)->type = FD_PIPE;
8010330a: 8b 03 mov (%ebx),%eax
8010330c: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f1)->readable = 0;
80103312: 8b 03 mov (%ebx),%eax
80103314: c6 40 08 00 movb $0x0,0x8(%eax)
(*f1)->writable = 1;
80103318: 8b 03 mov (%ebx),%eax
8010331a: c6 40 09 01 movb $0x1,0x9(%eax)
(*f1)->pipe = p;
8010331e: 8b 03 mov (%ebx),%eax
80103320: 89 78 0c mov %edi,0xc(%eax)
if(*f0)
fileclose(*f0);
if(*f1)
fileclose(*f1);
return -1;
}
80103323: 8d 65 f4 lea -0xc(%ebp),%esp
(*f0)->pipe = p;
(*f1)->type = FD_PIPE;
(*f1)->readable = 0;
(*f1)->writable = 1;
(*f1)->pipe = p;
return 0;
80103326: 31 c0 xor %eax,%eax
if(*f0)
fileclose(*f0);
if(*f1)
fileclose(*f1);
return -1;
}
80103328: 5b pop %ebx
80103329: 5e pop %esi
8010332a: 5f pop %edi
8010332b: 5d pop %ebp
8010332c: c3 ret
8010332d: 8d 76 00 lea 0x0(%esi),%esi
//PAGEBREAK: 20
bad:
if(p)
kfree((char*)p);
if(*f0)
80103330: 8b 06 mov (%esi),%eax
80103332: 85 c0 test %eax,%eax
80103334: 74 1e je 80103354 <pipealloc+0xe4>
fileclose(*f0);
80103336: 83 ec 0c sub $0xc,%esp
80103339: 50 push %eax
8010333a: e8 f1 da ff ff call 80100e30 <fileclose>
8010333f: 83 c4 10 add $0x10,%esp
if(*f1)
80103342: 8b 03 mov (%ebx),%eax
80103344: 85 c0 test %eax,%eax
80103346: 74 0c je 80103354 <pipealloc+0xe4>
fileclose(*f1);
80103348: 83 ec 0c sub $0xc,%esp
8010334b: 50 push %eax
8010334c: e8 df da ff ff call 80100e30 <fileclose>
80103351: 83 c4 10 add $0x10,%esp
return -1;
}
80103354: 8d 65 f4 lea -0xc(%ebp),%esp
kfree((char*)p);
if(*f0)
fileclose(*f0);
if(*f1)
fileclose(*f1);
return -1;
80103357: b8 ff ff ff ff mov $0xffffffff,%eax
}
8010335c: 5b pop %ebx
8010335d: 5e pop %esi
8010335e: 5f pop %edi
8010335f: 5d pop %ebp
80103360: c3 ret
80103361: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
//PAGEBREAK: 20
bad:
if(p)
kfree((char*)p);
if(*f0)
80103368: 8b 06 mov (%esi),%eax
8010336a: 85 c0 test %eax,%eax
8010336c: 75 c8 jne 80103336 <pipealloc+0xc6>
8010336e: eb d2 jmp 80103342 <pipealloc+0xd2>
80103370 <pipeclose>:
return -1;
}
void
pipeclose(struct pipe *p, int writable)
{
80103370: 55 push %ebp
80103371: 89 e5 mov %esp,%ebp
80103373: 56 push %esi
80103374: 53 push %ebx
80103375: 8b 5d 08 mov 0x8(%ebp),%ebx
80103378: 8b 75 0c mov 0xc(%ebp),%esi
acquire(&p->lock);
8010337b: 83 ec 0c sub $0xc,%esp
8010337e: 53 push %ebx
8010337f: e8 1c 10 00 00 call 801043a0 <acquire>
if(writable){
80103384: 83 c4 10 add $0x10,%esp
80103387: 85 f6 test %esi,%esi
80103389: 74 45 je 801033d0 <pipeclose+0x60>
p->writeopen = 0;
wakeup(&p->nread);
8010338b: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax
80103391: 83 ec 0c sub $0xc,%esp
void
pipeclose(struct pipe *p, int writable)
{
acquire(&p->lock);
if(writable){
p->writeopen = 0;
80103394: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx)
8010339b: 00 00 00
wakeup(&p->nread);
8010339e: 50 push %eax
8010339f: e8 bc 0b 00 00 call 80103f60 <wakeup>
801033a4: 83 c4 10 add $0x10,%esp
} else {
p->readopen = 0;
wakeup(&p->nwrite);
}
if(p->readopen == 0 && p->writeopen == 0){
801033a7: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx
801033ad: 85 d2 test %edx,%edx
801033af: 75 0a jne 801033bb <pipeclose+0x4b>
801033b1: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax
801033b7: 85 c0 test %eax,%eax
801033b9: 74 35 je 801033f0 <pipeclose+0x80>
release(&p->lock);
kfree((char*)p);
} else
release(&p->lock);
801033bb: 89 5d 08 mov %ebx,0x8(%ebp)
}
801033be: 8d 65 f8 lea -0x8(%ebp),%esp
801033c1: 5b pop %ebx
801033c2: 5e pop %esi
801033c3: 5d pop %ebp
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
kfree((char*)p);
} else
release(&p->lock);
801033c4: e9 87 10 00 00 jmp 80104450 <release>
801033c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(writable){
p->writeopen = 0;
wakeup(&p->nread);
} else {
p->readopen = 0;
wakeup(&p->nwrite);
801033d0: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax
801033d6: 83 ec 0c sub $0xc,%esp
acquire(&p->lock);
if(writable){
p->writeopen = 0;
wakeup(&p->nread);
} else {
p->readopen = 0;
801033d9: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx)
801033e0: 00 00 00
wakeup(&p->nwrite);
801033e3: 50 push %eax
801033e4: e8 77 0b 00 00 call 80103f60 <wakeup>
801033e9: 83 c4 10 add $0x10,%esp
801033ec: eb b9 jmp 801033a7 <pipeclose+0x37>
801033ee: 66 90 xchg %ax,%ax
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
801033f0: 83 ec 0c sub $0xc,%esp
801033f3: 53 push %ebx
801033f4: e8 57 10 00 00 call 80104450 <release>
kfree((char*)p);
801033f9: 89 5d 08 mov %ebx,0x8(%ebp)
801033fc: 83 c4 10 add $0x10,%esp
} else
release(&p->lock);
}
801033ff: 8d 65 f8 lea -0x8(%ebp),%esp
80103402: 5b pop %ebx
80103403: 5e pop %esi
80103404: 5d pop %ebp
p->readopen = 0;
wakeup(&p->nwrite);
}
if(p->readopen == 0 && p->writeopen == 0){
release(&p->lock);
kfree((char*)p);
80103405: e9 56 ef ff ff jmp 80102360 <kfree>
8010340a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103410 <pipewrite>:
}
//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
80103410: 55 push %ebp
80103411: 89 e5 mov %esp,%ebp
80103413: 57 push %edi
80103414: 56 push %esi
80103415: 53 push %ebx
80103416: 83 ec 28 sub $0x28,%esp
80103419: 8b 5d 08 mov 0x8(%ebp),%ebx
int i;
acquire(&p->lock);
8010341c: 53 push %ebx
8010341d: e8 7e 0f 00 00 call 801043a0 <acquire>
for(i = 0; i < n; i++){
80103422: 8b 45 10 mov 0x10(%ebp),%eax
80103425: 83 c4 10 add $0x10,%esp
80103428: 85 c0 test %eax,%eax
8010342a: 0f 8e b9 00 00 00 jle 801034e9 <pipewrite+0xd9>
80103430: 8b 4d 0c mov 0xc(%ebp),%ecx
80103433: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
if(p->readopen == 0 || myproc()->killed){
release(&p->lock);
return -1;
}
wakeup(&p->nread);
80103439: 8d bb 34 02 00 00 lea 0x234(%ebx),%edi
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
8010343f: 8d b3 38 02 00 00 lea 0x238(%ebx),%esi
80103445: 89 4d e4 mov %ecx,-0x1c(%ebp)
80103448: 03 4d 10 add 0x10(%ebp),%ecx
8010344b: 89 4d e0 mov %ecx,-0x20(%ebp)
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
8010344e: 8b 8b 34 02 00 00 mov 0x234(%ebx),%ecx
80103454: 8d 91 00 02 00 00 lea 0x200(%ecx),%edx
8010345a: 39 d0 cmp %edx,%eax
8010345c: 74 38 je 80103496 <pipewrite+0x86>
8010345e: eb 59 jmp 801034b9 <pipewrite+0xa9>
if(p->readopen == 0 || myproc()->killed){
80103460: e8 9b 03 00 00 call 80103800 <myproc>
80103465: 8b 48 24 mov 0x24(%eax),%ecx
80103468: 85 c9 test %ecx,%ecx
8010346a: 75 34 jne 801034a0 <pipewrite+0x90>
release(&p->lock);
return -1;
}
wakeup(&p->nread);
8010346c: 83 ec 0c sub $0xc,%esp
8010346f: 57 push %edi
80103470: e8 eb 0a 00 00 call 80103f60 <wakeup>
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
80103475: 58 pop %eax
80103476: 5a pop %edx
80103477: 53 push %ebx
80103478: 56 push %esi
80103479: e8 32 09 00 00 call 80103db0 <sleep>
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
8010347e: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax
80103484: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx
8010348a: 83 c4 10 add $0x10,%esp
8010348d: 05 00 02 00 00 add $0x200,%eax
80103492: 39 c2 cmp %eax,%edx
80103494: 75 2a jne 801034c0 <pipewrite+0xb0>
if(p->readopen == 0 || myproc()->killed){
80103496: 8b 83 3c 02 00 00 mov 0x23c(%ebx),%eax
8010349c: 85 c0 test %eax,%eax
8010349e: 75 c0 jne 80103460 <pipewrite+0x50>
release(&p->lock);
801034a0: 83 ec 0c sub $0xc,%esp
801034a3: 53 push %ebx
801034a4: e8 a7 0f 00 00 call 80104450 <release>
return -1;
801034a9: 83 c4 10 add $0x10,%esp
801034ac: b8 ff ff ff ff mov $0xffffffff,%eax
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
release(&p->lock);
return n;
}
801034b1: 8d 65 f4 lea -0xc(%ebp),%esp
801034b4: 5b pop %ebx
801034b5: 5e pop %esi
801034b6: 5f pop %edi
801034b7: 5d pop %ebp
801034b8: c3 ret
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
801034b9: 89 c2 mov %eax,%edx
801034bb: 90 nop
801034bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
}
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
801034c0: 8b 4d e4 mov -0x1c(%ebp),%ecx
801034c3: 8d 42 01 lea 0x1(%edx),%eax
801034c6: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
801034ca: 81 e2 ff 01 00 00 and $0x1ff,%edx
801034d0: 89 83 38 02 00 00 mov %eax,0x238(%ebx)
801034d6: 0f b6 09 movzbl (%ecx),%ecx
801034d9: 88 4c 13 34 mov %cl,0x34(%ebx,%edx,1)
801034dd: 8b 4d e4 mov -0x1c(%ebp),%ecx
pipewrite(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
801034e0: 3b 4d e0 cmp -0x20(%ebp),%ecx
801034e3: 0f 85 65 ff ff ff jne 8010344e <pipewrite+0x3e>
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
801034e9: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax
801034ef: 83 ec 0c sub $0xc,%esp
801034f2: 50 push %eax
801034f3: e8 68 0a 00 00 call 80103f60 <wakeup>
release(&p->lock);
801034f8: 89 1c 24 mov %ebx,(%esp)
801034fb: e8 50 0f 00 00 call 80104450 <release>
return n;
80103500: 83 c4 10 add $0x10,%esp
80103503: 8b 45 10 mov 0x10(%ebp),%eax
80103506: eb a9 jmp 801034b1 <pipewrite+0xa1>
80103508: 90 nop
80103509: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103510 <piperead>:
}
int
piperead(struct pipe *p, char *addr, int n)
{
80103510: 55 push %ebp
80103511: 89 e5 mov %esp,%ebp
80103513: 57 push %edi
80103514: 56 push %esi
80103515: 53 push %ebx
80103516: 83 ec 18 sub $0x18,%esp
80103519: 8b 5d 08 mov 0x8(%ebp),%ebx
8010351c: 8b 7d 0c mov 0xc(%ebp),%edi
int i;
acquire(&p->lock);
8010351f: 53 push %ebx
80103520: e8 7b 0e 00 00 call 801043a0 <acquire>
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
80103525: 83 c4 10 add $0x10,%esp
80103528: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax
8010352e: 39 83 38 02 00 00 cmp %eax,0x238(%ebx)
80103534: 75 6a jne 801035a0 <piperead+0x90>
80103536: 8b b3 40 02 00 00 mov 0x240(%ebx),%esi
8010353c: 85 f6 test %esi,%esi
8010353e: 0f 84 cc 00 00 00 je 80103610 <piperead+0x100>
if(myproc()->killed){
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
80103544: 8d b3 34 02 00 00 lea 0x234(%ebx),%esi
8010354a: eb 2d jmp 80103579 <piperead+0x69>
8010354c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103550: 83 ec 08 sub $0x8,%esp
80103553: 53 push %ebx
80103554: 56 push %esi
80103555: e8 56 08 00 00 call 80103db0 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
8010355a: 83 c4 10 add $0x10,%esp
8010355d: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax
80103563: 39 83 34 02 00 00 cmp %eax,0x234(%ebx)
80103569: 75 35 jne 801035a0 <piperead+0x90>
8010356b: 8b 93 40 02 00 00 mov 0x240(%ebx),%edx
80103571: 85 d2 test %edx,%edx
80103573: 0f 84 97 00 00 00 je 80103610 <piperead+0x100>
if(myproc()->killed){
80103579: e8 82 02 00 00 call 80103800 <myproc>
8010357e: 8b 48 24 mov 0x24(%eax),%ecx
80103581: 85 c9 test %ecx,%ecx
80103583: 74 cb je 80103550 <piperead+0x40>
release(&p->lock);
80103585: 83 ec 0c sub $0xc,%esp
80103588: 53 push %ebx
80103589: e8 c2 0e 00 00 call 80104450 <release>
return -1;
8010358e: 83 c4 10 add $0x10,%esp
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
release(&p->lock);
return i;
}
80103591: 8d 65 f4 lea -0xc(%ebp),%esp
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
if(myproc()->killed){
release(&p->lock);
return -1;
80103594: b8 ff ff ff ff mov $0xffffffff,%eax
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
release(&p->lock);
return i;
}
80103599: 5b pop %ebx
8010359a: 5e pop %esi
8010359b: 5f pop %edi
8010359c: 5d pop %ebp
8010359d: c3 ret
8010359e: 66 90 xchg %ax,%ax
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
801035a0: 8b 45 10 mov 0x10(%ebp),%eax
801035a3: 85 c0 test %eax,%eax
801035a5: 7e 69 jle 80103610 <piperead+0x100>
if(p->nread == p->nwrite)
801035a7: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax
801035ad: 31 c9 xor %ecx,%ecx
801035af: eb 15 jmp 801035c6 <piperead+0xb6>
801035b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801035b8: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax
801035be: 3b 83 38 02 00 00 cmp 0x238(%ebx),%eax
801035c4: 74 5a je 80103620 <piperead+0x110>
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
801035c6: 8d 70 01 lea 0x1(%eax),%esi
801035c9: 25 ff 01 00 00 and $0x1ff,%eax
801035ce: 89 b3 34 02 00 00 mov %esi,0x234(%ebx)
801035d4: 0f b6 44 03 34 movzbl 0x34(%ebx,%eax,1),%eax
801035d9: 88 04 0f mov %al,(%edi,%ecx,1)
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
801035dc: 83 c1 01 add $0x1,%ecx
801035df: 39 4d 10 cmp %ecx,0x10(%ebp)
801035e2: 75 d4 jne 801035b8 <piperead+0xa8>
if(p->nread == p->nwrite)
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
801035e4: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax
801035ea: 83 ec 0c sub $0xc,%esp
801035ed: 50 push %eax
801035ee: e8 6d 09 00 00 call 80103f60 <wakeup>
release(&p->lock);
801035f3: 89 1c 24 mov %ebx,(%esp)
801035f6: e8 55 0e 00 00 call 80104450 <release>
return i;
801035fb: 8b 45 10 mov 0x10(%ebp),%eax
801035fe: 83 c4 10 add $0x10,%esp
}
80103601: 8d 65 f4 lea -0xc(%ebp),%esp
80103604: 5b pop %ebx
80103605: 5e pop %esi
80103606: 5f pop %edi
80103607: 5d pop %ebp
80103608: c3 ret
80103609: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
80103610: c7 45 10 00 00 00 00 movl $0x0,0x10(%ebp)
80103617: eb cb jmp 801035e4 <piperead+0xd4>
80103619: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103620: 89 4d 10 mov %ecx,0x10(%ebp)
80103623: eb bf jmp 801035e4 <piperead+0xd4>
80103625: 66 90 xchg %ax,%ax
80103627: 66 90 xchg %ax,%ax
80103629: 66 90 xchg %ax,%ax
8010362b: 66 90 xchg %ax,%ax
8010362d: 66 90 xchg %ax,%ax
8010362f: 90 nop
80103630 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80103630: 55 push %ebp
80103631: 89 e5 mov %esp,%ebp
80103633: 53 push %ebx
struct proc *p;
char *sp;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103634: bb 54 2d 11 80 mov $0x80112d54,%ebx
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80103639: 83 ec 10 sub $0x10,%esp
struct proc *p;
char *sp;
acquire(&ptable.lock);
8010363c: 68 20 2d 11 80 push $0x80112d20
80103641: e8 5a 0d 00 00 call 801043a0 <acquire>
80103646: 83 c4 10 add $0x10,%esp
80103649: eb 10 jmp 8010365b <allocproc+0x2b>
8010364b: 90 nop
8010364c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103650: 83 c3 7c add $0x7c,%ebx
80103653: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx
80103659: 74 75 je 801036d0 <allocproc+0xa0>
if(p->state == UNUSED)
8010365b: 8b 43 0c mov 0xc(%ebx),%eax
8010365e: 85 c0 test %eax,%eax
80103660: 75 ee jne 80103650 <allocproc+0x20>
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
80103662: a1 04 a0 10 80 mov 0x8010a004,%eax
release(&ptable.lock);
80103667: 83 ec 0c sub $0xc,%esp
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
8010366a: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx)
p->pid = nextpid++;
release(&ptable.lock);
80103671: 68 20 2d 11 80 push $0x80112d20
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
p->pid = nextpid++;
80103676: 8d 50 01 lea 0x1(%eax),%edx
80103679: 89 43 10 mov %eax,0x10(%ebx)
8010367c: 89 15 04 a0 10 80 mov %edx,0x8010a004
release(&ptable.lock);
80103682: e8 c9 0d 00 00 call 80104450 <release>
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
80103687: e8 84 ee ff ff call 80102510 <kalloc>
8010368c: 83 c4 10 add $0x10,%esp
8010368f: 85 c0 test %eax,%eax
80103691: 89 43 08 mov %eax,0x8(%ebx)
80103694: 74 51 je 801036e7 <allocproc+0xb7>
return 0;
}
sp = p->kstack + KSTACKSIZE;
// Leave room for trap frame.
sp -= sizeof *p->tf;
80103696: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx
sp -= 4;
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
8010369c: 83 ec 04 sub $0x4,%esp
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
8010369f: 05 9c 0f 00 00 add $0xf9c,%eax
return 0;
}
sp = p->kstack + KSTACKSIZE;
// Leave room for trap frame.
sp -= sizeof *p->tf;
801036a4: 89 53 18 mov %edx,0x18(%ebx)
p->tf = (struct trapframe*)sp;
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
801036a7: c7 40 14 b2 56 10 80 movl $0x801056b2,0x14(%eax)
sp -= sizeof *p->context;
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
801036ae: 6a 14 push $0x14
801036b0: 6a 00 push $0x0
801036b2: 50 push %eax
// which returns to trapret.
sp -= 4;
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
p->context = (struct context*)sp;
801036b3: 89 43 1c mov %eax,0x1c(%ebx)
memset(p->context, 0, sizeof *p->context);
801036b6: e8 e5 0d 00 00 call 801044a0 <memset>
p->context->eip = (uint)forkret;
801036bb: 8b 43 1c mov 0x1c(%ebx),%eax
return p;
801036be: 83 c4 10 add $0x10,%esp
*(uint*)sp = (uint)trapret;
sp -= sizeof *p->context;
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
p->context->eip = (uint)forkret;
801036c1: c7 40 10 f0 36 10 80 movl $0x801036f0,0x10(%eax)
return p;
801036c8: 89 d8 mov %ebx,%eax
}
801036ca: 8b 5d fc mov -0x4(%ebp),%ebx
801036cd: c9 leave
801036ce: c3 ret
801036cf: 90 nop
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if(p->state == UNUSED)
goto found;
release(&ptable.lock);
801036d0: 83 ec 0c sub $0xc,%esp
801036d3: 68 20 2d 11 80 push $0x80112d20
801036d8: e8 73 0d 00 00 call 80104450 <release>
return 0;
801036dd: 83 c4 10 add $0x10,%esp
801036e0: 31 c0 xor %eax,%eax
p->context = (struct context*)sp;
memset(p->context, 0, sizeof *p->context);
p->context->eip = (uint)forkret;
return p;
}
801036e2: 8b 5d fc mov -0x4(%ebp),%ebx
801036e5: c9 leave
801036e6: c3 ret
release(&ptable.lock);
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
p->state = UNUSED;
801036e7: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
return 0;
801036ee: eb da jmp 801036ca <allocproc+0x9a>
801036f0 <forkret>:
// A fork child's very first scheduling by scheduler()
// will swtch here. "Return" to user space.
void
forkret(void)
{
801036f0: 55 push %ebp
801036f1: 89 e5 mov %esp,%ebp
801036f3: 83 ec 14 sub $0x14,%esp
static int first = 1;
// Still holding ptable.lock from scheduler.
release(&ptable.lock);
801036f6: 68 20 2d 11 80 push $0x80112d20
801036fb: e8 50 0d 00 00 call 80104450 <release>
if (first) {
80103700: a1 00 a0 10 80 mov 0x8010a000,%eax
80103705: 83 c4 10 add $0x10,%esp
80103708: 85 c0 test %eax,%eax
8010370a: 75 04 jne 80103710 <forkret+0x20>
iinit(ROOTDEV);
initlog(ROOTDEV);
}
// Return to "caller", actually trapret (see allocproc).
}
8010370c: c9 leave
8010370d: c3 ret
8010370e: 66 90 xchg %ax,%ax
if (first) {
// Some initialization functions must be run in the context
// of a regular process (e.g., they call sleep), and thus cannot
// be run from main().
first = 0;
iinit(ROOTDEV);
80103710: 83 ec 0c sub $0xc,%esp
if (first) {
// Some initialization functions must be run in the context
// of a regular process (e.g., they call sleep), and thus cannot
// be run from main().
first = 0;
80103713: c7 05 00 a0 10 80 00 movl $0x0,0x8010a000
8010371a: 00 00 00
iinit(ROOTDEV);
8010371d: 6a 01 push $0x1
8010371f: e8 4c dd ff ff call 80101470 <iinit>
initlog(ROOTDEV);
80103724: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010372b: e8 00 f4 ff ff call 80102b30 <initlog>
80103730: 83 c4 10 add $0x10,%esp
}
// Return to "caller", actually trapret (see allocproc).
}
80103733: c9 leave
80103734: c3 ret
80103735: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103739: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103740 <pinit>:
static void wakeup1(void *chan);
void
pinit(void)
{
80103740: 55 push %ebp
80103741: 89 e5 mov %esp,%ebp
80103743: 83 ec 10 sub $0x10,%esp
initlock(&ptable.lock, "ptable");
80103746: 68 b5 74 10 80 push $0x801074b5
8010374b: 68 20 2d 11 80 push $0x80112d20
80103750: e8 eb 0a 00 00 call 80104240 <initlock>
}
80103755: 83 c4 10 add $0x10,%esp
80103758: c9 leave
80103759: c3 ret
8010375a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103760 <mycpu>:
// Must be called with interrupts disabled to avoid the caller being
// rescheduled between reading lapicid and running through the loop.
struct cpu*
mycpu(void)
{
80103760: 55 push %ebp
80103761: 89 e5 mov %esp,%ebp
80103763: 56 push %esi
80103764: 53 push %ebx
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80103765: 9c pushf
80103766: 58 pop %eax
int apicid, i;
if(readeflags()&FL_IF)
80103767: f6 c4 02 test $0x2,%ah
8010376a: 75 5b jne 801037c7 <mycpu+0x67>
panic("mycpu called with interrupts enabled\n");
apicid = lapicid();
8010376c: e8 ff ef ff ff call 80102770 <lapicid>
// APIC IDs are not guaranteed to be contiguous. Maybe we should have
// a reverse map, or reserve a register to store &cpus[i].
for (i = 0; i < ncpu; ++i) {
80103771: 8b 35 00 2d 11 80 mov 0x80112d00,%esi
80103777: 85 f6 test %esi,%esi
80103779: 7e 3f jle 801037ba <mycpu+0x5a>
if (cpus[i].apicid == apicid)
8010377b: 0f b6 15 80 27 11 80 movzbl 0x80112780,%edx
80103782: 39 d0 cmp %edx,%eax
80103784: 74 30 je 801037b6 <mycpu+0x56>
80103786: b9 30 28 11 80 mov $0x80112830,%ecx
8010378b: 31 d2 xor %edx,%edx
8010378d: 8d 76 00 lea 0x0(%esi),%esi
panic("mycpu called with interrupts enabled\n");
apicid = lapicid();
// APIC IDs are not guaranteed to be contiguous. Maybe we should have
// a reverse map, or reserve a register to store &cpus[i].
for (i = 0; i < ncpu; ++i) {
80103790: 83 c2 01 add $0x1,%edx
80103793: 39 f2 cmp %esi,%edx
80103795: 74 23 je 801037ba <mycpu+0x5a>
if (cpus[i].apicid == apicid)
80103797: 0f b6 19 movzbl (%ecx),%ebx
8010379a: 81 c1 b0 00 00 00 add $0xb0,%ecx
801037a0: 39 d8 cmp %ebx,%eax
801037a2: 75 ec jne 80103790 <mycpu+0x30>
return &cpus[i];
801037a4: 69 c2 b0 00 00 00 imul $0xb0,%edx,%eax
}
panic("unknown apicid\n");
}
801037aa: 8d 65 f8 lea -0x8(%ebp),%esp
801037ad: 5b pop %ebx
apicid = lapicid();
// APIC IDs are not guaranteed to be contiguous. Maybe we should have
// a reverse map, or reserve a register to store &cpus[i].
for (i = 0; i < ncpu; ++i) {
if (cpus[i].apicid == apicid)
return &cpus[i];
801037ae: 05 80 27 11 80 add $0x80112780,%eax
}
panic("unknown apicid\n");
}
801037b3: 5e pop %esi
801037b4: 5d pop %ebp
801037b5: c3 ret
panic("mycpu called with interrupts enabled\n");
apicid = lapicid();
// APIC IDs are not guaranteed to be contiguous. Maybe we should have
// a reverse map, or reserve a register to store &cpus[i].
for (i = 0; i < ncpu; ++i) {
801037b6: 31 d2 xor %edx,%edx
801037b8: eb ea jmp 801037a4 <mycpu+0x44>
if (cpus[i].apicid == apicid)
return &cpus[i];
}
panic("unknown apicid\n");
801037ba: 83 ec 0c sub $0xc,%esp
801037bd: 68 bc 74 10 80 push $0x801074bc
801037c2: e8 a9 cb ff ff call 80100370 <panic>
mycpu(void)
{
int apicid, i;
if(readeflags()&FL_IF)
panic("mycpu called with interrupts enabled\n");
801037c7: 83 ec 0c sub $0xc,%esp
801037ca: 68 98 75 10 80 push $0x80107598
801037cf: e8 9c cb ff ff call 80100370 <panic>
801037d4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801037da: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
801037e0 <cpuid>:
initlock(&ptable.lock, "ptable");
}
// Must be called with interrupts disabled
int
cpuid() {
801037e0: 55 push %ebp
801037e1: 89 e5 mov %esp,%ebp
801037e3: 83 ec 08 sub $0x8,%esp
return mycpu()-cpus;
801037e6: e8 75 ff ff ff call 80103760 <mycpu>
801037eb: 2d 80 27 11 80 sub $0x80112780,%eax
}
801037f0: c9 leave
}
// Must be called with interrupts disabled
int
cpuid() {
return mycpu()-cpus;
801037f1: c1 f8 04 sar $0x4,%eax
801037f4: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax
}
801037fa: c3 ret
801037fb: 90 nop
801037fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103800 <myproc>:
}
// Disable interrupts so that we are not rescheduled
// while reading proc from the cpu structure
struct proc*
myproc(void) {
80103800: 55 push %ebp
80103801: 89 e5 mov %esp,%ebp
80103803: 53 push %ebx
80103804: 83 ec 04 sub $0x4,%esp
struct cpu *c;
struct proc *p;
pushcli();
80103807: e8 b4 0a 00 00 call 801042c0 <pushcli>
c = mycpu();
8010380c: e8 4f ff ff ff call 80103760 <mycpu>
p = c->proc;
80103811: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
80103817: e8 e4 0a 00 00 call 80104300 <popcli>
return p;
}
8010381c: 83 c4 04 add $0x4,%esp
8010381f: 89 d8 mov %ebx,%eax
80103821: 5b pop %ebx
80103822: 5d pop %ebp
80103823: c3 ret
80103824: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8010382a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80103830 <userinit>:
//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
80103830: 55 push %ebp
80103831: 89 e5 mov %esp,%ebp
80103833: 53 push %ebx
80103834: 83 ec 04 sub $0x4,%esp
struct proc *p;
extern char _binary_initcode_start[], _binary_initcode_size[];
p = allocproc();
80103837: e8 f4 fd ff ff call 80103630 <allocproc>
8010383c: 89 c3 mov %eax,%ebx
initproc = p;
8010383e: a3 b8 a5 10 80 mov %eax,0x8010a5b8
if((p->pgdir = setupkvm()) == 0)
80103843: e8 58 34 00 00 call 80106ca0 <setupkvm>
80103848: 85 c0 test %eax,%eax
8010384a: 89 43 04 mov %eax,0x4(%ebx)
8010384d: 0f 84 bd 00 00 00 je 80103910 <userinit+0xe0>
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
80103853: 83 ec 04 sub $0x4,%esp
80103856: 68 2c 00 00 00 push $0x2c
8010385b: 68 60 a4 10 80 push $0x8010a460
80103860: 50 push %eax
80103861: e8 4a 31 00 00 call 801069b0 <inituvm>
p->sz = PGSIZE;
memset(p->tf, 0, sizeof(*p->tf));
80103866: 83 c4 0c add $0xc,%esp
initproc = p;
if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
p->sz = PGSIZE;
80103869: c7 03 00 10 00 00 movl $0x1000,(%ebx)
memset(p->tf, 0, sizeof(*p->tf));
8010386f: 6a 4c push $0x4c
80103871: 6a 00 push $0x0
80103873: ff 73 18 pushl 0x18(%ebx)
80103876: e8 25 0c 00 00 call 801044a0 <memset>
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
8010387b: 8b 43 18 mov 0x18(%ebx),%eax
8010387e: ba 1b 00 00 00 mov $0x1b,%edx
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
80103883: b9 23 00 00 00 mov $0x23,%ecx
p->tf->ss = p->tf->ds;
p->tf->eflags = FL_IF;
p->tf->esp = PGSIZE;
p->tf->eip = 0; // beginning of initcode.S
safestrcpy(p->name, "initcode", sizeof(p->name));
80103888: 83 c4 0c add $0xc,%esp
if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
p->sz = PGSIZE;
memset(p->tf, 0, sizeof(*p->tf));
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
8010388b: 66 89 50 3c mov %dx,0x3c(%eax)
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
8010388f: 8b 43 18 mov 0x18(%ebx),%eax
80103892: 66 89 48 2c mov %cx,0x2c(%eax)
p->tf->es = p->tf->ds;
80103896: 8b 43 18 mov 0x18(%ebx),%eax
80103899: 0f b7 50 2c movzwl 0x2c(%eax),%edx
8010389d: 66 89 50 28 mov %dx,0x28(%eax)
p->tf->ss = p->tf->ds;
801038a1: 8b 43 18 mov 0x18(%ebx),%eax
801038a4: 0f b7 50 2c movzwl 0x2c(%eax),%edx
801038a8: 66 89 50 48 mov %dx,0x48(%eax)
p->tf->eflags = FL_IF;
801038ac: 8b 43 18 mov 0x18(%ebx),%eax
801038af: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax)
p->tf->esp = PGSIZE;
801038b6: 8b 43 18 mov 0x18(%ebx),%eax
801038b9: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax)
p->tf->eip = 0; // beginning of initcode.S
801038c0: 8b 43 18 mov 0x18(%ebx),%eax
801038c3: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax)
safestrcpy(p->name, "initcode", sizeof(p->name));
801038ca: 8d 43 6c lea 0x6c(%ebx),%eax
801038cd: 6a 10 push $0x10
801038cf: 68 e5 74 10 80 push $0x801074e5
801038d4: 50 push %eax
801038d5: e8 c6 0d 00 00 call 801046a0 <safestrcpy>
p->cwd = namei("/");
801038da: c7 04 24 ee 74 10 80 movl $0x801074ee,(%esp)
801038e1: e8 5a e6 ff ff call 80101f40 <namei>
801038e6: 89 43 68 mov %eax,0x68(%ebx)
// this assignment to p->state lets other cores
// run this process. the acquire forces the above
// writes to be visible, and the lock is also needed
// because the assignment might not be atomic.
acquire(&ptable.lock);
801038e9: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
801038f0: e8 ab 0a 00 00 call 801043a0 <acquire>
p->state = RUNNABLE;
801038f5: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx)
release(&ptable.lock);
801038fc: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103903: e8 48 0b 00 00 call 80104450 <release>
}
80103908: 83 c4 10 add $0x10,%esp
8010390b: 8b 5d fc mov -0x4(%ebp),%ebx
8010390e: c9 leave
8010390f: c3 ret
p = allocproc();
initproc = p;
if((p->pgdir = setupkvm()) == 0)
panic("userinit: out of memory?");
80103910: 83 ec 0c sub $0xc,%esp
80103913: 68 cc 74 10 80 push $0x801074cc
80103918: e8 53 ca ff ff call 80100370 <panic>
8010391d: 8d 76 00 lea 0x0(%esi),%esi
80103920 <growproc>:
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
80103920: 55 push %ebp
80103921: 89 e5 mov %esp,%ebp
80103923: 56 push %esi
80103924: 53 push %ebx
80103925: 8b 75 08 mov 0x8(%ebp),%esi
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103928: e8 93 09 00 00 call 801042c0 <pushcli>
c = mycpu();
8010392d: e8 2e fe ff ff call 80103760 <mycpu>
p = c->proc;
80103932: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
80103938: e8 c3 09 00 00 call 80104300 <popcli>
{
uint sz;
struct proc *curproc = myproc();
sz = curproc->sz;
if(n > 0){
8010393d: 83 fe 00 cmp $0x0,%esi
growproc(int n)
{
uint sz;
struct proc *curproc = myproc();
sz = curproc->sz;
80103940: 8b 03 mov (%ebx),%eax
if(n > 0){
80103942: 7e 34 jle 80103978 <growproc+0x58>
if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0)
80103944: 83 ec 04 sub $0x4,%esp
80103947: 01 c6 add %eax,%esi
80103949: 56 push %esi
8010394a: 50 push %eax
8010394b: ff 73 04 pushl 0x4(%ebx)
8010394e: e8 9d 31 00 00 call 80106af0 <allocuvm>
80103953: 83 c4 10 add $0x10,%esp
80103956: 85 c0 test %eax,%eax
80103958: 74 36 je 80103990 <growproc+0x70>
} else if(n < 0){
if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0)
return -1;
}
curproc->sz = sz;
switchuvm(curproc);
8010395a: 83 ec 0c sub $0xc,%esp
return -1;
} else if(n < 0){
if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0)
return -1;
}
curproc->sz = sz;
8010395d: 89 03 mov %eax,(%ebx)
switchuvm(curproc);
8010395f: 53 push %ebx
80103960: e8 3b 2f 00 00 call 801068a0 <switchuvm>
return 0;
80103965: 83 c4 10 add $0x10,%esp
80103968: 31 c0 xor %eax,%eax
}
8010396a: 8d 65 f8 lea -0x8(%ebp),%esp
8010396d: 5b pop %ebx
8010396e: 5e pop %esi
8010396f: 5d pop %ebp
80103970: c3 ret
80103971: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
sz = curproc->sz;
if(n > 0){
if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0)
return -1;
} else if(n < 0){
80103978: 74 e0 je 8010395a <growproc+0x3a>
if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0)
8010397a: 83 ec 04 sub $0x4,%esp
8010397d: 01 c6 add %eax,%esi
8010397f: 56 push %esi
80103980: 50 push %eax
80103981: ff 73 04 pushl 0x4(%ebx)
80103984: e8 67 32 00 00 call 80106bf0 <deallocuvm>
80103989: 83 c4 10 add $0x10,%esp
8010398c: 85 c0 test %eax,%eax
8010398e: 75 ca jne 8010395a <growproc+0x3a>
struct proc *curproc = myproc();
sz = curproc->sz;
if(n > 0){
if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0)
return -1;
80103990: b8 ff ff ff ff mov $0xffffffff,%eax
80103995: eb d3 jmp 8010396a <growproc+0x4a>
80103997: 89 f6 mov %esi,%esi
80103999: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801039a0 <fork>:
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
801039a0: 55 push %ebp
801039a1: 89 e5 mov %esp,%ebp
801039a3: 57 push %edi
801039a4: 56 push %esi
801039a5: 53 push %ebx
801039a6: 83 ec 1c sub $0x1c,%esp
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
801039a9: e8 12 09 00 00 call 801042c0 <pushcli>
c = mycpu();
801039ae: e8 ad fd ff ff call 80103760 <mycpu>
p = c->proc;
801039b3: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
801039b9: e8 42 09 00 00 call 80104300 <popcli>
int i, pid;
struct proc *np;
struct proc *curproc = myproc();
// Allocate process.
if((np = allocproc()) == 0){
801039be: e8 6d fc ff ff call 80103630 <allocproc>
801039c3: 85 c0 test %eax,%eax
801039c5: 89 c7 mov %eax,%edi
801039c7: 89 45 e4 mov %eax,-0x1c(%ebp)
801039ca: 0f 84 b5 00 00 00 je 80103a85 <fork+0xe5>
return -1;
}
// Copy process state from proc.
if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){
801039d0: 83 ec 08 sub $0x8,%esp
801039d3: ff 33 pushl (%ebx)
801039d5: ff 73 04 pushl 0x4(%ebx)
801039d8: e8 93 33 00 00 call 80106d70 <copyuvm>
801039dd: 83 c4 10 add $0x10,%esp
801039e0: 85 c0 test %eax,%eax
801039e2: 89 47 04 mov %eax,0x4(%edi)
801039e5: 0f 84 a1 00 00 00 je 80103a8c <fork+0xec>
kfree(np->kstack);
np->kstack = 0;
np->state = UNUSED;
return -1;
}
np->sz = curproc->sz;
801039eb: 8b 03 mov (%ebx),%eax
801039ed: 8b 4d e4 mov -0x1c(%ebp),%ecx
801039f0: 89 01 mov %eax,(%ecx)
np->parent = curproc;
801039f2: 89 59 14 mov %ebx,0x14(%ecx)
*np->tf = *curproc->tf;
801039f5: 89 c8 mov %ecx,%eax
801039f7: 8b 79 18 mov 0x18(%ecx),%edi
801039fa: 8b 73 18 mov 0x18(%ebx),%esi
801039fd: b9 13 00 00 00 mov $0x13,%ecx
80103a02: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
80103a04: 31 f6 xor %esi,%esi
np->sz = curproc->sz;
np->parent = curproc;
*np->tf = *curproc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
80103a06: 8b 40 18 mov 0x18(%eax),%eax
80103a09: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax)
for(i = 0; i < NOFILE; i++)
if(curproc->ofile[i])
80103a10: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax
80103a14: 85 c0 test %eax,%eax
80103a16: 74 13 je 80103a2b <fork+0x8b>
np->ofile[i] = filedup(curproc->ofile[i]);
80103a18: 83 ec 0c sub $0xc,%esp
80103a1b: 50 push %eax
80103a1c: e8 bf d3 ff ff call 80100de0 <filedup>
80103a21: 8b 55 e4 mov -0x1c(%ebp),%edx
80103a24: 83 c4 10 add $0x10,%esp
80103a27: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4)
*np->tf = *curproc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
80103a2b: 83 c6 01 add $0x1,%esi
80103a2e: 83 fe 10 cmp $0x10,%esi
80103a31: 75 dd jne 80103a10 <fork+0x70>
if(curproc->ofile[i])
np->ofile[i] = filedup(curproc->ofile[i]);
np->cwd = idup(curproc->cwd);
80103a33: 83 ec 0c sub $0xc,%esp
80103a36: ff 73 68 pushl 0x68(%ebx)
safestrcpy(np->name, curproc->name, sizeof(curproc->name));
80103a39: 83 c3 6c add $0x6c,%ebx
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
if(curproc->ofile[i])
np->ofile[i] = filedup(curproc->ofile[i]);
np->cwd = idup(curproc->cwd);
80103a3c: e8 3f dc ff ff call 80101680 <idup>
80103a41: 8b 7d e4 mov -0x1c(%ebp),%edi
safestrcpy(np->name, curproc->name, sizeof(curproc->name));
80103a44: 83 c4 0c add $0xc,%esp
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
if(curproc->ofile[i])
np->ofile[i] = filedup(curproc->ofile[i]);
np->cwd = idup(curproc->cwd);
80103a47: 89 47 68 mov %eax,0x68(%edi)
safestrcpy(np->name, curproc->name, sizeof(curproc->name));
80103a4a: 8d 47 6c lea 0x6c(%edi),%eax
80103a4d: 6a 10 push $0x10
80103a4f: 53 push %ebx
80103a50: 50 push %eax
80103a51: e8 4a 0c 00 00 call 801046a0 <safestrcpy>
pid = np->pid;
80103a56: 8b 5f 10 mov 0x10(%edi),%ebx
acquire(&ptable.lock);
80103a59: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103a60: e8 3b 09 00 00 call 801043a0 <acquire>
np->state = RUNNABLE;
80103a65: c7 47 0c 03 00 00 00 movl $0x3,0xc(%edi)
release(&ptable.lock);
80103a6c: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103a73: e8 d8 09 00 00 call 80104450 <release>
return pid;
80103a78: 83 c4 10 add $0x10,%esp
80103a7b: 89 d8 mov %ebx,%eax
}
80103a7d: 8d 65 f4 lea -0xc(%ebp),%esp
80103a80: 5b pop %ebx
80103a81: 5e pop %esi
80103a82: 5f pop %edi
80103a83: 5d pop %ebp
80103a84: c3 ret
struct proc *np;
struct proc *curproc = myproc();
// Allocate process.
if((np = allocproc()) == 0){
return -1;
80103a85: b8 ff ff ff ff mov $0xffffffff,%eax
80103a8a: eb f1 jmp 80103a7d <fork+0xdd>
}
// Copy process state from proc.
if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){
kfree(np->kstack);
80103a8c: 8b 7d e4 mov -0x1c(%ebp),%edi
80103a8f: 83 ec 0c sub $0xc,%esp
80103a92: ff 77 08 pushl 0x8(%edi)
80103a95: e8 c6 e8 ff ff call 80102360 <kfree>
np->kstack = 0;
80103a9a: c7 47 08 00 00 00 00 movl $0x0,0x8(%edi)
np->state = UNUSED;
80103aa1: c7 47 0c 00 00 00 00 movl $0x0,0xc(%edi)
return -1;
80103aa8: 83 c4 10 add $0x10,%esp
80103aab: b8 ff ff ff ff mov $0xffffffff,%eax
80103ab0: eb cb jmp 80103a7d <fork+0xdd>
80103ab2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80103ab9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103ac0 <scheduler>:
// - swtch to start running that process
// - eventually that process transfers control
// via swtch back to the scheduler.
void
scheduler(void)
{
80103ac0: 55 push %ebp
80103ac1: 89 e5 mov %esp,%ebp
80103ac3: 57 push %edi
80103ac4: 56 push %esi
80103ac5: 53 push %ebx
80103ac6: 83 ec 0c sub $0xc,%esp
struct proc *p;
struct cpu *c = mycpu();
80103ac9: e8 92 fc ff ff call 80103760 <mycpu>
80103ace: 8d 78 04 lea 0x4(%eax),%edi
80103ad1: 89 c6 mov %eax,%esi
c->proc = 0;
80103ad3: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax)
80103ada: 00 00 00
80103add: 8d 76 00 lea 0x0(%esi),%esi
}
static inline void
sti(void)
{
asm volatile("sti");
80103ae0: fb sti
for(;;){
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
80103ae1: 83 ec 0c sub $0xc,%esp
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103ae4: bb 54 2d 11 80 mov $0x80112d54,%ebx
for(;;){
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
80103ae9: 68 20 2d 11 80 push $0x80112d20
80103aee: e8 ad 08 00 00 call 801043a0 <acquire>
80103af3: 83 c4 10 add $0x10,%esp
80103af6: eb 13 jmp 80103b0b <scheduler+0x4b>
80103af8: 90 nop
80103af9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103b00: 83 c3 7c add $0x7c,%ebx
80103b03: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx
80103b09: 74 45 je 80103b50 <scheduler+0x90>
if(p->state != RUNNABLE)
80103b0b: 83 7b 0c 03 cmpl $0x3,0xc(%ebx)
80103b0f: 75 ef jne 80103b00 <scheduler+0x40>
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
c->proc = p;
switchuvm(p);
80103b11: 83 ec 0c sub $0xc,%esp
continue;
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
c->proc = p;
80103b14: 89 9e ac 00 00 00 mov %ebx,0xac(%esi)
switchuvm(p);
80103b1a: 53 push %ebx
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103b1b: 83 c3 7c add $0x7c,%ebx
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
c->proc = p;
switchuvm(p);
80103b1e: e8 7d 2d 00 00 call 801068a0 <switchuvm>
p->state = RUNNING;
swtch(&(c->scheduler), p->context);
80103b23: 58 pop %eax
80103b24: 5a pop %edx
80103b25: ff 73 a0 pushl -0x60(%ebx)
80103b28: 57 push %edi
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
c->proc = p;
switchuvm(p);
p->state = RUNNING;
80103b29: c7 43 90 04 00 00 00 movl $0x4,-0x70(%ebx)
swtch(&(c->scheduler), p->context);
80103b30: e8 c6 0b 00 00 call 801046fb <swtch>
switchkvm();
80103b35: e8 46 2d 00 00 call 80106880 <switchkvm>
// Process is done running for now.
// It should have changed its p->state before coming back.
c->proc = 0;
80103b3a: 83 c4 10 add $0x10,%esp
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103b3d: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx
swtch(&(c->scheduler), p->context);
switchkvm();
// Process is done running for now.
// It should have changed its p->state before coming back.
c->proc = 0;
80103b43: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi)
80103b4a: 00 00 00
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103b4d: 75 bc jne 80103b0b <scheduler+0x4b>
80103b4f: 90 nop
// Process is done running for now.
// It should have changed its p->state before coming back.
c->proc = 0;
}
release(&ptable.lock);
80103b50: 83 ec 0c sub $0xc,%esp
80103b53: 68 20 2d 11 80 push $0x80112d20
80103b58: e8 f3 08 00 00 call 80104450 <release>
}
80103b5d: 83 c4 10 add $0x10,%esp
80103b60: e9 7b ff ff ff jmp 80103ae0 <scheduler+0x20>
80103b65: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103b69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103b70 <sched>:
// be proc->intena and proc->ncli, but that would
// break in the few places where a lock is held but
// there's no process.
void
sched(void)
{
80103b70: 55 push %ebp
80103b71: 89 e5 mov %esp,%ebp
80103b73: 56 push %esi
80103b74: 53 push %ebx
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103b75: e8 46 07 00 00 call 801042c0 <pushcli>
c = mycpu();
80103b7a: e8 e1 fb ff ff call 80103760 <mycpu>
p = c->proc;
80103b7f: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
80103b85: e8 76 07 00 00 call 80104300 <popcli>
sched(void)
{
int intena;
struct proc *p = myproc();
if(!holding(&ptable.lock))
80103b8a: 83 ec 0c sub $0xc,%esp
80103b8d: 68 20 2d 11 80 push $0x80112d20
80103b92: e8 d9 07 00 00 call 80104370 <holding>
80103b97: 83 c4 10 add $0x10,%esp
80103b9a: 85 c0 test %eax,%eax
80103b9c: 74 4f je 80103bed <sched+0x7d>
panic("sched ptable.lock");
if(mycpu()->ncli != 1)
80103b9e: e8 bd fb ff ff call 80103760 <mycpu>
80103ba3: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax)
80103baa: 75 68 jne 80103c14 <sched+0xa4>
panic("sched locks");
if(p->state == RUNNING)
80103bac: 83 7b 0c 04 cmpl $0x4,0xc(%ebx)
80103bb0: 74 55 je 80103c07 <sched+0x97>
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80103bb2: 9c pushf
80103bb3: 58 pop %eax
panic("sched running");
if(readeflags()&FL_IF)
80103bb4: f6 c4 02 test $0x2,%ah
80103bb7: 75 41 jne 80103bfa <sched+0x8a>
panic("sched interruptible");
intena = mycpu()->intena;
80103bb9: e8 a2 fb ff ff call 80103760 <mycpu>
swtch(&p->context, mycpu()->scheduler);
80103bbe: 83 c3 1c add $0x1c,%ebx
panic("sched locks");
if(p->state == RUNNING)
panic("sched running");
if(readeflags()&FL_IF)
panic("sched interruptible");
intena = mycpu()->intena;
80103bc1: 8b b0 a8 00 00 00 mov 0xa8(%eax),%esi
swtch(&p->context, mycpu()->scheduler);
80103bc7: e8 94 fb ff ff call 80103760 <mycpu>
80103bcc: 83 ec 08 sub $0x8,%esp
80103bcf: ff 70 04 pushl 0x4(%eax)
80103bd2: 53 push %ebx
80103bd3: e8 23 0b 00 00 call 801046fb <swtch>
mycpu()->intena = intena;
80103bd8: e8 83 fb ff ff call 80103760 <mycpu>
}
80103bdd: 83 c4 10 add $0x10,%esp
panic("sched running");
if(readeflags()&FL_IF)
panic("sched interruptible");
intena = mycpu()->intena;
swtch(&p->context, mycpu()->scheduler);
mycpu()->intena = intena;
80103be0: 89 b0 a8 00 00 00 mov %esi,0xa8(%eax)
}
80103be6: 8d 65 f8 lea -0x8(%ebp),%esp
80103be9: 5b pop %ebx
80103bea: 5e pop %esi
80103beb: 5d pop %ebp
80103bec: c3 ret
{
int intena;
struct proc *p = myproc();
if(!holding(&ptable.lock))
panic("sched ptable.lock");
80103bed: 83 ec 0c sub $0xc,%esp
80103bf0: 68 f0 74 10 80 push $0x801074f0
80103bf5: e8 76 c7 ff ff call 80100370 <panic>
if(mycpu()->ncli != 1)
panic("sched locks");
if(p->state == RUNNING)
panic("sched running");
if(readeflags()&FL_IF)
panic("sched interruptible");
80103bfa: 83 ec 0c sub $0xc,%esp
80103bfd: 68 1c 75 10 80 push $0x8010751c
80103c02: e8 69 c7 ff ff call 80100370 <panic>
if(!holding(&ptable.lock))
panic("sched ptable.lock");
if(mycpu()->ncli != 1)
panic("sched locks");
if(p->state == RUNNING)
panic("sched running");
80103c07: 83 ec 0c sub $0xc,%esp
80103c0a: 68 0e 75 10 80 push $0x8010750e
80103c0f: e8 5c c7 ff ff call 80100370 <panic>
struct proc *p = myproc();
if(!holding(&ptable.lock))
panic("sched ptable.lock");
if(mycpu()->ncli != 1)
panic("sched locks");
80103c14: 83 ec 0c sub $0xc,%esp
80103c17: 68 02 75 10 80 push $0x80107502
80103c1c: e8 4f c7 ff ff call 80100370 <panic>
80103c21: eb 0d jmp 80103c30 <exit>
80103c23: 90 nop
80103c24: 90 nop
80103c25: 90 nop
80103c26: 90 nop
80103c27: 90 nop
80103c28: 90 nop
80103c29: 90 nop
80103c2a: 90 nop
80103c2b: 90 nop
80103c2c: 90 nop
80103c2d: 90 nop
80103c2e: 90 nop
80103c2f: 90 nop
80103c30 <exit>:
// Exit the current process. Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
80103c30: 55 push %ebp
80103c31: 89 e5 mov %esp,%ebp
80103c33: 57 push %edi
80103c34: 56 push %esi
80103c35: 53 push %ebx
80103c36: 83 ec 0c sub $0xc,%esp
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103c39: e8 82 06 00 00 call 801042c0 <pushcli>
c = mycpu();
80103c3e: e8 1d fb ff ff call 80103760 <mycpu>
p = c->proc;
80103c43: 8b b0 ac 00 00 00 mov 0xac(%eax),%esi
popcli();
80103c49: e8 b2 06 00 00 call 80104300 <popcli>
{
struct proc *curproc = myproc();
struct proc *p;
int fd;
if(curproc == initproc)
80103c4e: 39 35 b8 a5 10 80 cmp %esi,0x8010a5b8
80103c54: 8d 5e 28 lea 0x28(%esi),%ebx
80103c57: 8d 7e 68 lea 0x68(%esi),%edi
80103c5a: 0f 84 e7 00 00 00 je 80103d47 <exit+0x117>
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd]){
80103c60: 8b 03 mov (%ebx),%eax
80103c62: 85 c0 test %eax,%eax
80103c64: 74 12 je 80103c78 <exit+0x48>
fileclose(curproc->ofile[fd]);
80103c66: 83 ec 0c sub $0xc,%esp
80103c69: 50 push %eax
80103c6a: e8 c1 d1 ff ff call 80100e30 <fileclose>
curproc->ofile[fd] = 0;
80103c6f: c7 03 00 00 00 00 movl $0x0,(%ebx)
80103c75: 83 c4 10 add $0x10,%esp
80103c78: 83 c3 04 add $0x4,%ebx
if(curproc == initproc)
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
80103c7b: 39 df cmp %ebx,%edi
80103c7d: 75 e1 jne 80103c60 <exit+0x30>
fileclose(curproc->ofile[fd]);
curproc->ofile[fd] = 0;
}
}
begin_op();
80103c7f: e8 4c ef ff ff call 80102bd0 <begin_op>
iput(curproc->cwd);
80103c84: 83 ec 0c sub $0xc,%esp
80103c87: ff 76 68 pushl 0x68(%esi)
80103c8a: e8 71 db ff ff call 80101800 <iput>
end_op();
80103c8f: e8 ac ef ff ff call 80102c40 <end_op>
curproc->cwd = 0;
80103c94: c7 46 68 00 00 00 00 movl $0x0,0x68(%esi)
acquire(&ptable.lock);
80103c9b: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103ca2: e8 f9 06 00 00 call 801043a0 <acquire>
// Parent might be sleeping in wait().
wakeup1(curproc->parent);
80103ca7: 8b 56 14 mov 0x14(%esi),%edx
80103caa: 83 c4 10 add $0x10,%esp
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103cad: b8 54 2d 11 80 mov $0x80112d54,%eax
80103cb2: eb 0e jmp 80103cc2 <exit+0x92>
80103cb4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103cb8: 83 c0 7c add $0x7c,%eax
80103cbb: 3d 54 4c 11 80 cmp $0x80114c54,%eax
80103cc0: 74 1c je 80103cde <exit+0xae>
if(p->state == SLEEPING && p->chan == chan)
80103cc2: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80103cc6: 75 f0 jne 80103cb8 <exit+0x88>
80103cc8: 3b 50 20 cmp 0x20(%eax),%edx
80103ccb: 75 eb jne 80103cb8 <exit+0x88>
p->state = RUNNABLE;
80103ccd: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103cd4: 83 c0 7c add $0x7c,%eax
80103cd7: 3d 54 4c 11 80 cmp $0x80114c54,%eax
80103cdc: 75 e4 jne 80103cc2 <exit+0x92>
wakeup1(curproc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->parent == curproc){
p->parent = initproc;
80103cde: 8b 0d b8 a5 10 80 mov 0x8010a5b8,%ecx
80103ce4: ba 54 2d 11 80 mov $0x80112d54,%edx
80103ce9: eb 10 jmp 80103cfb <exit+0xcb>
80103ceb: 90 nop
80103cec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
// Parent might be sleeping in wait().
wakeup1(curproc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103cf0: 83 c2 7c add $0x7c,%edx
80103cf3: 81 fa 54 4c 11 80 cmp $0x80114c54,%edx
80103cf9: 74 33 je 80103d2e <exit+0xfe>
if(p->parent == curproc){
80103cfb: 39 72 14 cmp %esi,0x14(%edx)
80103cfe: 75 f0 jne 80103cf0 <exit+0xc0>
p->parent = initproc;
if(p->state == ZOMBIE)
80103d00: 83 7a 0c 05 cmpl $0x5,0xc(%edx)
wakeup1(curproc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->parent == curproc){
p->parent = initproc;
80103d04: 89 4a 14 mov %ecx,0x14(%edx)
if(p->state == ZOMBIE)
80103d07: 75 e7 jne 80103cf0 <exit+0xc0>
80103d09: b8 54 2d 11 80 mov $0x80112d54,%eax
80103d0e: eb 0a jmp 80103d1a <exit+0xea>
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103d10: 83 c0 7c add $0x7c,%eax
80103d13: 3d 54 4c 11 80 cmp $0x80114c54,%eax
80103d18: 74 d6 je 80103cf0 <exit+0xc0>
if(p->state == SLEEPING && p->chan == chan)
80103d1a: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80103d1e: 75 f0 jne 80103d10 <exit+0xe0>
80103d20: 3b 48 20 cmp 0x20(%eax),%ecx
80103d23: 75 eb jne 80103d10 <exit+0xe0>
p->state = RUNNABLE;
80103d25: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
80103d2c: eb e2 jmp 80103d10 <exit+0xe0>
wakeup1(initproc);
}
}
// Jump into the scheduler, never to return.
curproc->state = ZOMBIE;
80103d2e: c7 46 0c 05 00 00 00 movl $0x5,0xc(%esi)
sched();
80103d35: e8 36 fe ff ff call 80103b70 <sched>
panic("zombie exit");
80103d3a: 83 ec 0c sub $0xc,%esp
80103d3d: 68 3d 75 10 80 push $0x8010753d
80103d42: e8 29 c6 ff ff call 80100370 <panic>
struct proc *curproc = myproc();
struct proc *p;
int fd;
if(curproc == initproc)
panic("init exiting");
80103d47: 83 ec 0c sub $0xc,%esp
80103d4a: 68 30 75 10 80 push $0x80107530
80103d4f: e8 1c c6 ff ff call 80100370 <panic>
80103d54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80103d5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80103d60 <yield>:
}
// Give up the CPU for one scheduling round.
void
yield(void)
{
80103d60: 55 push %ebp
80103d61: 89 e5 mov %esp,%ebp
80103d63: 53 push %ebx
80103d64: 83 ec 10 sub $0x10,%esp
acquire(&ptable.lock); //DOC: yieldlock
80103d67: 68 20 2d 11 80 push $0x80112d20
80103d6c: e8 2f 06 00 00 call 801043a0 <acquire>
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103d71: e8 4a 05 00 00 call 801042c0 <pushcli>
c = mycpu();
80103d76: e8 e5 f9 ff ff call 80103760 <mycpu>
p = c->proc;
80103d7b: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
80103d81: e8 7a 05 00 00 call 80104300 <popcli>
// Give up the CPU for one scheduling round.
void
yield(void)
{
acquire(&ptable.lock); //DOC: yieldlock
myproc()->state = RUNNABLE;
80103d86: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx)
sched();
80103d8d: e8 de fd ff ff call 80103b70 <sched>
release(&ptable.lock);
80103d92: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103d99: e8 b2 06 00 00 call 80104450 <release>
}
80103d9e: 83 c4 10 add $0x10,%esp
80103da1: 8b 5d fc mov -0x4(%ebp),%ebx
80103da4: c9 leave
80103da5: c3 ret
80103da6: 8d 76 00 lea 0x0(%esi),%esi
80103da9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103db0 <sleep>:
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80103db0: 55 push %ebp
80103db1: 89 e5 mov %esp,%ebp
80103db3: 57 push %edi
80103db4: 56 push %esi
80103db5: 53 push %ebx
80103db6: 83 ec 0c sub $0xc,%esp
80103db9: 8b 7d 08 mov 0x8(%ebp),%edi
80103dbc: 8b 75 0c mov 0xc(%ebp),%esi
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103dbf: e8 fc 04 00 00 call 801042c0 <pushcli>
c = mycpu();
80103dc4: e8 97 f9 ff ff call 80103760 <mycpu>
p = c->proc;
80103dc9: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx
popcli();
80103dcf: e8 2c 05 00 00 call 80104300 <popcli>
void
sleep(void *chan, struct spinlock *lk)
{
struct proc *p = myproc();
if(p == 0)
80103dd4: 85 db test %ebx,%ebx
80103dd6: 0f 84 87 00 00 00 je 80103e63 <sleep+0xb3>
panic("sleep");
if(lk == 0)
80103ddc: 85 f6 test %esi,%esi
80103dde: 74 76 je 80103e56 <sleep+0xa6>
// change p->state and then call sched.
// Once we hold ptable.lock, we can be
// guaranteed that we won't miss any wakeup
// (wakeup runs with ptable.lock locked),
// so it's okay to release lk.
if(lk != &ptable.lock){ //DOC: sleeplock0
80103de0: 81 fe 20 2d 11 80 cmp $0x80112d20,%esi
80103de6: 74 50 je 80103e38 <sleep+0x88>
acquire(&ptable.lock); //DOC: sleeplock1
80103de8: 83 ec 0c sub $0xc,%esp
80103deb: 68 20 2d 11 80 push $0x80112d20
80103df0: e8 ab 05 00 00 call 801043a0 <acquire>
release(lk);
80103df5: 89 34 24 mov %esi,(%esp)
80103df8: e8 53 06 00 00 call 80104450 <release>
}
// Go to sleep.
p->chan = chan;
80103dfd: 89 7b 20 mov %edi,0x20(%ebx)
p->state = SLEEPING;
80103e00: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx)
sched();
80103e07: e8 64 fd ff ff call 80103b70 <sched>
// Tidy up.
p->chan = 0;
80103e0c: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
80103e13: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103e1a: e8 31 06 00 00 call 80104450 <release>
acquire(lk);
80103e1f: 89 75 08 mov %esi,0x8(%ebp)
80103e22: 83 c4 10 add $0x10,%esp
}
}
80103e25: 8d 65 f4 lea -0xc(%ebp),%esp
80103e28: 5b pop %ebx
80103e29: 5e pop %esi
80103e2a: 5f pop %edi
80103e2b: 5d pop %ebp
p->chan = 0;
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
acquire(lk);
80103e2c: e9 6f 05 00 00 jmp 801043a0 <acquire>
80103e31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(lk != &ptable.lock){ //DOC: sleeplock0
acquire(&ptable.lock); //DOC: sleeplock1
release(lk);
}
// Go to sleep.
p->chan = chan;
80103e38: 89 7b 20 mov %edi,0x20(%ebx)
p->state = SLEEPING;
80103e3b: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx)
sched();
80103e42: e8 29 fd ff ff call 80103b70 <sched>
// Tidy up.
p->chan = 0;
80103e47: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
release(&ptable.lock);
acquire(lk);
}
}
80103e4e: 8d 65 f4 lea -0xc(%ebp),%esp
80103e51: 5b pop %ebx
80103e52: 5e pop %esi
80103e53: 5f pop %edi
80103e54: 5d pop %ebp
80103e55: c3 ret
if(p == 0)
panic("sleep");
if(lk == 0)
panic("sleep without lk");
80103e56: 83 ec 0c sub $0xc,%esp
80103e59: 68 4f 75 10 80 push $0x8010754f
80103e5e: e8 0d c5 ff ff call 80100370 <panic>
sleep(void *chan, struct spinlock *lk)
{
struct proc *p = myproc();
if(p == 0)
panic("sleep");
80103e63: 83 ec 0c sub $0xc,%esp
80103e66: 68 49 75 10 80 push $0x80107549
80103e6b: e8 00 c5 ff ff call 80100370 <panic>
80103e70 <wait>:
// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
80103e70: 55 push %ebp
80103e71: 89 e5 mov %esp,%ebp
80103e73: 56 push %esi
80103e74: 53 push %ebx
// while reading proc from the cpu structure
struct proc*
myproc(void) {
struct cpu *c;
struct proc *p;
pushcli();
80103e75: e8 46 04 00 00 call 801042c0 <pushcli>
c = mycpu();
80103e7a: e8 e1 f8 ff ff call 80103760 <mycpu>
p = c->proc;
80103e7f: 8b b0 ac 00 00 00 mov 0xac(%eax),%esi
popcli();
80103e85: e8 76 04 00 00 call 80104300 <popcli>
{
struct proc *p;
int havekids, pid;
struct proc *curproc = myproc();
acquire(&ptable.lock);
80103e8a: 83 ec 0c sub $0xc,%esp
80103e8d: 68 20 2d 11 80 push $0x80112d20
80103e92: e8 09 05 00 00 call 801043a0 <acquire>
80103e97: 83 c4 10 add $0x10,%esp
for(;;){
// Scan through table looking for exited children.
havekids = 0;
80103e9a: 31 c0 xor %eax,%eax
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103e9c: bb 54 2d 11 80 mov $0x80112d54,%ebx
80103ea1: eb 10 jmp 80103eb3 <wait+0x43>
80103ea3: 90 nop
80103ea4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80103ea8: 83 c3 7c add $0x7c,%ebx
80103eab: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx
80103eb1: 74 1d je 80103ed0 <wait+0x60>
if(p->parent != curproc)
80103eb3: 39 73 14 cmp %esi,0x14(%ebx)
80103eb6: 75 f0 jne 80103ea8 <wait+0x38>
continue;
havekids = 1;
if(p->state == ZOMBIE){
80103eb8: 83 7b 0c 05 cmpl $0x5,0xc(%ebx)
80103ebc: 74 30 je 80103eee <wait+0x7e>
acquire(&ptable.lock);
for(;;){
// Scan through table looking for exited children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103ebe: 83 c3 7c add $0x7c,%ebx
if(p->parent != curproc)
continue;
havekids = 1;
80103ec1: b8 01 00 00 00 mov $0x1,%eax
acquire(&ptable.lock);
for(;;){
// Scan through table looking for exited children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103ec6: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx
80103ecc: 75 e5 jne 80103eb3 <wait+0x43>
80103ece: 66 90 xchg %ax,%ax
return pid;
}
}
// No point waiting if we don't have any children.
if(!havekids || curproc->killed){
80103ed0: 85 c0 test %eax,%eax
80103ed2: 74 70 je 80103f44 <wait+0xd4>
80103ed4: 8b 46 24 mov 0x24(%esi),%eax
80103ed7: 85 c0 test %eax,%eax
80103ed9: 75 69 jne 80103f44 <wait+0xd4>
release(&ptable.lock);
return -1;
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
80103edb: 83 ec 08 sub $0x8,%esp
80103ede: 68 20 2d 11 80 push $0x80112d20
80103ee3: 56 push %esi
80103ee4: e8 c7 fe ff ff call 80103db0 <sleep>
}
80103ee9: 83 c4 10 add $0x10,%esp
80103eec: eb ac jmp 80103e9a <wait+0x2a>
continue;
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
kfree(p->kstack);
80103eee: 83 ec 0c sub $0xc,%esp
80103ef1: ff 73 08 pushl 0x8(%ebx)
if(p->parent != curproc)
continue;
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
80103ef4: 8b 73 10 mov 0x10(%ebx),%esi
kfree(p->kstack);
80103ef7: e8 64 e4 ff ff call 80102360 <kfree>
p->kstack = 0;
freevm(p->pgdir);
80103efc: 5a pop %edx
80103efd: ff 73 04 pushl 0x4(%ebx)
havekids = 1;
if(p->state == ZOMBIE){
// Found one.
pid = p->pid;
kfree(p->kstack);
p->kstack = 0;
80103f00: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
freevm(p->pgdir);
80103f07: e8 14 2d 00 00 call 80106c20 <freevm>
p->pid = 0;
80103f0c: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx)
p->parent = 0;
80103f13: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx)
p->name[0] = 0;
80103f1a: c6 43 6c 00 movb $0x0,0x6c(%ebx)
p->killed = 0;
80103f1e: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx)
p->state = UNUSED;
80103f25: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
release(&ptable.lock);
80103f2c: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp)
80103f33: e8 18 05 00 00 call 80104450 <release>
return pid;
80103f38: 83 c4 10 add $0x10,%esp
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
}
}
80103f3b: 8d 65 f8 lea -0x8(%ebp),%esp
p->parent = 0;
p->name[0] = 0;
p->killed = 0;
p->state = UNUSED;
release(&ptable.lock);
return pid;
80103f3e: 89 f0 mov %esi,%eax
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
}
}
80103f40: 5b pop %ebx
80103f41: 5e pop %esi
80103f42: 5d pop %ebp
80103f43: c3 ret
}
}
// No point waiting if we don't have any children.
if(!havekids || curproc->killed){
release(&ptable.lock);
80103f44: 83 ec 0c sub $0xc,%esp
80103f47: 68 20 2d 11 80 push $0x80112d20
80103f4c: e8 ff 04 00 00 call 80104450 <release>
return -1;
80103f51: 83 c4 10 add $0x10,%esp
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
}
}
80103f54: 8d 65 f8 lea -0x8(%ebp),%esp
}
// No point waiting if we don't have any children.
if(!havekids || curproc->killed){
release(&ptable.lock);
return -1;
80103f57: b8 ff ff ff ff mov $0xffffffff,%eax
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(curproc, &ptable.lock); //DOC: wait-sleep
}
}
80103f5c: 5b pop %ebx
80103f5d: 5e pop %esi
80103f5e: 5d pop %ebp
80103f5f: c3 ret
80103f60 <wakeup>:
}
// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80103f60: 55 push %ebp
80103f61: 89 e5 mov %esp,%ebp
80103f63: 53 push %ebx
80103f64: 83 ec 10 sub $0x10,%esp
80103f67: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&ptable.lock);
80103f6a: 68 20 2d 11 80 push $0x80112d20
80103f6f: e8 2c 04 00 00 call 801043a0 <acquire>
80103f74: 83 c4 10 add $0x10,%esp
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103f77: b8 54 2d 11 80 mov $0x80112d54,%eax
80103f7c: eb 0c jmp 80103f8a <wakeup+0x2a>
80103f7e: 66 90 xchg %ax,%ax
80103f80: 83 c0 7c add $0x7c,%eax
80103f83: 3d 54 4c 11 80 cmp $0x80114c54,%eax
80103f88: 74 1c je 80103fa6 <wakeup+0x46>
if(p->state == SLEEPING && p->chan == chan)
80103f8a: 83 78 0c 02 cmpl $0x2,0xc(%eax)
80103f8e: 75 f0 jne 80103f80 <wakeup+0x20>
80103f90: 3b 58 20 cmp 0x20(%eax),%ebx
80103f93: 75 eb jne 80103f80 <wakeup+0x20>
p->state = RUNNABLE;
80103f95: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103f9c: 83 c0 7c add $0x7c,%eax
80103f9f: 3d 54 4c 11 80 cmp $0x80114c54,%eax
80103fa4: 75 e4 jne 80103f8a <wakeup+0x2a>
void
wakeup(void *chan)
{
acquire(&ptable.lock);
wakeup1(chan);
release(&ptable.lock);
80103fa6: c7 45 08 20 2d 11 80 movl $0x80112d20,0x8(%ebp)
}
80103fad: 8b 5d fc mov -0x4(%ebp),%ebx
80103fb0: c9 leave
void
wakeup(void *chan)
{
acquire(&ptable.lock);
wakeup1(chan);
release(&ptable.lock);
80103fb1: e9 9a 04 00 00 jmp 80104450 <release>
80103fb6: 8d 76 00 lea 0x0(%esi),%esi
80103fb9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80103fc0 <kill>:
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
80103fc0: 55 push %ebp
80103fc1: 89 e5 mov %esp,%ebp
80103fc3: 53 push %ebx
80103fc4: 83 ec 10 sub $0x10,%esp
80103fc7: 8b 5d 08 mov 0x8(%ebp),%ebx
struct proc *p;
acquire(&ptable.lock);
80103fca: 68 20 2d 11 80 push $0x80112d20
80103fcf: e8 cc 03 00 00 call 801043a0 <acquire>
80103fd4: 83 c4 10 add $0x10,%esp
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80103fd7: b8 54 2d 11 80 mov $0x80112d54,%eax
80103fdc: eb 0c jmp 80103fea <kill+0x2a>
80103fde: 66 90 xchg %ax,%ax
80103fe0: 83 c0 7c add $0x7c,%eax
80103fe3: 3d 54 4c 11 80 cmp $0x80114c54,%eax
80103fe8: 74 3e je 80104028 <kill+0x68>
if(p->pid == pid){
80103fea: 39 58 10 cmp %ebx,0x10(%eax)
80103fed: 75 f1 jne 80103fe0 <kill+0x20>
p->killed = 1;
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
80103fef: 83 78 0c 02 cmpl $0x2,0xc(%eax)
struct proc *p;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->pid == pid){
p->killed = 1;
80103ff3: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
80103ffa: 74 1c je 80104018 <kill+0x58>
p->state = RUNNABLE;
release(&ptable.lock);
80103ffc: 83 ec 0c sub $0xc,%esp
80103fff: 68 20 2d 11 80 push $0x80112d20
80104004: e8 47 04 00 00 call 80104450 <release>
return 0;
80104009: 83 c4 10 add $0x10,%esp
8010400c: 31 c0 xor %eax,%eax
}
}
release(&ptable.lock);
return -1;
}
8010400e: 8b 5d fc mov -0x4(%ebp),%ebx
80104011: c9 leave
80104012: c3 ret
80104013: 90 nop
80104014: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->pid == pid){
p->killed = 1;
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
p->state = RUNNABLE;
80104018: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
8010401f: eb db jmp 80103ffc <kill+0x3c>
80104021: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
80104028: 83 ec 0c sub $0xc,%esp
8010402b: 68 20 2d 11 80 push $0x80112d20
80104030: e8 1b 04 00 00 call 80104450 <release>
return -1;
80104035: 83 c4 10 add $0x10,%esp
80104038: b8 ff ff ff ff mov $0xffffffff,%eax
}
8010403d: 8b 5d fc mov -0x4(%ebp),%ebx
80104040: c9 leave
80104041: c3 ret
80104042: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104049: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104050 <procdump>:
// Print a process listing to console. For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
80104050: 55 push %ebp
80104051: 89 e5 mov %esp,%ebp
80104053: 57 push %edi
80104054: 56 push %esi
80104055: 53 push %ebx
80104056: 8d 75 e8 lea -0x18(%ebp),%esi
80104059: bb c0 2d 11 80 mov $0x80112dc0,%ebx
8010405e: 83 ec 3c sub $0x3c,%esp
80104061: eb 24 jmp 80104087 <procdump+0x37>
80104063: 90 nop
80104064: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p->state == SLEEPING){
getcallerpcs((uint*)p->context->ebp+2, pc);
for(i=0; i<10 && pc[i] != 0; i++)
cprintf(" %p", pc[i]);
}
cprintf("\n");
80104068: 83 ec 0c sub $0xc,%esp
8010406b: 68 d7 78 10 80 push $0x801078d7
80104070: e8 eb c5 ff ff call 80100660 <cprintf>
80104075: 83 c4 10 add $0x10,%esp
80104078: 83 c3 7c add $0x7c,%ebx
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010407b: 81 fb c0 4c 11 80 cmp $0x80114cc0,%ebx
80104081: 0f 84 81 00 00 00 je 80104108 <procdump+0xb8>
if(p->state == UNUSED)
80104087: 8b 43 a0 mov -0x60(%ebx),%eax
8010408a: 85 c0 test %eax,%eax
8010408c: 74 ea je 80104078 <procdump+0x28>
continue;
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
8010408e: 83 f8 05 cmp $0x5,%eax
state = states[p->state];
else
state = "???";
80104091: ba 60 75 10 80 mov $0x80107560,%edx
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state == UNUSED)
continue;
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80104096: 77 11 ja 801040a9 <procdump+0x59>
80104098: 8b 14 85 c0 75 10 80 mov -0x7fef8a40(,%eax,4),%edx
state = states[p->state];
else
state = "???";
8010409f: b8 60 75 10 80 mov $0x80107560,%eax
801040a4: 85 d2 test %edx,%edx
801040a6: 0f 44 d0 cmove %eax,%edx
cprintf("%d %s %s", p->pid, state, p->name);
801040a9: 53 push %ebx
801040aa: 52 push %edx
801040ab: ff 73 a4 pushl -0x5c(%ebx)
801040ae: 68 64 75 10 80 push $0x80107564
801040b3: e8 a8 c5 ff ff call 80100660 <cprintf>
if(p->state == SLEEPING){
801040b8: 83 c4 10 add $0x10,%esp
801040bb: 83 7b a0 02 cmpl $0x2,-0x60(%ebx)
801040bf: 75 a7 jne 80104068 <procdump+0x18>
getcallerpcs((uint*)p->context->ebp+2, pc);
801040c1: 8d 45 c0 lea -0x40(%ebp),%eax
801040c4: 83 ec 08 sub $0x8,%esp
801040c7: 8d 7d c0 lea -0x40(%ebp),%edi
801040ca: 50 push %eax
801040cb: 8b 43 b0 mov -0x50(%ebx),%eax
801040ce: 8b 40 0c mov 0xc(%eax),%eax
801040d1: 83 c0 08 add $0x8,%eax
801040d4: 50 push %eax
801040d5: e8 86 01 00 00 call 80104260 <getcallerpcs>
801040da: 83 c4 10 add $0x10,%esp
801040dd: 8d 76 00 lea 0x0(%esi),%esi
for(i=0; i<10 && pc[i] != 0; i++)
801040e0: 8b 17 mov (%edi),%edx
801040e2: 85 d2 test %edx,%edx
801040e4: 74 82 je 80104068 <procdump+0x18>
cprintf(" %p", pc[i]);
801040e6: 83 ec 08 sub $0x8,%esp
801040e9: 83 c7 04 add $0x4,%edi
801040ec: 52 push %edx
801040ed: 68 a1 6f 10 80 push $0x80106fa1
801040f2: e8 69 c5 ff ff call 80100660 <cprintf>
else
state = "???";
cprintf("%d %s %s", p->pid, state, p->name);
if(p->state == SLEEPING){
getcallerpcs((uint*)p->context->ebp+2, pc);
for(i=0; i<10 && pc[i] != 0; i++)
801040f7: 83 c4 10 add $0x10,%esp
801040fa: 39 f7 cmp %esi,%edi
801040fc: 75 e2 jne 801040e0 <procdump+0x90>
801040fe: e9 65 ff ff ff jmp 80104068 <procdump+0x18>
80104103: 90 nop
80104104: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
cprintf(" %p", pc[i]);
}
cprintf("\n");
}
}
80104108: 8d 65 f4 lea -0xc(%ebp),%esp
8010410b: 5b pop %ebx
8010410c: 5e pop %esi
8010410d: 5f pop %edi
8010410e: 5d pop %ebp
8010410f: c3 ret
80104110 <initsleeplock>:
#include "spinlock.h"
#include "sleeplock.h"
void
initsleeplock(struct sleeplock *lk, char *name)
{
80104110: 55 push %ebp
80104111: 89 e5 mov %esp,%ebp
80104113: 53 push %ebx
80104114: 83 ec 0c sub $0xc,%esp
80104117: 8b 5d 08 mov 0x8(%ebp),%ebx
initlock(&lk->lk, "sleep lock");
8010411a: 68 d8 75 10 80 push $0x801075d8
8010411f: 8d 43 04 lea 0x4(%ebx),%eax
80104122: 50 push %eax
80104123: e8 18 01 00 00 call 80104240 <initlock>
lk->name = name;
80104128: 8b 45 0c mov 0xc(%ebp),%eax
lk->locked = 0;
8010412b: c7 03 00 00 00 00 movl $0x0,(%ebx)
lk->pid = 0;
}
80104131: 83 c4 10 add $0x10,%esp
initsleeplock(struct sleeplock *lk, char *name)
{
initlock(&lk->lk, "sleep lock");
lk->name = name;
lk->locked = 0;
lk->pid = 0;
80104134: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx)
void
initsleeplock(struct sleeplock *lk, char *name)
{
initlock(&lk->lk, "sleep lock");
lk->name = name;
8010413b: 89 43 38 mov %eax,0x38(%ebx)
lk->locked = 0;
lk->pid = 0;
}
8010413e: 8b 5d fc mov -0x4(%ebp),%ebx
80104141: c9 leave
80104142: c3 ret
80104143: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104150 <acquiresleep>:
void
acquiresleep(struct sleeplock *lk)
{
80104150: 55 push %ebp
80104151: 89 e5 mov %esp,%ebp
80104153: 56 push %esi
80104154: 53 push %ebx
80104155: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&lk->lk);
80104158: 83 ec 0c sub $0xc,%esp
8010415b: 8d 73 04 lea 0x4(%ebx),%esi
8010415e: 56 push %esi
8010415f: e8 3c 02 00 00 call 801043a0 <acquire>
while (lk->locked) {
80104164: 8b 13 mov (%ebx),%edx
80104166: 83 c4 10 add $0x10,%esp
80104169: 85 d2 test %edx,%edx
8010416b: 74 16 je 80104183 <acquiresleep+0x33>
8010416d: 8d 76 00 lea 0x0(%esi),%esi
sleep(lk, &lk->lk);
80104170: 83 ec 08 sub $0x8,%esp
80104173: 56 push %esi
80104174: 53 push %ebx
80104175: e8 36 fc ff ff call 80103db0 <sleep>
void
acquiresleep(struct sleeplock *lk)
{
acquire(&lk->lk);
while (lk->locked) {
8010417a: 8b 03 mov (%ebx),%eax
8010417c: 83 c4 10 add $0x10,%esp
8010417f: 85 c0 test %eax,%eax
80104181: 75 ed jne 80104170 <acquiresleep+0x20>
sleep(lk, &lk->lk);
}
lk->locked = 1;
80104183: c7 03 01 00 00 00 movl $0x1,(%ebx)
lk->pid = myproc()->pid;
80104189: e8 72 f6 ff ff call 80103800 <myproc>
8010418e: 8b 40 10 mov 0x10(%eax),%eax
80104191: 89 43 3c mov %eax,0x3c(%ebx)
release(&lk->lk);
80104194: 89 75 08 mov %esi,0x8(%ebp)
}
80104197: 8d 65 f8 lea -0x8(%ebp),%esp
8010419a: 5b pop %ebx
8010419b: 5e pop %esi
8010419c: 5d pop %ebp
while (lk->locked) {
sleep(lk, &lk->lk);
}
lk->locked = 1;
lk->pid = myproc()->pid;
release(&lk->lk);
8010419d: e9 ae 02 00 00 jmp 80104450 <release>
801041a2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801041a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801041b0 <releasesleep>:
}
void
releasesleep(struct sleeplock *lk)
{
801041b0: 55 push %ebp
801041b1: 89 e5 mov %esp,%ebp
801041b3: 56 push %esi
801041b4: 53 push %ebx
801041b5: 8b 5d 08 mov 0x8(%ebp),%ebx
acquire(&lk->lk);
801041b8: 83 ec 0c sub $0xc,%esp
801041bb: 8d 73 04 lea 0x4(%ebx),%esi
801041be: 56 push %esi
801041bf: e8 dc 01 00 00 call 801043a0 <acquire>
lk->locked = 0;
801041c4: c7 03 00 00 00 00 movl $0x0,(%ebx)
lk->pid = 0;
801041ca: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx)
wakeup(lk);
801041d1: 89 1c 24 mov %ebx,(%esp)
801041d4: e8 87 fd ff ff call 80103f60 <wakeup>
release(&lk->lk);
801041d9: 89 75 08 mov %esi,0x8(%ebp)
801041dc: 83 c4 10 add $0x10,%esp
}
801041df: 8d 65 f8 lea -0x8(%ebp),%esp
801041e2: 5b pop %ebx
801041e3: 5e pop %esi
801041e4: 5d pop %ebp
{
acquire(&lk->lk);
lk->locked = 0;
lk->pid = 0;
wakeup(lk);
release(&lk->lk);
801041e5: e9 66 02 00 00 jmp 80104450 <release>
801041ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801041f0 <holdingsleep>:
}
int
holdingsleep(struct sleeplock *lk)
{
801041f0: 55 push %ebp
801041f1: 89 e5 mov %esp,%ebp
801041f3: 57 push %edi
801041f4: 56 push %esi
801041f5: 53 push %ebx
801041f6: 31 ff xor %edi,%edi
801041f8: 83 ec 18 sub $0x18,%esp
801041fb: 8b 5d 08 mov 0x8(%ebp),%ebx
int r;
acquire(&lk->lk);
801041fe: 8d 73 04 lea 0x4(%ebx),%esi
80104201: 56 push %esi
80104202: e8 99 01 00 00 call 801043a0 <acquire>
r = lk->locked && (lk->pid == myproc()->pid);
80104207: 8b 03 mov (%ebx),%eax
80104209: 83 c4 10 add $0x10,%esp
8010420c: 85 c0 test %eax,%eax
8010420e: 74 13 je 80104223 <holdingsleep+0x33>
80104210: 8b 5b 3c mov 0x3c(%ebx),%ebx
80104213: e8 e8 f5 ff ff call 80103800 <myproc>
80104218: 39 58 10 cmp %ebx,0x10(%eax)
8010421b: 0f 94 c0 sete %al
8010421e: 0f b6 c0 movzbl %al,%eax
80104221: 89 c7 mov %eax,%edi
release(&lk->lk);
80104223: 83 ec 0c sub $0xc,%esp
80104226: 56 push %esi
80104227: e8 24 02 00 00 call 80104450 <release>
return r;
}
8010422c: 8d 65 f4 lea -0xc(%ebp),%esp
8010422f: 89 f8 mov %edi,%eax
80104231: 5b pop %ebx
80104232: 5e pop %esi
80104233: 5f pop %edi
80104234: 5d pop %ebp
80104235: c3 ret
80104236: 66 90 xchg %ax,%ax
80104238: 66 90 xchg %ax,%ax
8010423a: 66 90 xchg %ax,%ax
8010423c: 66 90 xchg %ax,%ax
8010423e: 66 90 xchg %ax,%ax
80104240 <initlock>:
#include "proc.h"
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
80104240: 55 push %ebp
80104241: 89 e5 mov %esp,%ebp
80104243: 8b 45 08 mov 0x8(%ebp),%eax
lk->name = name;
80104246: 8b 55 0c mov 0xc(%ebp),%edx
lk->locked = 0;
80104249: c7 00 00 00 00 00 movl $0x0,(%eax)
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
lk->name = name;
8010424f: 89 50 04 mov %edx,0x4(%eax)
lk->locked = 0;
lk->cpu = 0;
80104252: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
80104259: 5d pop %ebp
8010425a: c3 ret
8010425b: 90 nop
8010425c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104260 <getcallerpcs>:
}
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80104260: 55 push %ebp
80104261: 89 e5 mov %esp,%ebp
80104263: 53 push %ebx
uint *ebp;
int i;
ebp = (uint*)v - 2;
80104264: 8b 45 08 mov 0x8(%ebp),%eax
}
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80104267: 8b 4d 0c mov 0xc(%ebp),%ecx
uint *ebp;
int i;
ebp = (uint*)v - 2;
8010426a: 8d 50 f8 lea -0x8(%eax),%edx
for(i = 0; i < 10; i++){
8010426d: 31 c0 xor %eax,%eax
8010426f: 90 nop
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
80104270: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx
80104276: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx
8010427c: 77 1a ja 80104298 <getcallerpcs+0x38>
break;
pcs[i] = ebp[1]; // saved %eip
8010427e: 8b 5a 04 mov 0x4(%edx),%ebx
80104281: 89 1c 81 mov %ebx,(%ecx,%eax,4)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104284: 83 c0 01 add $0x1,%eax
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
80104287: 8b 12 mov (%edx),%edx
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104289: 83 f8 0a cmp $0xa,%eax
8010428c: 75 e2 jne 80104270 <getcallerpcs+0x10>
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
pcs[i] = 0;
}
8010428e: 5b pop %ebx
8010428f: 5d pop %ebp
80104290: c3 ret
80104291: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
pcs[i] = 0;
80104298: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4)
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
8010429f: 83 c0 01 add $0x1,%eax
801042a2: 83 f8 0a cmp $0xa,%eax
801042a5: 74 e7 je 8010428e <getcallerpcs+0x2e>
pcs[i] = 0;
801042a7: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4)
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
801042ae: 83 c0 01 add $0x1,%eax
801042b1: 83 f8 0a cmp $0xa,%eax
801042b4: 75 e2 jne 80104298 <getcallerpcs+0x38>
801042b6: eb d6 jmp 8010428e <getcallerpcs+0x2e>
801042b8: 90 nop
801042b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801042c0 <pushcli>:
// it takes two popcli to undo two pushcli. Also, if interrupts
// are off, then pushcli, popcli leaves them off.
void
pushcli(void)
{
801042c0: 55 push %ebp
801042c1: 89 e5 mov %esp,%ebp
801042c3: 53 push %ebx
801042c4: 83 ec 04 sub $0x4,%esp
801042c7: 9c pushf
801042c8: 5b pop %ebx
}
static inline void
cli(void)
{
asm volatile("cli");
801042c9: fa cli
int eflags;
eflags = readeflags();
cli();
if(mycpu()->ncli == 0)
801042ca: e8 91 f4 ff ff call 80103760 <mycpu>
801042cf: 8b 80 a4 00 00 00 mov 0xa4(%eax),%eax
801042d5: 85 c0 test %eax,%eax
801042d7: 75 11 jne 801042ea <pushcli+0x2a>
mycpu()->intena = eflags & FL_IF;
801042d9: 81 e3 00 02 00 00 and $0x200,%ebx
801042df: e8 7c f4 ff ff call 80103760 <mycpu>
801042e4: 89 98 a8 00 00 00 mov %ebx,0xa8(%eax)
mycpu()->ncli += 1;
801042ea: e8 71 f4 ff ff call 80103760 <mycpu>
801042ef: 83 80 a4 00 00 00 01 addl $0x1,0xa4(%eax)
}
801042f6: 83 c4 04 add $0x4,%esp
801042f9: 5b pop %ebx
801042fa: 5d pop %ebp
801042fb: c3 ret
801042fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104300 <popcli>:
void
popcli(void)
{
80104300: 55 push %ebp
80104301: 89 e5 mov %esp,%ebp
80104303: 83 ec 08 sub $0x8,%esp
static inline uint
readeflags(void)
{
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80104306: 9c pushf
80104307: 58 pop %eax
if(readeflags()&FL_IF)
80104308: f6 c4 02 test $0x2,%ah
8010430b: 75 52 jne 8010435f <popcli+0x5f>
panic("popcli - interruptible");
if(--mycpu()->ncli < 0)
8010430d: e8 4e f4 ff ff call 80103760 <mycpu>
80104312: 8b 88 a4 00 00 00 mov 0xa4(%eax),%ecx
80104318: 8d 51 ff lea -0x1(%ecx),%edx
8010431b: 85 d2 test %edx,%edx
8010431d: 89 90 a4 00 00 00 mov %edx,0xa4(%eax)
80104323: 78 2d js 80104352 <popcli+0x52>
panic("popcli");
if(mycpu()->ncli == 0 && mycpu()->intena)
80104325: e8 36 f4 ff ff call 80103760 <mycpu>
8010432a: 8b 90 a4 00 00 00 mov 0xa4(%eax),%edx
80104330: 85 d2 test %edx,%edx
80104332: 74 0c je 80104340 <popcli+0x40>
sti();
}
80104334: c9 leave
80104335: c3 ret
80104336: 8d 76 00 lea 0x0(%esi),%esi
80104339: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
if(--mycpu()->ncli < 0)
panic("popcli");
if(mycpu()->ncli == 0 && mycpu()->intena)
80104340: e8 1b f4 ff ff call 80103760 <mycpu>
80104345: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax
8010434b: 85 c0 test %eax,%eax
8010434d: 74 e5 je 80104334 <popcli+0x34>
}
static inline void
sti(void)
{
asm volatile("sti");
8010434f: fb sti
sti();
}
80104350: c9 leave
80104351: c3 ret
popcli(void)
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
if(--mycpu()->ncli < 0)
panic("popcli");
80104352: 83 ec 0c sub $0xc,%esp
80104355: 68 fa 75 10 80 push $0x801075fa
8010435a: e8 11 c0 ff ff call 80100370 <panic>
void
popcli(void)
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
8010435f: 83 ec 0c sub $0xc,%esp
80104362: 68 e3 75 10 80 push $0x801075e3
80104367: e8 04 c0 ff ff call 80100370 <panic>
8010436c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104370 <holding>:
}
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80104370: 55 push %ebp
80104371: 89 e5 mov %esp,%ebp
80104373: 56 push %esi
80104374: 53 push %ebx
80104375: 8b 75 08 mov 0x8(%ebp),%esi
80104378: 31 db xor %ebx,%ebx
int r;
pushcli();
8010437a: e8 41 ff ff ff call 801042c0 <pushcli>
r = lock->locked && lock->cpu == mycpu();
8010437f: 8b 06 mov (%esi),%eax
80104381: 85 c0 test %eax,%eax
80104383: 74 10 je 80104395 <holding+0x25>
80104385: 8b 5e 08 mov 0x8(%esi),%ebx
80104388: e8 d3 f3 ff ff call 80103760 <mycpu>
8010438d: 39 c3 cmp %eax,%ebx
8010438f: 0f 94 c3 sete %bl
80104392: 0f b6 db movzbl %bl,%ebx
popcli();
80104395: e8 66 ff ff ff call 80104300 <popcli>
return r;
}
8010439a: 89 d8 mov %ebx,%eax
8010439c: 5b pop %ebx
8010439d: 5e pop %esi
8010439e: 5d pop %ebp
8010439f: c3 ret
801043a0 <acquire>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
801043a0: 55 push %ebp
801043a1: 89 e5 mov %esp,%ebp
801043a3: 53 push %ebx
801043a4: 83 ec 04 sub $0x4,%esp
pushcli(); // disable interrupts to avoid deadlock.
801043a7: e8 14 ff ff ff call 801042c0 <pushcli>
if(holding(lk))
801043ac: 8b 5d 08 mov 0x8(%ebp),%ebx
801043af: 83 ec 0c sub $0xc,%esp
801043b2: 53 push %ebx
801043b3: e8 b8 ff ff ff call 80104370 <holding>
801043b8: 83 c4 10 add $0x10,%esp
801043bb: 85 c0 test %eax,%eax
801043bd: 0f 85 7d 00 00 00 jne 80104440 <acquire+0xa0>
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
801043c3: ba 01 00 00 00 mov $0x1,%edx
801043c8: eb 09 jmp 801043d3 <acquire+0x33>
801043ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801043d0: 8b 5d 08 mov 0x8(%ebp),%ebx
801043d3: 89 d0 mov %edx,%eax
801043d5: f0 87 03 lock xchg %eax,(%ebx)
panic("acquire");
// The xchg is atomic.
while(xchg(&lk->locked, 1) != 0)
801043d8: 85 c0 test %eax,%eax
801043da: 75 f4 jne 801043d0 <acquire+0x30>
;
// Tell the C compiler and the processor to not move loads or stores
// past this point, to ensure that the critical section's memory
// references happen after the lock is acquired.
__sync_synchronize();
801043dc: f0 83 0c 24 00 lock orl $0x0,(%esp)
// Record info about lock acquisition for debugging.
lk->cpu = mycpu();
801043e1: 8b 5d 08 mov 0x8(%ebp),%ebx
801043e4: e8 77 f3 ff ff call 80103760 <mycpu>
getcallerpcs(void *v, uint pcs[])
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
801043e9: 89 ea mov %ebp,%edx
// references happen after the lock is acquired.
__sync_synchronize();
// Record info about lock acquisition for debugging.
lk->cpu = mycpu();
getcallerpcs(&lk, lk->pcs);
801043eb: 8d 4b 0c lea 0xc(%ebx),%ecx
// past this point, to ensure that the critical section's memory
// references happen after the lock is acquired.
__sync_synchronize();
// Record info about lock acquisition for debugging.
lk->cpu = mycpu();
801043ee: 89 43 08 mov %eax,0x8(%ebx)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
801043f1: 31 c0 xor %eax,%eax
801043f3: 90 nop
801043f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
801043f8: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx
801043fe: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx
80104404: 77 1a ja 80104420 <acquire+0x80>
break;
pcs[i] = ebp[1]; // saved %eip
80104406: 8b 5a 04 mov 0x4(%edx),%ebx
80104409: 89 1c 81 mov %ebx,(%ecx,%eax,4)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
8010440c: 83 c0 01 add $0x1,%eax
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
8010440f: 8b 12 mov (%edx),%edx
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104411: 83 f8 0a cmp $0xa,%eax
80104414: 75 e2 jne 801043f8 <acquire+0x58>
__sync_synchronize();
// Record info about lock acquisition for debugging.
lk->cpu = mycpu();
getcallerpcs(&lk, lk->pcs);
}
80104416: 8b 5d fc mov -0x4(%ebp),%ebx
80104419: c9 leave
8010441a: c3 ret
8010441b: 90 nop
8010441c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
pcs[i] = 0;
80104420: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4)
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
80104427: 83 c0 01 add $0x1,%eax
8010442a: 83 f8 0a cmp $0xa,%eax
8010442d: 74 e7 je 80104416 <acquire+0x76>
pcs[i] = 0;
8010442f: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4)
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
80104436: 83 c0 01 add $0x1,%eax
80104439: 83 f8 0a cmp $0xa,%eax
8010443c: 75 e2 jne 80104420 <acquire+0x80>
8010443e: eb d6 jmp 80104416 <acquire+0x76>
void
acquire(struct spinlock *lk)
{
pushcli(); // disable interrupts to avoid deadlock.
if(holding(lk))
panic("acquire");
80104440: 83 ec 0c sub $0xc,%esp
80104443: 68 01 76 10 80 push $0x80107601
80104448: e8 23 bf ff ff call 80100370 <panic>
8010444d: 8d 76 00 lea 0x0(%esi),%esi
80104450 <release>:
}
// Release the lock.
void
release(struct spinlock *lk)
{
80104450: 55 push %ebp
80104451: 89 e5 mov %esp,%ebp
80104453: 53 push %ebx
80104454: 83 ec 10 sub $0x10,%esp
80104457: 8b 5d 08 mov 0x8(%ebp),%ebx
if(!holding(lk))
8010445a: 53 push %ebx
8010445b: e8 10 ff ff ff call 80104370 <holding>
80104460: 83 c4 10 add $0x10,%esp
80104463: 85 c0 test %eax,%eax
80104465: 74 22 je 80104489 <release+0x39>
panic("release");
lk->pcs[0] = 0;
80104467: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx)
lk->cpu = 0;
8010446e: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
// Tell the C compiler and the processor to not move loads or stores
// past this point, to ensure that all the stores in the critical
// section are visible to other cores before the lock is released.
// Both the C compiler and the hardware may re-order loads and
// stores; __sync_synchronize() tells them both not to.
__sync_synchronize();
80104475: f0 83 0c 24 00 lock orl $0x0,(%esp)
// Release the lock, equivalent to lk->locked = 0.
// This code can't use a C assignment, since it might
// not be atomic. A real OS would use C atomics here.
asm volatile("movl $0, %0" : "+m" (lk->locked) : );
8010447a: c7 03 00 00 00 00 movl $0x0,(%ebx)
popcli();
}
80104480: 8b 5d fc mov -0x4(%ebp),%ebx
80104483: c9 leave
// Release the lock, equivalent to lk->locked = 0.
// This code can't use a C assignment, since it might
// not be atomic. A real OS would use C atomics here.
asm volatile("movl $0, %0" : "+m" (lk->locked) : );
popcli();
80104484: e9 77 fe ff ff jmp 80104300 <popcli>
// Release the lock.
void
release(struct spinlock *lk)
{
if(!holding(lk))
panic("release");
80104489: 83 ec 0c sub $0xc,%esp
8010448c: 68 09 76 10 80 push $0x80107609
80104491: e8 da be ff ff call 80100370 <panic>
80104496: 66 90 xchg %ax,%ax
80104498: 66 90 xchg %ax,%ax
8010449a: 66 90 xchg %ax,%ax
8010449c: 66 90 xchg %ax,%ax
8010449e: 66 90 xchg %ax,%ax
801044a0 <memset>:
#include "types.h"
#include "x86.h"
void*
memset(void *dst, int c, uint n)
{
801044a0: 55 push %ebp
801044a1: 89 e5 mov %esp,%ebp
801044a3: 57 push %edi
801044a4: 53 push %ebx
801044a5: 8b 55 08 mov 0x8(%ebp),%edx
801044a8: 8b 4d 10 mov 0x10(%ebp),%ecx
if ((int)dst%4 == 0 && n%4 == 0){
801044ab: f6 c2 03 test $0x3,%dl
801044ae: 75 05 jne 801044b5 <memset+0x15>
801044b0: f6 c1 03 test $0x3,%cl
801044b3: 74 13 je 801044c8 <memset+0x28>
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
801044b5: 89 d7 mov %edx,%edi
801044b7: 8b 45 0c mov 0xc(%ebp),%eax
801044ba: fc cld
801044bb: f3 aa rep stos %al,%es:(%edi)
c &= 0xFF;
stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
} else
stosb(dst, c, n);
return dst;
}
801044bd: 5b pop %ebx
801044be: 89 d0 mov %edx,%eax
801044c0: 5f pop %edi
801044c1: 5d pop %ebp
801044c2: c3 ret
801044c3: 90 nop
801044c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
void*
memset(void *dst, int c, uint n)
{
if ((int)dst%4 == 0 && n%4 == 0){
c &= 0xFF;
801044c8: 0f b6 7d 0c movzbl 0xc(%ebp),%edi
}
static inline void
stosl(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosl" :
801044cc: c1 e9 02 shr $0x2,%ecx
801044cf: 89 fb mov %edi,%ebx
801044d1: 89 f8 mov %edi,%eax
801044d3: c1 e3 18 shl $0x18,%ebx
801044d6: c1 e0 10 shl $0x10,%eax
801044d9: 09 d8 or %ebx,%eax
801044db: 09 f8 or %edi,%eax
801044dd: c1 e7 08 shl $0x8,%edi
801044e0: 09 f8 or %edi,%eax
801044e2: 89 d7 mov %edx,%edi
801044e4: fc cld
801044e5: f3 ab rep stos %eax,%es:(%edi)
stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
} else
stosb(dst, c, n);
return dst;
}
801044e7: 5b pop %ebx
801044e8: 89 d0 mov %edx,%eax
801044ea: 5f pop %edi
801044eb: 5d pop %ebp
801044ec: c3 ret
801044ed: 8d 76 00 lea 0x0(%esi),%esi
801044f0 <memcmp>:
int
memcmp(const void *v1, const void *v2, uint n)
{
801044f0: 55 push %ebp
801044f1: 89 e5 mov %esp,%ebp
801044f3: 57 push %edi
801044f4: 56 push %esi
801044f5: 8b 45 10 mov 0x10(%ebp),%eax
801044f8: 53 push %ebx
801044f9: 8b 75 0c mov 0xc(%ebp),%esi
801044fc: 8b 5d 08 mov 0x8(%ebp),%ebx
const uchar *s1, *s2;
s1 = v1;
s2 = v2;
while(n-- > 0){
801044ff: 85 c0 test %eax,%eax
80104501: 74 29 je 8010452c <memcmp+0x3c>
if(*s1 != *s2)
80104503: 0f b6 13 movzbl (%ebx),%edx
80104506: 0f b6 0e movzbl (%esi),%ecx
80104509: 38 d1 cmp %dl,%cl
8010450b: 75 2b jne 80104538 <memcmp+0x48>
8010450d: 8d 78 ff lea -0x1(%eax),%edi
80104510: 31 c0 xor %eax,%eax
80104512: eb 14 jmp 80104528 <memcmp+0x38>
80104514: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104518: 0f b6 54 03 01 movzbl 0x1(%ebx,%eax,1),%edx
8010451d: 83 c0 01 add $0x1,%eax
80104520: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx
80104524: 38 ca cmp %cl,%dl
80104526: 75 10 jne 80104538 <memcmp+0x48>
{
const uchar *s1, *s2;
s1 = v1;
s2 = v2;
while(n-- > 0){
80104528: 39 f8 cmp %edi,%eax
8010452a: 75 ec jne 80104518 <memcmp+0x28>
return *s1 - *s2;
s1++, s2++;
}
return 0;
}
8010452c: 5b pop %ebx
if(*s1 != *s2)
return *s1 - *s2;
s1++, s2++;
}
return 0;
8010452d: 31 c0 xor %eax,%eax
}
8010452f: 5e pop %esi
80104530: 5f pop %edi
80104531: 5d pop %ebp
80104532: c3 ret
80104533: 90 nop
80104534: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s1 = v1;
s2 = v2;
while(n-- > 0){
if(*s1 != *s2)
return *s1 - *s2;
80104538: 0f b6 c2 movzbl %dl,%eax
s1++, s2++;
}
return 0;
}
8010453b: 5b pop %ebx
s1 = v1;
s2 = v2;
while(n-- > 0){
if(*s1 != *s2)
return *s1 - *s2;
8010453c: 29 c8 sub %ecx,%eax
s1++, s2++;
}
return 0;
}
8010453e: 5e pop %esi
8010453f: 5f pop %edi
80104540: 5d pop %ebp
80104541: c3 ret
80104542: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104549: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104550 <memmove>:
void*
memmove(void *dst, const void *src, uint n)
{
80104550: 55 push %ebp
80104551: 89 e5 mov %esp,%ebp
80104553: 56 push %esi
80104554: 53 push %ebx
80104555: 8b 45 08 mov 0x8(%ebp),%eax
80104558: 8b 75 0c mov 0xc(%ebp),%esi
8010455b: 8b 5d 10 mov 0x10(%ebp),%ebx
const char *s;
char *d;
s = src;
d = dst;
if(s < d && s + n > d){
8010455e: 39 c6 cmp %eax,%esi
80104560: 73 2e jae 80104590 <memmove+0x40>
80104562: 8d 0c 1e lea (%esi,%ebx,1),%ecx
80104565: 39 c8 cmp %ecx,%eax
80104567: 73 27 jae 80104590 <memmove+0x40>
s += n;
d += n;
while(n-- > 0)
80104569: 85 db test %ebx,%ebx
8010456b: 8d 53 ff lea -0x1(%ebx),%edx
8010456e: 74 17 je 80104587 <memmove+0x37>
*--d = *--s;
80104570: 29 d9 sub %ebx,%ecx
80104572: 89 cb mov %ecx,%ebx
80104574: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104578: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
8010457c: 88 0c 10 mov %cl,(%eax,%edx,1)
s = src;
d = dst;
if(s < d && s + n > d){
s += n;
d += n;
while(n-- > 0)
8010457f: 83 ea 01 sub $0x1,%edx
80104582: 83 fa ff cmp $0xffffffff,%edx
80104585: 75 f1 jne 80104578 <memmove+0x28>
} else
while(n-- > 0)
*d++ = *s++;
return dst;
}
80104587: 5b pop %ebx
80104588: 5e pop %esi
80104589: 5d pop %ebp
8010458a: c3 ret
8010458b: 90 nop
8010458c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
80104590: 31 d2 xor %edx,%edx
80104592: 85 db test %ebx,%ebx
80104594: 74 f1 je 80104587 <memmove+0x37>
80104596: 8d 76 00 lea 0x0(%esi),%esi
80104599: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
*d++ = *s++;
801045a0: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
801045a4: 88 0c 10 mov %cl,(%eax,%edx,1)
801045a7: 83 c2 01 add $0x1,%edx
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
801045aa: 39 d3 cmp %edx,%ebx
801045ac: 75 f2 jne 801045a0 <memmove+0x50>
*d++ = *s++;
return dst;
}
801045ae: 5b pop %ebx
801045af: 5e pop %esi
801045b0: 5d pop %ebp
801045b1: c3 ret
801045b2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801045b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801045c0 <memcpy>:
// memcpy exists to placate GCC. Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
801045c0: 55 push %ebp
801045c1: 89 e5 mov %esp,%ebp
return memmove(dst, src, n);
}
801045c3: 5d pop %ebp
// memcpy exists to placate GCC. Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
return memmove(dst, src, n);
801045c4: eb 8a jmp 80104550 <memmove>
801045c6: 8d 76 00 lea 0x0(%esi),%esi
801045c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801045d0 <strncmp>:
}
int
strncmp(const char *p, const char *q, uint n)
{
801045d0: 55 push %ebp
801045d1: 89 e5 mov %esp,%ebp
801045d3: 57 push %edi
801045d4: 56 push %esi
801045d5: 8b 4d 10 mov 0x10(%ebp),%ecx
801045d8: 53 push %ebx
801045d9: 8b 7d 08 mov 0x8(%ebp),%edi
801045dc: 8b 75 0c mov 0xc(%ebp),%esi
while(n > 0 && *p && *p == *q)
801045df: 85 c9 test %ecx,%ecx
801045e1: 74 37 je 8010461a <strncmp+0x4a>
801045e3: 0f b6 17 movzbl (%edi),%edx
801045e6: 0f b6 1e movzbl (%esi),%ebx
801045e9: 84 d2 test %dl,%dl
801045eb: 74 3f je 8010462c <strncmp+0x5c>
801045ed: 38 d3 cmp %dl,%bl
801045ef: 75 3b jne 8010462c <strncmp+0x5c>
801045f1: 8d 47 01 lea 0x1(%edi),%eax
801045f4: 01 cf add %ecx,%edi
801045f6: eb 1b jmp 80104613 <strncmp+0x43>
801045f8: 90 nop
801045f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104600: 0f b6 10 movzbl (%eax),%edx
80104603: 84 d2 test %dl,%dl
80104605: 74 21 je 80104628 <strncmp+0x58>
80104607: 0f b6 19 movzbl (%ecx),%ebx
8010460a: 83 c0 01 add $0x1,%eax
8010460d: 89 ce mov %ecx,%esi
8010460f: 38 da cmp %bl,%dl
80104611: 75 19 jne 8010462c <strncmp+0x5c>
80104613: 39 c7 cmp %eax,%edi
n--, p++, q++;
80104615: 8d 4e 01 lea 0x1(%esi),%ecx
}
int
strncmp(const char *p, const char *q, uint n)
{
while(n > 0 && *p && *p == *q)
80104618: 75 e6 jne 80104600 <strncmp+0x30>
n--, p++, q++;
if(n == 0)
return 0;
return (uchar)*p - (uchar)*q;
}
8010461a: 5b pop %ebx
strncmp(const char *p, const char *q, uint n)
{
while(n > 0 && *p && *p == *q)
n--, p++, q++;
if(n == 0)
return 0;
8010461b: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
}
8010461d: 5e pop %esi
8010461e: 5f pop %edi
8010461f: 5d pop %ebp
80104620: c3 ret
80104621: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104628: 0f b6 5e 01 movzbl 0x1(%esi),%ebx
{
while(n > 0 && *p && *p == *q)
n--, p++, q++;
if(n == 0)
return 0;
return (uchar)*p - (uchar)*q;
8010462c: 0f b6 c2 movzbl %dl,%eax
8010462f: 29 d8 sub %ebx,%eax
}
80104631: 5b pop %ebx
80104632: 5e pop %esi
80104633: 5f pop %edi
80104634: 5d pop %ebp
80104635: c3 ret
80104636: 8d 76 00 lea 0x0(%esi),%esi
80104639: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104640 <strncpy>:
char*
strncpy(char *s, const char *t, int n)
{
80104640: 55 push %ebp
80104641: 89 e5 mov %esp,%ebp
80104643: 56 push %esi
80104644: 53 push %ebx
80104645: 8b 45 08 mov 0x8(%ebp),%eax
80104648: 8b 5d 0c mov 0xc(%ebp),%ebx
8010464b: 8b 4d 10 mov 0x10(%ebp),%ecx
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0)
8010464e: 89 c2 mov %eax,%edx
80104650: eb 19 jmp 8010466b <strncpy+0x2b>
80104652: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104658: 83 c3 01 add $0x1,%ebx
8010465b: 0f b6 4b ff movzbl -0x1(%ebx),%ecx
8010465f: 83 c2 01 add $0x1,%edx
80104662: 84 c9 test %cl,%cl
80104664: 88 4a ff mov %cl,-0x1(%edx)
80104667: 74 09 je 80104672 <strncpy+0x32>
80104669: 89 f1 mov %esi,%ecx
8010466b: 85 c9 test %ecx,%ecx
8010466d: 8d 71 ff lea -0x1(%ecx),%esi
80104670: 7f e6 jg 80104658 <strncpy+0x18>
;
while(n-- > 0)
80104672: 31 c9 xor %ecx,%ecx
80104674: 85 f6 test %esi,%esi
80104676: 7e 17 jle 8010468f <strncpy+0x4f>
80104678: 90 nop
80104679: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
*s++ = 0;
80104680: c6 04 0a 00 movb $0x0,(%edx,%ecx,1)
80104684: 89 f3 mov %esi,%ebx
80104686: 83 c1 01 add $0x1,%ecx
80104689: 29 cb sub %ecx,%ebx
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0)
;
while(n-- > 0)
8010468b: 85 db test %ebx,%ebx
8010468d: 7f f1 jg 80104680 <strncpy+0x40>
*s++ = 0;
return os;
}
8010468f: 5b pop %ebx
80104690: 5e pop %esi
80104691: 5d pop %ebp
80104692: c3 ret
80104693: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104699: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801046a0 <safestrcpy>:
// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
801046a0: 55 push %ebp
801046a1: 89 e5 mov %esp,%ebp
801046a3: 56 push %esi
801046a4: 53 push %ebx
801046a5: 8b 4d 10 mov 0x10(%ebp),%ecx
801046a8: 8b 45 08 mov 0x8(%ebp),%eax
801046ab: 8b 55 0c mov 0xc(%ebp),%edx
char *os;
os = s;
if(n <= 0)
801046ae: 85 c9 test %ecx,%ecx
801046b0: 7e 26 jle 801046d8 <safestrcpy+0x38>
801046b2: 8d 74 0a ff lea -0x1(%edx,%ecx,1),%esi
801046b6: 89 c1 mov %eax,%ecx
801046b8: eb 17 jmp 801046d1 <safestrcpy+0x31>
801046ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
return os;
while(--n > 0 && (*s++ = *t++) != 0)
801046c0: 83 c2 01 add $0x1,%edx
801046c3: 0f b6 5a ff movzbl -0x1(%edx),%ebx
801046c7: 83 c1 01 add $0x1,%ecx
801046ca: 84 db test %bl,%bl
801046cc: 88 59 ff mov %bl,-0x1(%ecx)
801046cf: 74 04 je 801046d5 <safestrcpy+0x35>
801046d1: 39 f2 cmp %esi,%edx
801046d3: 75 eb jne 801046c0 <safestrcpy+0x20>
;
*s = 0;
801046d5: c6 01 00 movb $0x0,(%ecx)
return os;
}
801046d8: 5b pop %ebx
801046d9: 5e pop %esi
801046da: 5d pop %ebp
801046db: c3 ret
801046dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
801046e0 <strlen>:
int
strlen(const char *s)
{
801046e0: 55 push %ebp
int n;
for(n = 0; s[n]; n++)
801046e1: 31 c0 xor %eax,%eax
return os;
}
int
strlen(const char *s)
{
801046e3: 89 e5 mov %esp,%ebp
801046e5: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for(n = 0; s[n]; n++)
801046e8: 80 3a 00 cmpb $0x0,(%edx)
801046eb: 74 0c je 801046f9 <strlen+0x19>
801046ed: 8d 76 00 lea 0x0(%esi),%esi
801046f0: 83 c0 01 add $0x1,%eax
801046f3: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
801046f7: 75 f7 jne 801046f0 <strlen+0x10>
;
return n;
}
801046f9: 5d pop %ebp
801046fa: c3 ret
801046fb <swtch>:
# a struct context, and save its address in *old.
# Switch stacks to new and pop previously-saved registers.
.globl swtch
swtch:
movl 4(%esp), %eax
801046fb: 8b 44 24 04 mov 0x4(%esp),%eax
movl 8(%esp), %edx
801046ff: 8b 54 24 08 mov 0x8(%esp),%edx
# Save old callee-saved registers
pushl %ebp
80104703: 55 push %ebp
pushl %ebx
80104704: 53 push %ebx
pushl %esi
80104705: 56 push %esi
pushl %edi
80104706: 57 push %edi
# Switch stacks
movl %esp, (%eax)
80104707: 89 20 mov %esp,(%eax)
movl %edx, %esp
80104709: 89 d4 mov %edx,%esp
# Load new callee-saved registers
popl %edi
8010470b: 5f pop %edi
popl %esi
8010470c: 5e pop %esi
popl %ebx
8010470d: 5b pop %ebx
popl %ebp
8010470e: 5d pop %ebp
ret
8010470f: c3 ret
80104710 <fetchint>:
// to a saved program counter, and then the first argument.
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
80104710: 55 push %ebp
80104711: 89 e5 mov %esp,%ebp
80104713: 53 push %ebx
80104714: 83 ec 04 sub $0x4,%esp
80104717: 8b 5d 08 mov 0x8(%ebp),%ebx
struct proc *curproc = myproc();
8010471a: e8 e1 f0 ff ff call 80103800 <myproc>
if(addr >= curproc->sz || addr+4 > curproc->sz)
8010471f: 8b 00 mov (%eax),%eax
80104721: 39 d8 cmp %ebx,%eax
80104723: 76 1b jbe 80104740 <fetchint+0x30>
80104725: 8d 53 04 lea 0x4(%ebx),%edx
80104728: 39 d0 cmp %edx,%eax
8010472a: 72 14 jb 80104740 <fetchint+0x30>
return -1;
*ip = *(int*)(addr);
8010472c: 8b 45 0c mov 0xc(%ebp),%eax
8010472f: 8b 13 mov (%ebx),%edx
80104731: 89 10 mov %edx,(%eax)
return 0;
80104733: 31 c0 xor %eax,%eax
}
80104735: 83 c4 04 add $0x4,%esp
80104738: 5b pop %ebx
80104739: 5d pop %ebp
8010473a: c3 ret
8010473b: 90 nop
8010473c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
fetchint(uint addr, int *ip)
{
struct proc *curproc = myproc();
if(addr >= curproc->sz || addr+4 > curproc->sz)
return -1;
80104740: b8 ff ff ff ff mov $0xffffffff,%eax
80104745: eb ee jmp 80104735 <fetchint+0x25>
80104747: 89 f6 mov %esi,%esi
80104749: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104750 <fetchstr>:
// Fetch the nul-terminated string at addr from the current process.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(uint addr, char **pp)
{
80104750: 55 push %ebp
80104751: 89 e5 mov %esp,%ebp
80104753: 53 push %ebx
80104754: 83 ec 04 sub $0x4,%esp
80104757: 8b 5d 08 mov 0x8(%ebp),%ebx
char *s, *ep;
struct proc *curproc = myproc();
8010475a: e8 a1 f0 ff ff call 80103800 <myproc>
if(addr >= curproc->sz)
8010475f: 39 18 cmp %ebx,(%eax)
80104761: 76 29 jbe 8010478c <fetchstr+0x3c>
return -1;
*pp = (char*)addr;
80104763: 8b 4d 0c mov 0xc(%ebp),%ecx
80104766: 89 da mov %ebx,%edx
80104768: 89 19 mov %ebx,(%ecx)
ep = (char*)curproc->sz;
8010476a: 8b 00 mov (%eax),%eax
for(s = *pp; s < ep; s++){
8010476c: 39 c3 cmp %eax,%ebx
8010476e: 73 1c jae 8010478c <fetchstr+0x3c>
if(*s == 0)
80104770: 80 3b 00 cmpb $0x0,(%ebx)
80104773: 75 10 jne 80104785 <fetchstr+0x35>
80104775: eb 29 jmp 801047a0 <fetchstr+0x50>
80104777: 89 f6 mov %esi,%esi
80104779: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104780: 80 3a 00 cmpb $0x0,(%edx)
80104783: 74 1b je 801047a0 <fetchstr+0x50>
if(addr >= curproc->sz)
return -1;
*pp = (char*)addr;
ep = (char*)curproc->sz;
for(s = *pp; s < ep; s++){
80104785: 83 c2 01 add $0x1,%edx
80104788: 39 d0 cmp %edx,%eax
8010478a: 77 f4 ja 80104780 <fetchstr+0x30>
if(*s == 0)
return s - *pp;
}
return -1;
}
8010478c: 83 c4 04 add $0x4,%esp
{
char *s, *ep;
struct proc *curproc = myproc();
if(addr >= curproc->sz)
return -1;
8010478f: b8 ff ff ff ff mov $0xffffffff,%eax
for(s = *pp; s < ep; s++){
if(*s == 0)
return s - *pp;
}
return -1;
}
80104794: 5b pop %ebx
80104795: 5d pop %ebp
80104796: c3 ret
80104797: 89 f6 mov %esi,%esi
80104799: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801047a0: 83 c4 04 add $0x4,%esp
return -1;
*pp = (char*)addr;
ep = (char*)curproc->sz;
for(s = *pp; s < ep; s++){
if(*s == 0)
return s - *pp;
801047a3: 89 d0 mov %edx,%eax
801047a5: 29 d8 sub %ebx,%eax
}
return -1;
}
801047a7: 5b pop %ebx
801047a8: 5d pop %ebp
801047a9: c3 ret
801047aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
801047b0 <argint>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
801047b0: 55 push %ebp
801047b1: 89 e5 mov %esp,%ebp
801047b3: 56 push %esi
801047b4: 53 push %ebx
return fetchint((myproc()->tf->esp) + 4 + 4*n, ip);
801047b5: e8 46 f0 ff ff call 80103800 <myproc>
801047ba: 8b 40 18 mov 0x18(%eax),%eax
801047bd: 8b 55 08 mov 0x8(%ebp),%edx
801047c0: 8b 40 44 mov 0x44(%eax),%eax
801047c3: 8d 1c 90 lea (%eax,%edx,4),%ebx
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
struct proc *curproc = myproc();
801047c6: e8 35 f0 ff ff call 80103800 <myproc>
if(addr >= curproc->sz || addr+4 > curproc->sz)
801047cb: 8b 00 mov (%eax),%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint((myproc()->tf->esp) + 4 + 4*n, ip);
801047cd: 8d 73 04 lea 0x4(%ebx),%esi
int
fetchint(uint addr, int *ip)
{
struct proc *curproc = myproc();
if(addr >= curproc->sz || addr+4 > curproc->sz)
801047d0: 39 c6 cmp %eax,%esi
801047d2: 73 1c jae 801047f0 <argint+0x40>
801047d4: 8d 53 08 lea 0x8(%ebx),%edx
801047d7: 39 d0 cmp %edx,%eax
801047d9: 72 15 jb 801047f0 <argint+0x40>
return -1;
*ip = *(int*)(addr);
801047db: 8b 45 0c mov 0xc(%ebp),%eax
801047de: 8b 53 04 mov 0x4(%ebx),%edx
801047e1: 89 10 mov %edx,(%eax)
return 0;
801047e3: 31 c0 xor %eax,%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
return fetchint((myproc()->tf->esp) + 4 + 4*n, ip);
}
801047e5: 5b pop %ebx
801047e6: 5e pop %esi
801047e7: 5d pop %ebp
801047e8: c3 ret
801047e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
fetchint(uint addr, int *ip)
{
struct proc *curproc = myproc();
if(addr >= curproc->sz || addr+4 > curproc->sz)
return -1;
801047f0: b8 ff ff ff ff mov $0xffffffff,%eax
801047f5: eb ee jmp 801047e5 <argint+0x35>
801047f7: 89 f6 mov %esi,%esi
801047f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104800 <argptr>:
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size bytes. Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
80104800: 55 push %ebp
80104801: 89 e5 mov %esp,%ebp
80104803: 56 push %esi
80104804: 53 push %ebx
80104805: 83 ec 10 sub $0x10,%esp
80104808: 8b 5d 10 mov 0x10(%ebp),%ebx
int i;
struct proc *curproc = myproc();
8010480b: e8 f0 ef ff ff call 80103800 <myproc>
80104810: 89 c6 mov %eax,%esi
if(argint(n, &i) < 0)
80104812: 8d 45 f4 lea -0xc(%ebp),%eax
80104815: 83 ec 08 sub $0x8,%esp
80104818: 50 push %eax
80104819: ff 75 08 pushl 0x8(%ebp)
8010481c: e8 8f ff ff ff call 801047b0 <argint>
return -1;
if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz)
80104821: c1 e8 1f shr $0x1f,%eax
80104824: 83 c4 10 add $0x10,%esp
80104827: 84 c0 test %al,%al
80104829: 75 2d jne 80104858 <argptr+0x58>
8010482b: 89 d8 mov %ebx,%eax
8010482d: c1 e8 1f shr $0x1f,%eax
80104830: 84 c0 test %al,%al
80104832: 75 24 jne 80104858 <argptr+0x58>
80104834: 8b 16 mov (%esi),%edx
80104836: 8b 45 f4 mov -0xc(%ebp),%eax
80104839: 39 c2 cmp %eax,%edx
8010483b: 76 1b jbe 80104858 <argptr+0x58>
8010483d: 01 c3 add %eax,%ebx
8010483f: 39 da cmp %ebx,%edx
80104841: 72 15 jb 80104858 <argptr+0x58>
return -1;
*pp = (char*)i;
80104843: 8b 55 0c mov 0xc(%ebp),%edx
80104846: 89 02 mov %eax,(%edx)
return 0;
80104848: 31 c0 xor %eax,%eax
}
8010484a: 8d 65 f8 lea -0x8(%ebp),%esp
8010484d: 5b pop %ebx
8010484e: 5e pop %esi
8010484f: 5d pop %ebp
80104850: c3 ret
80104851: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
struct proc *curproc = myproc();
if(argint(n, &i) < 0)
return -1;
if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz)
return -1;
80104858: b8 ff ff ff ff mov $0xffffffff,%eax
8010485d: eb eb jmp 8010484a <argptr+0x4a>
8010485f: 90 nop
80104860 <argstr>:
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
80104860: 55 push %ebp
80104861: 89 e5 mov %esp,%ebp
80104863: 83 ec 20 sub $0x20,%esp
int addr;
if(argint(n, &addr) < 0)
80104866: 8d 45 f4 lea -0xc(%ebp),%eax
80104869: 50 push %eax
8010486a: ff 75 08 pushl 0x8(%ebp)
8010486d: e8 3e ff ff ff call 801047b0 <argint>
80104872: 83 c4 10 add $0x10,%esp
80104875: 85 c0 test %eax,%eax
80104877: 78 17 js 80104890 <argstr+0x30>
return -1;
return fetchstr(addr, pp);
80104879: 83 ec 08 sub $0x8,%esp
8010487c: ff 75 0c pushl 0xc(%ebp)
8010487f: ff 75 f4 pushl -0xc(%ebp)
80104882: e8 c9 fe ff ff call 80104750 <fetchstr>
80104887: 83 c4 10 add $0x10,%esp
}
8010488a: c9 leave
8010488b: c3 ret
8010488c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int
argstr(int n, char **pp)
{
int addr;
if(argint(n, &addr) < 0)
return -1;
80104890: b8 ff ff ff ff mov $0xffffffff,%eax
return fetchstr(addr, pp);
}
80104895: c9 leave
80104896: c3 ret
80104897: 89 f6 mov %esi,%esi
80104899: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801048a0 <syscall>:
[SYS_close] sys_close,
};
void
syscall(void)
{
801048a0: 55 push %ebp
801048a1: 89 e5 mov %esp,%ebp
801048a3: 56 push %esi
801048a4: 53 push %ebx
int num;
struct proc *curproc = myproc();
801048a5: e8 56 ef ff ff call 80103800 <myproc>
num = curproc->tf->eax;
801048aa: 8b 70 18 mov 0x18(%eax),%esi
void
syscall(void)
{
int num;
struct proc *curproc = myproc();
801048ad: 89 c3 mov %eax,%ebx
num = curproc->tf->eax;
801048af: 8b 46 1c mov 0x1c(%esi),%eax
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
801048b2: 8d 50 ff lea -0x1(%eax),%edx
801048b5: 83 fa 14 cmp $0x14,%edx
801048b8: 77 1e ja 801048d8 <syscall+0x38>
801048ba: 8b 14 85 40 76 10 80 mov -0x7fef89c0(,%eax,4),%edx
801048c1: 85 d2 test %edx,%edx
801048c3: 74 13 je 801048d8 <syscall+0x38>
curproc->tf->eax = syscalls[num]();
801048c5: ff d2 call *%edx
801048c7: 89 46 1c mov %eax,0x1c(%esi)
} else {
cprintf("%d %s: unknown sys call %d\n",
curproc->pid, curproc->name, num);
curproc->tf->eax = -1;
}
}
801048ca: 8d 65 f8 lea -0x8(%ebp),%esp
801048cd: 5b pop %ebx
801048ce: 5e pop %esi
801048cf: 5d pop %ebp
801048d0: c3 ret
801048d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
num = curproc->tf->eax;
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
curproc->tf->eax = syscalls[num]();
} else {
cprintf("%d %s: unknown sys call %d\n",
801048d8: 50 push %eax
curproc->pid, curproc->name, num);
801048d9: 8d 43 6c lea 0x6c(%ebx),%eax
num = curproc->tf->eax;
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
curproc->tf->eax = syscalls[num]();
} else {
cprintf("%d %s: unknown sys call %d\n",
801048dc: 50 push %eax
801048dd: ff 73 10 pushl 0x10(%ebx)
801048e0: 68 11 76 10 80 push $0x80107611
801048e5: e8 76 bd ff ff call 80100660 <cprintf>
curproc->pid, curproc->name, num);
curproc->tf->eax = -1;
801048ea: 8b 43 18 mov 0x18(%ebx),%eax
801048ed: 83 c4 10 add $0x10,%esp
801048f0: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax)
}
}
801048f7: 8d 65 f8 lea -0x8(%ebp),%esp
801048fa: 5b pop %ebx
801048fb: 5e pop %esi
801048fc: 5d pop %ebp
801048fd: c3 ret
801048fe: 66 90 xchg %ax,%ax
80104900 <create>:
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
80104900: 55 push %ebp
80104901: 89 e5 mov %esp,%ebp
80104903: 57 push %edi
80104904: 56 push %esi
80104905: 53 push %ebx
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
80104906: 8d 75 da lea -0x26(%ebp),%esi
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
80104909: 83 ec 44 sub $0x44,%esp
8010490c: 89 4d c0 mov %ecx,-0x40(%ebp)
8010490f: 8b 4d 08 mov 0x8(%ebp),%ecx
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
80104912: 56 push %esi
80104913: 50 push %eax
return -1;
}
static struct inode*
create(char *path, short type, short major, short minor)
{
80104914: 89 55 c4 mov %edx,-0x3c(%ebp)
80104917: 89 4d bc mov %ecx,-0x44(%ebp)
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
8010491a: e8 41 d6 ff ff call 80101f60 <nameiparent>
8010491f: 83 c4 10 add $0x10,%esp
80104922: 85 c0 test %eax,%eax
80104924: 0f 84 f6 00 00 00 je 80104a20 <create+0x120>
return 0;
ilock(dp);
8010492a: 83 ec 0c sub $0xc,%esp
8010492d: 89 c7 mov %eax,%edi
8010492f: 50 push %eax
80104930: e8 7b cd ff ff call 801016b0 <ilock>
if((ip = dirlookup(dp, name, &off)) != 0){
80104935: 8d 45 d4 lea -0x2c(%ebp),%eax
80104938: 83 c4 0c add $0xc,%esp
8010493b: 50 push %eax
8010493c: 56 push %esi
8010493d: 57 push %edi
8010493e: e8 dd d2 ff ff call 80101c20 <dirlookup>
80104943: 83 c4 10 add $0x10,%esp
80104946: 85 c0 test %eax,%eax
80104948: 89 c3 mov %eax,%ebx
8010494a: 74 54 je 801049a0 <create+0xa0>
iunlockput(dp);
8010494c: 83 ec 0c sub $0xc,%esp
8010494f: 57 push %edi
80104950: e8 0b d0 ff ff call 80101960 <iunlockput>
ilock(ip);
80104955: 89 1c 24 mov %ebx,(%esp)
80104958: e8 53 cd ff ff call 801016b0 <ilock>
if(type == T_FILE && ip->type == T_FILE)
8010495d: 83 c4 10 add $0x10,%esp
80104960: 66 83 7d c4 02 cmpw $0x2,-0x3c(%ebp)
80104965: 75 19 jne 80104980 <create+0x80>
80104967: 66 83 7b 50 02 cmpw $0x2,0x50(%ebx)
8010496c: 89 d8 mov %ebx,%eax
8010496e: 75 10 jne 80104980 <create+0x80>
panic("create: dirlink");
iunlockput(dp);
return ip;
}
80104970: 8d 65 f4 lea -0xc(%ebp),%esp
80104973: 5b pop %ebx
80104974: 5e pop %esi
80104975: 5f pop %edi
80104976: 5d pop %ebp
80104977: c3 ret
80104978: 90 nop
80104979: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if((ip = dirlookup(dp, name, &off)) != 0){
iunlockput(dp);
ilock(ip);
if(type == T_FILE && ip->type == T_FILE)
return ip;
iunlockput(ip);
80104980: 83 ec 0c sub $0xc,%esp
80104983: 53 push %ebx
80104984: e8 d7 cf ff ff call 80101960 <iunlockput>
return 0;
80104989: 83 c4 10 add $0x10,%esp
panic("create: dirlink");
iunlockput(dp);
return ip;
}
8010498c: 8d 65 f4 lea -0xc(%ebp),%esp
iunlockput(dp);
ilock(ip);
if(type == T_FILE && ip->type == T_FILE)
return ip;
iunlockput(ip);
return 0;
8010498f: 31 c0 xor %eax,%eax
panic("create: dirlink");
iunlockput(dp);
return ip;
}
80104991: 5b pop %ebx
80104992: 5e pop %esi
80104993: 5f pop %edi
80104994: 5d pop %ebp
80104995: c3 ret
80104996: 8d 76 00 lea 0x0(%esi),%esi
80104999: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
return ip;
iunlockput(ip);
return 0;
}
if((ip = ialloc(dp->dev, type)) == 0)
801049a0: 0f bf 45 c4 movswl -0x3c(%ebp),%eax
801049a4: 83 ec 08 sub $0x8,%esp
801049a7: 50 push %eax
801049a8: ff 37 pushl (%edi)
801049aa: e8 51 cb ff ff call 80101500 <ialloc>
801049af: 83 c4 10 add $0x10,%esp
801049b2: 85 c0 test %eax,%eax
801049b4: 89 c3 mov %eax,%ebx
801049b6: 0f 84 cc 00 00 00 je 80104a88 <create+0x188>
panic("create: ialloc");
ilock(ip);
801049bc: 83 ec 0c sub $0xc,%esp
801049bf: 50 push %eax
801049c0: e8 eb cc ff ff call 801016b0 <ilock>
ip->major = major;
801049c5: 0f b7 45 c0 movzwl -0x40(%ebp),%eax
801049c9: 66 89 43 52 mov %ax,0x52(%ebx)
ip->minor = minor;
801049cd: 0f b7 45 bc movzwl -0x44(%ebp),%eax
801049d1: 66 89 43 54 mov %ax,0x54(%ebx)
ip->nlink = 1;
801049d5: b8 01 00 00 00 mov $0x1,%eax
801049da: 66 89 43 56 mov %ax,0x56(%ebx)
iupdate(ip);
801049de: 89 1c 24 mov %ebx,(%esp)
801049e1: e8 fa cb ff ff call 801015e0 <iupdate>
if(type == T_DIR){ // Create . and .. entries.
801049e6: 83 c4 10 add $0x10,%esp
801049e9: 66 83 7d c4 01 cmpw $0x1,-0x3c(%ebp)
801049ee: 74 40 je 80104a30 <create+0x130>
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
panic("create dots");
}
if(dirlink(dp, name, ip->inum) < 0)
801049f0: 83 ec 04 sub $0x4,%esp
801049f3: ff 73 04 pushl 0x4(%ebx)
801049f6: 56 push %esi
801049f7: 57 push %edi
801049f8: e8 83 d4 ff ff call 80101e80 <dirlink>
801049fd: 83 c4 10 add $0x10,%esp
80104a00: 85 c0 test %eax,%eax
80104a02: 78 77 js 80104a7b <create+0x17b>
panic("create: dirlink");
iunlockput(dp);
80104a04: 83 ec 0c sub $0xc,%esp
80104a07: 57 push %edi
80104a08: e8 53 cf ff ff call 80101960 <iunlockput>
return ip;
80104a0d: 83 c4 10 add $0x10,%esp
}
80104a10: 8d 65 f4 lea -0xc(%ebp),%esp
if(dirlink(dp, name, ip->inum) < 0)
panic("create: dirlink");
iunlockput(dp);
return ip;
80104a13: 89 d8 mov %ebx,%eax
}
80104a15: 5b pop %ebx
80104a16: 5e pop %esi
80104a17: 5f pop %edi
80104a18: 5d pop %ebp
80104a19: c3 ret
80104a1a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
return 0;
80104a20: 31 c0 xor %eax,%eax
80104a22: e9 49 ff ff ff jmp 80104970 <create+0x70>
80104a27: 89 f6 mov %esi,%esi
80104a29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
ip->minor = minor;
ip->nlink = 1;
iupdate(ip);
if(type == T_DIR){ // Create . and .. entries.
dp->nlink++; // for ".."
80104a30: 66 83 47 56 01 addw $0x1,0x56(%edi)
iupdate(dp);
80104a35: 83 ec 0c sub $0xc,%esp
80104a38: 57 push %edi
80104a39: e8 a2 cb ff ff call 801015e0 <iupdate>
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80104a3e: 83 c4 0c add $0xc,%esp
80104a41: ff 73 04 pushl 0x4(%ebx)
80104a44: 68 b4 76 10 80 push $0x801076b4
80104a49: 53 push %ebx
80104a4a: e8 31 d4 ff ff call 80101e80 <dirlink>
80104a4f: 83 c4 10 add $0x10,%esp
80104a52: 85 c0 test %eax,%eax
80104a54: 78 18 js 80104a6e <create+0x16e>
80104a56: 83 ec 04 sub $0x4,%esp
80104a59: ff 77 04 pushl 0x4(%edi)
80104a5c: 68 b3 76 10 80 push $0x801076b3
80104a61: 53 push %ebx
80104a62: e8 19 d4 ff ff call 80101e80 <dirlink>
80104a67: 83 c4 10 add $0x10,%esp
80104a6a: 85 c0 test %eax,%eax
80104a6c: 79 82 jns 801049f0 <create+0xf0>
panic("create dots");
80104a6e: 83 ec 0c sub $0xc,%esp
80104a71: 68 a7 76 10 80 push $0x801076a7
80104a76: e8 f5 b8 ff ff call 80100370 <panic>
}
if(dirlink(dp, name, ip->inum) < 0)
panic("create: dirlink");
80104a7b: 83 ec 0c sub $0xc,%esp
80104a7e: 68 b6 76 10 80 push $0x801076b6
80104a83: e8 e8 b8 ff ff call 80100370 <panic>
iunlockput(ip);
return 0;
}
if((ip = ialloc(dp->dev, type)) == 0)
panic("create: ialloc");
80104a88: 83 ec 0c sub $0xc,%esp
80104a8b: 68 98 76 10 80 push $0x80107698
80104a90: e8 db b8 ff ff call 80100370 <panic>
80104a95: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104a99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104aa0 <argfd.constprop.0>:
#include "fcntl.h"
// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
80104aa0: 55 push %ebp
80104aa1: 89 e5 mov %esp,%ebp
80104aa3: 56 push %esi
80104aa4: 53 push %ebx
80104aa5: 89 c6 mov %eax,%esi
{
int fd;
struct file *f;
if(argint(n, &fd) < 0)
80104aa7: 8d 45 f4 lea -0xc(%ebp),%eax
#include "fcntl.h"
// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
80104aaa: 89 d3 mov %edx,%ebx
80104aac: 83 ec 18 sub $0x18,%esp
{
int fd;
struct file *f;
if(argint(n, &fd) < 0)
80104aaf: 50 push %eax
80104ab0: 6a 00 push $0x0
80104ab2: e8 f9 fc ff ff call 801047b0 <argint>
80104ab7: 83 c4 10 add $0x10,%esp
80104aba: 85 c0 test %eax,%eax
80104abc: 78 32 js 80104af0 <argfd.constprop.0+0x50>
return -1;
if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0)
80104abe: 83 7d f4 0f cmpl $0xf,-0xc(%ebp)
80104ac2: 77 2c ja 80104af0 <argfd.constprop.0+0x50>
80104ac4: e8 37 ed ff ff call 80103800 <myproc>
80104ac9: 8b 55 f4 mov -0xc(%ebp),%edx
80104acc: 8b 44 90 28 mov 0x28(%eax,%edx,4),%eax
80104ad0: 85 c0 test %eax,%eax
80104ad2: 74 1c je 80104af0 <argfd.constprop.0+0x50>
return -1;
if(pfd)
80104ad4: 85 f6 test %esi,%esi
80104ad6: 74 02 je 80104ada <argfd.constprop.0+0x3a>
*pfd = fd;
80104ad8: 89 16 mov %edx,(%esi)
if(pf)
80104ada: 85 db test %ebx,%ebx
80104adc: 74 22 je 80104b00 <argfd.constprop.0+0x60>
*pf = f;
80104ade: 89 03 mov %eax,(%ebx)
return 0;
80104ae0: 31 c0 xor %eax,%eax
}
80104ae2: 8d 65 f8 lea -0x8(%ebp),%esp
80104ae5: 5b pop %ebx
80104ae6: 5e pop %esi
80104ae7: 5d pop %ebp
80104ae8: c3 ret
80104ae9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80104af0: 8d 65 f8 lea -0x8(%ebp),%esp
{
int fd;
struct file *f;
if(argint(n, &fd) < 0)
return -1;
80104af3: b8 ff ff ff ff mov $0xffffffff,%eax
if(pfd)
*pfd = fd;
if(pf)
*pf = f;
return 0;
}
80104af8: 5b pop %ebx
80104af9: 5e pop %esi
80104afa: 5d pop %ebp
80104afb: c3 ret
80104afc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
if(pfd)
*pfd = fd;
if(pf)
*pf = f;
return 0;
80104b00: 31 c0 xor %eax,%eax
80104b02: eb de jmp 80104ae2 <argfd.constprop.0+0x42>
80104b04: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104b0a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80104b10 <sys_dup>:
return -1;
}
int
sys_dup(void)
{
80104b10: 55 push %ebp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80104b11: 31 c0 xor %eax,%eax
return -1;
}
int
sys_dup(void)
{
80104b13: 89 e5 mov %esp,%ebp
80104b15: 56 push %esi
80104b16: 53 push %ebx
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80104b17: 8d 55 f4 lea -0xc(%ebp),%edx
return -1;
}
int
sys_dup(void)
{
80104b1a: 83 ec 10 sub $0x10,%esp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80104b1d: e8 7e ff ff ff call 80104aa0 <argfd.constprop.0>
80104b22: 85 c0 test %eax,%eax
80104b24: 78 1a js 80104b40 <sys_dup+0x30>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
80104b26: 31 db xor %ebx,%ebx
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
return -1;
if((fd=fdalloc(f)) < 0)
80104b28: 8b 75 f4 mov -0xc(%ebp),%esi
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
80104b2b: e8 d0 ec ff ff call 80103800 <myproc>
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
80104b30: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx
80104b34: 85 d2 test %edx,%edx
80104b36: 74 18 je 80104b50 <sys_dup+0x40>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
80104b38: 83 c3 01 add $0x1,%ebx
80104b3b: 83 fb 10 cmp $0x10,%ebx
80104b3e: 75 f0 jne 80104b30 <sys_dup+0x20>
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
}
80104b40: 8d 65 f8 lea -0x8(%ebp),%esp
{
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
return -1;
80104b43: b8 ff ff ff ff mov $0xffffffff,%eax
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
}
80104b48: 5b pop %ebx
80104b49: 5e pop %esi
80104b4a: 5d pop %ebp
80104b4b: c3 ret
80104b4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
curproc->ofile[fd] = f;
80104b50: 89 74 98 28 mov %esi,0x28(%eax,%ebx,4)
if(argfd(0, 0, &f) < 0)
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
80104b54: 83 ec 0c sub $0xc,%esp
80104b57: ff 75 f4 pushl -0xc(%ebp)
80104b5a: e8 81 c2 ff ff call 80100de0 <filedup>
return fd;
80104b5f: 83 c4 10 add $0x10,%esp
}
80104b62: 8d 65 f8 lea -0x8(%ebp),%esp
if(argfd(0, 0, &f) < 0)
return -1;
if((fd=fdalloc(f)) < 0)
return -1;
filedup(f);
return fd;
80104b65: 89 d8 mov %ebx,%eax
}
80104b67: 5b pop %ebx
80104b68: 5e pop %esi
80104b69: 5d pop %ebp
80104b6a: c3 ret
80104b6b: 90 nop
80104b6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80104b70 <sys_read>:
int
sys_read(void)
{
80104b70: 55 push %ebp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104b71: 31 c0 xor %eax,%eax
return fd;
}
int
sys_read(void)
{
80104b73: 89 e5 mov %esp,%ebp
80104b75: 83 ec 18 sub $0x18,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104b78: 8d 55 ec lea -0x14(%ebp),%edx
80104b7b: e8 20 ff ff ff call 80104aa0 <argfd.constprop.0>
80104b80: 85 c0 test %eax,%eax
80104b82: 78 4c js 80104bd0 <sys_read+0x60>
80104b84: 8d 45 f0 lea -0x10(%ebp),%eax
80104b87: 83 ec 08 sub $0x8,%esp
80104b8a: 50 push %eax
80104b8b: 6a 02 push $0x2
80104b8d: e8 1e fc ff ff call 801047b0 <argint>
80104b92: 83 c4 10 add $0x10,%esp
80104b95: 85 c0 test %eax,%eax
80104b97: 78 37 js 80104bd0 <sys_read+0x60>
80104b99: 8d 45 f4 lea -0xc(%ebp),%eax
80104b9c: 83 ec 04 sub $0x4,%esp
80104b9f: ff 75 f0 pushl -0x10(%ebp)
80104ba2: 50 push %eax
80104ba3: 6a 01 push $0x1
80104ba5: e8 56 fc ff ff call 80104800 <argptr>
80104baa: 83 c4 10 add $0x10,%esp
80104bad: 85 c0 test %eax,%eax
80104baf: 78 1f js 80104bd0 <sys_read+0x60>
return -1;
return fileread(f, p, n);
80104bb1: 83 ec 04 sub $0x4,%esp
80104bb4: ff 75 f0 pushl -0x10(%ebp)
80104bb7: ff 75 f4 pushl -0xc(%ebp)
80104bba: ff 75 ec pushl -0x14(%ebp)
80104bbd: e8 8e c3 ff ff call 80100f50 <fileread>
80104bc2: 83 c4 10 add $0x10,%esp
}
80104bc5: c9 leave
80104bc6: c3 ret
80104bc7: 89 f6 mov %esi,%esi
80104bc9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
return -1;
80104bd0: b8 ff ff ff ff mov $0xffffffff,%eax
return fileread(f, p, n);
}
80104bd5: c9 leave
80104bd6: c3 ret
80104bd7: 89 f6 mov %esi,%esi
80104bd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104be0 <sys_write>:
int
sys_write(void)
{
80104be0: 55 push %ebp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104be1: 31 c0 xor %eax,%eax
return fileread(f, p, n);
}
int
sys_write(void)
{
80104be3: 89 e5 mov %esp,%ebp
80104be5: 83 ec 18 sub $0x18,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80104be8: 8d 55 ec lea -0x14(%ebp),%edx
80104beb: e8 b0 fe ff ff call 80104aa0 <argfd.constprop.0>
80104bf0: 85 c0 test %eax,%eax
80104bf2: 78 4c js 80104c40 <sys_write+0x60>
80104bf4: 8d 45 f0 lea -0x10(%ebp),%eax
80104bf7: 83 ec 08 sub $0x8,%esp
80104bfa: 50 push %eax
80104bfb: 6a 02 push $0x2
80104bfd: e8 ae fb ff ff call 801047b0 <argint>
80104c02: 83 c4 10 add $0x10,%esp
80104c05: 85 c0 test %eax,%eax
80104c07: 78 37 js 80104c40 <sys_write+0x60>
80104c09: 8d 45 f4 lea -0xc(%ebp),%eax
80104c0c: 83 ec 04 sub $0x4,%esp
80104c0f: ff 75 f0 pushl -0x10(%ebp)
80104c12: 50 push %eax
80104c13: 6a 01 push $0x1
80104c15: e8 e6 fb ff ff call 80104800 <argptr>
80104c1a: 83 c4 10 add $0x10,%esp
80104c1d: 85 c0 test %eax,%eax
80104c1f: 78 1f js 80104c40 <sys_write+0x60>
return -1;
return filewrite(f, p, n);
80104c21: 83 ec 04 sub $0x4,%esp
80104c24: ff 75 f0 pushl -0x10(%ebp)
80104c27: ff 75 f4 pushl -0xc(%ebp)
80104c2a: ff 75 ec pushl -0x14(%ebp)
80104c2d: e8 ae c3 ff ff call 80100fe0 <filewrite>
80104c32: 83 c4 10 add $0x10,%esp
}
80104c35: c9 leave
80104c36: c3 ret
80104c37: 89 f6 mov %esi,%esi
80104c39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
return -1;
80104c40: b8 ff ff ff ff mov $0xffffffff,%eax
return filewrite(f, p, n);
}
80104c45: c9 leave
80104c46: c3 ret
80104c47: 89 f6 mov %esi,%esi
80104c49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104c50 <sys_close>:
int
sys_close(void)
{
80104c50: 55 push %ebp
80104c51: 89 e5 mov %esp,%ebp
80104c53: 83 ec 18 sub $0x18,%esp
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
80104c56: 8d 55 f4 lea -0xc(%ebp),%edx
80104c59: 8d 45 f0 lea -0x10(%ebp),%eax
80104c5c: e8 3f fe ff ff call 80104aa0 <argfd.constprop.0>
80104c61: 85 c0 test %eax,%eax
80104c63: 78 2b js 80104c90 <sys_close+0x40>
return -1;
myproc()->ofile[fd] = 0;
80104c65: e8 96 eb ff ff call 80103800 <myproc>
80104c6a: 8b 55 f0 mov -0x10(%ebp),%edx
fileclose(f);
80104c6d: 83 ec 0c sub $0xc,%esp
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
return -1;
myproc()->ofile[fd] = 0;
80104c70: c7 44 90 28 00 00 00 movl $0x0,0x28(%eax,%edx,4)
80104c77: 00
fileclose(f);
80104c78: ff 75 f4 pushl -0xc(%ebp)
80104c7b: e8 b0 c1 ff ff call 80100e30 <fileclose>
return 0;
80104c80: 83 c4 10 add $0x10,%esp
80104c83: 31 c0 xor %eax,%eax
}
80104c85: c9 leave
80104c86: c3 ret
80104c87: 89 f6 mov %esi,%esi
80104c89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
{
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
return -1;
80104c90: b8 ff ff ff ff mov $0xffffffff,%eax
myproc()->ofile[fd] = 0;
fileclose(f);
return 0;
}
80104c95: c9 leave
80104c96: c3 ret
80104c97: 89 f6 mov %esi,%esi
80104c99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104ca0 <sys_fstat>:
int
sys_fstat(void)
{
80104ca0: 55 push %ebp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
80104ca1: 31 c0 xor %eax,%eax
return 0;
}
int
sys_fstat(void)
{
80104ca3: 89 e5 mov %esp,%ebp
80104ca5: 83 ec 18 sub $0x18,%esp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
80104ca8: 8d 55 f0 lea -0x10(%ebp),%edx
80104cab: e8 f0 fd ff ff call 80104aa0 <argfd.constprop.0>
80104cb0: 85 c0 test %eax,%eax
80104cb2: 78 2c js 80104ce0 <sys_fstat+0x40>
80104cb4: 8d 45 f4 lea -0xc(%ebp),%eax
80104cb7: 83 ec 04 sub $0x4,%esp
80104cba: 6a 1c push $0x1c
80104cbc: 50 push %eax
80104cbd: 6a 01 push $0x1
80104cbf: e8 3c fb ff ff call 80104800 <argptr>
80104cc4: 83 c4 10 add $0x10,%esp
80104cc7: 85 c0 test %eax,%eax
80104cc9: 78 15 js 80104ce0 <sys_fstat+0x40>
return -1;
return filestat(f, st);
80104ccb: 83 ec 08 sub $0x8,%esp
80104cce: ff 75 f4 pushl -0xc(%ebp)
80104cd1: ff 75 f0 pushl -0x10(%ebp)
80104cd4: e8 27 c2 ff ff call 80100f00 <filestat>
80104cd9: 83 c4 10 add $0x10,%esp
}
80104cdc: c9 leave
80104cdd: c3 ret
80104cde: 66 90 xchg %ax,%ax
{
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
return -1;
80104ce0: b8 ff ff ff ff mov $0xffffffff,%eax
return filestat(f, st);
}
80104ce5: c9 leave
80104ce6: c3 ret
80104ce7: 89 f6 mov %esi,%esi
80104ce9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80104cf0 <sys_link>:
// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80104cf0: 55 push %ebp
80104cf1: 89 e5 mov %esp,%ebp
80104cf3: 57 push %edi
80104cf4: 56 push %esi
80104cf5: 53 push %ebx
char name[DIRSIZ], *new, *old;
struct inode *dp, *ip;
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80104cf6: 8d 45 d4 lea -0x2c(%ebp),%eax
}
// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80104cf9: 83 ec 34 sub $0x34,%esp
char name[DIRSIZ], *new, *old;
struct inode *dp, *ip;
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80104cfc: 50 push %eax
80104cfd: 6a 00 push $0x0
80104cff: e8 5c fb ff ff call 80104860 <argstr>
80104d04: 83 c4 10 add $0x10,%esp
80104d07: 85 c0 test %eax,%eax
80104d09: 0f 88 fb 00 00 00 js 80104e0a <sys_link+0x11a>
80104d0f: 8d 45 d0 lea -0x30(%ebp),%eax
80104d12: 83 ec 08 sub $0x8,%esp
80104d15: 50 push %eax
80104d16: 6a 01 push $0x1
80104d18: e8 43 fb ff ff call 80104860 <argstr>
80104d1d: 83 c4 10 add $0x10,%esp
80104d20: 85 c0 test %eax,%eax
80104d22: 0f 88 e2 00 00 00 js 80104e0a <sys_link+0x11a>
return -1;
begin_op();
80104d28: e8 a3 de ff ff call 80102bd0 <begin_op>
if((ip = namei(old)) == 0){
80104d2d: 83 ec 0c sub $0xc,%esp
80104d30: ff 75 d4 pushl -0x2c(%ebp)
80104d33: e8 08 d2 ff ff call 80101f40 <namei>
80104d38: 83 c4 10 add $0x10,%esp
80104d3b: 85 c0 test %eax,%eax
80104d3d: 89 c3 mov %eax,%ebx
80104d3f: 0f 84 f3 00 00 00 je 80104e38 <sys_link+0x148>
end_op();
return -1;
}
ilock(ip);
80104d45: 83 ec 0c sub $0xc,%esp
80104d48: 50 push %eax
80104d49: e8 62 c9 ff ff call 801016b0 <ilock>
if(ip->type == T_DIR){
80104d4e: 83 c4 10 add $0x10,%esp
80104d51: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104d56: 0f 84 c4 00 00 00 je 80104e20 <sys_link+0x130>
iunlockput(ip);
end_op();
return -1;
}
ip->nlink++;
80104d5c: 66 83 43 56 01 addw $0x1,0x56(%ebx)
iupdate(ip);
80104d61: 83 ec 0c sub $0xc,%esp
iunlock(ip);
if((dp = nameiparent(new, name)) == 0)
80104d64: 8d 7d da lea -0x26(%ebp),%edi
end_op();
return -1;
}
ip->nlink++;
iupdate(ip);
80104d67: 53 push %ebx
80104d68: e8 73 c8 ff ff call 801015e0 <iupdate>
iunlock(ip);
80104d6d: 89 1c 24 mov %ebx,(%esp)
80104d70: e8 3b ca ff ff call 801017b0 <iunlock>
if((dp = nameiparent(new, name)) == 0)
80104d75: 58 pop %eax
80104d76: 5a pop %edx
80104d77: 57 push %edi
80104d78: ff 75 d0 pushl -0x30(%ebp)
80104d7b: e8 e0 d1 ff ff call 80101f60 <nameiparent>
80104d80: 83 c4 10 add $0x10,%esp
80104d83: 85 c0 test %eax,%eax
80104d85: 89 c6 mov %eax,%esi
80104d87: 74 5b je 80104de4 <sys_link+0xf4>
goto bad;
ilock(dp);
80104d89: 83 ec 0c sub $0xc,%esp
80104d8c: 50 push %eax
80104d8d: e8 1e c9 ff ff call 801016b0 <ilock>
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
80104d92: 83 c4 10 add $0x10,%esp
80104d95: 8b 03 mov (%ebx),%eax
80104d97: 39 06 cmp %eax,(%esi)
80104d99: 75 3d jne 80104dd8 <sys_link+0xe8>
80104d9b: 83 ec 04 sub $0x4,%esp
80104d9e: ff 73 04 pushl 0x4(%ebx)
80104da1: 57 push %edi
80104da2: 56 push %esi
80104da3: e8 d8 d0 ff ff call 80101e80 <dirlink>
80104da8: 83 c4 10 add $0x10,%esp
80104dab: 85 c0 test %eax,%eax
80104dad: 78 29 js 80104dd8 <sys_link+0xe8>
iunlockput(dp);
goto bad;
}
iunlockput(dp);
80104daf: 83 ec 0c sub $0xc,%esp
80104db2: 56 push %esi
80104db3: e8 a8 cb ff ff call 80101960 <iunlockput>
iput(ip);
80104db8: 89 1c 24 mov %ebx,(%esp)
80104dbb: e8 40 ca ff ff call 80101800 <iput>
end_op();
80104dc0: e8 7b de ff ff call 80102c40 <end_op>
return 0;
80104dc5: 83 c4 10 add $0x10,%esp
80104dc8: 31 c0 xor %eax,%eax
ip->nlink--;
iupdate(ip);
iunlockput(ip);
end_op();
return -1;
}
80104dca: 8d 65 f4 lea -0xc(%ebp),%esp
80104dcd: 5b pop %ebx
80104dce: 5e pop %esi
80104dcf: 5f pop %edi
80104dd0: 5d pop %ebp
80104dd1: c3 ret
80104dd2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if((dp = nameiparent(new, name)) == 0)
goto bad;
ilock(dp);
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
iunlockput(dp);
80104dd8: 83 ec 0c sub $0xc,%esp
80104ddb: 56 push %esi
80104ddc: e8 7f cb ff ff call 80101960 <iunlockput>
goto bad;
80104de1: 83 c4 10 add $0x10,%esp
end_op();
return 0;
bad:
ilock(ip);
80104de4: 83 ec 0c sub $0xc,%esp
80104de7: 53 push %ebx
80104de8: e8 c3 c8 ff ff call 801016b0 <ilock>
ip->nlink--;
80104ded: 66 83 6b 56 01 subw $0x1,0x56(%ebx)
iupdate(ip);
80104df2: 89 1c 24 mov %ebx,(%esp)
80104df5: e8 e6 c7 ff ff call 801015e0 <iupdate>
iunlockput(ip);
80104dfa: 89 1c 24 mov %ebx,(%esp)
80104dfd: e8 5e cb ff ff call 80101960 <iunlockput>
end_op();
80104e02: e8 39 de ff ff call 80102c40 <end_op>
return -1;
80104e07: 83 c4 10 add $0x10,%esp
}
80104e0a: 8d 65 f4 lea -0xc(%ebp),%esp
ilock(ip);
ip->nlink--;
iupdate(ip);
iunlockput(ip);
end_op();
return -1;
80104e0d: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104e12: 5b pop %ebx
80104e13: 5e pop %esi
80104e14: 5f pop %edi
80104e15: 5d pop %ebp
80104e16: c3 ret
80104e17: 89 f6 mov %esi,%esi
80104e19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
return -1;
}
ilock(ip);
if(ip->type == T_DIR){
iunlockput(ip);
80104e20: 83 ec 0c sub $0xc,%esp
80104e23: 53 push %ebx
80104e24: e8 37 cb ff ff call 80101960 <iunlockput>
end_op();
80104e29: e8 12 de ff ff call 80102c40 <end_op>
return -1;
80104e2e: 83 c4 10 add $0x10,%esp
80104e31: b8 ff ff ff ff mov $0xffffffff,%eax
80104e36: eb 92 jmp 80104dca <sys_link+0xda>
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
return -1;
begin_op();
if((ip = namei(old)) == 0){
end_op();
80104e38: e8 03 de ff ff call 80102c40 <end_op>
return -1;
80104e3d: b8 ff ff ff ff mov $0xffffffff,%eax
80104e42: eb 86 jmp 80104dca <sys_link+0xda>
80104e44: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80104e4a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80104e50 <sys_unlink>:
}
//PAGEBREAK!
int
sys_unlink(void)
{
80104e50: 55 push %ebp
80104e51: 89 e5 mov %esp,%ebp
80104e53: 57 push %edi
80104e54: 56 push %esi
80104e55: 53 push %ebx
struct inode *ip, *dp;
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
80104e56: 8d 45 c0 lea -0x40(%ebp),%eax
}
//PAGEBREAK!
int
sys_unlink(void)
{
80104e59: 83 ec 54 sub $0x54,%esp
struct inode *ip, *dp;
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
80104e5c: 50 push %eax
80104e5d: 6a 00 push $0x0
80104e5f: e8 fc f9 ff ff call 80104860 <argstr>
80104e64: 83 c4 10 add $0x10,%esp
80104e67: 85 c0 test %eax,%eax
80104e69: 0f 88 82 01 00 00 js 80104ff1 <sys_unlink+0x1a1>
return -1;
begin_op();
if((dp = nameiparent(path, name)) == 0){
80104e6f: 8d 5d ca lea -0x36(%ebp),%ebx
uint off;
if(argstr(0, &path) < 0)
return -1;
begin_op();
80104e72: e8 59 dd ff ff call 80102bd0 <begin_op>
if((dp = nameiparent(path, name)) == 0){
80104e77: 83 ec 08 sub $0x8,%esp
80104e7a: 53 push %ebx
80104e7b: ff 75 c0 pushl -0x40(%ebp)
80104e7e: e8 dd d0 ff ff call 80101f60 <nameiparent>
80104e83: 83 c4 10 add $0x10,%esp
80104e86: 85 c0 test %eax,%eax
80104e88: 89 45 b4 mov %eax,-0x4c(%ebp)
80104e8b: 0f 84 6a 01 00 00 je 80104ffb <sys_unlink+0x1ab>
end_op();
return -1;
}
ilock(dp);
80104e91: 8b 75 b4 mov -0x4c(%ebp),%esi
80104e94: 83 ec 0c sub $0xc,%esp
80104e97: 56 push %esi
80104e98: e8 13 c8 ff ff call 801016b0 <ilock>
// Cannot unlink "." or "..".
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
80104e9d: 58 pop %eax
80104e9e: 5a pop %edx
80104e9f: 68 b4 76 10 80 push $0x801076b4
80104ea4: 53 push %ebx
80104ea5: e8 56 cd ff ff call 80101c00 <namecmp>
80104eaa: 83 c4 10 add $0x10,%esp
80104ead: 85 c0 test %eax,%eax
80104eaf: 0f 84 fc 00 00 00 je 80104fb1 <sys_unlink+0x161>
80104eb5: 83 ec 08 sub $0x8,%esp
80104eb8: 68 b3 76 10 80 push $0x801076b3
80104ebd: 53 push %ebx
80104ebe: e8 3d cd ff ff call 80101c00 <namecmp>
80104ec3: 83 c4 10 add $0x10,%esp
80104ec6: 85 c0 test %eax,%eax
80104ec8: 0f 84 e3 00 00 00 je 80104fb1 <sys_unlink+0x161>
goto bad;
if((ip = dirlookup(dp, name, &off)) == 0)
80104ece: 8d 45 c4 lea -0x3c(%ebp),%eax
80104ed1: 83 ec 04 sub $0x4,%esp
80104ed4: 50 push %eax
80104ed5: 53 push %ebx
80104ed6: 56 push %esi
80104ed7: e8 44 cd ff ff call 80101c20 <dirlookup>
80104edc: 83 c4 10 add $0x10,%esp
80104edf: 85 c0 test %eax,%eax
80104ee1: 89 c3 mov %eax,%ebx
80104ee3: 0f 84 c8 00 00 00 je 80104fb1 <sys_unlink+0x161>
goto bad;
ilock(ip);
80104ee9: 83 ec 0c sub $0xc,%esp
80104eec: 50 push %eax
80104eed: e8 be c7 ff ff call 801016b0 <ilock>
if(ip->nlink < 1)
80104ef2: 83 c4 10 add $0x10,%esp
80104ef5: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx)
80104efa: 0f 8e 24 01 00 00 jle 80105024 <sys_unlink+0x1d4>
panic("unlink: nlink < 1");
if(ip->type == T_DIR && !isdirempty(ip)){
80104f00: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104f05: 8d 75 d8 lea -0x28(%ebp),%esi
80104f08: 74 66 je 80104f70 <sys_unlink+0x120>
iunlockput(ip);
goto bad;
}
memset(&de, 0, sizeof(de));
80104f0a: 83 ec 04 sub $0x4,%esp
80104f0d: 6a 10 push $0x10
80104f0f: 6a 00 push $0x0
80104f11: 56 push %esi
80104f12: e8 89 f5 ff ff call 801044a0 <memset>
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80104f17: 6a 10 push $0x10
80104f19: ff 75 c4 pushl -0x3c(%ebp)
80104f1c: 56 push %esi
80104f1d: ff 75 b4 pushl -0x4c(%ebp)
80104f20: e8 ab cb ff ff call 80101ad0 <writei>
80104f25: 83 c4 20 add $0x20,%esp
80104f28: 83 f8 10 cmp $0x10,%eax
80104f2b: 0f 85 e6 00 00 00 jne 80105017 <sys_unlink+0x1c7>
panic("unlink: writei");
if(ip->type == T_DIR){
80104f31: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
80104f36: 0f 84 9c 00 00 00 je 80104fd8 <sys_unlink+0x188>
dp->nlink--;
iupdate(dp);
}
iunlockput(dp);
80104f3c: 83 ec 0c sub $0xc,%esp
80104f3f: ff 75 b4 pushl -0x4c(%ebp)
80104f42: e8 19 ca ff ff call 80101960 <iunlockput>
ip->nlink--;
80104f47: 66 83 6b 56 01 subw $0x1,0x56(%ebx)
iupdate(ip);
80104f4c: 89 1c 24 mov %ebx,(%esp)
80104f4f: e8 8c c6 ff ff call 801015e0 <iupdate>
iunlockput(ip);
80104f54: 89 1c 24 mov %ebx,(%esp)
80104f57: e8 04 ca ff ff call 80101960 <iunlockput>
end_op();
80104f5c: e8 df dc ff ff call 80102c40 <end_op>
return 0;
80104f61: 83 c4 10 add $0x10,%esp
80104f64: 31 c0 xor %eax,%eax
bad:
iunlockput(dp);
end_op();
return -1;
}
80104f66: 8d 65 f4 lea -0xc(%ebp),%esp
80104f69: 5b pop %ebx
80104f6a: 5e pop %esi
80104f6b: 5f pop %edi
80104f6c: 5d pop %ebp
80104f6d: c3 ret
80104f6e: 66 90 xchg %ax,%ax
isdirempty(struct inode *dp)
{
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80104f70: 83 7b 58 20 cmpl $0x20,0x58(%ebx)
80104f74: 76 94 jbe 80104f0a <sys_unlink+0xba>
80104f76: bf 20 00 00 00 mov $0x20,%edi
80104f7b: eb 0f jmp 80104f8c <sys_unlink+0x13c>
80104f7d: 8d 76 00 lea 0x0(%esi),%esi
80104f80: 83 c7 10 add $0x10,%edi
80104f83: 3b 7b 58 cmp 0x58(%ebx),%edi
80104f86: 0f 83 7e ff ff ff jae 80104f0a <sys_unlink+0xba>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80104f8c: 6a 10 push $0x10
80104f8e: 57 push %edi
80104f8f: 56 push %esi
80104f90: 53 push %ebx
80104f91: e8 3a ca ff ff call 801019d0 <readi>
80104f96: 83 c4 10 add $0x10,%esp
80104f99: 83 f8 10 cmp $0x10,%eax
80104f9c: 75 6c jne 8010500a <sys_unlink+0x1ba>
panic("isdirempty: readi");
if(de.inum != 0)
80104f9e: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
80104fa3: 74 db je 80104f80 <sys_unlink+0x130>
ilock(ip);
if(ip->nlink < 1)
panic("unlink: nlink < 1");
if(ip->type == T_DIR && !isdirempty(ip)){
iunlockput(ip);
80104fa5: 83 ec 0c sub $0xc,%esp
80104fa8: 53 push %ebx
80104fa9: e8 b2 c9 ff ff call 80101960 <iunlockput>
goto bad;
80104fae: 83 c4 10 add $0x10,%esp
end_op();
return 0;
bad:
iunlockput(dp);
80104fb1: 83 ec 0c sub $0xc,%esp
80104fb4: ff 75 b4 pushl -0x4c(%ebp)
80104fb7: e8 a4 c9 ff ff call 80101960 <iunlockput>
end_op();
80104fbc: e8 7f dc ff ff call 80102c40 <end_op>
return -1;
80104fc1: 83 c4 10 add $0x10,%esp
}
80104fc4: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
bad:
iunlockput(dp);
end_op();
return -1;
80104fc7: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104fcc: 5b pop %ebx
80104fcd: 5e pop %esi
80104fce: 5f pop %edi
80104fcf: 5d pop %ebp
80104fd0: c3 ret
80104fd1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
memset(&de, 0, sizeof(de));
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("unlink: writei");
if(ip->type == T_DIR){
dp->nlink--;
80104fd8: 8b 45 b4 mov -0x4c(%ebp),%eax
iupdate(dp);
80104fdb: 83 ec 0c sub $0xc,%esp
memset(&de, 0, sizeof(de));
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("unlink: writei");
if(ip->type == T_DIR){
dp->nlink--;
80104fde: 66 83 68 56 01 subw $0x1,0x56(%eax)
iupdate(dp);
80104fe3: 50 push %eax
80104fe4: e8 f7 c5 ff ff call 801015e0 <iupdate>
80104fe9: 83 c4 10 add $0x10,%esp
80104fec: e9 4b ff ff ff jmp 80104f3c <sys_unlink+0xec>
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
return -1;
80104ff1: b8 ff ff ff ff mov $0xffffffff,%eax
80104ff6: e9 6b ff ff ff jmp 80104f66 <sys_unlink+0x116>
begin_op();
if((dp = nameiparent(path, name)) == 0){
end_op();
80104ffb: e8 40 dc ff ff call 80102c40 <end_op>
return -1;
80105000: b8 ff ff ff ff mov $0xffffffff,%eax
80105005: e9 5c ff ff ff jmp 80104f66 <sys_unlink+0x116>
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("isdirempty: readi");
8010500a: 83 ec 0c sub $0xc,%esp
8010500d: 68 d8 76 10 80 push $0x801076d8
80105012: e8 59 b3 ff ff call 80100370 <panic>
goto bad;
}
memset(&de, 0, sizeof(de));
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("unlink: writei");
80105017: 83 ec 0c sub $0xc,%esp
8010501a: 68 ea 76 10 80 push $0x801076ea
8010501f: e8 4c b3 ff ff call 80100370 <panic>
if((ip = dirlookup(dp, name, &off)) == 0)
goto bad;
ilock(ip);
if(ip->nlink < 1)
panic("unlink: nlink < 1");
80105024: 83 ec 0c sub $0xc,%esp
80105027: 68 c6 76 10 80 push $0x801076c6
8010502c: e8 3f b3 ff ff call 80100370 <panic>
80105031: eb 0d jmp 80105040 <sys_open>
80105033: 90 nop
80105034: 90 nop
80105035: 90 nop
80105036: 90 nop
80105037: 90 nop
80105038: 90 nop
80105039: 90 nop
8010503a: 90 nop
8010503b: 90 nop
8010503c: 90 nop
8010503d: 90 nop
8010503e: 90 nop
8010503f: 90 nop
80105040 <sys_open>:
return ip;
}
int
sys_open(void)
{
80105040: 55 push %ebp
80105041: 89 e5 mov %esp,%ebp
80105043: 57 push %edi
80105044: 56 push %esi
80105045: 53 push %ebx
char *path;
int fd, omode;
struct file *f;
struct inode *ip;
if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80105046: 8d 45 e0 lea -0x20(%ebp),%eax
return ip;
}
int
sys_open(void)
{
80105049: 83 ec 24 sub $0x24,%esp
char *path;
int fd, omode;
struct file *f;
struct inode *ip;
if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
8010504c: 50 push %eax
8010504d: 6a 00 push $0x0
8010504f: e8 0c f8 ff ff call 80104860 <argstr>
80105054: 83 c4 10 add $0x10,%esp
80105057: 85 c0 test %eax,%eax
80105059: 0f 88 9e 00 00 00 js 801050fd <sys_open+0xbd>
8010505f: 8d 45 e4 lea -0x1c(%ebp),%eax
80105062: 83 ec 08 sub $0x8,%esp
80105065: 50 push %eax
80105066: 6a 01 push $0x1
80105068: e8 43 f7 ff ff call 801047b0 <argint>
8010506d: 83 c4 10 add $0x10,%esp
80105070: 85 c0 test %eax,%eax
80105072: 0f 88 85 00 00 00 js 801050fd <sys_open+0xbd>
return -1;
begin_op();
80105078: e8 53 db ff ff call 80102bd0 <begin_op>
if(omode & O_CREATE){
8010507d: f6 45 e5 02 testb $0x2,-0x1b(%ebp)
80105081: 0f 85 89 00 00 00 jne 80105110 <sys_open+0xd0>
if(ip == 0){
end_op();
return -1;
}
} else {
if((ip = namei(path)) == 0){
80105087: 83 ec 0c sub $0xc,%esp
8010508a: ff 75 e0 pushl -0x20(%ebp)
8010508d: e8 ae ce ff ff call 80101f40 <namei>
80105092: 83 c4 10 add $0x10,%esp
80105095: 85 c0 test %eax,%eax
80105097: 89 c6 mov %eax,%esi
80105099: 0f 84 8e 00 00 00 je 8010512d <sys_open+0xed>
end_op();
return -1;
}
ilock(ip);
8010509f: 83 ec 0c sub $0xc,%esp
801050a2: 50 push %eax
801050a3: e8 08 c6 ff ff call 801016b0 <ilock>
if(ip->type == T_DIR && omode != O_RDONLY){
801050a8: 83 c4 10 add $0x10,%esp
801050ab: 66 83 7e 50 01 cmpw $0x1,0x50(%esi)
801050b0: 0f 84 d2 00 00 00 je 80105188 <sys_open+0x148>
end_op();
return -1;
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
801050b6: e8 b5 bc ff ff call 80100d70 <filealloc>
801050bb: 85 c0 test %eax,%eax
801050bd: 89 c7 mov %eax,%edi
801050bf: 74 2b je 801050ec <sys_open+0xac>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
801050c1: 31 db xor %ebx,%ebx
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
801050c3: e8 38 e7 ff ff call 80103800 <myproc>
801050c8: 90 nop
801050c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
801050d0: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx
801050d4: 85 d2 test %edx,%edx
801050d6: 74 68 je 80105140 <sys_open+0x100>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
801050d8: 83 c3 01 add $0x1,%ebx
801050db: 83 fb 10 cmp $0x10,%ebx
801050de: 75 f0 jne 801050d0 <sys_open+0x90>
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
if(f)
fileclose(f);
801050e0: 83 ec 0c sub $0xc,%esp
801050e3: 57 push %edi
801050e4: e8 47 bd ff ff call 80100e30 <fileclose>
801050e9: 83 c4 10 add $0x10,%esp
iunlockput(ip);
801050ec: 83 ec 0c sub $0xc,%esp
801050ef: 56 push %esi
801050f0: e8 6b c8 ff ff call 80101960 <iunlockput>
end_op();
801050f5: e8 46 db ff ff call 80102c40 <end_op>
return -1;
801050fa: 83 c4 10 add $0x10,%esp
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
return fd;
}
801050fd: 8d 65 f4 lea -0xc(%ebp),%esp
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
if(f)
fileclose(f);
iunlockput(ip);
end_op();
return -1;
80105100: b8 ff ff ff ff mov $0xffffffff,%eax
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
return fd;
}
80105105: 5b pop %ebx
80105106: 5e pop %esi
80105107: 5f pop %edi
80105108: 5d pop %ebp
80105109: c3 ret
8010510a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
return -1;
begin_op();
if(omode & O_CREATE){
ip = create(path, T_FILE, 0, 0);
80105110: 83 ec 0c sub $0xc,%esp
80105113: 8b 45 e0 mov -0x20(%ebp),%eax
80105116: 31 c9 xor %ecx,%ecx
80105118: 6a 00 push $0x0
8010511a: ba 02 00 00 00 mov $0x2,%edx
8010511f: e8 dc f7 ff ff call 80104900 <create>
if(ip == 0){
80105124: 83 c4 10 add $0x10,%esp
80105127: 85 c0 test %eax,%eax
return -1;
begin_op();
if(omode & O_CREATE){
ip = create(path, T_FILE, 0, 0);
80105129: 89 c6 mov %eax,%esi
if(ip == 0){
8010512b: 75 89 jne 801050b6 <sys_open+0x76>
end_op();
8010512d: e8 0e db ff ff call 80102c40 <end_op>
return -1;
80105132: b8 ff ff ff ff mov $0xffffffff,%eax
80105137: eb 43 jmp 8010517c <sys_open+0x13c>
80105139: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
fileclose(f);
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
80105140: 83 ec 0c sub $0xc,%esp
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
curproc->ofile[fd] = f;
80105143: 89 7c 98 28 mov %edi,0x28(%eax,%ebx,4)
fileclose(f);
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
80105147: 56 push %esi
80105148: e8 63 c6 ff ff call 801017b0 <iunlock>
end_op();
8010514d: e8 ee da ff ff call 80102c40 <end_op>
f->type = FD_INODE;
80105152: c7 07 02 00 00 00 movl $0x2,(%edi)
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
80105158: 8b 55 e4 mov -0x1c(%ebp),%edx
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
8010515b: 83 c4 10 add $0x10,%esp
}
iunlock(ip);
end_op();
f->type = FD_INODE;
f->ip = ip;
8010515e: 89 77 10 mov %esi,0x10(%edi)
f->off = 0;
80105161: c7 47 14 00 00 00 00 movl $0x0,0x14(%edi)
f->readable = !(omode & O_WRONLY);
80105168: 89 d0 mov %edx,%eax
8010516a: 83 e0 01 and $0x1,%eax
8010516d: 83 f0 01 xor $0x1,%eax
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80105170: 83 e2 03 and $0x3,%edx
end_op();
f->type = FD_INODE;
f->ip = ip;
f->off = 0;
f->readable = !(omode & O_WRONLY);
80105173: 88 47 08 mov %al,0x8(%edi)
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80105176: 0f 95 47 09 setne 0x9(%edi)
return fd;
8010517a: 89 d8 mov %ebx,%eax
}
8010517c: 8d 65 f4 lea -0xc(%ebp),%esp
8010517f: 5b pop %ebx
80105180: 5e pop %esi
80105181: 5f pop %edi
80105182: 5d pop %ebp
80105183: c3 ret
80105184: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if((ip = namei(path)) == 0){
end_op();
return -1;
}
ilock(ip);
if(ip->type == T_DIR && omode != O_RDONLY){
80105188: 8b 4d e4 mov -0x1c(%ebp),%ecx
8010518b: 85 c9 test %ecx,%ecx
8010518d: 0f 84 23 ff ff ff je 801050b6 <sys_open+0x76>
80105193: e9 54 ff ff ff jmp 801050ec <sys_open+0xac>
80105198: 90 nop
80105199: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801051a0 <sys_mkdir>:
return fd;
}
int
sys_mkdir(void)
{
801051a0: 55 push %ebp
801051a1: 89 e5 mov %esp,%ebp
801051a3: 83 ec 18 sub $0x18,%esp
char *path;
struct inode *ip;
begin_op();
801051a6: e8 25 da ff ff call 80102bd0 <begin_op>
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
801051ab: 8d 45 f4 lea -0xc(%ebp),%eax
801051ae: 83 ec 08 sub $0x8,%esp
801051b1: 50 push %eax
801051b2: 6a 00 push $0x0
801051b4: e8 a7 f6 ff ff call 80104860 <argstr>
801051b9: 83 c4 10 add $0x10,%esp
801051bc: 85 c0 test %eax,%eax
801051be: 78 30 js 801051f0 <sys_mkdir+0x50>
801051c0: 83 ec 0c sub $0xc,%esp
801051c3: 8b 45 f4 mov -0xc(%ebp),%eax
801051c6: 31 c9 xor %ecx,%ecx
801051c8: 6a 00 push $0x0
801051ca: ba 01 00 00 00 mov $0x1,%edx
801051cf: e8 2c f7 ff ff call 80104900 <create>
801051d4: 83 c4 10 add $0x10,%esp
801051d7: 85 c0 test %eax,%eax
801051d9: 74 15 je 801051f0 <sys_mkdir+0x50>
end_op();
return -1;
}
iunlockput(ip);
801051db: 83 ec 0c sub $0xc,%esp
801051de: 50 push %eax
801051df: e8 7c c7 ff ff call 80101960 <iunlockput>
end_op();
801051e4: e8 57 da ff ff call 80102c40 <end_op>
return 0;
801051e9: 83 c4 10 add $0x10,%esp
801051ec: 31 c0 xor %eax,%eax
}
801051ee: c9 leave
801051ef: c3 ret
char *path;
struct inode *ip;
begin_op();
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
end_op();
801051f0: e8 4b da ff ff call 80102c40 <end_op>
return -1;
801051f5: b8 ff ff ff ff mov $0xffffffff,%eax
}
iunlockput(ip);
end_op();
return 0;
}
801051fa: c9 leave
801051fb: c3 ret
801051fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105200 <sys_mknod>:
int
sys_mknod(void)
{
80105200: 55 push %ebp
80105201: 89 e5 mov %esp,%ebp
80105203: 83 ec 18 sub $0x18,%esp
struct inode *ip;
char *path;
int major, minor;
begin_op();
80105206: e8 c5 d9 ff ff call 80102bd0 <begin_op>
if((argstr(0, &path)) < 0 ||
8010520b: 8d 45 ec lea -0x14(%ebp),%eax
8010520e: 83 ec 08 sub $0x8,%esp
80105211: 50 push %eax
80105212: 6a 00 push $0x0
80105214: e8 47 f6 ff ff call 80104860 <argstr>
80105219: 83 c4 10 add $0x10,%esp
8010521c: 85 c0 test %eax,%eax
8010521e: 78 60 js 80105280 <sys_mknod+0x80>
argint(1, &major) < 0 ||
80105220: 8d 45 f0 lea -0x10(%ebp),%eax
80105223: 83 ec 08 sub $0x8,%esp
80105226: 50 push %eax
80105227: 6a 01 push $0x1
80105229: e8 82 f5 ff ff call 801047b0 <argint>
struct inode *ip;
char *path;
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
8010522e: 83 c4 10 add $0x10,%esp
80105231: 85 c0 test %eax,%eax
80105233: 78 4b js 80105280 <sys_mknod+0x80>
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105235: 8d 45 f4 lea -0xc(%ebp),%eax
80105238: 83 ec 08 sub $0x8,%esp
8010523b: 50 push %eax
8010523c: 6a 02 push $0x2
8010523e: e8 6d f5 ff ff call 801047b0 <argint>
char *path;
int major, minor;
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
80105243: 83 c4 10 add $0x10,%esp
80105246: 85 c0 test %eax,%eax
80105248: 78 36 js 80105280 <sys_mknod+0x80>
argint(2, &minor) < 0 ||
8010524a: 0f bf 45 f4 movswl -0xc(%ebp),%eax
8010524e: 83 ec 0c sub $0xc,%esp
80105251: 0f bf 4d f0 movswl -0x10(%ebp),%ecx
80105255: ba 03 00 00 00 mov $0x3,%edx
8010525a: 50 push %eax
8010525b: 8b 45 ec mov -0x14(%ebp),%eax
8010525e: e8 9d f6 ff ff call 80104900 <create>
80105263: 83 c4 10 add $0x10,%esp
80105266: 85 c0 test %eax,%eax
80105268: 74 16 je 80105280 <sys_mknod+0x80>
(ip = create(path, T_DEV, major, minor)) == 0){
end_op();
return -1;
}
iunlockput(ip);
8010526a: 83 ec 0c sub $0xc,%esp
8010526d: 50 push %eax
8010526e: e8 ed c6 ff ff call 80101960 <iunlockput>
end_op();
80105273: e8 c8 d9 ff ff call 80102c40 <end_op>
return 0;
80105278: 83 c4 10 add $0x10,%esp
8010527b: 31 c0 xor %eax,%eax
}
8010527d: c9 leave
8010527e: c3 ret
8010527f: 90 nop
begin_op();
if((argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
(ip = create(path, T_DEV, major, minor)) == 0){
end_op();
80105280: e8 bb d9 ff ff call 80102c40 <end_op>
return -1;
80105285: b8 ff ff ff ff mov $0xffffffff,%eax
}
iunlockput(ip);
end_op();
return 0;
}
8010528a: c9 leave
8010528b: c3 ret
8010528c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105290 <sys_chdir>:
int
sys_chdir(void)
{
80105290: 55 push %ebp
80105291: 89 e5 mov %esp,%ebp
80105293: 56 push %esi
80105294: 53 push %ebx
80105295: 83 ec 10 sub $0x10,%esp
char *path;
struct inode *ip;
struct proc *curproc = myproc();
80105298: e8 63 e5 ff ff call 80103800 <myproc>
8010529d: 89 c6 mov %eax,%esi
begin_op();
8010529f: e8 2c d9 ff ff call 80102bd0 <begin_op>
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
801052a4: 8d 45 f4 lea -0xc(%ebp),%eax
801052a7: 83 ec 08 sub $0x8,%esp
801052aa: 50 push %eax
801052ab: 6a 00 push $0x0
801052ad: e8 ae f5 ff ff call 80104860 <argstr>
801052b2: 83 c4 10 add $0x10,%esp
801052b5: 85 c0 test %eax,%eax
801052b7: 78 77 js 80105330 <sys_chdir+0xa0>
801052b9: 83 ec 0c sub $0xc,%esp
801052bc: ff 75 f4 pushl -0xc(%ebp)
801052bf: e8 7c cc ff ff call 80101f40 <namei>
801052c4: 83 c4 10 add $0x10,%esp
801052c7: 85 c0 test %eax,%eax
801052c9: 89 c3 mov %eax,%ebx
801052cb: 74 63 je 80105330 <sys_chdir+0xa0>
end_op();
return -1;
}
ilock(ip);
801052cd: 83 ec 0c sub $0xc,%esp
801052d0: 50 push %eax
801052d1: e8 da c3 ff ff call 801016b0 <ilock>
if(ip->type != T_DIR){
801052d6: 83 c4 10 add $0x10,%esp
801052d9: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx)
801052de: 75 30 jne 80105310 <sys_chdir+0x80>
iunlockput(ip);
end_op();
return -1;
}
iunlock(ip);
801052e0: 83 ec 0c sub $0xc,%esp
801052e3: 53 push %ebx
801052e4: e8 c7 c4 ff ff call 801017b0 <iunlock>
iput(curproc->cwd);
801052e9: 58 pop %eax
801052ea: ff 76 68 pushl 0x68(%esi)
801052ed: e8 0e c5 ff ff call 80101800 <iput>
end_op();
801052f2: e8 49 d9 ff ff call 80102c40 <end_op>
curproc->cwd = ip;
801052f7: 89 5e 68 mov %ebx,0x68(%esi)
return 0;
801052fa: 83 c4 10 add $0x10,%esp
801052fd: 31 c0 xor %eax,%eax
}
801052ff: 8d 65 f8 lea -0x8(%ebp),%esp
80105302: 5b pop %ebx
80105303: 5e pop %esi
80105304: 5d pop %ebp
80105305: c3 ret
80105306: 8d 76 00 lea 0x0(%esi),%esi
80105309: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
end_op();
return -1;
}
ilock(ip);
if(ip->type != T_DIR){
iunlockput(ip);
80105310: 83 ec 0c sub $0xc,%esp
80105313: 53 push %ebx
80105314: e8 47 c6 ff ff call 80101960 <iunlockput>
end_op();
80105319: e8 22 d9 ff ff call 80102c40 <end_op>
return -1;
8010531e: 83 c4 10 add $0x10,%esp
80105321: b8 ff ff ff ff mov $0xffffffff,%eax
80105326: eb d7 jmp 801052ff <sys_chdir+0x6f>
80105328: 90 nop
80105329: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
struct inode *ip;
struct proc *curproc = myproc();
begin_op();
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
end_op();
80105330: e8 0b d9 ff ff call 80102c40 <end_op>
return -1;
80105335: b8 ff ff ff ff mov $0xffffffff,%eax
8010533a: eb c3 jmp 801052ff <sys_chdir+0x6f>
8010533c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105340 <sys_exec>:
return 0;
}
int
sys_exec(void)
{
80105340: 55 push %ebp
80105341: 89 e5 mov %esp,%ebp
80105343: 57 push %edi
80105344: 56 push %esi
80105345: 53 push %ebx
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
80105346: 8d 85 5c ff ff ff lea -0xa4(%ebp),%eax
return 0;
}
int
sys_exec(void)
{
8010534c: 81 ec a4 00 00 00 sub $0xa4,%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
80105352: 50 push %eax
80105353: 6a 00 push $0x0
80105355: e8 06 f5 ff ff call 80104860 <argstr>
8010535a: 83 c4 10 add $0x10,%esp
8010535d: 85 c0 test %eax,%eax
8010535f: 78 7f js 801053e0 <sys_exec+0xa0>
80105361: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax
80105367: 83 ec 08 sub $0x8,%esp
8010536a: 50 push %eax
8010536b: 6a 01 push $0x1
8010536d: e8 3e f4 ff ff call 801047b0 <argint>
80105372: 83 c4 10 add $0x10,%esp
80105375: 85 c0 test %eax,%eax
80105377: 78 67 js 801053e0 <sys_exec+0xa0>
return -1;
}
memset(argv, 0, sizeof(argv));
80105379: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
8010537f: 83 ec 04 sub $0x4,%esp
80105382: 8d b5 68 ff ff ff lea -0x98(%ebp),%esi
80105388: 68 80 00 00 00 push $0x80
8010538d: 6a 00 push $0x0
8010538f: 8d bd 64 ff ff ff lea -0x9c(%ebp),%edi
80105395: 50 push %eax
80105396: 31 db xor %ebx,%ebx
80105398: e8 03 f1 ff ff call 801044a0 <memset>
8010539d: 83 c4 10 add $0x10,%esp
for(i=0;; i++){
if(i >= NELEM(argv))
return -1;
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
801053a0: 8b 85 60 ff ff ff mov -0xa0(%ebp),%eax
801053a6: 83 ec 08 sub $0x8,%esp
801053a9: 57 push %edi
801053aa: 8d 04 98 lea (%eax,%ebx,4),%eax
801053ad: 50 push %eax
801053ae: e8 5d f3 ff ff call 80104710 <fetchint>
801053b3: 83 c4 10 add $0x10,%esp
801053b6: 85 c0 test %eax,%eax
801053b8: 78 26 js 801053e0 <sys_exec+0xa0>
return -1;
if(uarg == 0){
801053ba: 8b 85 64 ff ff ff mov -0x9c(%ebp),%eax
801053c0: 85 c0 test %eax,%eax
801053c2: 74 2c je 801053f0 <sys_exec+0xb0>
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
801053c4: 83 ec 08 sub $0x8,%esp
801053c7: 56 push %esi
801053c8: 50 push %eax
801053c9: e8 82 f3 ff ff call 80104750 <fetchstr>
801053ce: 83 c4 10 add $0x10,%esp
801053d1: 85 c0 test %eax,%eax
801053d3: 78 0b js 801053e0 <sys_exec+0xa0>
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
}
memset(argv, 0, sizeof(argv));
for(i=0;; i++){
801053d5: 83 c3 01 add $0x1,%ebx
801053d8: 83 c6 04 add $0x4,%esi
if(i >= NELEM(argv))
801053db: 83 fb 20 cmp $0x20,%ebx
801053de: 75 c0 jne 801053a0 <sys_exec+0x60>
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
}
801053e0: 8d 65 f4 lea -0xc(%ebp),%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
801053e3: b8 ff ff ff ff mov $0xffffffff,%eax
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
}
801053e8: 5b pop %ebx
801053e9: 5e pop %esi
801053ea: 5f pop %edi
801053eb: 5d pop %ebp
801053ec: c3 ret
801053ed: 8d 76 00 lea 0x0(%esi),%esi
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
801053f0: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
801053f6: 83 ec 08 sub $0x8,%esp
if(i >= NELEM(argv))
return -1;
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
return -1;
if(uarg == 0){
argv[i] = 0;
801053f9: c7 84 9d 68 ff ff ff movl $0x0,-0x98(%ebp,%ebx,4)
80105400: 00 00 00 00
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
80105404: 50 push %eax
80105405: ff b5 5c ff ff ff pushl -0xa4(%ebp)
8010540b: e8 e0 b5 ff ff call 801009f0 <exec>
80105410: 83 c4 10 add $0x10,%esp
}
80105413: 8d 65 f4 lea -0xc(%ebp),%esp
80105416: 5b pop %ebx
80105417: 5e pop %esi
80105418: 5f pop %edi
80105419: 5d pop %ebp
8010541a: c3 ret
8010541b: 90 nop
8010541c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105420 <sys_pipe>:
int
sys_pipe(void)
{
80105420: 55 push %ebp
80105421: 89 e5 mov %esp,%ebp
80105423: 57 push %edi
80105424: 56 push %esi
80105425: 53 push %ebx
int *fd;
struct file *rf, *wf;
int fd0, fd1;
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
80105426: 8d 45 dc lea -0x24(%ebp),%eax
return exec(path, argv);
}
int
sys_pipe(void)
{
80105429: 83 ec 20 sub $0x20,%esp
int *fd;
struct file *rf, *wf;
int fd0, fd1;
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
8010542c: 6a 08 push $0x8
8010542e: 50 push %eax
8010542f: 6a 00 push $0x0
80105431: e8 ca f3 ff ff call 80104800 <argptr>
80105436: 83 c4 10 add $0x10,%esp
80105439: 85 c0 test %eax,%eax
8010543b: 78 4a js 80105487 <sys_pipe+0x67>
return -1;
if(pipealloc(&rf, &wf) < 0)
8010543d: 8d 45 e4 lea -0x1c(%ebp),%eax
80105440: 83 ec 08 sub $0x8,%esp
80105443: 50 push %eax
80105444: 8d 45 e0 lea -0x20(%ebp),%eax
80105447: 50 push %eax
80105448: e8 23 de ff ff call 80103270 <pipealloc>
8010544d: 83 c4 10 add $0x10,%esp
80105450: 85 c0 test %eax,%eax
80105452: 78 33 js 80105487 <sys_pipe+0x67>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
80105454: 31 db xor %ebx,%ebx
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
return -1;
if(pipealloc(&rf, &wf) < 0)
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
80105456: 8b 7d e0 mov -0x20(%ebp),%edi
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
80105459: e8 a2 e3 ff ff call 80103800 <myproc>
8010545e: 66 90 xchg %ax,%ax
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
80105460: 8b 74 98 28 mov 0x28(%eax,%ebx,4),%esi
80105464: 85 f6 test %esi,%esi
80105466: 74 30 je 80105498 <sys_pipe+0x78>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
80105468: 83 c3 01 add $0x1,%ebx
8010546b: 83 fb 10 cmp $0x10,%ebx
8010546e: 75 f0 jne 80105460 <sys_pipe+0x40>
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
myproc()->ofile[fd0] = 0;
fileclose(rf);
80105470: 83 ec 0c sub $0xc,%esp
80105473: ff 75 e0 pushl -0x20(%ebp)
80105476: e8 b5 b9 ff ff call 80100e30 <fileclose>
fileclose(wf);
8010547b: 58 pop %eax
8010547c: ff 75 e4 pushl -0x1c(%ebp)
8010547f: e8 ac b9 ff ff call 80100e30 <fileclose>
return -1;
80105484: 83 c4 10 add $0x10,%esp
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
}
80105487: 8d 65 f4 lea -0xc(%ebp),%esp
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
myproc()->ofile[fd0] = 0;
fileclose(rf);
fileclose(wf);
return -1;
8010548a: b8 ff ff ff ff mov $0xffffffff,%eax
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
}
8010548f: 5b pop %ebx
80105490: 5e pop %esi
80105491: 5f pop %edi
80105492: 5d pop %ebp
80105493: c3 ret
80105494: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
curproc->ofile[fd] = f;
80105498: 8d 73 08 lea 0x8(%ebx),%esi
8010549b: 89 7c b0 08 mov %edi,0x8(%eax,%esi,4)
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
return -1;
if(pipealloc(&rf, &wf) < 0)
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
8010549f: 8b 7d e4 mov -0x1c(%ebp),%edi
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
801054a2: e8 59 e3 ff ff call 80103800 <myproc>
for(fd = 0; fd < NOFILE; fd++){
801054a7: 31 d2 xor %edx,%edx
801054a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(curproc->ofile[fd] == 0){
801054b0: 8b 4c 90 28 mov 0x28(%eax,%edx,4),%ecx
801054b4: 85 c9 test %ecx,%ecx
801054b6: 74 18 je 801054d0 <sys_pipe+0xb0>
fdalloc(struct file *f)
{
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
801054b8: 83 c2 01 add $0x1,%edx
801054bb: 83 fa 10 cmp $0x10,%edx
801054be: 75 f0 jne 801054b0 <sys_pipe+0x90>
if(pipealloc(&rf, &wf) < 0)
return -1;
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
myproc()->ofile[fd0] = 0;
801054c0: e8 3b e3 ff ff call 80103800 <myproc>
801054c5: c7 44 b0 08 00 00 00 movl $0x0,0x8(%eax,%esi,4)
801054cc: 00
801054cd: eb a1 jmp 80105470 <sys_pipe+0x50>
801054cf: 90 nop
int fd;
struct proc *curproc = myproc();
for(fd = 0; fd < NOFILE; fd++){
if(curproc->ofile[fd] == 0){
curproc->ofile[fd] = f;
801054d0: 89 7c 90 28 mov %edi,0x28(%eax,%edx,4)
myproc()->ofile[fd0] = 0;
fileclose(rf);
fileclose(wf);
return -1;
}
fd[0] = fd0;
801054d4: 8b 45 dc mov -0x24(%ebp),%eax
801054d7: 89 18 mov %ebx,(%eax)
fd[1] = fd1;
801054d9: 8b 45 dc mov -0x24(%ebp),%eax
801054dc: 89 50 04 mov %edx,0x4(%eax)
return 0;
}
801054df: 8d 65 f4 lea -0xc(%ebp),%esp
fileclose(wf);
return -1;
}
fd[0] = fd0;
fd[1] = fd1;
return 0;
801054e2: 31 c0 xor %eax,%eax
}
801054e4: 5b pop %ebx
801054e5: 5e pop %esi
801054e6: 5f pop %edi
801054e7: 5d pop %ebp
801054e8: c3 ret
801054e9: 66 90 xchg %ax,%ax
801054eb: 66 90 xchg %ax,%ax
801054ed: 66 90 xchg %ax,%ax
801054ef: 90 nop
801054f0 <sys_fork>:
#include "mmu.h"
#include "proc.h"
int
sys_fork(void)
{
801054f0: 55 push %ebp
801054f1: 89 e5 mov %esp,%ebp
return fork();
}
801054f3: 5d pop %ebp
#include "proc.h"
int
sys_fork(void)
{
return fork();
801054f4: e9 a7 e4 ff ff jmp 801039a0 <fork>
801054f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80105500 <sys_exit>:
}
int
sys_exit(void)
{
80105500: 55 push %ebp
80105501: 89 e5 mov %esp,%ebp
80105503: 83 ec 08 sub $0x8,%esp
exit();
80105506: e8 25 e7 ff ff call 80103c30 <exit>
return 0; // not reached
}
8010550b: 31 c0 xor %eax,%eax
8010550d: c9 leave
8010550e: c3 ret
8010550f: 90 nop
80105510 <sys_wait>:
int
sys_wait(void)
{
80105510: 55 push %ebp
80105511: 89 e5 mov %esp,%ebp
return wait();
}
80105513: 5d pop %ebp
}
int
sys_wait(void)
{
return wait();
80105514: e9 57 e9 ff ff jmp 80103e70 <wait>
80105519: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80105520 <sys_kill>:
}
int
sys_kill(void)
{
80105520: 55 push %ebp
80105521: 89 e5 mov %esp,%ebp
80105523: 83 ec 20 sub $0x20,%esp
int pid;
if(argint(0, &pid) < 0)
80105526: 8d 45 f4 lea -0xc(%ebp),%eax
80105529: 50 push %eax
8010552a: 6a 00 push $0x0
8010552c: e8 7f f2 ff ff call 801047b0 <argint>
80105531: 83 c4 10 add $0x10,%esp
80105534: 85 c0 test %eax,%eax
80105536: 78 18 js 80105550 <sys_kill+0x30>
return -1;
return kill(pid);
80105538: 83 ec 0c sub $0xc,%esp
8010553b: ff 75 f4 pushl -0xc(%ebp)
8010553e: e8 7d ea ff ff call 80103fc0 <kill>
80105543: 83 c4 10 add $0x10,%esp
}
80105546: c9 leave
80105547: c3 ret
80105548: 90 nop
80105549: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
sys_kill(void)
{
int pid;
if(argint(0, &pid) < 0)
return -1;
80105550: b8 ff ff ff ff mov $0xffffffff,%eax
return kill(pid);
}
80105555: c9 leave
80105556: c3 ret
80105557: 89 f6 mov %esi,%esi
80105559: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105560 <sys_getpid>:
int
sys_getpid(void)
{
80105560: 55 push %ebp
80105561: 89 e5 mov %esp,%ebp
80105563: 83 ec 08 sub $0x8,%esp
return myproc()->pid;
80105566: e8 95 e2 ff ff call 80103800 <myproc>
8010556b: 8b 40 10 mov 0x10(%eax),%eax
}
8010556e: c9 leave
8010556f: c3 ret
80105570 <sys_sbrk>:
int
sys_sbrk(void)
{
80105570: 55 push %ebp
80105571: 89 e5 mov %esp,%ebp
80105573: 53 push %ebx
int addr;
int n;
if(argint(0, &n) < 0)
80105574: 8d 45 f4 lea -0xc(%ebp),%eax
return myproc()->pid;
}
int
sys_sbrk(void)
{
80105577: 83 ec 1c sub $0x1c,%esp
int addr;
int n;
if(argint(0, &n) < 0)
8010557a: 50 push %eax
8010557b: 6a 00 push $0x0
8010557d: e8 2e f2 ff ff call 801047b0 <argint>
80105582: 83 c4 10 add $0x10,%esp
80105585: 85 c0 test %eax,%eax
80105587: 78 27 js 801055b0 <sys_sbrk+0x40>
return -1;
addr = myproc()->sz;
80105589: e8 72 e2 ff ff call 80103800 <myproc>
if(growproc(n) < 0)
8010558e: 83 ec 0c sub $0xc,%esp
int addr;
int n;
if(argint(0, &n) < 0)
return -1;
addr = myproc()->sz;
80105591: 8b 18 mov (%eax),%ebx
if(growproc(n) < 0)
80105593: ff 75 f4 pushl -0xc(%ebp)
80105596: e8 85 e3 ff ff call 80103920 <growproc>
8010559b: 83 c4 10 add $0x10,%esp
8010559e: 85 c0 test %eax,%eax
801055a0: 78 0e js 801055b0 <sys_sbrk+0x40>
return -1;
return addr;
801055a2: 89 d8 mov %ebx,%eax
}
801055a4: 8b 5d fc mov -0x4(%ebp),%ebx
801055a7: c9 leave
801055a8: c3 ret
801055a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
{
int addr;
int n;
if(argint(0, &n) < 0)
return -1;
801055b0: b8 ff ff ff ff mov $0xffffffff,%eax
801055b5: eb ed jmp 801055a4 <sys_sbrk+0x34>
801055b7: 89 f6 mov %esi,%esi
801055b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801055c0 <sys_sleep>:
return addr;
}
int
sys_sleep(void)
{
801055c0: 55 push %ebp
801055c1: 89 e5 mov %esp,%ebp
801055c3: 53 push %ebx
int n;
uint ticks0;
if(argint(0, &n) < 0)
801055c4: 8d 45 f4 lea -0xc(%ebp),%eax
return addr;
}
int
sys_sleep(void)
{
801055c7: 83 ec 1c sub $0x1c,%esp
int n;
uint ticks0;
if(argint(0, &n) < 0)
801055ca: 50 push %eax
801055cb: 6a 00 push $0x0
801055cd: e8 de f1 ff ff call 801047b0 <argint>
801055d2: 83 c4 10 add $0x10,%esp
801055d5: 85 c0 test %eax,%eax
801055d7: 0f 88 8a 00 00 00 js 80105667 <sys_sleep+0xa7>
return -1;
acquire(&tickslock);
801055dd: 83 ec 0c sub $0xc,%esp
801055e0: 68 60 4c 11 80 push $0x80114c60
801055e5: e8 b6 ed ff ff call 801043a0 <acquire>
ticks0 = ticks;
while(ticks - ticks0 < n){
801055ea: 8b 55 f4 mov -0xc(%ebp),%edx
801055ed: 83 c4 10 add $0x10,%esp
uint ticks0;
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
801055f0: 8b 1d a0 54 11 80 mov 0x801154a0,%ebx
while(ticks - ticks0 < n){
801055f6: 85 d2 test %edx,%edx
801055f8: 75 27 jne 80105621 <sys_sleep+0x61>
801055fa: eb 54 jmp 80105650 <sys_sleep+0x90>
801055fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(myproc()->killed){
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
80105600: 83 ec 08 sub $0x8,%esp
80105603: 68 60 4c 11 80 push $0x80114c60
80105608: 68 a0 54 11 80 push $0x801154a0
8010560d: e8 9e e7 ff ff call 80103db0 <sleep>
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
while(ticks - ticks0 < n){
80105612: a1 a0 54 11 80 mov 0x801154a0,%eax
80105617: 83 c4 10 add $0x10,%esp
8010561a: 29 d8 sub %ebx,%eax
8010561c: 3b 45 f4 cmp -0xc(%ebp),%eax
8010561f: 73 2f jae 80105650 <sys_sleep+0x90>
if(myproc()->killed){
80105621: e8 da e1 ff ff call 80103800 <myproc>
80105626: 8b 40 24 mov 0x24(%eax),%eax
80105629: 85 c0 test %eax,%eax
8010562b: 74 d3 je 80105600 <sys_sleep+0x40>
release(&tickslock);
8010562d: 83 ec 0c sub $0xc,%esp
80105630: 68 60 4c 11 80 push $0x80114c60
80105635: e8 16 ee ff ff call 80104450 <release>
return -1;
8010563a: 83 c4 10 add $0x10,%esp
8010563d: b8 ff ff ff ff mov $0xffffffff,%eax
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
return 0;
}
80105642: 8b 5d fc mov -0x4(%ebp),%ebx
80105645: c9 leave
80105646: c3 ret
80105647: 89 f6 mov %esi,%esi
80105649: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
80105650: 83 ec 0c sub $0xc,%esp
80105653: 68 60 4c 11 80 push $0x80114c60
80105658: e8 f3 ed ff ff call 80104450 <release>
return 0;
8010565d: 83 c4 10 add $0x10,%esp
80105660: 31 c0 xor %eax,%eax
}
80105662: 8b 5d fc mov -0x4(%ebp),%ebx
80105665: c9 leave
80105666: c3 ret
{
int n;
uint ticks0;
if(argint(0, &n) < 0)
return -1;
80105667: b8 ff ff ff ff mov $0xffffffff,%eax
8010566c: eb d4 jmp 80105642 <sys_sleep+0x82>
8010566e: 66 90 xchg %ax,%ax
80105670 <sys_uptime>:
// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
80105670: 55 push %ebp
80105671: 89 e5 mov %esp,%ebp
80105673: 53 push %ebx
80105674: 83 ec 10 sub $0x10,%esp
uint xticks;
acquire(&tickslock);
80105677: 68 60 4c 11 80 push $0x80114c60
8010567c: e8 1f ed ff ff call 801043a0 <acquire>
xticks = ticks;
80105681: 8b 1d a0 54 11 80 mov 0x801154a0,%ebx
release(&tickslock);
80105687: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp)
8010568e: e8 bd ed ff ff call 80104450 <release>
return xticks;
}
80105693: 89 d8 mov %ebx,%eax
80105695: 8b 5d fc mov -0x4(%ebp),%ebx
80105698: c9 leave
80105699: c3 ret
8010569a <alltraps>:
# vectors.S sends all traps here.
.globl alltraps
alltraps:
# Build trap frame.
pushl %ds
8010569a: 1e push %ds
pushl %es
8010569b: 06 push %es
pushl %fs
8010569c: 0f a0 push %fs
pushl %gs
8010569e: 0f a8 push %gs
pushal
801056a0: 60 pusha
# Set up data segments.
movw $(SEG_KDATA<<3), %ax
801056a1: 66 b8 10 00 mov $0x10,%ax
movw %ax, %ds
801056a5: 8e d8 mov %eax,%ds
movw %ax, %es
801056a7: 8e c0 mov %eax,%es
# Call trap(tf), where tf=%esp
pushl %esp
801056a9: 54 push %esp
call trap
801056aa: e8 e1 00 00 00 call 80105790 <trap>
addl $4, %esp
801056af: 83 c4 04 add $0x4,%esp
801056b2 <trapret>:
# Return falls through to trapret...
.globl trapret
trapret:
popal
801056b2: 61 popa
popl %gs
801056b3: 0f a9 pop %gs
popl %fs
801056b5: 0f a1 pop %fs
popl %es
801056b7: 07 pop %es
popl %ds
801056b8: 1f pop %ds
addl $0x8, %esp # trapno and errcode
801056b9: 83 c4 08 add $0x8,%esp
iret
801056bc: cf iret
801056bd: 66 90 xchg %ax,%ax
801056bf: 90 nop
801056c0 <tvinit>:
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
801056c0: 31 c0 xor %eax,%eax
801056c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
801056c8: 8b 14 85 08 a0 10 80 mov -0x7fef5ff8(,%eax,4),%edx
801056cf: b9 08 00 00 00 mov $0x8,%ecx
801056d4: c6 04 c5 a4 4c 11 80 movb $0x0,-0x7feeb35c(,%eax,8)
801056db: 00
801056dc: 66 89 0c c5 a2 4c 11 mov %cx,-0x7feeb35e(,%eax,8)
801056e3: 80
801056e4: c6 04 c5 a5 4c 11 80 movb $0x8e,-0x7feeb35b(,%eax,8)
801056eb: 8e
801056ec: 66 89 14 c5 a0 4c 11 mov %dx,-0x7feeb360(,%eax,8)
801056f3: 80
801056f4: c1 ea 10 shr $0x10,%edx
801056f7: 66 89 14 c5 a6 4c 11 mov %dx,-0x7feeb35a(,%eax,8)
801056fe: 80
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
801056ff: 83 c0 01 add $0x1,%eax
80105702: 3d 00 01 00 00 cmp $0x100,%eax
80105707: 75 bf jne 801056c8 <tvinit+0x8>
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
80105709: 55 push %ebp
int i;
for(i = 0; i < 256; i++)
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
8010570a: ba 08 00 00 00 mov $0x8,%edx
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
8010570f: 89 e5 mov %esp,%ebp
80105711: 83 ec 10 sub $0x10,%esp
int i;
for(i = 0; i < 256; i++)
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
80105714: a1 08 a1 10 80 mov 0x8010a108,%eax
initlock(&tickslock, "time");
80105719: 68 f9 76 10 80 push $0x801076f9
8010571e: 68 60 4c 11 80 push $0x80114c60
{
int i;
for(i = 0; i < 256; i++)
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
80105723: 66 89 15 a2 4e 11 80 mov %dx,0x80114ea2
8010572a: c6 05 a4 4e 11 80 00 movb $0x0,0x80114ea4
80105731: 66 a3 a0 4e 11 80 mov %ax,0x80114ea0
80105737: c1 e8 10 shr $0x10,%eax
8010573a: c6 05 a5 4e 11 80 ef movb $0xef,0x80114ea5
80105741: 66 a3 a6 4e 11 80 mov %ax,0x80114ea6
initlock(&tickslock, "time");
80105747: e8 f4 ea ff ff call 80104240 <initlock>
}
8010574c: 83 c4 10 add $0x10,%esp
8010574f: c9 leave
80105750: c3 ret
80105751: eb 0d jmp 80105760 <idtinit>
80105753: 90 nop
80105754: 90 nop
80105755: 90 nop
80105756: 90 nop
80105757: 90 nop
80105758: 90 nop
80105759: 90 nop
8010575a: 90 nop
8010575b: 90 nop
8010575c: 90 nop
8010575d: 90 nop
8010575e: 90 nop
8010575f: 90 nop
80105760 <idtinit>:
void
idtinit(void)
{
80105760: 55 push %ebp
static inline void
lidt(struct gatedesc *p, int size)
{
volatile ushort pd[3];
pd[0] = size-1;
80105761: b8 ff 07 00 00 mov $0x7ff,%eax
80105766: 89 e5 mov %esp,%ebp
80105768: 83 ec 10 sub $0x10,%esp
8010576b: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
8010576f: b8 a0 4c 11 80 mov $0x80114ca0,%eax
80105774: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
80105778: c1 e8 10 shr $0x10,%eax
8010577b: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lidt (%0)" : : "r" (pd));
8010577f: 8d 45 fa lea -0x6(%ebp),%eax
80105782: 0f 01 18 lidtl (%eax)
lidt(idt, sizeof(idt));
}
80105785: c9 leave
80105786: c3 ret
80105787: 89 f6 mov %esi,%esi
80105789: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105790 <trap>:
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
80105790: 55 push %ebp
80105791: 89 e5 mov %esp,%ebp
80105793: 57 push %edi
80105794: 56 push %esi
80105795: 53 push %ebx
80105796: 83 ec 1c sub $0x1c,%esp
80105799: 8b 7d 08 mov 0x8(%ebp),%edi
if(tf->trapno == T_SYSCALL){
8010579c: 8b 47 30 mov 0x30(%edi),%eax
8010579f: 83 f8 40 cmp $0x40,%eax
801057a2: 0f 84 88 01 00 00 je 80105930 <trap+0x1a0>
if(myproc()->killed)
exit();
return;
}
switch(tf->trapno){
801057a8: 83 e8 20 sub $0x20,%eax
801057ab: 83 f8 1f cmp $0x1f,%eax
801057ae: 77 10 ja 801057c0 <trap+0x30>
801057b0: ff 24 85 a0 77 10 80 jmp *-0x7fef8860(,%eax,4)
801057b7: 89 f6 mov %esi,%esi
801057b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
lapiceoi();
break;
//PAGEBREAK: 13
default:
if(myproc() == 0 || (tf->cs&3) == 0){
801057c0: e8 3b e0 ff ff call 80103800 <myproc>
801057c5: 85 c0 test %eax,%eax
801057c7: 0f 84 d7 01 00 00 je 801059a4 <trap+0x214>
801057cd: f6 47 3c 03 testb $0x3,0x3c(%edi)
801057d1: 0f 84 cd 01 00 00 je 801059a4 <trap+0x214>
static inline uint
rcr2(void)
{
uint val;
asm volatile("movl %%cr2,%0" : "=r" (val));
801057d7: 0f 20 d1 mov %cr2,%ecx
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpuid(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801057da: 8b 57 38 mov 0x38(%edi),%edx
801057dd: 89 4d d8 mov %ecx,-0x28(%ebp)
801057e0: 89 55 dc mov %edx,-0x24(%ebp)
801057e3: e8 f8 df ff ff call 801037e0 <cpuid>
801057e8: 8b 77 34 mov 0x34(%edi),%esi
801057eb: 8b 5f 30 mov 0x30(%edi),%ebx
801057ee: 89 45 e4 mov %eax,-0x1c(%ebp)
"eip 0x%x addr 0x%x--kill proc\n",
myproc()->pid, myproc()->name, tf->trapno,
801057f1: e8 0a e0 ff ff call 80103800 <myproc>
801057f6: 89 45 e0 mov %eax,-0x20(%ebp)
801057f9: e8 02 e0 ff ff call 80103800 <myproc>
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpuid(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
801057fe: 8b 4d d8 mov -0x28(%ebp),%ecx
80105801: 8b 55 dc mov -0x24(%ebp),%edx
80105804: 51 push %ecx
80105805: 52 push %edx
"eip 0x%x addr 0x%x--kill proc\n",
myproc()->pid, myproc()->name, tf->trapno,
80105806: 8b 55 e0 mov -0x20(%ebp),%edx
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpuid(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
80105809: ff 75 e4 pushl -0x1c(%ebp)
8010580c: 56 push %esi
8010580d: 53 push %ebx
"eip 0x%x addr 0x%x--kill proc\n",
myproc()->pid, myproc()->name, tf->trapno,
8010580e: 83 c2 6c add $0x6c,%edx
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpuid(), tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
80105811: 52 push %edx
80105812: ff 70 10 pushl 0x10(%eax)
80105815: 68 5c 77 10 80 push $0x8010775c
8010581a: e8 41 ae ff ff call 80100660 <cprintf>
"eip 0x%x addr 0x%x--kill proc\n",
myproc()->pid, myproc()->name, tf->trapno,
tf->err, cpuid(), tf->eip, rcr2());
myproc()->killed = 1;
8010581f: 83 c4 20 add $0x20,%esp
80105822: e8 d9 df ff ff call 80103800 <myproc>
80105827: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
8010582e: 66 90 xchg %ax,%ax
}
// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
// until it gets to the regular system call return.)
if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER)
80105830: e8 cb df ff ff call 80103800 <myproc>
80105835: 85 c0 test %eax,%eax
80105837: 74 0c je 80105845 <trap+0xb5>
80105839: e8 c2 df ff ff call 80103800 <myproc>
8010583e: 8b 50 24 mov 0x24(%eax),%edx
80105841: 85 d2 test %edx,%edx
80105843: 75 4b jne 80105890 <trap+0x100>
exit();
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(myproc() && myproc()->state == RUNNING &&
80105845: e8 b6 df ff ff call 80103800 <myproc>
8010584a: 85 c0 test %eax,%eax
8010584c: 74 0b je 80105859 <trap+0xc9>
8010584e: e8 ad df ff ff call 80103800 <myproc>
80105853: 83 78 0c 04 cmpl $0x4,0xc(%eax)
80105857: 74 4f je 801058a8 <trap+0x118>
tf->trapno == T_IRQ0+IRQ_TIMER)
yield();
// Check if the process has been killed since we yielded
if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER)
80105859: e8 a2 df ff ff call 80103800 <myproc>
8010585e: 85 c0 test %eax,%eax
80105860: 74 1d je 8010587f <trap+0xef>
80105862: e8 99 df ff ff call 80103800 <myproc>
80105867: 8b 40 24 mov 0x24(%eax),%eax
8010586a: 85 c0 test %eax,%eax
8010586c: 74 11 je 8010587f <trap+0xef>
8010586e: 0f b7 47 3c movzwl 0x3c(%edi),%eax
80105872: 83 e0 03 and $0x3,%eax
80105875: 66 83 f8 03 cmp $0x3,%ax
80105879: 0f 84 da 00 00 00 je 80105959 <trap+0x1c9>
exit();
}
8010587f: 8d 65 f4 lea -0xc(%ebp),%esp
80105882: 5b pop %ebx
80105883: 5e pop %esi
80105884: 5f pop %edi
80105885: 5d pop %ebp
80105886: c3 ret
80105887: 89 f6 mov %esi,%esi
80105889: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
}
// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
// until it gets to the regular system call return.)
if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER)
80105890: 0f b7 47 3c movzwl 0x3c(%edi),%eax
80105894: 83 e0 03 and $0x3,%eax
80105897: 66 83 f8 03 cmp $0x3,%ax
8010589b: 75 a8 jne 80105845 <trap+0xb5>
exit();
8010589d: e8 8e e3 ff ff call 80103c30 <exit>
801058a2: eb a1 jmp 80105845 <trap+0xb5>
801058a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(myproc() && myproc()->state == RUNNING &&
801058a8: 83 7f 30 20 cmpl $0x20,0x30(%edi)
801058ac: 75 ab jne 80105859 <trap+0xc9>
tf->trapno == T_IRQ0+IRQ_TIMER)
yield();
801058ae: e8 ad e4 ff ff call 80103d60 <yield>
801058b3: eb a4 jmp 80105859 <trap+0xc9>
801058b5: 8d 76 00 lea 0x0(%esi),%esi
return;
}
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if(cpuid() == 0){
801058b8: e8 23 df ff ff call 801037e0 <cpuid>
801058bd: 85 c0 test %eax,%eax
801058bf: 0f 84 ab 00 00 00 je 80105970 <trap+0x1e0>
}
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE:
ideintr();
lapiceoi();
801058c5: e8 c6 ce ff ff call 80102790 <lapiceoi>
break;
801058ca: e9 61 ff ff ff jmp 80105830 <trap+0xa0>
801058cf: 90 nop
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
case T_IRQ0 + IRQ_KBD:
kbdintr();
801058d0: e8 7b cd ff ff call 80102650 <kbdintr>
lapiceoi();
801058d5: e8 b6 ce ff ff call 80102790 <lapiceoi>
break;
801058da: e9 51 ff ff ff jmp 80105830 <trap+0xa0>
801058df: 90 nop
case T_IRQ0 + IRQ_COM1:
uartintr();
801058e0: e8 5b 02 00 00 call 80105b40 <uartintr>
lapiceoi();
801058e5: e8 a6 ce ff ff call 80102790 <lapiceoi>
break;
801058ea: e9 41 ff ff ff jmp 80105830 <trap+0xa0>
801058ef: 90 nop
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
801058f0: 0f b7 5f 3c movzwl 0x3c(%edi),%ebx
801058f4: 8b 77 38 mov 0x38(%edi),%esi
801058f7: e8 e4 de ff ff call 801037e0 <cpuid>
801058fc: 56 push %esi
801058fd: 53 push %ebx
801058fe: 50 push %eax
801058ff: 68 04 77 10 80 push $0x80107704
80105904: e8 57 ad ff ff call 80100660 <cprintf>
cpuid(), tf->cs, tf->eip);
lapiceoi();
80105909: e8 82 ce ff ff call 80102790 <lapiceoi>
break;
8010590e: 83 c4 10 add $0x10,%esp
80105911: e9 1a ff ff ff jmp 80105830 <trap+0xa0>
80105916: 8d 76 00 lea 0x0(%esi),%esi
80105919: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
release(&tickslock);
}
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE:
ideintr();
80105920: e8 ab c7 ff ff call 801020d0 <ideintr>
80105925: eb 9e jmp 801058c5 <trap+0x135>
80105927: 89 f6 mov %esi,%esi
80105929: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
if(tf->trapno == T_SYSCALL){
if(myproc()->killed)
80105930: e8 cb de ff ff call 80103800 <myproc>
80105935: 8b 58 24 mov 0x24(%eax),%ebx
80105938: 85 db test %ebx,%ebx
8010593a: 75 2c jne 80105968 <trap+0x1d8>
exit();
myproc()->tf = tf;
8010593c: e8 bf de ff ff call 80103800 <myproc>
80105941: 89 78 18 mov %edi,0x18(%eax)
syscall();
80105944: e8 57 ef ff ff call 801048a0 <syscall>
if(myproc()->killed)
80105949: e8 b2 de ff ff call 80103800 <myproc>
8010594e: 8b 48 24 mov 0x24(%eax),%ecx
80105951: 85 c9 test %ecx,%ecx
80105953: 0f 84 26 ff ff ff je 8010587f <trap+0xef>
yield();
// Check if the process has been killed since we yielded
if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER)
exit();
}
80105959: 8d 65 f4 lea -0xc(%ebp),%esp
8010595c: 5b pop %ebx
8010595d: 5e pop %esi
8010595e: 5f pop %edi
8010595f: 5d pop %ebp
if(myproc()->killed)
exit();
myproc()->tf = tf;
syscall();
if(myproc()->killed)
exit();
80105960: e9 cb e2 ff ff jmp 80103c30 <exit>
80105965: 8d 76 00 lea 0x0(%esi),%esi
void
trap(struct trapframe *tf)
{
if(tf->trapno == T_SYSCALL){
if(myproc()->killed)
exit();
80105968: e8 c3 e2 ff ff call 80103c30 <exit>
8010596d: eb cd jmp 8010593c <trap+0x1ac>
8010596f: 90 nop
}
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if(cpuid() == 0){
acquire(&tickslock);
80105970: 83 ec 0c sub $0xc,%esp
80105973: 68 60 4c 11 80 push $0x80114c60
80105978: e8 23 ea ff ff call 801043a0 <acquire>
ticks++;
wakeup(&ticks);
8010597d: c7 04 24 a0 54 11 80 movl $0x801154a0,(%esp)
switch(tf->trapno){
case T_IRQ0 + IRQ_TIMER:
if(cpuid() == 0){
acquire(&tickslock);
ticks++;
80105984: 83 05 a0 54 11 80 01 addl $0x1,0x801154a0
wakeup(&ticks);
8010598b: e8 d0 e5 ff ff call 80103f60 <wakeup>
release(&tickslock);
80105990: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp)
80105997: e8 b4 ea ff ff call 80104450 <release>
8010599c: 83 c4 10 add $0x10,%esp
8010599f: e9 21 ff ff ff jmp 801058c5 <trap+0x135>
801059a4: 0f 20 d6 mov %cr2,%esi
//PAGEBREAK: 13
default:
if(myproc() == 0 || (tf->cs&3) == 0){
// In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801059a7: 8b 5f 38 mov 0x38(%edi),%ebx
801059aa: e8 31 de ff ff call 801037e0 <cpuid>
801059af: 83 ec 0c sub $0xc,%esp
801059b2: 56 push %esi
801059b3: 53 push %ebx
801059b4: 50 push %eax
801059b5: ff 77 30 pushl 0x30(%edi)
801059b8: 68 28 77 10 80 push $0x80107728
801059bd: e8 9e ac ff ff call 80100660 <cprintf>
tf->trapno, cpuid(), tf->eip, rcr2());
panic("trap");
801059c2: 83 c4 14 add $0x14,%esp
801059c5: 68 fe 76 10 80 push $0x801076fe
801059ca: e8 a1 a9 ff ff call 80100370 <panic>
801059cf: 90 nop
801059d0 <uartgetc>:
}
static int
uartgetc(void)
{
if(!uart)
801059d0: a1 bc a5 10 80 mov 0x8010a5bc,%eax
outb(COM1+0, c);
}
static int
uartgetc(void)
{
801059d5: 55 push %ebp
801059d6: 89 e5 mov %esp,%ebp
if(!uart)
801059d8: 85 c0 test %eax,%eax
801059da: 74 1c je 801059f8 <uartgetc+0x28>
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801059dc: ba fd 03 00 00 mov $0x3fd,%edx
801059e1: ec in (%dx),%al
return -1;
if(!(inb(COM1+5) & 0x01))
801059e2: a8 01 test $0x1,%al
801059e4: 74 12 je 801059f8 <uartgetc+0x28>
801059e6: ba f8 03 00 00 mov $0x3f8,%edx
801059eb: ec in (%dx),%al
return -1;
return inb(COM1+0);
801059ec: 0f b6 c0 movzbl %al,%eax
}
801059ef: 5d pop %ebp
801059f0: c3 ret
801059f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
static int
uartgetc(void)
{
if(!uart)
return -1;
801059f8: b8 ff ff ff ff mov $0xffffffff,%eax
if(!(inb(COM1+5) & 0x01))
return -1;
return inb(COM1+0);
}
801059fd: 5d pop %ebp
801059fe: c3 ret
801059ff: 90 nop
80105a00 <uartputc.part.0>:
for(p="xv6...\n"; *p; p++)
uartputc(*p);
}
void
uartputc(int c)
80105a00: 55 push %ebp
80105a01: 89 e5 mov %esp,%ebp
80105a03: 57 push %edi
80105a04: 56 push %esi
80105a05: 53 push %ebx
80105a06: 89 c7 mov %eax,%edi
80105a08: bb 80 00 00 00 mov $0x80,%ebx
80105a0d: be fd 03 00 00 mov $0x3fd,%esi
80105a12: 83 ec 0c sub $0xc,%esp
80105a15: eb 1b jmp 80105a32 <uartputc.part.0+0x32>
80105a17: 89 f6 mov %esi,%esi
80105a19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
microdelay(10);
80105a20: 83 ec 0c sub $0xc,%esp
80105a23: 6a 0a push $0xa
80105a25: e8 86 cd ff ff call 801027b0 <microdelay>
{
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80105a2a: 83 c4 10 add $0x10,%esp
80105a2d: 83 eb 01 sub $0x1,%ebx
80105a30: 74 07 je 80105a39 <uartputc.part.0+0x39>
80105a32: 89 f2 mov %esi,%edx
80105a34: ec in (%dx),%al
80105a35: a8 20 test $0x20,%al
80105a37: 74 e7 je 80105a20 <uartputc.part.0+0x20>
}
static inline void
outb(ushort port, uchar data)
{
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80105a39: ba f8 03 00 00 mov $0x3f8,%edx
80105a3e: 89 f8 mov %edi,%eax
80105a40: ee out %al,(%dx)
microdelay(10);
outb(COM1+0, c);
}
80105a41: 8d 65 f4 lea -0xc(%ebp),%esp
80105a44: 5b pop %ebx
80105a45: 5e pop %esi
80105a46: 5f pop %edi
80105a47: 5d pop %ebp
80105a48: c3 ret
80105a49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80105a50 <uartinit>:
static int uart; // is there a uart?
void
uartinit(void)
{
80105a50: 55 push %ebp
80105a51: 31 c9 xor %ecx,%ecx
80105a53: 89 c8 mov %ecx,%eax
80105a55: 89 e5 mov %esp,%ebp
80105a57: 57 push %edi
80105a58: 56 push %esi
80105a59: 53 push %ebx
80105a5a: bb fa 03 00 00 mov $0x3fa,%ebx
80105a5f: 89 da mov %ebx,%edx
80105a61: 83 ec 0c sub $0xc,%esp
80105a64: ee out %al,(%dx)
80105a65: bf fb 03 00 00 mov $0x3fb,%edi
80105a6a: b8 80 ff ff ff mov $0xffffff80,%eax
80105a6f: 89 fa mov %edi,%edx
80105a71: ee out %al,(%dx)
80105a72: b8 0c 00 00 00 mov $0xc,%eax
80105a77: ba f8 03 00 00 mov $0x3f8,%edx
80105a7c: ee out %al,(%dx)
80105a7d: be f9 03 00 00 mov $0x3f9,%esi
80105a82: 89 c8 mov %ecx,%eax
80105a84: 89 f2 mov %esi,%edx
80105a86: ee out %al,(%dx)
80105a87: b8 03 00 00 00 mov $0x3,%eax
80105a8c: 89 fa mov %edi,%edx
80105a8e: ee out %al,(%dx)
80105a8f: ba fc 03 00 00 mov $0x3fc,%edx
80105a94: 89 c8 mov %ecx,%eax
80105a96: ee out %al,(%dx)
80105a97: b8 01 00 00 00 mov $0x1,%eax
80105a9c: 89 f2 mov %esi,%edx
80105a9e: ee out %al,(%dx)
static inline uchar
inb(ushort port)
{
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80105a9f: ba fd 03 00 00 mov $0x3fd,%edx
80105aa4: ec in (%dx),%al
outb(COM1+3, 0x03); // Lock divisor, 8 data bits.
outb(COM1+4, 0);
outb(COM1+1, 0x01); // Enable receive interrupts.
// If status is 0xFF, no serial port.
if(inb(COM1+5) == 0xFF)
80105aa5: 3c ff cmp $0xff,%al
80105aa7: 74 5a je 80105b03 <uartinit+0xb3>
return;
uart = 1;
80105aa9: c7 05 bc a5 10 80 01 movl $0x1,0x8010a5bc
80105ab0: 00 00 00
80105ab3: 89 da mov %ebx,%edx
80105ab5: ec in (%dx),%al
80105ab6: ba f8 03 00 00 mov $0x3f8,%edx
80105abb: ec in (%dx),%al
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb(COM1+2);
inb(COM1+0);
ioapicenable(IRQ_COM1, 0);
80105abc: 83 ec 08 sub $0x8,%esp
80105abf: bb 20 78 10 80 mov $0x80107820,%ebx
80105ac4: 6a 00 push $0x0
80105ac6: 6a 04 push $0x4
80105ac8: e8 53 c8 ff ff call 80102320 <ioapicenable>
80105acd: 83 c4 10 add $0x10,%esp
80105ad0: b8 78 00 00 00 mov $0x78,%eax
80105ad5: eb 13 jmp 80105aea <uartinit+0x9a>
80105ad7: 89 f6 mov %esi,%esi
80105ad9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105ae0: 83 c3 01 add $0x1,%ebx
80105ae3: 0f be 03 movsbl (%ebx),%eax
80105ae6: 84 c0 test %al,%al
80105ae8: 74 19 je 80105b03 <uartinit+0xb3>
void
uartputc(int c)
{
int i;
if(!uart)
80105aea: 8b 15 bc a5 10 80 mov 0x8010a5bc,%edx
80105af0: 85 d2 test %edx,%edx
80105af2: 74 ec je 80105ae0 <uartinit+0x90>
inb(COM1+2);
inb(COM1+0);
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80105af4: 83 c3 01 add $0x1,%ebx
80105af7: e8 04 ff ff ff call 80105a00 <uartputc.part.0>
80105afc: 0f be 03 movsbl (%ebx),%eax
80105aff: 84 c0 test %al,%al
80105b01: 75 e7 jne 80105aea <uartinit+0x9a>
uartputc(*p);
}
80105b03: 8d 65 f4 lea -0xc(%ebp),%esp
80105b06: 5b pop %ebx
80105b07: 5e pop %esi
80105b08: 5f pop %edi
80105b09: 5d pop %ebp
80105b0a: c3 ret
80105b0b: 90 nop
80105b0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80105b10 <uartputc>:
void
uartputc(int c)
{
int i;
if(!uart)
80105b10: 8b 15 bc a5 10 80 mov 0x8010a5bc,%edx
uartputc(*p);
}
void
uartputc(int c)
{
80105b16: 55 push %ebp
80105b17: 89 e5 mov %esp,%ebp
int i;
if(!uart)
80105b19: 85 d2 test %edx,%edx
uartputc(*p);
}
void
uartputc(int c)
{
80105b1b: 8b 45 08 mov 0x8(%ebp),%eax
int i;
if(!uart)
80105b1e: 74 10 je 80105b30 <uartputc+0x20>
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
microdelay(10);
outb(COM1+0, c);
}
80105b20: 5d pop %ebp
80105b21: e9 da fe ff ff jmp 80105a00 <uartputc.part.0>
80105b26: 8d 76 00 lea 0x0(%esi),%esi
80105b29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105b30: 5d pop %ebp
80105b31: c3 ret
80105b32: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80105b39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80105b40 <uartintr>:
return inb(COM1+0);
}
void
uartintr(void)
{
80105b40: 55 push %ebp
80105b41: 89 e5 mov %esp,%ebp
80105b43: 83 ec 14 sub $0x14,%esp
consoleintr(uartgetc);
80105b46: 68 d0 59 10 80 push $0x801059d0
80105b4b: e8 a0 ac ff ff call 801007f0 <consoleintr>
}
80105b50: 83 c4 10 add $0x10,%esp
80105b53: c9 leave
80105b54: c3 ret
80105b55 <vector0>:
# generated by vectors.pl - do not edit
# handlers
.globl alltraps
.globl vector0
vector0:
pushl $0
80105b55: 6a 00 push $0x0
pushl $0
80105b57: 6a 00 push $0x0
jmp alltraps
80105b59: e9 3c fb ff ff jmp 8010569a <alltraps>
80105b5e <vector1>:
.globl vector1
vector1:
pushl $0
80105b5e: 6a 00 push $0x0
pushl $1
80105b60: 6a 01 push $0x1
jmp alltraps
80105b62: e9 33 fb ff ff jmp 8010569a <alltraps>
80105b67 <vector2>:
.globl vector2
vector2:
pushl $0
80105b67: 6a 00 push $0x0
pushl $2
80105b69: 6a 02 push $0x2
jmp alltraps
80105b6b: e9 2a fb ff ff jmp 8010569a <alltraps>
80105b70 <vector3>:
.globl vector3
vector3:
pushl $0
80105b70: 6a 00 push $0x0
pushl $3
80105b72: 6a 03 push $0x3
jmp alltraps
80105b74: e9 21 fb ff ff jmp 8010569a <alltraps>
80105b79 <vector4>:
.globl vector4
vector4:
pushl $0
80105b79: 6a 00 push $0x0
pushl $4
80105b7b: 6a 04 push $0x4
jmp alltraps
80105b7d: e9 18 fb ff ff jmp 8010569a <alltraps>
80105b82 <vector5>:
.globl vector5
vector5:
pushl $0
80105b82: 6a 00 push $0x0
pushl $5
80105b84: 6a 05 push $0x5
jmp alltraps
80105b86: e9 0f fb ff ff jmp 8010569a <alltraps>
80105b8b <vector6>:
.globl vector6
vector6:
pushl $0
80105b8b: 6a 00 push $0x0
pushl $6
80105b8d: 6a 06 push $0x6
jmp alltraps
80105b8f: e9 06 fb ff ff jmp 8010569a <alltraps>
80105b94 <vector7>:
.globl vector7
vector7:
pushl $0
80105b94: 6a 00 push $0x0
pushl $7
80105b96: 6a 07 push $0x7
jmp alltraps
80105b98: e9 fd fa ff ff jmp 8010569a <alltraps>
80105b9d <vector8>:
.globl vector8
vector8:
pushl $8
80105b9d: 6a 08 push $0x8
jmp alltraps
80105b9f: e9 f6 fa ff ff jmp 8010569a <alltraps>
80105ba4 <vector9>:
.globl vector9
vector9:
pushl $0
80105ba4: 6a 00 push $0x0
pushl $9
80105ba6: 6a 09 push $0x9
jmp alltraps
80105ba8: e9 ed fa ff ff jmp 8010569a <alltraps>
80105bad <vector10>:
.globl vector10
vector10:
pushl $10
80105bad: 6a 0a push $0xa
jmp alltraps
80105baf: e9 e6 fa ff ff jmp 8010569a <alltraps>
80105bb4 <vector11>:
.globl vector11
vector11:
pushl $11
80105bb4: 6a 0b push $0xb
jmp alltraps
80105bb6: e9 df fa ff ff jmp 8010569a <alltraps>
80105bbb <vector12>:
.globl vector12
vector12:
pushl $12
80105bbb: 6a 0c push $0xc
jmp alltraps
80105bbd: e9 d8 fa ff ff jmp 8010569a <alltraps>
80105bc2 <vector13>:
.globl vector13
vector13:
pushl $13
80105bc2: 6a 0d push $0xd
jmp alltraps
80105bc4: e9 d1 fa ff ff jmp 8010569a <alltraps>
80105bc9 <vector14>:
.globl vector14
vector14:
pushl $14
80105bc9: 6a 0e push $0xe
jmp alltraps
80105bcb: e9 ca fa ff ff jmp 8010569a <alltraps>
80105bd0 <vector15>:
.globl vector15
vector15:
pushl $0
80105bd0: 6a 00 push $0x0
pushl $15
80105bd2: 6a 0f push $0xf
jmp alltraps
80105bd4: e9 c1 fa ff ff jmp 8010569a <alltraps>
80105bd9 <vector16>:
.globl vector16
vector16:
pushl $0
80105bd9: 6a 00 push $0x0
pushl $16
80105bdb: 6a 10 push $0x10
jmp alltraps
80105bdd: e9 b8 fa ff ff jmp 8010569a <alltraps>
80105be2 <vector17>:
.globl vector17
vector17:
pushl $17
80105be2: 6a 11 push $0x11
jmp alltraps
80105be4: e9 b1 fa ff ff jmp 8010569a <alltraps>
80105be9 <vector18>:
.globl vector18
vector18:
pushl $0
80105be9: 6a 00 push $0x0
pushl $18
80105beb: 6a 12 push $0x12
jmp alltraps
80105bed: e9 a8 fa ff ff jmp 8010569a <alltraps>
80105bf2 <vector19>:
.globl vector19
vector19:
pushl $0
80105bf2: 6a 00 push $0x0
pushl $19
80105bf4: 6a 13 push $0x13
jmp alltraps
80105bf6: e9 9f fa ff ff jmp 8010569a <alltraps>
80105bfb <vector20>:
.globl vector20
vector20:
pushl $0
80105bfb: 6a 00 push $0x0
pushl $20
80105bfd: 6a 14 push $0x14
jmp alltraps
80105bff: e9 96 fa ff ff jmp 8010569a <alltraps>
80105c04 <vector21>:
.globl vector21
vector21:
pushl $0
80105c04: 6a 00 push $0x0
pushl $21
80105c06: 6a 15 push $0x15
jmp alltraps
80105c08: e9 8d fa ff ff jmp 8010569a <alltraps>
80105c0d <vector22>:
.globl vector22
vector22:
pushl $0
80105c0d: 6a 00 push $0x0
pushl $22
80105c0f: 6a 16 push $0x16
jmp alltraps
80105c11: e9 84 fa ff ff jmp 8010569a <alltraps>
80105c16 <vector23>:
.globl vector23
vector23:
pushl $0
80105c16: 6a 00 push $0x0
pushl $23
80105c18: 6a 17 push $0x17
jmp alltraps
80105c1a: e9 7b fa ff ff jmp 8010569a <alltraps>
80105c1f <vector24>:
.globl vector24
vector24:
pushl $0
80105c1f: 6a 00 push $0x0
pushl $24
80105c21: 6a 18 push $0x18
jmp alltraps
80105c23: e9 72 fa ff ff jmp 8010569a <alltraps>
80105c28 <vector25>:
.globl vector25
vector25:
pushl $0
80105c28: 6a 00 push $0x0
pushl $25
80105c2a: 6a 19 push $0x19
jmp alltraps
80105c2c: e9 69 fa ff ff jmp 8010569a <alltraps>
80105c31 <vector26>:
.globl vector26
vector26:
pushl $0
80105c31: 6a 00 push $0x0
pushl $26
80105c33: 6a 1a push $0x1a
jmp alltraps
80105c35: e9 60 fa ff ff jmp 8010569a <alltraps>
80105c3a <vector27>:
.globl vector27
vector27:
pushl $0
80105c3a: 6a 00 push $0x0
pushl $27
80105c3c: 6a 1b push $0x1b
jmp alltraps
80105c3e: e9 57 fa ff ff jmp 8010569a <alltraps>
80105c43 <vector28>:
.globl vector28
vector28:
pushl $0
80105c43: 6a 00 push $0x0
pushl $28
80105c45: 6a 1c push $0x1c
jmp alltraps
80105c47: e9 4e fa ff ff jmp 8010569a <alltraps>
80105c4c <vector29>:
.globl vector29
vector29:
pushl $0
80105c4c: 6a 00 push $0x0
pushl $29
80105c4e: 6a 1d push $0x1d
jmp alltraps
80105c50: e9 45 fa ff ff jmp 8010569a <alltraps>
80105c55 <vector30>:
.globl vector30
vector30:
pushl $0
80105c55: 6a 00 push $0x0
pushl $30
80105c57: 6a 1e push $0x1e
jmp alltraps
80105c59: e9 3c fa ff ff jmp 8010569a <alltraps>
80105c5e <vector31>:
.globl vector31
vector31:
pushl $0
80105c5e: 6a 00 push $0x0
pushl $31
80105c60: 6a 1f push $0x1f
jmp alltraps
80105c62: e9 33 fa ff ff jmp 8010569a <alltraps>
80105c67 <vector32>:
.globl vector32
vector32:
pushl $0
80105c67: 6a 00 push $0x0
pushl $32
80105c69: 6a 20 push $0x20
jmp alltraps
80105c6b: e9 2a fa ff ff jmp 8010569a <alltraps>
80105c70 <vector33>:
.globl vector33
vector33:
pushl $0
80105c70: 6a 00 push $0x0
pushl $33
80105c72: 6a 21 push $0x21
jmp alltraps
80105c74: e9 21 fa ff ff jmp 8010569a <alltraps>
80105c79 <vector34>:
.globl vector34
vector34:
pushl $0
80105c79: 6a 00 push $0x0
pushl $34
80105c7b: 6a 22 push $0x22
jmp alltraps
80105c7d: e9 18 fa ff ff jmp 8010569a <alltraps>
80105c82 <vector35>:
.globl vector35
vector35:
pushl $0
80105c82: 6a 00 push $0x0
pushl $35
80105c84: 6a 23 push $0x23
jmp alltraps
80105c86: e9 0f fa ff ff jmp 8010569a <alltraps>
80105c8b <vector36>:
.globl vector36
vector36:
pushl $0
80105c8b: 6a 00 push $0x0
pushl $36
80105c8d: 6a 24 push $0x24
jmp alltraps
80105c8f: e9 06 fa ff ff jmp 8010569a <alltraps>
80105c94 <vector37>:
.globl vector37
vector37:
pushl $0
80105c94: 6a 00 push $0x0
pushl $37
80105c96: 6a 25 push $0x25
jmp alltraps
80105c98: e9 fd f9 ff ff jmp 8010569a <alltraps>
80105c9d <vector38>:
.globl vector38
vector38:
pushl $0
80105c9d: 6a 00 push $0x0
pushl $38
80105c9f: 6a 26 push $0x26
jmp alltraps
80105ca1: e9 f4 f9 ff ff jmp 8010569a <alltraps>
80105ca6 <vector39>:
.globl vector39
vector39:
pushl $0
80105ca6: 6a 00 push $0x0
pushl $39
80105ca8: 6a 27 push $0x27
jmp alltraps
80105caa: e9 eb f9 ff ff jmp 8010569a <alltraps>
80105caf <vector40>:
.globl vector40
vector40:
pushl $0
80105caf: 6a 00 push $0x0
pushl $40
80105cb1: 6a 28 push $0x28
jmp alltraps
80105cb3: e9 e2 f9 ff ff jmp 8010569a <alltraps>
80105cb8 <vector41>:
.globl vector41
vector41:
pushl $0
80105cb8: 6a 00 push $0x0
pushl $41
80105cba: 6a 29 push $0x29
jmp alltraps
80105cbc: e9 d9 f9 ff ff jmp 8010569a <alltraps>
80105cc1 <vector42>:
.globl vector42
vector42:
pushl $0
80105cc1: 6a 00 push $0x0
pushl $42
80105cc3: 6a 2a push $0x2a
jmp alltraps
80105cc5: e9 d0 f9 ff ff jmp 8010569a <alltraps>
80105cca <vector43>:
.globl vector43
vector43:
pushl $0
80105cca: 6a 00 push $0x0
pushl $43
80105ccc: 6a 2b push $0x2b
jmp alltraps
80105cce: e9 c7 f9 ff ff jmp 8010569a <alltraps>
80105cd3 <vector44>:
.globl vector44
vector44:
pushl $0
80105cd3: 6a 00 push $0x0
pushl $44
80105cd5: 6a 2c push $0x2c
jmp alltraps
80105cd7: e9 be f9 ff ff jmp 8010569a <alltraps>
80105cdc <vector45>:
.globl vector45
vector45:
pushl $0
80105cdc: 6a 00 push $0x0
pushl $45
80105cde: 6a 2d push $0x2d
jmp alltraps
80105ce0: e9 b5 f9 ff ff jmp 8010569a <alltraps>
80105ce5 <vector46>:
.globl vector46
vector46:
pushl $0
80105ce5: 6a 00 push $0x0
pushl $46
80105ce7: 6a 2e push $0x2e
jmp alltraps
80105ce9: e9 ac f9 ff ff jmp 8010569a <alltraps>
80105cee <vector47>:
.globl vector47
vector47:
pushl $0
80105cee: 6a 00 push $0x0
pushl $47
80105cf0: 6a 2f push $0x2f
jmp alltraps
80105cf2: e9 a3 f9 ff ff jmp 8010569a <alltraps>
80105cf7 <vector48>:
.globl vector48
vector48:
pushl $0
80105cf7: 6a 00 push $0x0
pushl $48
80105cf9: 6a 30 push $0x30
jmp alltraps
80105cfb: e9 9a f9 ff ff jmp 8010569a <alltraps>
80105d00 <vector49>:
.globl vector49
vector49:
pushl $0
80105d00: 6a 00 push $0x0
pushl $49
80105d02: 6a 31 push $0x31
jmp alltraps
80105d04: e9 91 f9 ff ff jmp 8010569a <alltraps>
80105d09 <vector50>:
.globl vector50
vector50:
pushl $0
80105d09: 6a 00 push $0x0
pushl $50
80105d0b: 6a 32 push $0x32
jmp alltraps
80105d0d: e9 88 f9 ff ff jmp 8010569a <alltraps>
80105d12 <vector51>:
.globl vector51
vector51:
pushl $0
80105d12: 6a 00 push $0x0
pushl $51
80105d14: 6a 33 push $0x33
jmp alltraps
80105d16: e9 7f f9 ff ff jmp 8010569a <alltraps>
80105d1b <vector52>:
.globl vector52
vector52:
pushl $0
80105d1b: 6a 00 push $0x0
pushl $52
80105d1d: 6a 34 push $0x34
jmp alltraps
80105d1f: e9 76 f9 ff ff jmp 8010569a <alltraps>
80105d24 <vector53>:
.globl vector53
vector53:
pushl $0
80105d24: 6a 00 push $0x0
pushl $53
80105d26: 6a 35 push $0x35
jmp alltraps
80105d28: e9 6d f9 ff ff jmp 8010569a <alltraps>
80105d2d <vector54>:
.globl vector54
vector54:
pushl $0
80105d2d: 6a 00 push $0x0
pushl $54
80105d2f: 6a 36 push $0x36
jmp alltraps
80105d31: e9 64 f9 ff ff jmp 8010569a <alltraps>
80105d36 <vector55>:
.globl vector55
vector55:
pushl $0
80105d36: 6a 00 push $0x0
pushl $55
80105d38: 6a 37 push $0x37
jmp alltraps
80105d3a: e9 5b f9 ff ff jmp 8010569a <alltraps>
80105d3f <vector56>:
.globl vector56
vector56:
pushl $0
80105d3f: 6a 00 push $0x0
pushl $56
80105d41: 6a 38 push $0x38
jmp alltraps
80105d43: e9 52 f9 ff ff jmp 8010569a <alltraps>
80105d48 <vector57>:
.globl vector57
vector57:
pushl $0
80105d48: 6a 00 push $0x0
pushl $57
80105d4a: 6a 39 push $0x39
jmp alltraps
80105d4c: e9 49 f9 ff ff jmp 8010569a <alltraps>
80105d51 <vector58>:
.globl vector58
vector58:
pushl $0
80105d51: 6a 00 push $0x0
pushl $58
80105d53: 6a 3a push $0x3a
jmp alltraps
80105d55: e9 40 f9 ff ff jmp 8010569a <alltraps>
80105d5a <vector59>:
.globl vector59
vector59:
pushl $0
80105d5a: 6a 00 push $0x0
pushl $59
80105d5c: 6a 3b push $0x3b
jmp alltraps
80105d5e: e9 37 f9 ff ff jmp 8010569a <alltraps>
80105d63 <vector60>:
.globl vector60
vector60:
pushl $0
80105d63: 6a 00 push $0x0
pushl $60
80105d65: 6a 3c push $0x3c
jmp alltraps
80105d67: e9 2e f9 ff ff jmp 8010569a <alltraps>
80105d6c <vector61>:
.globl vector61
vector61:
pushl $0
80105d6c: 6a 00 push $0x0
pushl $61
80105d6e: 6a 3d push $0x3d
jmp alltraps
80105d70: e9 25 f9 ff ff jmp 8010569a <alltraps>
80105d75 <vector62>:
.globl vector62
vector62:
pushl $0
80105d75: 6a 00 push $0x0
pushl $62
80105d77: 6a 3e push $0x3e
jmp alltraps
80105d79: e9 1c f9 ff ff jmp 8010569a <alltraps>
80105d7e <vector63>:
.globl vector63
vector63:
pushl $0
80105d7e: 6a 00 push $0x0
pushl $63
80105d80: 6a 3f push $0x3f
jmp alltraps
80105d82: e9 13 f9 ff ff jmp 8010569a <alltraps>
80105d87 <vector64>:
.globl vector64
vector64:
pushl $0
80105d87: 6a 00 push $0x0
pushl $64
80105d89: 6a 40 push $0x40
jmp alltraps
80105d8b: e9 0a f9 ff ff jmp 8010569a <alltraps>
80105d90 <vector65>:
.globl vector65
vector65:
pushl $0
80105d90: 6a 00 push $0x0
pushl $65
80105d92: 6a 41 push $0x41
jmp alltraps
80105d94: e9 01 f9 ff ff jmp 8010569a <alltraps>
80105d99 <vector66>:
.globl vector66
vector66:
pushl $0
80105d99: 6a 00 push $0x0
pushl $66
80105d9b: 6a 42 push $0x42
jmp alltraps
80105d9d: e9 f8 f8 ff ff jmp 8010569a <alltraps>
80105da2 <vector67>:
.globl vector67
vector67:
pushl $0
80105da2: 6a 00 push $0x0
pushl $67
80105da4: 6a 43 push $0x43
jmp alltraps
80105da6: e9 ef f8 ff ff jmp 8010569a <alltraps>
80105dab <vector68>:
.globl vector68
vector68:
pushl $0
80105dab: 6a 00 push $0x0
pushl $68
80105dad: 6a 44 push $0x44
jmp alltraps
80105daf: e9 e6 f8 ff ff jmp 8010569a <alltraps>
80105db4 <vector69>:
.globl vector69
vector69:
pushl $0
80105db4: 6a 00 push $0x0
pushl $69
80105db6: 6a 45 push $0x45
jmp alltraps
80105db8: e9 dd f8 ff ff jmp 8010569a <alltraps>
80105dbd <vector70>:
.globl vector70
vector70:
pushl $0
80105dbd: 6a 00 push $0x0
pushl $70
80105dbf: 6a 46 push $0x46
jmp alltraps
80105dc1: e9 d4 f8 ff ff jmp 8010569a <alltraps>
80105dc6 <vector71>:
.globl vector71
vector71:
pushl $0
80105dc6: 6a 00 push $0x0
pushl $71
80105dc8: 6a 47 push $0x47
jmp alltraps
80105dca: e9 cb f8 ff ff jmp 8010569a <alltraps>
80105dcf <vector72>:
.globl vector72
vector72:
pushl $0
80105dcf: 6a 00 push $0x0
pushl $72
80105dd1: 6a 48 push $0x48
jmp alltraps
80105dd3: e9 c2 f8 ff ff jmp 8010569a <alltraps>
80105dd8 <vector73>:
.globl vector73
vector73:
pushl $0
80105dd8: 6a 00 push $0x0
pushl $73
80105dda: 6a 49 push $0x49
jmp alltraps
80105ddc: e9 b9 f8 ff ff jmp 8010569a <alltraps>
80105de1 <vector74>:
.globl vector74
vector74:
pushl $0
80105de1: 6a 00 push $0x0
pushl $74
80105de3: 6a 4a push $0x4a
jmp alltraps
80105de5: e9 b0 f8 ff ff jmp 8010569a <alltraps>
80105dea <vector75>:
.globl vector75
vector75:
pushl $0
80105dea: 6a 00 push $0x0
pushl $75
80105dec: 6a 4b push $0x4b
jmp alltraps
80105dee: e9 a7 f8 ff ff jmp 8010569a <alltraps>
80105df3 <vector76>:
.globl vector76
vector76:
pushl $0
80105df3: 6a 00 push $0x0
pushl $76
80105df5: 6a 4c push $0x4c
jmp alltraps
80105df7: e9 9e f8 ff ff jmp 8010569a <alltraps>
80105dfc <vector77>:
.globl vector77
vector77:
pushl $0
80105dfc: 6a 00 push $0x0
pushl $77
80105dfe: 6a 4d push $0x4d
jmp alltraps
80105e00: e9 95 f8 ff ff jmp 8010569a <alltraps>
80105e05 <vector78>:
.globl vector78
vector78:
pushl $0
80105e05: 6a 00 push $0x0
pushl $78
80105e07: 6a 4e push $0x4e
jmp alltraps
80105e09: e9 8c f8 ff ff jmp 8010569a <alltraps>
80105e0e <vector79>:
.globl vector79
vector79:
pushl $0
80105e0e: 6a 00 push $0x0
pushl $79
80105e10: 6a 4f push $0x4f
jmp alltraps
80105e12: e9 83 f8 ff ff jmp 8010569a <alltraps>
80105e17 <vector80>:
.globl vector80
vector80:
pushl $0
80105e17: 6a 00 push $0x0
pushl $80
80105e19: 6a 50 push $0x50
jmp alltraps
80105e1b: e9 7a f8 ff ff jmp 8010569a <alltraps>
80105e20 <vector81>:
.globl vector81
vector81:
pushl $0
80105e20: 6a 00 push $0x0
pushl $81
80105e22: 6a 51 push $0x51
jmp alltraps
80105e24: e9 71 f8 ff ff jmp 8010569a <alltraps>
80105e29 <vector82>:
.globl vector82
vector82:
pushl $0
80105e29: 6a 00 push $0x0
pushl $82
80105e2b: 6a 52 push $0x52
jmp alltraps
80105e2d: e9 68 f8 ff ff jmp 8010569a <alltraps>
80105e32 <vector83>:
.globl vector83
vector83:
pushl $0
80105e32: 6a 00 push $0x0
pushl $83
80105e34: 6a 53 push $0x53
jmp alltraps
80105e36: e9 5f f8 ff ff jmp 8010569a <alltraps>
80105e3b <vector84>:
.globl vector84
vector84:
pushl $0
80105e3b: 6a 00 push $0x0
pushl $84
80105e3d: 6a 54 push $0x54
jmp alltraps
80105e3f: e9 56 f8 ff ff jmp 8010569a <alltraps>
80105e44 <vector85>:
.globl vector85
vector85:
pushl $0
80105e44: 6a 00 push $0x0
pushl $85
80105e46: 6a 55 push $0x55
jmp alltraps
80105e48: e9 4d f8 ff ff jmp 8010569a <alltraps>
80105e4d <vector86>:
.globl vector86
vector86:
pushl $0
80105e4d: 6a 00 push $0x0
pushl $86
80105e4f: 6a 56 push $0x56
jmp alltraps
80105e51: e9 44 f8 ff ff jmp 8010569a <alltraps>
80105e56 <vector87>:
.globl vector87
vector87:
pushl $0
80105e56: 6a 00 push $0x0
pushl $87
80105e58: 6a 57 push $0x57
jmp alltraps
80105e5a: e9 3b f8 ff ff jmp 8010569a <alltraps>
80105e5f <vector88>:
.globl vector88
vector88:
pushl $0
80105e5f: 6a 00 push $0x0
pushl $88
80105e61: 6a 58 push $0x58
jmp alltraps
80105e63: e9 32 f8 ff ff jmp 8010569a <alltraps>
80105e68 <vector89>:
.globl vector89
vector89:
pushl $0
80105e68: 6a 00 push $0x0
pushl $89
80105e6a: 6a 59 push $0x59
jmp alltraps
80105e6c: e9 29 f8 ff ff jmp 8010569a <alltraps>
80105e71 <vector90>:
.globl vector90
vector90:
pushl $0
80105e71: 6a 00 push $0x0
pushl $90
80105e73: 6a 5a push $0x5a
jmp alltraps
80105e75: e9 20 f8 ff ff jmp 8010569a <alltraps>
80105e7a <vector91>:
.globl vector91
vector91:
pushl $0
80105e7a: 6a 00 push $0x0
pushl $91
80105e7c: 6a 5b push $0x5b
jmp alltraps
80105e7e: e9 17 f8 ff ff jmp 8010569a <alltraps>
80105e83 <vector92>:
.globl vector92
vector92:
pushl $0
80105e83: 6a 00 push $0x0
pushl $92
80105e85: 6a 5c push $0x5c
jmp alltraps
80105e87: e9 0e f8 ff ff jmp 8010569a <alltraps>
80105e8c <vector93>:
.globl vector93
vector93:
pushl $0
80105e8c: 6a 00 push $0x0
pushl $93
80105e8e: 6a 5d push $0x5d
jmp alltraps
80105e90: e9 05 f8 ff ff jmp 8010569a <alltraps>
80105e95 <vector94>:
.globl vector94
vector94:
pushl $0
80105e95: 6a 00 push $0x0
pushl $94
80105e97: 6a 5e push $0x5e
jmp alltraps
80105e99: e9 fc f7 ff ff jmp 8010569a <alltraps>
80105e9e <vector95>:
.globl vector95
vector95:
pushl $0
80105e9e: 6a 00 push $0x0
pushl $95
80105ea0: 6a 5f push $0x5f
jmp alltraps
80105ea2: e9 f3 f7 ff ff jmp 8010569a <alltraps>
80105ea7 <vector96>:
.globl vector96
vector96:
pushl $0
80105ea7: 6a 00 push $0x0
pushl $96
80105ea9: 6a 60 push $0x60
jmp alltraps
80105eab: e9 ea f7 ff ff jmp 8010569a <alltraps>
80105eb0 <vector97>:
.globl vector97
vector97:
pushl $0
80105eb0: 6a 00 push $0x0
pushl $97
80105eb2: 6a 61 push $0x61
jmp alltraps
80105eb4: e9 e1 f7 ff ff jmp 8010569a <alltraps>
80105eb9 <vector98>:
.globl vector98
vector98:
pushl $0
80105eb9: 6a 00 push $0x0
pushl $98
80105ebb: 6a 62 push $0x62
jmp alltraps
80105ebd: e9 d8 f7 ff ff jmp 8010569a <alltraps>
80105ec2 <vector99>:
.globl vector99
vector99:
pushl $0
80105ec2: 6a 00 push $0x0
pushl $99
80105ec4: 6a 63 push $0x63
jmp alltraps
80105ec6: e9 cf f7 ff ff jmp 8010569a <alltraps>
80105ecb <vector100>:
.globl vector100
vector100:
pushl $0
80105ecb: 6a 00 push $0x0
pushl $100
80105ecd: 6a 64 push $0x64
jmp alltraps
80105ecf: e9 c6 f7 ff ff jmp 8010569a <alltraps>
80105ed4 <vector101>:
.globl vector101
vector101:
pushl $0
80105ed4: 6a 00 push $0x0
pushl $101
80105ed6: 6a 65 push $0x65
jmp alltraps
80105ed8: e9 bd f7 ff ff jmp 8010569a <alltraps>
80105edd <vector102>:
.globl vector102
vector102:
pushl $0
80105edd: 6a 00 push $0x0
pushl $102
80105edf: 6a 66 push $0x66
jmp alltraps
80105ee1: e9 b4 f7 ff ff jmp 8010569a <alltraps>
80105ee6 <vector103>:
.globl vector103
vector103:
pushl $0
80105ee6: 6a 00 push $0x0
pushl $103
80105ee8: 6a 67 push $0x67
jmp alltraps
80105eea: e9 ab f7 ff ff jmp 8010569a <alltraps>
80105eef <vector104>:
.globl vector104
vector104:
pushl $0
80105eef: 6a 00 push $0x0
pushl $104
80105ef1: 6a 68 push $0x68
jmp alltraps
80105ef3: e9 a2 f7 ff ff jmp 8010569a <alltraps>
80105ef8 <vector105>:
.globl vector105
vector105:
pushl $0
80105ef8: 6a 00 push $0x0
pushl $105
80105efa: 6a 69 push $0x69
jmp alltraps
80105efc: e9 99 f7 ff ff jmp 8010569a <alltraps>
80105f01 <vector106>:
.globl vector106
vector106:
pushl $0
80105f01: 6a 00 push $0x0
pushl $106
80105f03: 6a 6a push $0x6a
jmp alltraps
80105f05: e9 90 f7 ff ff jmp 8010569a <alltraps>
80105f0a <vector107>:
.globl vector107
vector107:
pushl $0
80105f0a: 6a 00 push $0x0
pushl $107
80105f0c: 6a 6b push $0x6b
jmp alltraps
80105f0e: e9 87 f7 ff ff jmp 8010569a <alltraps>
80105f13 <vector108>:
.globl vector108
vector108:
pushl $0
80105f13: 6a 00 push $0x0
pushl $108
80105f15: 6a 6c push $0x6c
jmp alltraps
80105f17: e9 7e f7 ff ff jmp 8010569a <alltraps>
80105f1c <vector109>:
.globl vector109
vector109:
pushl $0
80105f1c: 6a 00 push $0x0
pushl $109
80105f1e: 6a 6d push $0x6d
jmp alltraps
80105f20: e9 75 f7 ff ff jmp 8010569a <alltraps>
80105f25 <vector110>:
.globl vector110
vector110:
pushl $0
80105f25: 6a 00 push $0x0
pushl $110
80105f27: 6a 6e push $0x6e
jmp alltraps
80105f29: e9 6c f7 ff ff jmp 8010569a <alltraps>
80105f2e <vector111>:
.globl vector111
vector111:
pushl $0
80105f2e: 6a 00 push $0x0
pushl $111
80105f30: 6a 6f push $0x6f
jmp alltraps
80105f32: e9 63 f7 ff ff jmp 8010569a <alltraps>
80105f37 <vector112>:
.globl vector112
vector112:
pushl $0
80105f37: 6a 00 push $0x0
pushl $112
80105f39: 6a 70 push $0x70
jmp alltraps
80105f3b: e9 5a f7 ff ff jmp 8010569a <alltraps>
80105f40 <vector113>:
.globl vector113
vector113:
pushl $0
80105f40: 6a 00 push $0x0
pushl $113
80105f42: 6a 71 push $0x71
jmp alltraps
80105f44: e9 51 f7 ff ff jmp 8010569a <alltraps>
80105f49 <vector114>:
.globl vector114
vector114:
pushl $0
80105f49: 6a 00 push $0x0
pushl $114
80105f4b: 6a 72 push $0x72
jmp alltraps
80105f4d: e9 48 f7 ff ff jmp 8010569a <alltraps>
80105f52 <vector115>:
.globl vector115
vector115:
pushl $0
80105f52: 6a 00 push $0x0
pushl $115
80105f54: 6a 73 push $0x73
jmp alltraps
80105f56: e9 3f f7 ff ff jmp 8010569a <alltraps>
80105f5b <vector116>:
.globl vector116
vector116:
pushl $0
80105f5b: 6a 00 push $0x0
pushl $116
80105f5d: 6a 74 push $0x74
jmp alltraps
80105f5f: e9 36 f7 ff ff jmp 8010569a <alltraps>
80105f64 <vector117>:
.globl vector117
vector117:
pushl $0
80105f64: 6a 00 push $0x0
pushl $117
80105f66: 6a 75 push $0x75
jmp alltraps
80105f68: e9 2d f7 ff ff jmp 8010569a <alltraps>
80105f6d <vector118>:
.globl vector118
vector118:
pushl $0
80105f6d: 6a 00 push $0x0
pushl $118
80105f6f: 6a 76 push $0x76
jmp alltraps
80105f71: e9 24 f7 ff ff jmp 8010569a <alltraps>
80105f76 <vector119>:
.globl vector119
vector119:
pushl $0
80105f76: 6a 00 push $0x0
pushl $119
80105f78: 6a 77 push $0x77
jmp alltraps
80105f7a: e9 1b f7 ff ff jmp 8010569a <alltraps>
80105f7f <vector120>:
.globl vector120
vector120:
pushl $0
80105f7f: 6a 00 push $0x0
pushl $120
80105f81: 6a 78 push $0x78
jmp alltraps
80105f83: e9 12 f7 ff ff jmp 8010569a <alltraps>
80105f88 <vector121>:
.globl vector121
vector121:
pushl $0
80105f88: 6a 00 push $0x0
pushl $121
80105f8a: 6a 79 push $0x79
jmp alltraps
80105f8c: e9 09 f7 ff ff jmp 8010569a <alltraps>
80105f91 <vector122>:
.globl vector122
vector122:
pushl $0
80105f91: 6a 00 push $0x0
pushl $122
80105f93: 6a 7a push $0x7a
jmp alltraps
80105f95: e9 00 f7 ff ff jmp 8010569a <alltraps>
80105f9a <vector123>:
.globl vector123
vector123:
pushl $0
80105f9a: 6a 00 push $0x0
pushl $123
80105f9c: 6a 7b push $0x7b
jmp alltraps
80105f9e: e9 f7 f6 ff ff jmp 8010569a <alltraps>
80105fa3 <vector124>:
.globl vector124
vector124:
pushl $0
80105fa3: 6a 00 push $0x0
pushl $124
80105fa5: 6a 7c push $0x7c
jmp alltraps
80105fa7: e9 ee f6 ff ff jmp 8010569a <alltraps>
80105fac <vector125>:
.globl vector125
vector125:
pushl $0
80105fac: 6a 00 push $0x0
pushl $125
80105fae: 6a 7d push $0x7d
jmp alltraps
80105fb0: e9 e5 f6 ff ff jmp 8010569a <alltraps>
80105fb5 <vector126>:
.globl vector126
vector126:
pushl $0
80105fb5: 6a 00 push $0x0
pushl $126
80105fb7: 6a 7e push $0x7e
jmp alltraps
80105fb9: e9 dc f6 ff ff jmp 8010569a <alltraps>
80105fbe <vector127>:
.globl vector127
vector127:
pushl $0
80105fbe: 6a 00 push $0x0
pushl $127
80105fc0: 6a 7f push $0x7f
jmp alltraps
80105fc2: e9 d3 f6 ff ff jmp 8010569a <alltraps>
80105fc7 <vector128>:
.globl vector128
vector128:
pushl $0
80105fc7: 6a 00 push $0x0
pushl $128
80105fc9: 68 80 00 00 00 push $0x80
jmp alltraps
80105fce: e9 c7 f6 ff ff jmp 8010569a <alltraps>
80105fd3 <vector129>:
.globl vector129
vector129:
pushl $0
80105fd3: 6a 00 push $0x0
pushl $129
80105fd5: 68 81 00 00 00 push $0x81
jmp alltraps
80105fda: e9 bb f6 ff ff jmp 8010569a <alltraps>
80105fdf <vector130>:
.globl vector130
vector130:
pushl $0
80105fdf: 6a 00 push $0x0
pushl $130
80105fe1: 68 82 00 00 00 push $0x82
jmp alltraps
80105fe6: e9 af f6 ff ff jmp 8010569a <alltraps>
80105feb <vector131>:
.globl vector131
vector131:
pushl $0
80105feb: 6a 00 push $0x0
pushl $131
80105fed: 68 83 00 00 00 push $0x83
jmp alltraps
80105ff2: e9 a3 f6 ff ff jmp 8010569a <alltraps>
80105ff7 <vector132>:
.globl vector132
vector132:
pushl $0
80105ff7: 6a 00 push $0x0
pushl $132
80105ff9: 68 84 00 00 00 push $0x84
jmp alltraps
80105ffe: e9 97 f6 ff ff jmp 8010569a <alltraps>
80106003 <vector133>:
.globl vector133
vector133:
pushl $0
80106003: 6a 00 push $0x0
pushl $133
80106005: 68 85 00 00 00 push $0x85
jmp alltraps
8010600a: e9 8b f6 ff ff jmp 8010569a <alltraps>
8010600f <vector134>:
.globl vector134
vector134:
pushl $0
8010600f: 6a 00 push $0x0
pushl $134
80106011: 68 86 00 00 00 push $0x86
jmp alltraps
80106016: e9 7f f6 ff ff jmp 8010569a <alltraps>
8010601b <vector135>:
.globl vector135
vector135:
pushl $0
8010601b: 6a 00 push $0x0
pushl $135
8010601d: 68 87 00 00 00 push $0x87
jmp alltraps
80106022: e9 73 f6 ff ff jmp 8010569a <alltraps>
80106027 <vector136>:
.globl vector136
vector136:
pushl $0
80106027: 6a 00 push $0x0
pushl $136
80106029: 68 88 00 00 00 push $0x88
jmp alltraps
8010602e: e9 67 f6 ff ff jmp 8010569a <alltraps>
80106033 <vector137>:
.globl vector137
vector137:
pushl $0
80106033: 6a 00 push $0x0
pushl $137
80106035: 68 89 00 00 00 push $0x89
jmp alltraps
8010603a: e9 5b f6 ff ff jmp 8010569a <alltraps>
8010603f <vector138>:
.globl vector138
vector138:
pushl $0
8010603f: 6a 00 push $0x0
pushl $138
80106041: 68 8a 00 00 00 push $0x8a
jmp alltraps
80106046: e9 4f f6 ff ff jmp 8010569a <alltraps>
8010604b <vector139>:
.globl vector139
vector139:
pushl $0
8010604b: 6a 00 push $0x0
pushl $139
8010604d: 68 8b 00 00 00 push $0x8b
jmp alltraps
80106052: e9 43 f6 ff ff jmp 8010569a <alltraps>
80106057 <vector140>:
.globl vector140
vector140:
pushl $0
80106057: 6a 00 push $0x0
pushl $140
80106059: 68 8c 00 00 00 push $0x8c
jmp alltraps
8010605e: e9 37 f6 ff ff jmp 8010569a <alltraps>
80106063 <vector141>:
.globl vector141
vector141:
pushl $0
80106063: 6a 00 push $0x0
pushl $141
80106065: 68 8d 00 00 00 push $0x8d
jmp alltraps
8010606a: e9 2b f6 ff ff jmp 8010569a <alltraps>
8010606f <vector142>:
.globl vector142
vector142:
pushl $0
8010606f: 6a 00 push $0x0
pushl $142
80106071: 68 8e 00 00 00 push $0x8e
jmp alltraps
80106076: e9 1f f6 ff ff jmp 8010569a <alltraps>
8010607b <vector143>:
.globl vector143
vector143:
pushl $0
8010607b: 6a 00 push $0x0
pushl $143
8010607d: 68 8f 00 00 00 push $0x8f
jmp alltraps
80106082: e9 13 f6 ff ff jmp 8010569a <alltraps>
80106087 <vector144>:
.globl vector144
vector144:
pushl $0
80106087: 6a 00 push $0x0
pushl $144
80106089: 68 90 00 00 00 push $0x90
jmp alltraps
8010608e: e9 07 f6 ff ff jmp 8010569a <alltraps>
80106093 <vector145>:
.globl vector145
vector145:
pushl $0
80106093: 6a 00 push $0x0
pushl $145
80106095: 68 91 00 00 00 push $0x91
jmp alltraps
8010609a: e9 fb f5 ff ff jmp 8010569a <alltraps>
8010609f <vector146>:
.globl vector146
vector146:
pushl $0
8010609f: 6a 00 push $0x0
pushl $146
801060a1: 68 92 00 00 00 push $0x92
jmp alltraps
801060a6: e9 ef f5 ff ff jmp 8010569a <alltraps>
801060ab <vector147>:
.globl vector147
vector147:
pushl $0
801060ab: 6a 00 push $0x0
pushl $147
801060ad: 68 93 00 00 00 push $0x93
jmp alltraps
801060b2: e9 e3 f5 ff ff jmp 8010569a <alltraps>
801060b7 <vector148>:
.globl vector148
vector148:
pushl $0
801060b7: 6a 00 push $0x0
pushl $148
801060b9: 68 94 00 00 00 push $0x94
jmp alltraps
801060be: e9 d7 f5 ff ff jmp 8010569a <alltraps>
801060c3 <vector149>:
.globl vector149
vector149:
pushl $0
801060c3: 6a 00 push $0x0
pushl $149
801060c5: 68 95 00 00 00 push $0x95
jmp alltraps
801060ca: e9 cb f5 ff ff jmp 8010569a <alltraps>
801060cf <vector150>:
.globl vector150
vector150:
pushl $0
801060cf: 6a 00 push $0x0
pushl $150
801060d1: 68 96 00 00 00 push $0x96
jmp alltraps
801060d6: e9 bf f5 ff ff jmp 8010569a <alltraps>
801060db <vector151>:
.globl vector151
vector151:
pushl $0
801060db: 6a 00 push $0x0
pushl $151
801060dd: 68 97 00 00 00 push $0x97
jmp alltraps
801060e2: e9 b3 f5 ff ff jmp 8010569a <alltraps>
801060e7 <vector152>:
.globl vector152
vector152:
pushl $0
801060e7: 6a 00 push $0x0
pushl $152
801060e9: 68 98 00 00 00 push $0x98
jmp alltraps
801060ee: e9 a7 f5 ff ff jmp 8010569a <alltraps>
801060f3 <vector153>:
.globl vector153
vector153:
pushl $0
801060f3: 6a 00 push $0x0
pushl $153
801060f5: 68 99 00 00 00 push $0x99
jmp alltraps
801060fa: e9 9b f5 ff ff jmp 8010569a <alltraps>
801060ff <vector154>:
.globl vector154
vector154:
pushl $0
801060ff: 6a 00 push $0x0
pushl $154
80106101: 68 9a 00 00 00 push $0x9a
jmp alltraps
80106106: e9 8f f5 ff ff jmp 8010569a <alltraps>
8010610b <vector155>:
.globl vector155
vector155:
pushl $0
8010610b: 6a 00 push $0x0
pushl $155
8010610d: 68 9b 00 00 00 push $0x9b
jmp alltraps
80106112: e9 83 f5 ff ff jmp 8010569a <alltraps>
80106117 <vector156>:
.globl vector156
vector156:
pushl $0
80106117: 6a 00 push $0x0
pushl $156
80106119: 68 9c 00 00 00 push $0x9c
jmp alltraps
8010611e: e9 77 f5 ff ff jmp 8010569a <alltraps>
80106123 <vector157>:
.globl vector157
vector157:
pushl $0
80106123: 6a 00 push $0x0
pushl $157
80106125: 68 9d 00 00 00 push $0x9d
jmp alltraps
8010612a: e9 6b f5 ff ff jmp 8010569a <alltraps>
8010612f <vector158>:
.globl vector158
vector158:
pushl $0
8010612f: 6a 00 push $0x0
pushl $158
80106131: 68 9e 00 00 00 push $0x9e
jmp alltraps
80106136: e9 5f f5 ff ff jmp 8010569a <alltraps>
8010613b <vector159>:
.globl vector159
vector159:
pushl $0
8010613b: 6a 00 push $0x0
pushl $159
8010613d: 68 9f 00 00 00 push $0x9f
jmp alltraps
80106142: e9 53 f5 ff ff jmp 8010569a <alltraps>
80106147 <vector160>:
.globl vector160
vector160:
pushl $0
80106147: 6a 00 push $0x0
pushl $160
80106149: 68 a0 00 00 00 push $0xa0
jmp alltraps
8010614e: e9 47 f5 ff ff jmp 8010569a <alltraps>
80106153 <vector161>:
.globl vector161
vector161:
pushl $0
80106153: 6a 00 push $0x0
pushl $161
80106155: 68 a1 00 00 00 push $0xa1
jmp alltraps
8010615a: e9 3b f5 ff ff jmp 8010569a <alltraps>
8010615f <vector162>:
.globl vector162
vector162:
pushl $0
8010615f: 6a 00 push $0x0
pushl $162
80106161: 68 a2 00 00 00 push $0xa2
jmp alltraps
80106166: e9 2f f5 ff ff jmp 8010569a <alltraps>
8010616b <vector163>:
.globl vector163
vector163:
pushl $0
8010616b: 6a 00 push $0x0
pushl $163
8010616d: 68 a3 00 00 00 push $0xa3
jmp alltraps
80106172: e9 23 f5 ff ff jmp 8010569a <alltraps>
80106177 <vector164>:
.globl vector164
vector164:
pushl $0
80106177: 6a 00 push $0x0
pushl $164
80106179: 68 a4 00 00 00 push $0xa4
jmp alltraps
8010617e: e9 17 f5 ff ff jmp 8010569a <alltraps>
80106183 <vector165>:
.globl vector165
vector165:
pushl $0
80106183: 6a 00 push $0x0
pushl $165
80106185: 68 a5 00 00 00 push $0xa5
jmp alltraps
8010618a: e9 0b f5 ff ff jmp 8010569a <alltraps>
8010618f <vector166>:
.globl vector166
vector166:
pushl $0
8010618f: 6a 00 push $0x0
pushl $166
80106191: 68 a6 00 00 00 push $0xa6
jmp alltraps
80106196: e9 ff f4 ff ff jmp 8010569a <alltraps>
8010619b <vector167>:
.globl vector167
vector167:
pushl $0
8010619b: 6a 00 push $0x0
pushl $167
8010619d: 68 a7 00 00 00 push $0xa7
jmp alltraps
801061a2: e9 f3 f4 ff ff jmp 8010569a <alltraps>
801061a7 <vector168>:
.globl vector168
vector168:
pushl $0
801061a7: 6a 00 push $0x0
pushl $168
801061a9: 68 a8 00 00 00 push $0xa8
jmp alltraps
801061ae: e9 e7 f4 ff ff jmp 8010569a <alltraps>
801061b3 <vector169>:
.globl vector169
vector169:
pushl $0
801061b3: 6a 00 push $0x0
pushl $169
801061b5: 68 a9 00 00 00 push $0xa9
jmp alltraps
801061ba: e9 db f4 ff ff jmp 8010569a <alltraps>
801061bf <vector170>:
.globl vector170
vector170:
pushl $0
801061bf: 6a 00 push $0x0
pushl $170
801061c1: 68 aa 00 00 00 push $0xaa
jmp alltraps
801061c6: e9 cf f4 ff ff jmp 8010569a <alltraps>
801061cb <vector171>:
.globl vector171
vector171:
pushl $0
801061cb: 6a 00 push $0x0
pushl $171
801061cd: 68 ab 00 00 00 push $0xab
jmp alltraps
801061d2: e9 c3 f4 ff ff jmp 8010569a <alltraps>
801061d7 <vector172>:
.globl vector172
vector172:
pushl $0
801061d7: 6a 00 push $0x0
pushl $172
801061d9: 68 ac 00 00 00 push $0xac
jmp alltraps
801061de: e9 b7 f4 ff ff jmp 8010569a <alltraps>
801061e3 <vector173>:
.globl vector173
vector173:
pushl $0
801061e3: 6a 00 push $0x0
pushl $173
801061e5: 68 ad 00 00 00 push $0xad
jmp alltraps
801061ea: e9 ab f4 ff ff jmp 8010569a <alltraps>
801061ef <vector174>:
.globl vector174
vector174:
pushl $0
801061ef: 6a 00 push $0x0
pushl $174
801061f1: 68 ae 00 00 00 push $0xae
jmp alltraps
801061f6: e9 9f f4 ff ff jmp 8010569a <alltraps>
801061fb <vector175>:
.globl vector175
vector175:
pushl $0
801061fb: 6a 00 push $0x0
pushl $175
801061fd: 68 af 00 00 00 push $0xaf
jmp alltraps
80106202: e9 93 f4 ff ff jmp 8010569a <alltraps>
80106207 <vector176>:
.globl vector176
vector176:
pushl $0
80106207: 6a 00 push $0x0
pushl $176
80106209: 68 b0 00 00 00 push $0xb0
jmp alltraps
8010620e: e9 87 f4 ff ff jmp 8010569a <alltraps>
80106213 <vector177>:
.globl vector177
vector177:
pushl $0
80106213: 6a 00 push $0x0
pushl $177
80106215: 68 b1 00 00 00 push $0xb1
jmp alltraps
8010621a: e9 7b f4 ff ff jmp 8010569a <alltraps>
8010621f <vector178>:
.globl vector178
vector178:
pushl $0
8010621f: 6a 00 push $0x0
pushl $178
80106221: 68 b2 00 00 00 push $0xb2
jmp alltraps
80106226: e9 6f f4 ff ff jmp 8010569a <alltraps>
8010622b <vector179>:
.globl vector179
vector179:
pushl $0
8010622b: 6a 00 push $0x0
pushl $179
8010622d: 68 b3 00 00 00 push $0xb3
jmp alltraps
80106232: e9 63 f4 ff ff jmp 8010569a <alltraps>
80106237 <vector180>:
.globl vector180
vector180:
pushl $0
80106237: 6a 00 push $0x0
pushl $180
80106239: 68 b4 00 00 00 push $0xb4
jmp alltraps
8010623e: e9 57 f4 ff ff jmp 8010569a <alltraps>
80106243 <vector181>:
.globl vector181
vector181:
pushl $0
80106243: 6a 00 push $0x0
pushl $181
80106245: 68 b5 00 00 00 push $0xb5
jmp alltraps
8010624a: e9 4b f4 ff ff jmp 8010569a <alltraps>
8010624f <vector182>:
.globl vector182
vector182:
pushl $0
8010624f: 6a 00 push $0x0
pushl $182
80106251: 68 b6 00 00 00 push $0xb6
jmp alltraps
80106256: e9 3f f4 ff ff jmp 8010569a <alltraps>
8010625b <vector183>:
.globl vector183
vector183:
pushl $0
8010625b: 6a 00 push $0x0
pushl $183
8010625d: 68 b7 00 00 00 push $0xb7
jmp alltraps
80106262: e9 33 f4 ff ff jmp 8010569a <alltraps>
80106267 <vector184>:
.globl vector184
vector184:
pushl $0
80106267: 6a 00 push $0x0
pushl $184
80106269: 68 b8 00 00 00 push $0xb8
jmp alltraps
8010626e: e9 27 f4 ff ff jmp 8010569a <alltraps>
80106273 <vector185>:
.globl vector185
vector185:
pushl $0
80106273: 6a 00 push $0x0
pushl $185
80106275: 68 b9 00 00 00 push $0xb9
jmp alltraps
8010627a: e9 1b f4 ff ff jmp 8010569a <alltraps>
8010627f <vector186>:
.globl vector186
vector186:
pushl $0
8010627f: 6a 00 push $0x0
pushl $186
80106281: 68 ba 00 00 00 push $0xba
jmp alltraps
80106286: e9 0f f4 ff ff jmp 8010569a <alltraps>
8010628b <vector187>:
.globl vector187
vector187:
pushl $0
8010628b: 6a 00 push $0x0
pushl $187
8010628d: 68 bb 00 00 00 push $0xbb
jmp alltraps
80106292: e9 03 f4 ff ff jmp 8010569a <alltraps>
80106297 <vector188>:
.globl vector188
vector188:
pushl $0
80106297: 6a 00 push $0x0
pushl $188
80106299: 68 bc 00 00 00 push $0xbc
jmp alltraps
8010629e: e9 f7 f3 ff ff jmp 8010569a <alltraps>
801062a3 <vector189>:
.globl vector189
vector189:
pushl $0
801062a3: 6a 00 push $0x0
pushl $189
801062a5: 68 bd 00 00 00 push $0xbd
jmp alltraps
801062aa: e9 eb f3 ff ff jmp 8010569a <alltraps>
801062af <vector190>:
.globl vector190
vector190:
pushl $0
801062af: 6a 00 push $0x0
pushl $190
801062b1: 68 be 00 00 00 push $0xbe
jmp alltraps
801062b6: e9 df f3 ff ff jmp 8010569a <alltraps>
801062bb <vector191>:
.globl vector191
vector191:
pushl $0
801062bb: 6a 00 push $0x0
pushl $191
801062bd: 68 bf 00 00 00 push $0xbf
jmp alltraps
801062c2: e9 d3 f3 ff ff jmp 8010569a <alltraps>
801062c7 <vector192>:
.globl vector192
vector192:
pushl $0
801062c7: 6a 00 push $0x0
pushl $192
801062c9: 68 c0 00 00 00 push $0xc0
jmp alltraps
801062ce: e9 c7 f3 ff ff jmp 8010569a <alltraps>
801062d3 <vector193>:
.globl vector193
vector193:
pushl $0
801062d3: 6a 00 push $0x0
pushl $193
801062d5: 68 c1 00 00 00 push $0xc1
jmp alltraps
801062da: e9 bb f3 ff ff jmp 8010569a <alltraps>
801062df <vector194>:
.globl vector194
vector194:
pushl $0
801062df: 6a 00 push $0x0
pushl $194
801062e1: 68 c2 00 00 00 push $0xc2
jmp alltraps
801062e6: e9 af f3 ff ff jmp 8010569a <alltraps>
801062eb <vector195>:
.globl vector195
vector195:
pushl $0
801062eb: 6a 00 push $0x0
pushl $195
801062ed: 68 c3 00 00 00 push $0xc3
jmp alltraps
801062f2: e9 a3 f3 ff ff jmp 8010569a <alltraps>
801062f7 <vector196>:
.globl vector196
vector196:
pushl $0
801062f7: 6a 00 push $0x0
pushl $196
801062f9: 68 c4 00 00 00 push $0xc4
jmp alltraps
801062fe: e9 97 f3 ff ff jmp 8010569a <alltraps>
80106303 <vector197>:
.globl vector197
vector197:
pushl $0
80106303: 6a 00 push $0x0
pushl $197
80106305: 68 c5 00 00 00 push $0xc5
jmp alltraps
8010630a: e9 8b f3 ff ff jmp 8010569a <alltraps>
8010630f <vector198>:
.globl vector198
vector198:
pushl $0
8010630f: 6a 00 push $0x0
pushl $198
80106311: 68 c6 00 00 00 push $0xc6
jmp alltraps
80106316: e9 7f f3 ff ff jmp 8010569a <alltraps>
8010631b <vector199>:
.globl vector199
vector199:
pushl $0
8010631b: 6a 00 push $0x0
pushl $199
8010631d: 68 c7 00 00 00 push $0xc7
jmp alltraps
80106322: e9 73 f3 ff ff jmp 8010569a <alltraps>
80106327 <vector200>:
.globl vector200
vector200:
pushl $0
80106327: 6a 00 push $0x0
pushl $200
80106329: 68 c8 00 00 00 push $0xc8
jmp alltraps
8010632e: e9 67 f3 ff ff jmp 8010569a <alltraps>
80106333 <vector201>:
.globl vector201
vector201:
pushl $0
80106333: 6a 00 push $0x0
pushl $201
80106335: 68 c9 00 00 00 push $0xc9
jmp alltraps
8010633a: e9 5b f3 ff ff jmp 8010569a <alltraps>
8010633f <vector202>:
.globl vector202
vector202:
pushl $0
8010633f: 6a 00 push $0x0
pushl $202
80106341: 68 ca 00 00 00 push $0xca
jmp alltraps
80106346: e9 4f f3 ff ff jmp 8010569a <alltraps>
8010634b <vector203>:
.globl vector203
vector203:
pushl $0
8010634b: 6a 00 push $0x0
pushl $203
8010634d: 68 cb 00 00 00 push $0xcb
jmp alltraps
80106352: e9 43 f3 ff ff jmp 8010569a <alltraps>
80106357 <vector204>:
.globl vector204
vector204:
pushl $0
80106357: 6a 00 push $0x0
pushl $204
80106359: 68 cc 00 00 00 push $0xcc
jmp alltraps
8010635e: e9 37 f3 ff ff jmp 8010569a <alltraps>
80106363 <vector205>:
.globl vector205
vector205:
pushl $0
80106363: 6a 00 push $0x0
pushl $205
80106365: 68 cd 00 00 00 push $0xcd
jmp alltraps
8010636a: e9 2b f3 ff ff jmp 8010569a <alltraps>
8010636f <vector206>:
.globl vector206
vector206:
pushl $0
8010636f: 6a 00 push $0x0
pushl $206
80106371: 68 ce 00 00 00 push $0xce
jmp alltraps
80106376: e9 1f f3 ff ff jmp 8010569a <alltraps>
8010637b <vector207>:
.globl vector207
vector207:
pushl $0
8010637b: 6a 00 push $0x0
pushl $207
8010637d: 68 cf 00 00 00 push $0xcf
jmp alltraps
80106382: e9 13 f3 ff ff jmp 8010569a <alltraps>
80106387 <vector208>:
.globl vector208
vector208:
pushl $0
80106387: 6a 00 push $0x0
pushl $208
80106389: 68 d0 00 00 00 push $0xd0
jmp alltraps
8010638e: e9 07 f3 ff ff jmp 8010569a <alltraps>
80106393 <vector209>:
.globl vector209
vector209:
pushl $0
80106393: 6a 00 push $0x0
pushl $209
80106395: 68 d1 00 00 00 push $0xd1
jmp alltraps
8010639a: e9 fb f2 ff ff jmp 8010569a <alltraps>
8010639f <vector210>:
.globl vector210
vector210:
pushl $0
8010639f: 6a 00 push $0x0
pushl $210
801063a1: 68 d2 00 00 00 push $0xd2
jmp alltraps
801063a6: e9 ef f2 ff ff jmp 8010569a <alltraps>
801063ab <vector211>:
.globl vector211
vector211:
pushl $0
801063ab: 6a 00 push $0x0
pushl $211
801063ad: 68 d3 00 00 00 push $0xd3
jmp alltraps
801063b2: e9 e3 f2 ff ff jmp 8010569a <alltraps>
801063b7 <vector212>:
.globl vector212
vector212:
pushl $0
801063b7: 6a 00 push $0x0
pushl $212
801063b9: 68 d4 00 00 00 push $0xd4
jmp alltraps
801063be: e9 d7 f2 ff ff jmp 8010569a <alltraps>
801063c3 <vector213>:
.globl vector213
vector213:
pushl $0
801063c3: 6a 00 push $0x0
pushl $213
801063c5: 68 d5 00 00 00 push $0xd5
jmp alltraps
801063ca: e9 cb f2 ff ff jmp 8010569a <alltraps>
801063cf <vector214>:
.globl vector214
vector214:
pushl $0
801063cf: 6a 00 push $0x0
pushl $214
801063d1: 68 d6 00 00 00 push $0xd6
jmp alltraps
801063d6: e9 bf f2 ff ff jmp 8010569a <alltraps>
801063db <vector215>:
.globl vector215
vector215:
pushl $0
801063db: 6a 00 push $0x0
pushl $215
801063dd: 68 d7 00 00 00 push $0xd7
jmp alltraps
801063e2: e9 b3 f2 ff ff jmp 8010569a <alltraps>
801063e7 <vector216>:
.globl vector216
vector216:
pushl $0
801063e7: 6a 00 push $0x0
pushl $216
801063e9: 68 d8 00 00 00 push $0xd8
jmp alltraps
801063ee: e9 a7 f2 ff ff jmp 8010569a <alltraps>
801063f3 <vector217>:
.globl vector217
vector217:
pushl $0
801063f3: 6a 00 push $0x0
pushl $217
801063f5: 68 d9 00 00 00 push $0xd9
jmp alltraps
801063fa: e9 9b f2 ff ff jmp 8010569a <alltraps>
801063ff <vector218>:
.globl vector218
vector218:
pushl $0
801063ff: 6a 00 push $0x0
pushl $218
80106401: 68 da 00 00 00 push $0xda
jmp alltraps
80106406: e9 8f f2 ff ff jmp 8010569a <alltraps>
8010640b <vector219>:
.globl vector219
vector219:
pushl $0
8010640b: 6a 00 push $0x0
pushl $219
8010640d: 68 db 00 00 00 push $0xdb
jmp alltraps
80106412: e9 83 f2 ff ff jmp 8010569a <alltraps>
80106417 <vector220>:
.globl vector220
vector220:
pushl $0
80106417: 6a 00 push $0x0
pushl $220
80106419: 68 dc 00 00 00 push $0xdc
jmp alltraps
8010641e: e9 77 f2 ff ff jmp 8010569a <alltraps>
80106423 <vector221>:
.globl vector221
vector221:
pushl $0
80106423: 6a 00 push $0x0
pushl $221
80106425: 68 dd 00 00 00 push $0xdd
jmp alltraps
8010642a: e9 6b f2 ff ff jmp 8010569a <alltraps>
8010642f <vector222>:
.globl vector222
vector222:
pushl $0
8010642f: 6a 00 push $0x0
pushl $222
80106431: 68 de 00 00 00 push $0xde
jmp alltraps
80106436: e9 5f f2 ff ff jmp 8010569a <alltraps>
8010643b <vector223>:
.globl vector223
vector223:
pushl $0
8010643b: 6a 00 push $0x0
pushl $223
8010643d: 68 df 00 00 00 push $0xdf
jmp alltraps
80106442: e9 53 f2 ff ff jmp 8010569a <alltraps>
80106447 <vector224>:
.globl vector224
vector224:
pushl $0
80106447: 6a 00 push $0x0
pushl $224
80106449: 68 e0 00 00 00 push $0xe0
jmp alltraps
8010644e: e9 47 f2 ff ff jmp 8010569a <alltraps>
80106453 <vector225>:
.globl vector225
vector225:
pushl $0
80106453: 6a 00 push $0x0
pushl $225
80106455: 68 e1 00 00 00 push $0xe1
jmp alltraps
8010645a: e9 3b f2 ff ff jmp 8010569a <alltraps>
8010645f <vector226>:
.globl vector226
vector226:
pushl $0
8010645f: 6a 00 push $0x0
pushl $226
80106461: 68 e2 00 00 00 push $0xe2
jmp alltraps
80106466: e9 2f f2 ff ff jmp 8010569a <alltraps>
8010646b <vector227>:
.globl vector227
vector227:
pushl $0
8010646b: 6a 00 push $0x0
pushl $227
8010646d: 68 e3 00 00 00 push $0xe3
jmp alltraps
80106472: e9 23 f2 ff ff jmp 8010569a <alltraps>
80106477 <vector228>:
.globl vector228
vector228:
pushl $0
80106477: 6a 00 push $0x0
pushl $228
80106479: 68 e4 00 00 00 push $0xe4
jmp alltraps
8010647e: e9 17 f2 ff ff jmp 8010569a <alltraps>
80106483 <vector229>:
.globl vector229
vector229:
pushl $0
80106483: 6a 00 push $0x0
pushl $229
80106485: 68 e5 00 00 00 push $0xe5
jmp alltraps
8010648a: e9 0b f2 ff ff jmp 8010569a <alltraps>
8010648f <vector230>:
.globl vector230
vector230:
pushl $0
8010648f: 6a 00 push $0x0
pushl $230
80106491: 68 e6 00 00 00 push $0xe6
jmp alltraps
80106496: e9 ff f1 ff ff jmp 8010569a <alltraps>
8010649b <vector231>:
.globl vector231
vector231:
pushl $0
8010649b: 6a 00 push $0x0
pushl $231
8010649d: 68 e7 00 00 00 push $0xe7
jmp alltraps
801064a2: e9 f3 f1 ff ff jmp 8010569a <alltraps>
801064a7 <vector232>:
.globl vector232
vector232:
pushl $0
801064a7: 6a 00 push $0x0
pushl $232
801064a9: 68 e8 00 00 00 push $0xe8
jmp alltraps
801064ae: e9 e7 f1 ff ff jmp 8010569a <alltraps>
801064b3 <vector233>:
.globl vector233
vector233:
pushl $0
801064b3: 6a 00 push $0x0
pushl $233
801064b5: 68 e9 00 00 00 push $0xe9
jmp alltraps
801064ba: e9 db f1 ff ff jmp 8010569a <alltraps>
801064bf <vector234>:
.globl vector234
vector234:
pushl $0
801064bf: 6a 00 push $0x0
pushl $234
801064c1: 68 ea 00 00 00 push $0xea
jmp alltraps
801064c6: e9 cf f1 ff ff jmp 8010569a <alltraps>
801064cb <vector235>:
.globl vector235
vector235:
pushl $0
801064cb: 6a 00 push $0x0
pushl $235
801064cd: 68 eb 00 00 00 push $0xeb
jmp alltraps
801064d2: e9 c3 f1 ff ff jmp 8010569a <alltraps>
801064d7 <vector236>:
.globl vector236
vector236:
pushl $0
801064d7: 6a 00 push $0x0
pushl $236
801064d9: 68 ec 00 00 00 push $0xec
jmp alltraps
801064de: e9 b7 f1 ff ff jmp 8010569a <alltraps>
801064e3 <vector237>:
.globl vector237
vector237:
pushl $0
801064e3: 6a 00 push $0x0
pushl $237
801064e5: 68 ed 00 00 00 push $0xed
jmp alltraps
801064ea: e9 ab f1 ff ff jmp 8010569a <alltraps>
801064ef <vector238>:
.globl vector238
vector238:
pushl $0
801064ef: 6a 00 push $0x0
pushl $238
801064f1: 68 ee 00 00 00 push $0xee
jmp alltraps
801064f6: e9 9f f1 ff ff jmp 8010569a <alltraps>
801064fb <vector239>:
.globl vector239
vector239:
pushl $0
801064fb: 6a 00 push $0x0
pushl $239
801064fd: 68 ef 00 00 00 push $0xef
jmp alltraps
80106502: e9 93 f1 ff ff jmp 8010569a <alltraps>
80106507 <vector240>:
.globl vector240
vector240:
pushl $0
80106507: 6a 00 push $0x0
pushl $240
80106509: 68 f0 00 00 00 push $0xf0
jmp alltraps
8010650e: e9 87 f1 ff ff jmp 8010569a <alltraps>
80106513 <vector241>:
.globl vector241
vector241:
pushl $0
80106513: 6a 00 push $0x0
pushl $241
80106515: 68 f1 00 00 00 push $0xf1
jmp alltraps
8010651a: e9 7b f1 ff ff jmp 8010569a <alltraps>
8010651f <vector242>:
.globl vector242
vector242:
pushl $0
8010651f: 6a 00 push $0x0
pushl $242
80106521: 68 f2 00 00 00 push $0xf2
jmp alltraps
80106526: e9 6f f1 ff ff jmp 8010569a <alltraps>
8010652b <vector243>:
.globl vector243
vector243:
pushl $0
8010652b: 6a 00 push $0x0
pushl $243
8010652d: 68 f3 00 00 00 push $0xf3
jmp alltraps
80106532: e9 63 f1 ff ff jmp 8010569a <alltraps>
80106537 <vector244>:
.globl vector244
vector244:
pushl $0
80106537: 6a 00 push $0x0
pushl $244
80106539: 68 f4 00 00 00 push $0xf4
jmp alltraps
8010653e: e9 57 f1 ff ff jmp 8010569a <alltraps>
80106543 <vector245>:
.globl vector245
vector245:
pushl $0
80106543: 6a 00 push $0x0
pushl $245
80106545: 68 f5 00 00 00 push $0xf5
jmp alltraps
8010654a: e9 4b f1 ff ff jmp 8010569a <alltraps>
8010654f <vector246>:
.globl vector246
vector246:
pushl $0
8010654f: 6a 00 push $0x0
pushl $246
80106551: 68 f6 00 00 00 push $0xf6
jmp alltraps
80106556: e9 3f f1 ff ff jmp 8010569a <alltraps>
8010655b <vector247>:
.globl vector247
vector247:
pushl $0
8010655b: 6a 00 push $0x0
pushl $247
8010655d: 68 f7 00 00 00 push $0xf7
jmp alltraps
80106562: e9 33 f1 ff ff jmp 8010569a <alltraps>
80106567 <vector248>:
.globl vector248
vector248:
pushl $0
80106567: 6a 00 push $0x0
pushl $248
80106569: 68 f8 00 00 00 push $0xf8
jmp alltraps
8010656e: e9 27 f1 ff ff jmp 8010569a <alltraps>
80106573 <vector249>:
.globl vector249
vector249:
pushl $0
80106573: 6a 00 push $0x0
pushl $249
80106575: 68 f9 00 00 00 push $0xf9
jmp alltraps
8010657a: e9 1b f1 ff ff jmp 8010569a <alltraps>
8010657f <vector250>:
.globl vector250
vector250:
pushl $0
8010657f: 6a 00 push $0x0
pushl $250
80106581: 68 fa 00 00 00 push $0xfa
jmp alltraps
80106586: e9 0f f1 ff ff jmp 8010569a <alltraps>
8010658b <vector251>:
.globl vector251
vector251:
pushl $0
8010658b: 6a 00 push $0x0
pushl $251
8010658d: 68 fb 00 00 00 push $0xfb
jmp alltraps
80106592: e9 03 f1 ff ff jmp 8010569a <alltraps>
80106597 <vector252>:
.globl vector252
vector252:
pushl $0
80106597: 6a 00 push $0x0
pushl $252
80106599: 68 fc 00 00 00 push $0xfc
jmp alltraps
8010659e: e9 f7 f0 ff ff jmp 8010569a <alltraps>
801065a3 <vector253>:
.globl vector253
vector253:
pushl $0
801065a3: 6a 00 push $0x0
pushl $253
801065a5: 68 fd 00 00 00 push $0xfd
jmp alltraps
801065aa: e9 eb f0 ff ff jmp 8010569a <alltraps>
801065af <vector254>:
.globl vector254
vector254:
pushl $0
801065af: 6a 00 push $0x0
pushl $254
801065b1: 68 fe 00 00 00 push $0xfe
jmp alltraps
801065b6: e9 df f0 ff ff jmp 8010569a <alltraps>
801065bb <vector255>:
.globl vector255
vector255:
pushl $0
801065bb: 6a 00 push $0x0
pushl $255
801065bd: 68 ff 00 00 00 push $0xff
jmp alltraps
801065c2: e9 d3 f0 ff ff jmp 8010569a <alltraps>
801065c7: 66 90 xchg %ax,%ax
801065c9: 66 90 xchg %ax,%ax
801065cb: 66 90 xchg %ax,%ax
801065cd: 66 90 xchg %ax,%ax
801065cf: 90 nop
801065d0 <walkpgdir>:
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va. If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
801065d0: 55 push %ebp
801065d1: 89 e5 mov %esp,%ebp
801065d3: 57 push %edi
801065d4: 56 push %esi
801065d5: 53 push %ebx
801065d6: 89 d3 mov %edx,%ebx
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
801065d8: c1 ea 16 shr $0x16,%edx
801065db: 8d 3c 90 lea (%eax,%edx,4),%edi
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va. If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
801065de: 83 ec 0c sub $0xc,%esp
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
801065e1: 8b 07 mov (%edi),%eax
801065e3: a8 01 test $0x1,%al
801065e5: 74 29 je 80106610 <walkpgdir+0x40>
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
801065e7: 25 00 f0 ff ff and $0xfffff000,%eax
801065ec: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
}
return &pgtab[PTX(va)];
}
801065f2: 8d 65 f4 lea -0xc(%ebp),%esp
// The permissions here are overly generous, but they can
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
}
return &pgtab[PTX(va)];
801065f5: c1 eb 0a shr $0xa,%ebx
801065f8: 81 e3 fc 0f 00 00 and $0xffc,%ebx
801065fe: 8d 04 1e lea (%esi,%ebx,1),%eax
}
80106601: 5b pop %ebx
80106602: 5e pop %esi
80106603: 5f pop %edi
80106604: 5d pop %ebp
80106605: c3 ret
80106606: 8d 76 00 lea 0x0(%esi),%esi
80106609: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
80106610: 85 c9 test %ecx,%ecx
80106612: 74 2c je 80106640 <walkpgdir+0x70>
80106614: e8 f7 be ff ff call 80102510 <kalloc>
80106619: 85 c0 test %eax,%eax
8010661b: 89 c6 mov %eax,%esi
8010661d: 74 21 je 80106640 <walkpgdir+0x70>
return 0;
// Make sure all those PTE_P bits are zero.
memset(pgtab, 0, PGSIZE);
8010661f: 83 ec 04 sub $0x4,%esp
80106622: 68 00 10 00 00 push $0x1000
80106627: 6a 00 push $0x0
80106629: 50 push %eax
8010662a: e8 71 de ff ff call 801044a0 <memset>
// The permissions here are overly generous, but they can
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
8010662f: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax
80106635: 83 c4 10 add $0x10,%esp
80106638: 83 c8 07 or $0x7,%eax
8010663b: 89 07 mov %eax,(%edi)
8010663d: eb b3 jmp 801065f2 <walkpgdir+0x22>
8010663f: 90 nop
}
return &pgtab[PTX(va)];
}
80106640: 8d 65 f4 lea -0xc(%ebp),%esp
pde = &pgdir[PDX(va)];
if(*pde & PTE_P){
pgtab = (pte_t*)P2V(PTE_ADDR(*pde));
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
return 0;
80106643: 31 c0 xor %eax,%eax
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U;
}
return &pgtab[PTX(va)];
}
80106645: 5b pop %ebx
80106646: 5e pop %esi
80106647: 5f pop %edi
80106648: 5d pop %ebp
80106649: c3 ret
8010664a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106650 <mappages>:
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
80106650: 55 push %ebp
80106651: 89 e5 mov %esp,%ebp
80106653: 57 push %edi
80106654: 56 push %esi
80106655: 53 push %ebx
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
80106656: 89 d3 mov %edx,%ebx
80106658: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
8010665e: 83 ec 1c sub $0x1c,%esp
80106661: 89 45 e4 mov %eax,-0x1c(%ebp)
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
80106664: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax
80106668: 8b 7d 08 mov 0x8(%ebp),%edi
8010666b: 25 00 f0 ff ff and $0xfffff000,%eax
80106670: 89 45 e0 mov %eax,-0x20(%ebp)
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
80106673: 8b 45 0c mov 0xc(%ebp),%eax
80106676: 29 df sub %ebx,%edi
80106678: 83 c8 01 or $0x1,%eax
8010667b: 89 45 dc mov %eax,-0x24(%ebp)
8010667e: eb 15 jmp 80106695 <mappages+0x45>
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
80106680: f6 00 01 testb $0x1,(%eax)
80106683: 75 45 jne 801066ca <mappages+0x7a>
panic("remap");
*pte = pa | perm | PTE_P;
80106685: 0b 75 dc or -0x24(%ebp),%esi
if(a == last)
80106688: 3b 5d e0 cmp -0x20(%ebp),%ebx
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
8010668b: 89 30 mov %esi,(%eax)
if(a == last)
8010668d: 74 31 je 801066c0 <mappages+0x70>
break;
a += PGSIZE;
8010668f: 81 c3 00 10 00 00 add $0x1000,%ebx
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
80106695: 8b 45 e4 mov -0x1c(%ebp),%eax
80106698: b9 01 00 00 00 mov $0x1,%ecx
8010669d: 89 da mov %ebx,%edx
8010669f: 8d 34 3b lea (%ebx,%edi,1),%esi
801066a2: e8 29 ff ff ff call 801065d0 <walkpgdir>
801066a7: 85 c0 test %eax,%eax
801066a9: 75 d5 jne 80106680 <mappages+0x30>
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
}
801066ab: 8d 65 f4 lea -0xc(%ebp),%esp
a = (char*)PGROUNDDOWN((uint)va);
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
801066ae: b8 ff ff ff ff mov $0xffffffff,%eax
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
}
801066b3: 5b pop %ebx
801066b4: 5e pop %esi
801066b5: 5f pop %edi
801066b6: 5d pop %ebp
801066b7: c3 ret
801066b8: 90 nop
801066b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801066c0: 8d 65 f4 lea -0xc(%ebp),%esp
if(a == last)
break;
a += PGSIZE;
pa += PGSIZE;
}
return 0;
801066c3: 31 c0 xor %eax,%eax
}
801066c5: 5b pop %ebx
801066c6: 5e pop %esi
801066c7: 5f pop %edi
801066c8: 5d pop %ebp
801066c9: c3 ret
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
return -1;
if(*pte & PTE_P)
panic("remap");
801066ca: 83 ec 0c sub $0xc,%esp
801066cd: 68 28 78 10 80 push $0x80107828
801066d2: e8 99 9c ff ff call 80100370 <panic>
801066d7: 89 f6 mov %esi,%esi
801066d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801066e0 <deallocuvm.part.0>:
// Deallocate user pages to bring the process size from oldsz to
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
801066e0: 55 push %ebp
801066e1: 89 e5 mov %esp,%ebp
801066e3: 57 push %edi
801066e4: 56 push %esi
801066e5: 53 push %ebx
uint a, pa;
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
801066e6: 8d 99 ff 0f 00 00 lea 0xfff(%ecx),%ebx
// Deallocate user pages to bring the process size from oldsz to
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
801066ec: 89 c7 mov %eax,%edi
uint a, pa;
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
801066ee: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
// Deallocate user pages to bring the process size from oldsz to
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
801066f4: 83 ec 1c sub $0x1c,%esp
801066f7: 89 4d e0 mov %ecx,-0x20(%ebp)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
801066fa: 39 d3 cmp %edx,%ebx
801066fc: 73 66 jae 80106764 <deallocuvm.part.0+0x84>
801066fe: 89 d6 mov %edx,%esi
80106700: eb 3d jmp 8010673f <deallocuvm.part.0+0x5f>
80106702: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
pte = walkpgdir(pgdir, (char*)a, 0);
if(!pte)
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
else if((*pte & PTE_P) != 0){
80106708: 8b 10 mov (%eax),%edx
8010670a: f6 c2 01 test $0x1,%dl
8010670d: 74 26 je 80106735 <deallocuvm.part.0+0x55>
pa = PTE_ADDR(*pte);
if(pa == 0)
8010670f: 81 e2 00 f0 ff ff and $0xfffff000,%edx
80106715: 74 58 je 8010676f <deallocuvm.part.0+0x8f>
panic("kfree");
char *v = P2V(pa);
kfree(v);
80106717: 83 ec 0c sub $0xc,%esp
8010671a: 81 c2 00 00 00 80 add $0x80000000,%edx
80106720: 89 45 e4 mov %eax,-0x1c(%ebp)
80106723: 52 push %edx
80106724: e8 37 bc ff ff call 80102360 <kfree>
*pte = 0;
80106729: 8b 45 e4 mov -0x1c(%ebp),%eax
8010672c: 83 c4 10 add $0x10,%esp
8010672f: c7 00 00 00 00 00 movl $0x0,(%eax)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
80106735: 81 c3 00 10 00 00 add $0x1000,%ebx
8010673b: 39 f3 cmp %esi,%ebx
8010673d: 73 25 jae 80106764 <deallocuvm.part.0+0x84>
pte = walkpgdir(pgdir, (char*)a, 0);
8010673f: 31 c9 xor %ecx,%ecx
80106741: 89 da mov %ebx,%edx
80106743: 89 f8 mov %edi,%eax
80106745: e8 86 fe ff ff call 801065d0 <walkpgdir>
if(!pte)
8010674a: 85 c0 test %eax,%eax
8010674c: 75 ba jne 80106708 <deallocuvm.part.0+0x28>
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
8010674e: 81 e3 00 00 c0 ff and $0xffc00000,%ebx
80106754: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
8010675a: 81 c3 00 10 00 00 add $0x1000,%ebx
80106760: 39 f3 cmp %esi,%ebx
80106762: 72 db jb 8010673f <deallocuvm.part.0+0x5f>
kfree(v);
*pte = 0;
}
}
return newsz;
}
80106764: 8b 45 e0 mov -0x20(%ebp),%eax
80106767: 8d 65 f4 lea -0xc(%ebp),%esp
8010676a: 5b pop %ebx
8010676b: 5e pop %esi
8010676c: 5f pop %edi
8010676d: 5d pop %ebp
8010676e: c3 ret
if(!pte)
a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
else if((*pte & PTE_P) != 0){
pa = PTE_ADDR(*pte);
if(pa == 0)
panic("kfree");
8010676f: 83 ec 0c sub $0xc,%esp
80106772: 68 c6 71 10 80 push $0x801071c6
80106777: e8 f4 9b ff ff call 80100370 <panic>
8010677c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106780 <seginit>:
// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
80106780: 55 push %ebp
80106781: 89 e5 mov %esp,%ebp
80106783: 83 ec 18 sub $0x18,%esp
// Map "logical" addresses to virtual addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpuid()];
80106786: e8 55 d0 ff ff call 801037e0 <cpuid>
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
8010678b: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax
80106791: 31 c9 xor %ecx,%ecx
80106793: ba ff ff ff ff mov $0xffffffff,%edx
80106798: 66 89 90 f8 27 11 80 mov %dx,-0x7feed808(%eax)
8010679f: 66 89 88 fa 27 11 80 mov %cx,-0x7feed806(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801067a6: ba ff ff ff ff mov $0xffffffff,%edx
801067ab: 31 c9 xor %ecx,%ecx
801067ad: 66 89 90 00 28 11 80 mov %dx,-0x7feed800(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
801067b4: ba ff ff ff ff mov $0xffffffff,%edx
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpuid()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801067b9: 66 89 88 02 28 11 80 mov %cx,-0x7feed7fe(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
801067c0: 31 c9 xor %ecx,%ecx
801067c2: 66 89 90 08 28 11 80 mov %dx,-0x7feed7f8(%eax)
801067c9: 66 89 88 0a 28 11 80 mov %cx,-0x7feed7f6(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
801067d0: ba ff ff ff ff mov $0xffffffff,%edx
801067d5: 31 c9 xor %ecx,%ecx
801067d7: 66 89 90 10 28 11 80 mov %dx,-0x7feed7f0(%eax)
// Map "logical" addresses to virtual addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpuid()];
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
801067de: c6 80 fc 27 11 80 00 movb $0x0,-0x7feed804(%eax)
static inline void
lgdt(struct segdesc *p, int size)
{
volatile ushort pd[3];
pd[0] = size-1;
801067e5: ba 2f 00 00 00 mov $0x2f,%edx
801067ea: c6 80 fd 27 11 80 9a movb $0x9a,-0x7feed803(%eax)
801067f1: c6 80 fe 27 11 80 cf movb $0xcf,-0x7feed802(%eax)
801067f8: c6 80 ff 27 11 80 00 movb $0x0,-0x7feed801(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801067ff: c6 80 04 28 11 80 00 movb $0x0,-0x7feed7fc(%eax)
80106806: c6 80 05 28 11 80 92 movb $0x92,-0x7feed7fb(%eax)
8010680d: c6 80 06 28 11 80 cf movb $0xcf,-0x7feed7fa(%eax)
80106814: c6 80 07 28 11 80 00 movb $0x0,-0x7feed7f9(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
8010681b: c6 80 0c 28 11 80 00 movb $0x0,-0x7feed7f4(%eax)
80106822: c6 80 0d 28 11 80 fa movb $0xfa,-0x7feed7f3(%eax)
80106829: c6 80 0e 28 11 80 cf movb $0xcf,-0x7feed7f2(%eax)
80106830: c6 80 0f 28 11 80 00 movb $0x0,-0x7feed7f1(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80106837: 66 89 88 12 28 11 80 mov %cx,-0x7feed7ee(%eax)
8010683e: c6 80 14 28 11 80 00 movb $0x0,-0x7feed7ec(%eax)
80106845: c6 80 15 28 11 80 f2 movb $0xf2,-0x7feed7eb(%eax)
8010684c: c6 80 16 28 11 80 cf movb $0xcf,-0x7feed7ea(%eax)
80106853: c6 80 17 28 11 80 00 movb $0x0,-0x7feed7e9(%eax)
lgdt(c->gdt, sizeof(c->gdt));
8010685a: 05 f0 27 11 80 add $0x801127f0,%eax
8010685f: 66 89 55 f2 mov %dx,-0xe(%ebp)
pd[1] = (uint)p;
80106863: 66 89 45 f4 mov %ax,-0xc(%ebp)
pd[2] = (uint)p >> 16;
80106867: c1 e8 10 shr $0x10,%eax
8010686a: 66 89 45 f6 mov %ax,-0xa(%ebp)
asm volatile("lgdt (%0)" : : "r" (pd));
8010686e: 8d 45 f2 lea -0xe(%ebp),%eax
80106871: 0f 01 10 lgdtl (%eax)
}
80106874: c9 leave
80106875: c3 ret
80106876: 8d 76 00 lea 0x0(%esi),%esi
80106879: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106880 <switchkvm>:
}
static inline void
lcr3(uint val)
{
asm volatile("movl %0,%%cr3" : : "r" (val));
80106880: a1 a4 54 11 80 mov 0x801154a4,%eax
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
80106885: 55 push %ebp
80106886: 89 e5 mov %esp,%ebp
80106888: 05 00 00 00 80 add $0x80000000,%eax
8010688d: 0f 22 d8 mov %eax,%cr3
lcr3(V2P(kpgdir)); // switch to the kernel page table
}
80106890: 5d pop %ebp
80106891: c3 ret
80106892: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106899: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
801068a0 <switchuvm>:
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
801068a0: 55 push %ebp
801068a1: 89 e5 mov %esp,%ebp
801068a3: 57 push %edi
801068a4: 56 push %esi
801068a5: 53 push %ebx
801068a6: 83 ec 1c sub $0x1c,%esp
801068a9: 8b 75 08 mov 0x8(%ebp),%esi
if(p == 0)
801068ac: 85 f6 test %esi,%esi
801068ae: 0f 84 cd 00 00 00 je 80106981 <switchuvm+0xe1>
panic("switchuvm: no process");
if(p->kstack == 0)
801068b4: 8b 46 08 mov 0x8(%esi),%eax
801068b7: 85 c0 test %eax,%eax
801068b9: 0f 84 dc 00 00 00 je 8010699b <switchuvm+0xfb>
panic("switchuvm: no kstack");
if(p->pgdir == 0)
801068bf: 8b 7e 04 mov 0x4(%esi),%edi
801068c2: 85 ff test %edi,%edi
801068c4: 0f 84 c4 00 00 00 je 8010698e <switchuvm+0xee>
panic("switchuvm: no pgdir");
pushcli();
801068ca: e8 f1 d9 ff ff call 801042c0 <pushcli>
mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts,
801068cf: e8 8c ce ff ff call 80103760 <mycpu>
801068d4: 89 c3 mov %eax,%ebx
801068d6: e8 85 ce ff ff call 80103760 <mycpu>
801068db: 89 c7 mov %eax,%edi
801068dd: e8 7e ce ff ff call 80103760 <mycpu>
801068e2: 89 45 e4 mov %eax,-0x1c(%ebp)
801068e5: 83 c7 08 add $0x8,%edi
801068e8: e8 73 ce ff ff call 80103760 <mycpu>
801068ed: 8b 4d e4 mov -0x1c(%ebp),%ecx
801068f0: 83 c0 08 add $0x8,%eax
801068f3: ba 67 00 00 00 mov $0x67,%edx
801068f8: c1 e8 18 shr $0x18,%eax
801068fb: 66 89 93 98 00 00 00 mov %dx,0x98(%ebx)
80106902: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx)
80106909: c6 83 9d 00 00 00 99 movb $0x99,0x9d(%ebx)
80106910: c6 83 9e 00 00 00 40 movb $0x40,0x9e(%ebx)
80106917: 83 c1 08 add $0x8,%ecx
8010691a: 88 83 9f 00 00 00 mov %al,0x9f(%ebx)
80106920: c1 e9 10 shr $0x10,%ecx
80106923: 88 8b 9c 00 00 00 mov %cl,0x9c(%ebx)
mycpu()->gdt[SEG_TSS].s = 0;
mycpu()->ts.ss0 = SEG_KDATA << 3;
mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE;
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
mycpu()->ts.iomb = (ushort) 0xFFFF;
80106929: bb ff ff ff ff mov $0xffffffff,%ebx
panic("switchuvm: no pgdir");
pushcli();
mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts,
sizeof(mycpu()->ts)-1, 0);
mycpu()->gdt[SEG_TSS].s = 0;
8010692e: e8 2d ce ff ff call 80103760 <mycpu>
80106933: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax)
mycpu()->ts.ss0 = SEG_KDATA << 3;
8010693a: e8 21 ce ff ff call 80103760 <mycpu>
8010693f: b9 10 00 00 00 mov $0x10,%ecx
80106944: 66 89 48 10 mov %cx,0x10(%eax)
mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE;
80106948: e8 13 ce ff ff call 80103760 <mycpu>
8010694d: 8b 56 08 mov 0x8(%esi),%edx
80106950: 8d 8a 00 10 00 00 lea 0x1000(%edx),%ecx
80106956: 89 48 0c mov %ecx,0xc(%eax)
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
mycpu()->ts.iomb = (ushort) 0xFFFF;
80106959: e8 02 ce ff ff call 80103760 <mycpu>
8010695e: 66 89 58 6e mov %bx,0x6e(%eax)
}
static inline void
ltr(ushort sel)
{
asm volatile("ltr %0" : : "r" (sel));
80106962: b8 28 00 00 00 mov $0x28,%eax
80106967: 0f 00 d8 ltr %ax
}
static inline void
lcr3(uint val)
{
asm volatile("movl %0,%%cr3" : : "r" (val));
8010696a: 8b 46 04 mov 0x4(%esi),%eax
8010696d: 05 00 00 00 80 add $0x80000000,%eax
80106972: 0f 22 d8 mov %eax,%cr3
ltr(SEG_TSS << 3);
lcr3(V2P(p->pgdir)); // switch to process's address space
popcli();
}
80106975: 8d 65 f4 lea -0xc(%ebp),%esp
80106978: 5b pop %ebx
80106979: 5e pop %esi
8010697a: 5f pop %edi
8010697b: 5d pop %ebp
// setting IOPL=0 in eflags *and* iomb beyond the tss segment limit
// forbids I/O instructions (e.g., inb and outb) from user space
mycpu()->ts.iomb = (ushort) 0xFFFF;
ltr(SEG_TSS << 3);
lcr3(V2P(p->pgdir)); // switch to process's address space
popcli();
8010697c: e9 7f d9 ff ff jmp 80104300 <popcli>
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
if(p == 0)
panic("switchuvm: no process");
80106981: 83 ec 0c sub $0xc,%esp
80106984: 68 2e 78 10 80 push $0x8010782e
80106989: e8 e2 99 ff ff call 80100370 <panic>
if(p->kstack == 0)
panic("switchuvm: no kstack");
if(p->pgdir == 0)
panic("switchuvm: no pgdir");
8010698e: 83 ec 0c sub $0xc,%esp
80106991: 68 59 78 10 80 push $0x80107859
80106996: e8 d5 99 ff ff call 80100370 <panic>
switchuvm(struct proc *p)
{
if(p == 0)
panic("switchuvm: no process");
if(p->kstack == 0)
panic("switchuvm: no kstack");
8010699b: 83 ec 0c sub $0xc,%esp
8010699e: 68 44 78 10 80 push $0x80107844
801069a3: e8 c8 99 ff ff call 80100370 <panic>
801069a8: 90 nop
801069a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
801069b0 <inituvm>:
// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
801069b0: 55 push %ebp
801069b1: 89 e5 mov %esp,%ebp
801069b3: 57 push %edi
801069b4: 56 push %esi
801069b5: 53 push %ebx
801069b6: 83 ec 1c sub $0x1c,%esp
801069b9: 8b 75 10 mov 0x10(%ebp),%esi
801069bc: 8b 45 08 mov 0x8(%ebp),%eax
801069bf: 8b 7d 0c mov 0xc(%ebp),%edi
char *mem;
if(sz >= PGSIZE)
801069c2: 81 fe ff 0f 00 00 cmp $0xfff,%esi
// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
801069c8: 89 45 e4 mov %eax,-0x1c(%ebp)
char *mem;
if(sz >= PGSIZE)
801069cb: 77 49 ja 80106a16 <inituvm+0x66>
panic("inituvm: more than a page");
mem = kalloc();
801069cd: e8 3e bb ff ff call 80102510 <kalloc>
memset(mem, 0, PGSIZE);
801069d2: 83 ec 04 sub $0x4,%esp
{
char *mem;
if(sz >= PGSIZE)
panic("inituvm: more than a page");
mem = kalloc();
801069d5: 89 c3 mov %eax,%ebx
memset(mem, 0, PGSIZE);
801069d7: 68 00 10 00 00 push $0x1000
801069dc: 6a 00 push $0x0
801069de: 50 push %eax
801069df: e8 bc da ff ff call 801044a0 <memset>
mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U);
801069e4: 58 pop %eax
801069e5: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax
801069eb: b9 00 10 00 00 mov $0x1000,%ecx
801069f0: 5a pop %edx
801069f1: 6a 06 push $0x6
801069f3: 50 push %eax
801069f4: 31 d2 xor %edx,%edx
801069f6: 8b 45 e4 mov -0x1c(%ebp),%eax
801069f9: e8 52 fc ff ff call 80106650 <mappages>
memmove(mem, init, sz);
801069fe: 89 75 10 mov %esi,0x10(%ebp)
80106a01: 89 7d 0c mov %edi,0xc(%ebp)
80106a04: 83 c4 10 add $0x10,%esp
80106a07: 89 5d 08 mov %ebx,0x8(%ebp)
}
80106a0a: 8d 65 f4 lea -0xc(%ebp),%esp
80106a0d: 5b pop %ebx
80106a0e: 5e pop %esi
80106a0f: 5f pop %edi
80106a10: 5d pop %ebp
if(sz >= PGSIZE)
panic("inituvm: more than a page");
mem = kalloc();
memset(mem, 0, PGSIZE);
mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U);
memmove(mem, init, sz);
80106a11: e9 3a db ff ff jmp 80104550 <memmove>
inituvm(pde_t *pgdir, char *init, uint sz)
{
char *mem;
if(sz >= PGSIZE)
panic("inituvm: more than a page");
80106a16: 83 ec 0c sub $0xc,%esp
80106a19: 68 6d 78 10 80 push $0x8010786d
80106a1e: e8 4d 99 ff ff call 80100370 <panic>
80106a23: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106a29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106a30 <loaduvm>:
// Load a program segment into pgdir. addr must be page-aligned
// and the pages from addr to addr+sz must already be mapped.
int
loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
{
80106a30: 55 push %ebp
80106a31: 89 e5 mov %esp,%ebp
80106a33: 57 push %edi
80106a34: 56 push %esi
80106a35: 53 push %ebx
80106a36: 83 ec 0c sub $0xc,%esp
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
80106a39: f7 45 0c ff 0f 00 00 testl $0xfff,0xc(%ebp)
80106a40: 0f 85 91 00 00 00 jne 80106ad7 <loaduvm+0xa7>
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
80106a46: 8b 75 18 mov 0x18(%ebp),%esi
80106a49: 31 db xor %ebx,%ebx
80106a4b: 85 f6 test %esi,%esi
80106a4d: 75 1a jne 80106a69 <loaduvm+0x39>
80106a4f: eb 6f jmp 80106ac0 <loaduvm+0x90>
80106a51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106a58: 81 c3 00 10 00 00 add $0x1000,%ebx
80106a5e: 81 ee 00 10 00 00 sub $0x1000,%esi
80106a64: 39 5d 18 cmp %ebx,0x18(%ebp)
80106a67: 76 57 jbe 80106ac0 <loaduvm+0x90>
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
80106a69: 8b 55 0c mov 0xc(%ebp),%edx
80106a6c: 8b 45 08 mov 0x8(%ebp),%eax
80106a6f: 31 c9 xor %ecx,%ecx
80106a71: 01 da add %ebx,%edx
80106a73: e8 58 fb ff ff call 801065d0 <walkpgdir>
80106a78: 85 c0 test %eax,%eax
80106a7a: 74 4e je 80106aca <loaduvm+0x9a>
panic("loaduvm: address should exist");
pa = PTE_ADDR(*pte);
80106a7c: 8b 00 mov (%eax),%eax
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
80106a7e: 8b 4d 14 mov 0x14(%ebp),%ecx
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
panic("loaduvm: address should exist");
pa = PTE_ADDR(*pte);
if(sz - i < PGSIZE)
80106a81: bf 00 10 00 00 mov $0x1000,%edi
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
panic("loaduvm: address should exist");
pa = PTE_ADDR(*pte);
80106a86: 25 00 f0 ff ff and $0xfffff000,%eax
if(sz - i < PGSIZE)
80106a8b: 81 fe ff 0f 00 00 cmp $0xfff,%esi
80106a91: 0f 46 fe cmovbe %esi,%edi
n = sz - i;
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
80106a94: 01 d9 add %ebx,%ecx
80106a96: 05 00 00 00 80 add $0x80000000,%eax
80106a9b: 57 push %edi
80106a9c: 51 push %ecx
80106a9d: 50 push %eax
80106a9e: ff 75 10 pushl 0x10(%ebp)
80106aa1: e8 2a af ff ff call 801019d0 <readi>
80106aa6: 83 c4 10 add $0x10,%esp
80106aa9: 39 c7 cmp %eax,%edi
80106aab: 74 ab je 80106a58 <loaduvm+0x28>
return -1;
}
return 0;
}
80106aad: 8d 65 f4 lea -0xc(%ebp),%esp
if(sz - i < PGSIZE)
n = sz - i;
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
return -1;
80106ab0: b8 ff ff ff ff mov $0xffffffff,%eax
}
return 0;
}
80106ab5: 5b pop %ebx
80106ab6: 5e pop %esi
80106ab7: 5f pop %edi
80106ab8: 5d pop %ebp
80106ab9: c3 ret
80106aba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106ac0: 8d 65 f4 lea -0xc(%ebp),%esp
else
n = PGSIZE;
if(readi(ip, P2V(pa), offset+i, n) != n)
return -1;
}
return 0;
80106ac3: 31 c0 xor %eax,%eax
}
80106ac5: 5b pop %ebx
80106ac6: 5e pop %esi
80106ac7: 5f pop %edi
80106ac8: 5d pop %ebp
80106ac9: c3 ret
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
panic("loaduvm: address should exist");
80106aca: 83 ec 0c sub $0xc,%esp
80106acd: 68 87 78 10 80 push $0x80107887
80106ad2: e8 99 98 ff ff call 80100370 <panic>
{
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
80106ad7: 83 ec 0c sub $0xc,%esp
80106ada: 68 28 79 10 80 push $0x80107928
80106adf: e8 8c 98 ff ff call 80100370 <panic>
80106ae4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106aea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80106af0 <allocuvm>:
// Allocate page tables and physical memory to grow process from oldsz to
// newsz, which need not be page aligned. Returns new size or 0 on error.
int
allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80106af0: 55 push %ebp
80106af1: 89 e5 mov %esp,%ebp
80106af3: 57 push %edi
80106af4: 56 push %esi
80106af5: 53 push %ebx
80106af6: 83 ec 0c sub $0xc,%esp
80106af9: 8b 7d 10 mov 0x10(%ebp),%edi
char *mem;
uint a;
if(newsz >= KERNBASE)
80106afc: 85 ff test %edi,%edi
80106afe: 0f 88 ca 00 00 00 js 80106bce <allocuvm+0xde>
return 0;
if(newsz < oldsz)
80106b04: 3b 7d 0c cmp 0xc(%ebp),%edi
return oldsz;
80106b07: 8b 45 0c mov 0xc(%ebp),%eax
char *mem;
uint a;
if(newsz >= KERNBASE)
return 0;
if(newsz < oldsz)
80106b0a: 0f 82 82 00 00 00 jb 80106b92 <allocuvm+0xa2>
return oldsz;
a = PGROUNDUP(oldsz);
80106b10: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx
80106b16: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
for(; a < newsz; a += PGSIZE){
80106b1c: 39 df cmp %ebx,%edi
80106b1e: 77 43 ja 80106b63 <allocuvm+0x73>
80106b20: e9 bb 00 00 00 jmp 80106be0 <allocuvm+0xf0>
80106b25: 8d 76 00 lea 0x0(%esi),%esi
if(mem == 0){
cprintf("allocuvm out of memory\n");
deallocuvm(pgdir, newsz, oldsz);
return 0;
}
memset(mem, 0, PGSIZE);
80106b28: 83 ec 04 sub $0x4,%esp
80106b2b: 68 00 10 00 00 push $0x1000
80106b30: 6a 00 push $0x0
80106b32: 50 push %eax
80106b33: e8 68 d9 ff ff call 801044a0 <memset>
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
80106b38: 58 pop %eax
80106b39: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax
80106b3f: b9 00 10 00 00 mov $0x1000,%ecx
80106b44: 5a pop %edx
80106b45: 6a 06 push $0x6
80106b47: 50 push %eax
80106b48: 89 da mov %ebx,%edx
80106b4a: 8b 45 08 mov 0x8(%ebp),%eax
80106b4d: e8 fe fa ff ff call 80106650 <mappages>
80106b52: 83 c4 10 add $0x10,%esp
80106b55: 85 c0 test %eax,%eax
80106b57: 78 47 js 80106ba0 <allocuvm+0xb0>
return 0;
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
80106b59: 81 c3 00 10 00 00 add $0x1000,%ebx
80106b5f: 39 df cmp %ebx,%edi
80106b61: 76 7d jbe 80106be0 <allocuvm+0xf0>
mem = kalloc();
80106b63: e8 a8 b9 ff ff call 80102510 <kalloc>
if(mem == 0){
80106b68: 85 c0 test %eax,%eax
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
mem = kalloc();
80106b6a: 89 c6 mov %eax,%esi
if(mem == 0){
80106b6c: 75 ba jne 80106b28 <allocuvm+0x38>
cprintf("allocuvm out of memory\n");
80106b6e: 83 ec 0c sub $0xc,%esp
80106b71: 68 a5 78 10 80 push $0x801078a5
80106b76: e8 e5 9a ff ff call 80100660 <cprintf>
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106b7b: 83 c4 10 add $0x10,%esp
80106b7e: 3b 7d 0c cmp 0xc(%ebp),%edi
80106b81: 76 4b jbe 80106bce <allocuvm+0xde>
80106b83: 8b 4d 0c mov 0xc(%ebp),%ecx
80106b86: 8b 45 08 mov 0x8(%ebp),%eax
80106b89: 89 fa mov %edi,%edx
80106b8b: e8 50 fb ff ff call 801066e0 <deallocuvm.part.0>
for(; a < newsz; a += PGSIZE){
mem = kalloc();
if(mem == 0){
cprintf("allocuvm out of memory\n");
deallocuvm(pgdir, newsz, oldsz);
return 0;
80106b90: 31 c0 xor %eax,%eax
kfree(mem);
return 0;
}
}
return newsz;
}
80106b92: 8d 65 f4 lea -0xc(%ebp),%esp
80106b95: 5b pop %ebx
80106b96: 5e pop %esi
80106b97: 5f pop %edi
80106b98: 5d pop %ebp
80106b99: c3 ret
80106b9a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
deallocuvm(pgdir, newsz, oldsz);
return 0;
}
memset(mem, 0, PGSIZE);
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
cprintf("allocuvm out of memory (2)\n");
80106ba0: 83 ec 0c sub $0xc,%esp
80106ba3: 68 bd 78 10 80 push $0x801078bd
80106ba8: e8 b3 9a ff ff call 80100660 <cprintf>
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106bad: 83 c4 10 add $0x10,%esp
80106bb0: 3b 7d 0c cmp 0xc(%ebp),%edi
80106bb3: 76 0d jbe 80106bc2 <allocuvm+0xd2>
80106bb5: 8b 4d 0c mov 0xc(%ebp),%ecx
80106bb8: 8b 45 08 mov 0x8(%ebp),%eax
80106bbb: 89 fa mov %edi,%edx
80106bbd: e8 1e fb ff ff call 801066e0 <deallocuvm.part.0>
}
memset(mem, 0, PGSIZE);
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
cprintf("allocuvm out of memory (2)\n");
deallocuvm(pgdir, newsz, oldsz);
kfree(mem);
80106bc2: 83 ec 0c sub $0xc,%esp
80106bc5: 56 push %esi
80106bc6: e8 95 b7 ff ff call 80102360 <kfree>
return 0;
80106bcb: 83 c4 10 add $0x10,%esp
}
}
return newsz;
}
80106bce: 8d 65 f4 lea -0xc(%ebp),%esp
memset(mem, 0, PGSIZE);
if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){
cprintf("allocuvm out of memory (2)\n");
deallocuvm(pgdir, newsz, oldsz);
kfree(mem);
return 0;
80106bd1: 31 c0 xor %eax,%eax
}
}
return newsz;
}
80106bd3: 5b pop %ebx
80106bd4: 5e pop %esi
80106bd5: 5f pop %edi
80106bd6: 5d pop %ebp
80106bd7: c3 ret
80106bd8: 90 nop
80106bd9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106be0: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
80106be3: 89 f8 mov %edi,%eax
kfree(mem);
return 0;
}
}
return newsz;
}
80106be5: 5b pop %ebx
80106be6: 5e pop %esi
80106be7: 5f pop %edi
80106be8: 5d pop %ebp
80106be9: c3 ret
80106bea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106bf0 <deallocuvm>:
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80106bf0: 55 push %ebp
80106bf1: 89 e5 mov %esp,%ebp
80106bf3: 8b 55 0c mov 0xc(%ebp),%edx
80106bf6: 8b 4d 10 mov 0x10(%ebp),%ecx
80106bf9: 8b 45 08 mov 0x8(%ebp),%eax
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80106bfc: 39 d1 cmp %edx,%ecx
80106bfe: 73 10 jae 80106c10 <deallocuvm+0x20>
kfree(v);
*pte = 0;
}
}
return newsz;
}
80106c00: 5d pop %ebp
80106c01: e9 da fa ff ff jmp 801066e0 <deallocuvm.part.0>
80106c06: 8d 76 00 lea 0x0(%esi),%esi
80106c09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106c10: 89 d0 mov %edx,%eax
80106c12: 5d pop %ebp
80106c13: c3 ret
80106c14: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106c1a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80106c20 <freevm>:
// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
80106c20: 55 push %ebp
80106c21: 89 e5 mov %esp,%ebp
80106c23: 57 push %edi
80106c24: 56 push %esi
80106c25: 53 push %ebx
80106c26: 83 ec 0c sub $0xc,%esp
80106c29: 8b 75 08 mov 0x8(%ebp),%esi
uint i;
if(pgdir == 0)
80106c2c: 85 f6 test %esi,%esi
80106c2e: 74 59 je 80106c89 <freevm+0x69>
80106c30: 31 c9 xor %ecx,%ecx
80106c32: ba 00 00 00 80 mov $0x80000000,%edx
80106c37: 89 f0 mov %esi,%eax
80106c39: e8 a2 fa ff ff call 801066e0 <deallocuvm.part.0>
80106c3e: 89 f3 mov %esi,%ebx
80106c40: 8d be 00 10 00 00 lea 0x1000(%esi),%edi
80106c46: eb 0f jmp 80106c57 <freevm+0x37>
80106c48: 90 nop
80106c49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106c50: 83 c3 04 add $0x4,%ebx
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80106c53: 39 fb cmp %edi,%ebx
80106c55: 74 23 je 80106c7a <freevm+0x5a>
if(pgdir[i] & PTE_P){
80106c57: 8b 03 mov (%ebx),%eax
80106c59: a8 01 test $0x1,%al
80106c5b: 74 f3 je 80106c50 <freevm+0x30>
char * v = P2V(PTE_ADDR(pgdir[i]));
kfree(v);
80106c5d: 25 00 f0 ff ff and $0xfffff000,%eax
80106c62: 83 ec 0c sub $0xc,%esp
80106c65: 83 c3 04 add $0x4,%ebx
80106c68: 05 00 00 00 80 add $0x80000000,%eax
80106c6d: 50 push %eax
80106c6e: e8 ed b6 ff ff call 80102360 <kfree>
80106c73: 83 c4 10 add $0x10,%esp
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80106c76: 39 fb cmp %edi,%ebx
80106c78: 75 dd jne 80106c57 <freevm+0x37>
if(pgdir[i] & PTE_P){
char * v = P2V(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
80106c7a: 89 75 08 mov %esi,0x8(%ebp)
}
80106c7d: 8d 65 f4 lea -0xc(%ebp),%esp
80106c80: 5b pop %ebx
80106c81: 5e pop %esi
80106c82: 5f pop %edi
80106c83: 5d pop %ebp
if(pgdir[i] & PTE_P){
char * v = P2V(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
80106c84: e9 d7 b6 ff ff jmp 80102360 <kfree>
freevm(pde_t *pgdir)
{
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
80106c89: 83 ec 0c sub $0xc,%esp
80106c8c: 68 d9 78 10 80 push $0x801078d9
80106c91: e8 da 96 ff ff call 80100370 <panic>
80106c96: 8d 76 00 lea 0x0(%esi),%esi
80106c99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
80106ca0 <setupkvm>:
};
// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
80106ca0: 55 push %ebp
80106ca1: 89 e5 mov %esp,%ebp
80106ca3: 56 push %esi
80106ca4: 53 push %ebx
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
80106ca5: e8 66 b8 ff ff call 80102510 <kalloc>
80106caa: 85 c0 test %eax,%eax
80106cac: 74 6a je 80106d18 <setupkvm+0x78>
return 0;
memset(pgdir, 0, PGSIZE);
80106cae: 83 ec 04 sub $0x4,%esp
80106cb1: 89 c6 mov %eax,%esi
if (P2V(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80106cb3: bb 20 a4 10 80 mov $0x8010a420,%ebx
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
memset(pgdir, 0, PGSIZE);
80106cb8: 68 00 10 00 00 push $0x1000
80106cbd: 6a 00 push $0x0
80106cbf: 50 push %eax
80106cc0: e8 db d7 ff ff call 801044a0 <memset>
80106cc5: 83 c4 10 add $0x10,%esp
if (P2V(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
80106cc8: 8b 43 04 mov 0x4(%ebx),%eax
80106ccb: 8b 4b 08 mov 0x8(%ebx),%ecx
80106cce: 83 ec 08 sub $0x8,%esp
80106cd1: 8b 13 mov (%ebx),%edx
80106cd3: ff 73 0c pushl 0xc(%ebx)
80106cd6: 50 push %eax
80106cd7: 29 c1 sub %eax,%ecx
80106cd9: 89 f0 mov %esi,%eax
80106cdb: e8 70 f9 ff ff call 80106650 <mappages>
80106ce0: 83 c4 10 add $0x10,%esp
80106ce3: 85 c0 test %eax,%eax
80106ce5: 78 19 js 80106d00 <setupkvm+0x60>
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
memset(pgdir, 0, PGSIZE);
if (P2V(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80106ce7: 83 c3 10 add $0x10,%ebx
80106cea: 81 fb 60 a4 10 80 cmp $0x8010a460,%ebx
80106cf0: 75 d6 jne 80106cc8 <setupkvm+0x28>
80106cf2: 89 f0 mov %esi,%eax
(uint)k->phys_start, k->perm) < 0) {
freevm(pgdir);
return 0;
}
return pgdir;
}
80106cf4: 8d 65 f8 lea -0x8(%ebp),%esp
80106cf7: 5b pop %ebx
80106cf8: 5e pop %esi
80106cf9: 5d pop %ebp
80106cfa: c3 ret
80106cfb: 90 nop
80106cfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if (P2V(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0) {
freevm(pgdir);
80106d00: 83 ec 0c sub $0xc,%esp
80106d03: 56 push %esi
80106d04: e8 17 ff ff ff call 80106c20 <freevm>
return 0;
80106d09: 83 c4 10 add $0x10,%esp
}
return pgdir;
}
80106d0c: 8d 65 f8 lea -0x8(%ebp),%esp
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0) {
freevm(pgdir);
return 0;
80106d0f: 31 c0 xor %eax,%eax
}
return pgdir;
}
80106d11: 5b pop %ebx
80106d12: 5e pop %esi
80106d13: 5d pop %ebp
80106d14: c3 ret
80106d15: 8d 76 00 lea 0x0(%esi),%esi
{
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
80106d18: 31 c0 xor %eax,%eax
80106d1a: eb d8 jmp 80106cf4 <setupkvm+0x54>
80106d1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106d20 <kvmalloc>:
// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
80106d20: 55 push %ebp
80106d21: 89 e5 mov %esp,%ebp
80106d23: 83 ec 08 sub $0x8,%esp
kpgdir = setupkvm();
80106d26: e8 75 ff ff ff call 80106ca0 <setupkvm>
80106d2b: a3 a4 54 11 80 mov %eax,0x801154a4
80106d30: 05 00 00 00 80 add $0x80000000,%eax
80106d35: 0f 22 d8 mov %eax,%cr3
switchkvm();
}
80106d38: c9 leave
80106d39: c3 ret
80106d3a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106d40 <clearpteu>:
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
80106d40: 55 push %ebp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106d41: 31 c9 xor %ecx,%ecx
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
80106d43: 89 e5 mov %esp,%ebp
80106d45: 83 ec 08 sub $0x8,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106d48: 8b 55 0c mov 0xc(%ebp),%edx
80106d4b: 8b 45 08 mov 0x8(%ebp),%eax
80106d4e: e8 7d f8 ff ff call 801065d0 <walkpgdir>
if(pte == 0)
80106d53: 85 c0 test %eax,%eax
80106d55: 74 05 je 80106d5c <clearpteu+0x1c>
panic("clearpteu");
*pte &= ~PTE_U;
80106d57: 83 20 fb andl $0xfffffffb,(%eax)
}
80106d5a: c9 leave
80106d5b: c3 ret
{
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
if(pte == 0)
panic("clearpteu");
80106d5c: 83 ec 0c sub $0xc,%esp
80106d5f: 68 ea 78 10 80 push $0x801078ea
80106d64: e8 07 96 ff ff call 80100370 <panic>
80106d69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106d70 <copyuvm>:
// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
80106d70: 55 push %ebp
80106d71: 89 e5 mov %esp,%ebp
80106d73: 57 push %edi
80106d74: 56 push %esi
80106d75: 53 push %ebx
80106d76: 83 ec 1c sub $0x1c,%esp
pde_t *d;
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
80106d79: e8 22 ff ff ff call 80106ca0 <setupkvm>
80106d7e: 85 c0 test %eax,%eax
80106d80: 89 45 e0 mov %eax,-0x20(%ebp)
80106d83: 0f 84 c5 00 00 00 je 80106e4e <copyuvm+0xde>
return 0;
for(i = 0; i < sz; i += PGSIZE){
80106d89: 8b 4d 0c mov 0xc(%ebp),%ecx
80106d8c: 85 c9 test %ecx,%ecx
80106d8e: 0f 84 9c 00 00 00 je 80106e30 <copyuvm+0xc0>
80106d94: 31 ff xor %edi,%edi
80106d96: eb 4a jmp 80106de2 <copyuvm+0x72>
80106d98: 90 nop
80106d99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
flags = PTE_FLAGS(*pte);
if((mem = kalloc()) == 0)
goto bad;
memmove(mem, (char*)P2V(pa), PGSIZE);
80106da0: 83 ec 04 sub $0x4,%esp
80106da3: 81 c3 00 00 00 80 add $0x80000000,%ebx
80106da9: 68 00 10 00 00 push $0x1000
80106dae: 53 push %ebx
80106daf: 50 push %eax
80106db0: e8 9b d7 ff ff call 80104550 <memmove>
if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) {
80106db5: 58 pop %eax
80106db6: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax
80106dbc: b9 00 10 00 00 mov $0x1000,%ecx
80106dc1: 5a pop %edx
80106dc2: ff 75 e4 pushl -0x1c(%ebp)
80106dc5: 50 push %eax
80106dc6: 89 fa mov %edi,%edx
80106dc8: 8b 45 e0 mov -0x20(%ebp),%eax
80106dcb: e8 80 f8 ff ff call 80106650 <mappages>
80106dd0: 83 c4 10 add $0x10,%esp
80106dd3: 85 c0 test %eax,%eax
80106dd5: 78 69 js 80106e40 <copyuvm+0xd0>
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
80106dd7: 81 c7 00 10 00 00 add $0x1000,%edi
80106ddd: 39 7d 0c cmp %edi,0xc(%ebp)
80106de0: 76 4e jbe 80106e30 <copyuvm+0xc0>
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
80106de2: 8b 45 08 mov 0x8(%ebp),%eax
80106de5: 31 c9 xor %ecx,%ecx
80106de7: 89 fa mov %edi,%edx
80106de9: e8 e2 f7 ff ff call 801065d0 <walkpgdir>
80106dee: 85 c0 test %eax,%eax
80106df0: 74 6d je 80106e5f <copyuvm+0xef>
panic("copyuvm: pte should exist");
if(!(*pte & PTE_P))
80106df2: 8b 00 mov (%eax),%eax
80106df4: a8 01 test $0x1,%al
80106df6: 74 5a je 80106e52 <copyuvm+0xe2>
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
80106df8: 89 c3 mov %eax,%ebx
flags = PTE_FLAGS(*pte);
80106dfa: 25 ff 0f 00 00 and $0xfff,%eax
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
panic("copyuvm: pte should exist");
if(!(*pte & PTE_P))
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
80106dff: 81 e3 00 f0 ff ff and $0xfffff000,%ebx
flags = PTE_FLAGS(*pte);
80106e05: 89 45 e4 mov %eax,-0x1c(%ebp)
if((mem = kalloc()) == 0)
80106e08: e8 03 b7 ff ff call 80102510 <kalloc>
80106e0d: 85 c0 test %eax,%eax
80106e0f: 89 c6 mov %eax,%esi
80106e11: 75 8d jne 80106da0 <copyuvm+0x30>
}
}
return d;
bad:
freevm(d);
80106e13: 83 ec 0c sub $0xc,%esp
80106e16: ff 75 e0 pushl -0x20(%ebp)
80106e19: e8 02 fe ff ff call 80106c20 <freevm>
return 0;
80106e1e: 83 c4 10 add $0x10,%esp
80106e21: 31 c0 xor %eax,%eax
}
80106e23: 8d 65 f4 lea -0xc(%ebp),%esp
80106e26: 5b pop %ebx
80106e27: 5e pop %esi
80106e28: 5f pop %edi
80106e29: 5d pop %ebp
80106e2a: c3 ret
80106e2b: 90 nop
80106e2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
80106e30: 8b 45 e0 mov -0x20(%ebp),%eax
return d;
bad:
freevm(d);
return 0;
}
80106e33: 8d 65 f4 lea -0xc(%ebp),%esp
80106e36: 5b pop %ebx
80106e37: 5e pop %esi
80106e38: 5f pop %edi
80106e39: 5d pop %ebp
80106e3a: c3 ret
80106e3b: 90 nop
80106e3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
flags = PTE_FLAGS(*pte);
if((mem = kalloc()) == 0)
goto bad;
memmove(mem, (char*)P2V(pa), PGSIZE);
if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) {
kfree(mem);
80106e40: 83 ec 0c sub $0xc,%esp
80106e43: 56 push %esi
80106e44: e8 17 b5 ff ff call 80102360 <kfree>
goto bad;
80106e49: 83 c4 10 add $0x10,%esp
80106e4c: eb c5 jmp 80106e13 <copyuvm+0xa3>
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
80106e4e: 31 c0 xor %eax,%eax
80106e50: eb d1 jmp 80106e23 <copyuvm+0xb3>
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
panic("copyuvm: pte should exist");
if(!(*pte & PTE_P))
panic("copyuvm: page not present");
80106e52: 83 ec 0c sub $0xc,%esp
80106e55: 68 0e 79 10 80 push $0x8010790e
80106e5a: e8 11 95 ff ff call 80100370 <panic>
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
panic("copyuvm: pte should exist");
80106e5f: 83 ec 0c sub $0xc,%esp
80106e62: 68 f4 78 10 80 push $0x801078f4
80106e67: e8 04 95 ff ff call 80100370 <panic>
80106e6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80106e70 <uva2ka>:
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80106e70: 55 push %ebp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106e71: 31 c9 xor %ecx,%ecx
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80106e73: 89 e5 mov %esp,%ebp
80106e75: 83 ec 08 sub $0x8,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80106e78: 8b 55 0c mov 0xc(%ebp),%edx
80106e7b: 8b 45 08 mov 0x8(%ebp),%eax
80106e7e: e8 4d f7 ff ff call 801065d0 <walkpgdir>
if((*pte & PTE_P) == 0)
80106e83: 8b 00 mov (%eax),%eax
return 0;
if((*pte & PTE_U) == 0)
80106e85: 89 c2 mov %eax,%edx
80106e87: 83 e2 05 and $0x5,%edx
80106e8a: 83 fa 05 cmp $0x5,%edx
80106e8d: 75 11 jne 80106ea0 <uva2ka+0x30>
return 0;
return (char*)P2V(PTE_ADDR(*pte));
80106e8f: 25 00 f0 ff ff and $0xfffff000,%eax
}
80106e94: c9 leave
pte = walkpgdir(pgdir, uva, 0);
if((*pte & PTE_P) == 0)
return 0;
if((*pte & PTE_U) == 0)
return 0;
return (char*)P2V(PTE_ADDR(*pte));
80106e95: 05 00 00 00 80 add $0x80000000,%eax
}
80106e9a: c3 ret
80106e9b: 90 nop
80106e9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
pte = walkpgdir(pgdir, uva, 0);
if((*pte & PTE_P) == 0)
return 0;
if((*pte & PTE_U) == 0)
return 0;
80106ea0: 31 c0 xor %eax,%eax
return (char*)P2V(PTE_ADDR(*pte));
}
80106ea2: c9 leave
80106ea3: c3 ret
80106ea4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80106eaa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
80106eb0 <copyout>:
// Copy len bytes from p to user address va in page table pgdir.
// Most useful when pgdir is not the current page table.
// uva2ka ensures this only works for PTE_U pages.
int
copyout(pde_t *pgdir, uint va, void *p, uint len)
{
80106eb0: 55 push %ebp
80106eb1: 89 e5 mov %esp,%ebp
80106eb3: 57 push %edi
80106eb4: 56 push %esi
80106eb5: 53 push %ebx
80106eb6: 83 ec 1c sub $0x1c,%esp
80106eb9: 8b 5d 14 mov 0x14(%ebp),%ebx
80106ebc: 8b 55 0c mov 0xc(%ebp),%edx
80106ebf: 8b 7d 10 mov 0x10(%ebp),%edi
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80106ec2: 85 db test %ebx,%ebx
80106ec4: 75 40 jne 80106f06 <copyout+0x56>
80106ec6: eb 70 jmp 80106f38 <copyout+0x88>
80106ec8: 90 nop
80106ec9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
if(pa0 == 0)
return -1;
n = PGSIZE - (va - va0);
80106ed0: 8b 55 e4 mov -0x1c(%ebp),%edx
80106ed3: 89 f1 mov %esi,%ecx
80106ed5: 29 d1 sub %edx,%ecx
80106ed7: 81 c1 00 10 00 00 add $0x1000,%ecx
80106edd: 39 d9 cmp %ebx,%ecx
80106edf: 0f 47 cb cmova %ebx,%ecx
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
80106ee2: 29 f2 sub %esi,%edx
80106ee4: 83 ec 04 sub $0x4,%esp
80106ee7: 01 d0 add %edx,%eax
80106ee9: 51 push %ecx
80106eea: 57 push %edi
80106eeb: 50 push %eax
80106eec: 89 4d e4 mov %ecx,-0x1c(%ebp)
80106eef: e8 5c d6 ff ff call 80104550 <memmove>
len -= n;
buf += n;
80106ef4: 8b 4d e4 mov -0x1c(%ebp),%ecx
{
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80106ef7: 83 c4 10 add $0x10,%esp
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
va = va0 + PGSIZE;
80106efa: 8d 96 00 10 00 00 lea 0x1000(%esi),%edx
n = PGSIZE - (va - va0);
if(n > len)
n = len;
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
80106f00: 01 cf add %ecx,%edi
{
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80106f02: 29 cb sub %ecx,%ebx
80106f04: 74 32 je 80106f38 <copyout+0x88>
va0 = (uint)PGROUNDDOWN(va);
80106f06: 89 d6 mov %edx,%esi
pa0 = uva2ka(pgdir, (char*)va0);
80106f08: 83 ec 08 sub $0x8,%esp
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
80106f0b: 89 55 e4 mov %edx,-0x1c(%ebp)
80106f0e: 81 e6 00 f0 ff ff and $0xfffff000,%esi
pa0 = uva2ka(pgdir, (char*)va0);
80106f14: 56 push %esi
80106f15: ff 75 08 pushl 0x8(%ebp)
80106f18: e8 53 ff ff ff call 80106e70 <uva2ka>
if(pa0 == 0)
80106f1d: 83 c4 10 add $0x10,%esp
80106f20: 85 c0 test %eax,%eax
80106f22: 75 ac jne 80106ed0 <copyout+0x20>
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
}
80106f24: 8d 65 f4 lea -0xc(%ebp),%esp
buf = (char*)p;
while(len > 0){
va0 = (uint)PGROUNDDOWN(va);
pa0 = uva2ka(pgdir, (char*)va0);
if(pa0 == 0)
return -1;
80106f27: b8 ff ff ff ff mov $0xffffffff,%eax
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
}
80106f2c: 5b pop %ebx
80106f2d: 5e pop %esi
80106f2e: 5f pop %edi
80106f2f: 5d pop %ebp
80106f30: c3 ret
80106f31: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
80106f38: 8d 65 f4 lea -0xc(%ebp),%esp
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
80106f3b: 31 c0 xor %eax,%eax
}
80106f3d: 5b pop %ebx
80106f3e: 5e pop %esi
80106f3f: 5f pop %edi
80106f40: 5d pop %ebp
80106f41: c3 ret
| 33.218932 | 74 | 0.531731 |
d7ed0786e9024a43c7dcaecab27ed379687aa228 | 6,292 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1695.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1695.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1695.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x12432, %rsi
lea addresses_WC_ht+0x1a20e, %rdi
nop
xor %r8, %r8
mov $110, %rcx
rep movsw
nop
nop
nop
sub $60074, %r12
lea addresses_UC_ht+0x1de0e, %rsi
lea addresses_A_ht+0x1021d, %rdi
clflush (%rsi)
nop
cmp $54403, %r14
mov $66, %rcx
rep movsl
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_WC_ht+0x7e8e, %rsi
lea addresses_WT_ht+0xb0e, %rdi
nop
nop
nop
cmp %r14, %r14
mov $37, %rcx
rep movsl
nop
nop
nop
nop
inc %r12
lea addresses_A_ht+0xa076, %r12
nop
add $13215, %rdi
vmovups (%r12), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rsi
nop
nop
add %rdi, %rdi
lea addresses_A_ht+0x760e, %rsi
lea addresses_D_ht+0x462e, %rdi
nop
nop
cmp $26460, %rbp
mov $35, %rcx
rep movsq
nop
and $21254, %rsi
lea addresses_normal_ht+0x1b0e, %rcx
nop
dec %r14
mov (%rcx), %r8d
nop
inc %r12
lea addresses_A_ht+0x7522, %r8
nop
nop
nop
nop
nop
xor %r14, %r14
and $0xffffffffffffffc0, %r8
movaps (%r8), %xmm0
vpextrq $1, %xmm0, %rcx
nop
nop
nop
nop
nop
sub $33308, %rcx
lea addresses_normal_ht+0xe40e, %r12
nop
nop
nop
nop
nop
and $21226, %rsi
mov (%r12), %bp
nop
sub $37353, %rbp
lea addresses_WT_ht+0x67ae, %rbp
nop
cmp $20525, %rcx
mov (%rbp), %esi
nop
nop
nop
nop
nop
and %r14, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %rdx
push %rsi
// Faulty Load
lea addresses_WC+0x1720e, %rdx
nop
nop
nop
nop
xor %r8, %r8
vmovups (%rdx), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %rsi
lea oracles, %rdx
and $0xff, %rsi
shlq $12, %rsi
mov (%rdx,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WC', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_WC', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A_ht', 'size': 16, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
| 38.839506 | 2,999 | 0.659886 |
914470d20813109057ec6b0a191f80b92d5dd2c3 | 4,077 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1733.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1733.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1733.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_WC+0x1f5a2, %rsi
lea addresses_PSE+0x11e32, %rdi
nop
nop
nop
nop
cmp %r15, %r15
mov $115, %rcx
rep movsb
nop
nop
sub %r15, %r15
// Faulty Load
lea addresses_WT+0x85a2, %rbx
nop
nop
nop
nop
add %rdi, %rdi
vmovups (%rbx), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rcx
lea oracles, %rdi
and $0xff, %rcx
shlq $12, %rcx
mov (%rdi,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_PSE'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
| 64.714286 | 2,999 | 0.663478 |
19ab53f2bc8c918e99ee94d6d9fdc58120a3fc17 | 629 | asm | Assembly | oeis/126/A126596.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/126/A126596.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/126/A126596.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A126596: a(n) = binomial(4*n,n)*(2*n+1)/(3*n+1).
; Submitted by Jon Maiga
; 1,3,20,154,1260,10659,92092,807300,7152444,63882940,574221648,5188082354,47073334100,428634152730,3914819231400,35848190542920,329007937216860,3025582795190340,27872496751392496,257172019222240200,2376196095585231920,21983235825545286435,203610515307263199900,1887832261192440843540,17520331497290833875300,162743194154436752260404,1512916194114680143308912,14075108991995087737942780,131035744869447110024745336,1220696468738663051827687940,11378536971523537840407302416
mov $2,4
mul $2,$0
mov $1,$2
bin $1,$0
sub $0,1
bin $2,$0
sub $1,$2
mov $0,$1
| 48.384615 | 473 | 0.836248 |
68dc2b53cf21709113918dd73c2bb7863e44fec2 | 777 | asm | Assembly | programs/oeis/298/A298030.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/298/A298030.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/298/A298030.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A298030: Partial sums of A298029.
; 1,4,10,22,40,73,112,163,220,289,364,451,544,649,760,883,1012,1153,1300,1459,1624,1801,1984,2179,2380,2593,2812,3043,3280,3529,3784,4051,4324,4609,4900,5203,5512,5833,6160,6499,6844,7201,7564,7939,8320,8713,9112,9523,9940,10369,10804,11251,11704,12169,12640,13123,13612,14113,14620,15139,15664,16201,16744,17299,17860,18433,19012,19603,20200,20809,21424,22051,22684,23329,23980,24643,25312,25993,26680,27379,28084,28801,29524,30259,31000,31753,32512,33283,34060,34849,35644,36451,37264,38089,38920,39763,40612,41473,42340,43219
mov $1,$0
trn $0,1
pow $0,2
add $0,1
mov $2,1
mov $3,$1
add $3,1
lpb $1
mov $1,3
mul $2,2
mov $3,2
mov $4,$0
mul $0,2
div $4,$2
lpe
sub $0,$4
sub $0,$2
div $3,$2
add $0,$3
sub $0,1
mul $0,3
add $0,1
| 29.884615 | 528 | 0.722008 |
a4cc2be1ce671437351495312e8b6e35137f855a | 371 | asm | Assembly | programs/oeis/132/A132380.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/132/A132380.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/132/A132380.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A132380: Period 8: repeat [0, 0, 1, 1, 0, 0, -1, -1].
; 0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1,0,0,-1,-1,0,0,1,1
div $0,2
mov $1,$0
sub $0,3456
mod $0,2
mov $2,$1
mov $1,4
add $1,$2
div $1,2
pow $0,$1
| 28.538462 | 225 | 0.474394 |
0ec2f992b6547980f701b68f4ecebaa1b39309ca | 690 | asm | Assembly | oeis/095/A095277.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | oeis/095/A095277.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | oeis/095/A095277.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | ; A095277: Numbers k such that 4k + 3 is composite.
; Submitted by Jamie Morken(w2)
; 3,6,8,9,12,13,15,18,21,22,23,24,27,28,29,30,33,35,36,38,39,42,43,45,46,48,50,51,53,54,57,58,60,61,63,64,66,68,69,71,72,73,74,75,78,79,80,81,83,84,85,87,88,90,92,93,96,97,98,99,100,101,102,103,105,106,108,111,112,113,114,117,118,120,123,126,127,128,129,131,132,133,134,135,137,138,139,141,143,144,145,147,148,150,152,153,155,156,158,159
mov $1,6
mov $2,$0
add $2,2
pow $2,2
lpb $2
add $1,4
sub $2,1
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
add $0,$3
sub $0,1
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
sub $0,14
div $0,4
add $0,3
| 27.6 | 337 | 0.644928 |
aa1b763dc389477209941664524d71f6d5c38232 | 182 | asm | Assembly | interrupts.asm | MineRobber9000/gb-gopher | 29acd73808586026cc71c97be0e5d742805b476f | [
"MIT"
] | null | null | null | interrupts.asm | MineRobber9000/gb-gopher | 29acd73808586026cc71c97be0e5d742805b476f | [
"MIT"
] | null | null | null | interrupts.asm | MineRobber9000/gb-gopher | 29acd73808586026cc71c97be0e5d742805b476f | [
"MIT"
] | null | null | null | SECTION "vblank",ROM0[$40]
jp VBlank
SECTION "lcdc",ROM0[$48]
reti
SECTION "timer",ROM0[$50]
reti
SECTION "serial",ROM0[$58]
reti
SECTION "joypad",ROM0[$60]
reti
| 16.545455 | 26 | 0.637363 |
1aa953f0f3e18dd157da492f0667de9fa07d5a6f | 5,042 | asm | Assembly | player.asm | Jartza/coldwar | f4d8f447912f0e45a3c59119681d9d58cb9630fc | [
"MIT"
] | 1 | 2020-02-02T17:23:05.000Z | 2020-02-02T17:23:05.000Z | player.asm | Jartza/coldwar | f4d8f447912f0e45a3c59119681d9d58cb9630fc | [
"MIT"
] | null | null | null | player.asm | Jartza/coldwar | f4d8f447912f0e45a3c59119681d9d58cb9630fc | [
"MIT"
] | null | null | null | ; da65 V2.18 - Git N/A
; Created: 2020-03-03 14:46:12
; Input file: player.bin
; Page: 1
.setcpu "6502"
L5641 := $5641
jmp L1D9C
jmp L1DDD
dec $03EC
beq L1C2F
L1C0B: lda #$0A
sta $FD
ldx #$00
jsr L1D1A
inc $FD
ldx #$04
jsr L1D1A
inc $FD
ldx #$08
jsr L1D1A
inc $FD
ldx #$0C
jsr L1D1A
lda $03EF
bne L1C84
rts
L1C2F: lda $03ED
sta $03EC
lda $03EA
cmp #$FF
beq L1C0B
ldx #$00
jsr L1CCD
ldx #$04
jsr L1CCD
ldx #$08
jsr L1CCD
ldx #$0C
jsr L1CCD
inc $03EB
lda $03EB
and #$0F
bne L1C0B
sta $03EB
lda $03EA
clc
adc #$04
sta $03EA
L1C66: tay
lda $1A00,y
cmp #$FE
beq L1C77
sta $03F0
jsr L1DCA
jmp L1C0B
L1C77: lda $1A01,y
sta $03EA
cmp #$FF
bne L1C66
jmp L1C0B
L1C84: dec $03EE
beq L1C8A
rts
L1C8A: lda #$80
sta $FB
lda #$1B
sta $FC
ldy $03EF
L1C95: lda ($FB),y
ror a
ror a
ror a
ror a
and #$0F
sta $FD
lda ($FB),y
and #$0F
beq L1CB7
sta $03EE
lda $900E
and #$F0
ora $FD
sta $900E
iny
sty $03EF
rts
L1CB7: lda $FD
beq L1CC9
lda $03EF
and #$F0
ora $FD
sta $03EF
tay
jmp L1C95
L1CC9: sta $03EF
rts
L1CCD: ldy $03EB
lda $03F0,x
bmi L1CE5
sta $FD
and #$70
ora #$80
sta $FB
lda #$1A
sta $FC
lda ($FB),y
bne L1CE6
L1CE5: rts
L1CE6: and #$1F
sta $FE
lda $FD
and #$0F
sec
sbc #$08
clc
adc $FE
sta $03F1,x
lda #$01
sta $03F2,x
lda ($FB),y
ror a
and #$70
sta $03F3,x
ror a
ror a
ror a
ror a
and #$07
tay
lda $1B88,y
bne L1D11
rts
L1D11: sta $03EF
lda #$01
sta $03EE
rts
L1D1A: lda $03F3,x
cmp #$FF
beq L1D31
dec $03F2,x
beq L1D32
rts
L1D27: ldy $FD
sta $9000,y
lda #$FF
sta $03F3,x
L1D31: rts
L1D32: lda $03F3,x
sta $FB
ror a
ror a
ror a
ror a
and #$0F
tay
lda $1B80,y
sta $03F2,x
L1D44: lda #$1B
sta $FC
ldy #$00
lda ($FB),y
beq L1D27
cmp #$10
bcc L1D8A
and #$1F
clc
adc #$10
sta $FE
lda $03F1,x
clc
adc $FE
tay
cpy #$40
bcc L1D66
ldy #$3F
L1D66: cpy #$C0
bcc L1D6C
ldy #$00
L1D6C: lda $1BC0,y
sta $FE
ldy #$00
lda ($FB),y
rol a
rol a
rol a
rol a
and #$07
sec
sbc #$04
clc
adc $FE
ldy $FD
sta $9000,y
inc $03F3,x
rts
L1D8A: and #$0F
sta $FE
lda $FB
and #$F0
ora $FE
sta $FB
sta $03F3,x
jmp L1D44
L1D9C: jsr L1DDD
lda L1DFF
sta $03ED
lda #$01
sta $03EC
lda #$FF
sta $03F3
sta $03F7
sta $03FB
sta $03FF
lda $900E
and #$F0
ora #$08
sta $900E
lda $1A00
sta $03F0
ldy #$00
L1DCA: lda $1A01,y
sta $03F4
lda $1A02,y
sta $03F8
lda $1A03,y
sta $03FC
rts
L1DDD: lda #$00
ldy #$15
L1DE1: sta $03EA,y
cpy #$04
bcs L1DEB
sta $900A,y
L1DEB: dey
bpl L1DE1
rts
brk
lsr $49
.byte $53
eor #$43
pha
eor $4C
jmp L5641
and ($2E),y
bmi L1DFF
L1DFF: .byte $06
| 18.743494 | 33 | 0.319318 |
fedd1c4c89dd8dccb5c1f67a82068e249adbc652 | 3,166 | asm | Assembly | asm/ehbasic/sbc_mon.asm | napobear/6502 | 0385ed2739ac8d4d1c24a9e42c7e4c3e3276d7f5 | [
"Apache-2.0"
] | 188 | 2015-01-06T02:31:15.000Z | 2022-03-13T10:17:17.000Z | asm/ehbasic/sbc_mon.asm | napobear/6502 | 0385ed2739ac8d4d1c24a9e42c7e4c3e3276d7f5 | [
"Apache-2.0"
] | 12 | 2016-11-23T22:45:05.000Z | 2021-05-29T15:01:41.000Z | asm/ehbasic/sbc_mon.asm | napobear/6502 | 0385ed2739ac8d4d1c24a9e42c7e4c3e3276d7f5 | [
"Apache-2.0"
] | 54 | 2015-05-06T05:31:12.000Z | 2022-01-04T22:35:46.000Z |
; Minimal monitor for my 6502 Single Board COmputer.
.include "basic.asm"
; Defines
ACIA = $A000 ; 6850 ACIA
ACIAControl = ACIA+0
ACIAStatus = ACIA+0
ACIAData = ACIA+1
; Put the IRQ and NMI code in RAM so that it can be changed
IRQ_vec = VEC_SV+2 ; IRQ code vector
NMI_vec = IRQ_vec+$0A ; NMI code vector
; Now the code. all this does is set up the vectors and interrupt code
; and wait for the user to select [C]old or [W]arm start. Nothing else.
; Fits in less than 128 bytes
; Reset vector points here
RES_vec
CLD ; clear decimal mode
LDX #$FF ; empty stack
TXS ; set the stack
LDA #$15 ; Set ACIA to 8N1 and divide by 16 clock
STA ACIAControl
; Set up vectors and interrupt code, copy them to page 2.
LDY #END_CODE-LAB_vec ; set index/count
LAB_stlp
LDA LAB_vec-1,Y ; get byte from interrupt code
STA VEC_IN-1,Y ; save to RAM
DEY ; decrement index/count
BNE LAB_stlp ; loop if more to do
; Now do the signon message, Y = $00 here
LAB_signon
LDA LAB_mess,Y ; get byte from sign on message
BEQ LAB_nokey ; exit loop if done
JSR V_OUTP ; output character
INY ; increment index
BNE LAB_signon ; loop, branch always
LAB_nokey
JSR V_INPT ; call scan input device
BCC LAB_nokey ; loop if no key
AND #$DF ; mask xx0x xxxx, ensure upper case
CMP #'W' ; compare with [W]arm start
BEQ LAB_dowarm ; branch if [W]arm start
CMP #'C' ; compare with [C]old start
BNE RES_vec ; loop if not [C]old start
JMP LAB_COLD ; do EhBASIC cold start
LAB_dowarm
JMP LAB_WARM ; do EhBASIC warm start
; Byte out to serial console
SCRNout
PHA
SerialOutWait
LDA ACIAStatus
AND #2
CMP #2
BNE SerialOutWait
PLA
STA ACIAData
RTS
; Byte in from serial console
KBDin
LDA ACIAStatus
AND #1
CMP #1
BNE NoDataIn
LDA ACIAData
SEC ; Carry set if key available
RTS
NoDataIn:
CLC ; Carry clear if no key pressed
RTS
; LOAD - currently does nothing.
SBCload ; load vector for EhBASIC
RTS
; SAVE - currently does nothing.
SBCsave ; save vector for EhBASIC
RTS
; vector tables
LAB_vec
.word KBDin ; byte in from keyboard
.word SCRNout ; byte out to screen
.word SBCload ; load vector for EhBASIC
.word SBCsave ; save vector for EhBASIC
; EhBASIC IRQ support
IRQ_CODE
PHA ; save A
LDA IrqBase ; get the IRQ flag byte
LSR ; shift the set b7 to b6, and on down ...
ORA IrqBase ; OR the original back in
STA IrqBase ; save the new IRQ flag byte
PLA ; restore A
RTI
; EhBASIC NMI support
NMI_CODE
PHA ; save A
LDA NmiBase ; get the NMI flag byte
LSR ; shift the set b7 to b6, and on down ...
ORA NmiBase ; OR the original back in
STA NmiBase ; save the new NMI flag byte
PLA ; restore A
RTI
END_CODE
LAB_mess
.byte $0D,$0A,"6502 EhBASIC",$0D,$0A, "[C]old/[W]arm?",$00
; sign on string
; system vectors
.res $FFFA-*
.word NMI_vec ; NMI vector
.word RES_vec ; RESET vector
.word IRQ_vec ; IRQ vector
| 21.834483 | 80 | 0.64561 |
a27a145bb84df7f4cb75673e06741ddb6fa6b86b | 298 | asm | Assembly | 3rdParties/src/nasm/nasm-2.15.02/travis/test/inctest.asm | blue3k/StormForge | 1557e699a673ae9adcc8f987868139f601ec0887 | [
"Apache-2.0"
] | 1 | 2020-06-20T07:35:25.000Z | 2020-06-20T07:35:25.000Z | 3rdParties/src/nasm/nasm-2.15.02/travis/test/inctest.asm | blue3k/StormForge | 1557e699a673ae9adcc8f987868139f601ec0887 | [
"Apache-2.0"
] | null | null | null | 3rdParties/src/nasm/nasm-2.15.02/travis/test/inctest.asm | blue3k/StormForge | 1557e699a673ae9adcc8f987868139f601ec0887 | [
"Apache-2.0"
] | null | null | null | ; This file, plus inc1.asm and inc2.asm, test NASM's file inclusion
; mechanism.
;
; This produces a DOS .COM file: to assemble, use
; nasm -f bin inctest.asm -o inctest.com
; and when run, it should print `hello, world'.
BITS 16
ORG 0x100
jmp _main
%include "inc1.asm"
| 21.285714 | 68 | 0.651007 |
6f92190915e3dbbc01a19a7d208b298d18e7a139 | 1,135 | asm | Assembly | WangShuang_book/hw3.asm | SmirnovKol/Learning_x86_assembly_language | 239b2fb60d6df87316b98184c9c6b6f36940ccbe | [
"MIT"
] | 1 | 2018-11-21T23:34:24.000Z | 2018-11-21T23:34:24.000Z | WangShuang_book/hw3.asm | SmirnovKol/Learning_x86_assembly_language | 239b2fb60d6df87316b98184c9c6b6f36940ccbe | [
"MIT"
] | null | null | null | WangShuang_book/hw3.asm | SmirnovKol/Learning_x86_assembly_language | 239b2fb60d6df87316b98184c9c6b6f36940ccbe | [
"MIT"
] | null | null | null | ASSUME SS:stack,CS:code,DS:data
;数据段的定义
data SEGMENT
strInput DB 100H dup(?)
str0 DB 0DH, 0AH, 24H
strExit DB 'Please press any key to exit!', 0DH, 0AH, 24H
data ends
;栈空间的定义
stack SEGMENT STACK ;这里要加上“STACK”,不然编译器不知道这是一段栈空间,在连接时老是说没有栈
DB 20 DUP(0)
top LABEL WORD ;栈顶指针
stack ends
;代码段空间的定义
code SEGMENT
start: MOV AX, stack
MOV SS, AX ;栈空间的初始化
LEA SP, top ;设置栈和栈顶地址
MOV AX, data
MOV DS, AX ;初始化数据段
input: LEA DX, strInput
MOV BX, DX
MOV byte ptr DS:[BX], 0ffh
MOV AH, 0AH
INT 21H ;键盘输入到缓冲区
MOV DI, DX ;获取输入缓冲区首址,放在DI中
MOV BH, DS:[DI] ;获取输入缓冲区的最大字符数
MOV BL, DS:[DI+1] ;获取输入缓冲区中实际输入的字符数
LEA DX, str0
MOV AH, 9
INT 21H ;输出回车换行
output: XOR CH, CH
MOV CL, BL
MOV BX, DI
lea bx, strInput
ADD BX, CX
ADD BX, 2
MOV byte ptr DS:[BX], 0AH
INC BX
MOV byte ptr DS:[BX], 0DH
INC BX
MOV byte ptr DS:[BX], 24H ;插入回车、换行和结束字符
MOV DX, DI
ADD DX, 2
MOV AH, 9
INT 21H
finish: LEA DX, strExit ;DX指向要输出字符串
MOV AH, 9
INT 21H ;执行输出语句
MOV AH, 7
INT 21H
;INT 21H的7号功能是让用户输入但不回显,所以程序在就不会一闪而过了
MOV AX, 4C00H
;MOV AH, 4CH
INT 21H ;返回
code ends
end start
| 17.734375 | 60 | 0.656388 |
3a14da2db8889a335de1cf1000c61333993747e7 | 410 | asm | Assembly | programs/oeis/127/A127231.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/127/A127231.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/127/A127231.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A127231: a(n) = (2n)! + 1.
; 2,3,25,721,40321,3628801,479001601,87178291201,20922789888001,6402373705728001,2432902008176640001,1124000727777607680001,620448401733239439360001,403291461126605635584000001,304888344611713860501504000001,265252859812191058636308480000001
mul $0,2
seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters).
add $0,1
| 58.571429 | 241 | 0.802439 |
1a453b44f06a11e64846c2fab13bac5b571c2de5 | 321 | asm | Assembly | programs/oeis/088/A088841.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/088/A088841.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/088/A088841.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A088841: Numerator of quotient=sigma[7n]/sigma[n].
; 8,8,8,8,8,8,57,8,8,8,8,8,8,57,8,8,8,8,8,8,57,8,8,8,8,8,8,57,8,8,8,8,8,8,57,8,8,8,8,8,8,57,8,8,8,8,8,8,400,8,8,8,8,8,8,57,8,8,8,8,8,8,57,8,8,8,8,8,8,57,8,8,8,8,8,8,57,8,8,8,8,8,8,57,8,8,8,8,8,8,57,8,8,8,8,8,8
mov $1,$0
add $1,1
gcd $1,49
div $1,6
mul $1,49
add $1,8
| 32.1 | 209 | 0.566978 |
fe3c9326d9526ff9ab9aa924618ab06cfaef215b | 768 | asm | Assembly | data/pokemon/base_stats/vibrava.asm | TastySnax12/pokecrystal16-493-plus | 9de36c8803c9bdf4b8564ed547f988b0b66f0c41 | [
"blessing"
] | 2 | 2021-07-31T07:05:06.000Z | 2021-10-16T03:32:26.000Z | data/pokemon/base_stats/vibrava.asm | TastySnax12/pokecrystal16-493-plus | 9de36c8803c9bdf4b8564ed547f988b0b66f0c41 | [
"blessing"
] | null | null | null | data/pokemon/base_stats/vibrava.asm | TastySnax12/pokecrystal16-493-plus | 9de36c8803c9bdf4b8564ed547f988b0b66f0c41 | [
"blessing"
] | 3 | 2021-01-15T18:45:40.000Z | 2021-10-16T03:35:27.000Z | db 0 ; species ID placeholder
db 50, 70, 50, 70, 50, 50
; hp atk def spd sat sdf
db GROUND, DRAGON ; type
db 120 ; catch rate
db 126 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F50 ; gender ratio
db 100 ; unknown 1
db 20 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/vibrava/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_MEDIUM_SLOW ; growth rate
dn EGG_BUG, EGG_BUG ; egg groups
; tm/hm learnset
tmhm HEADBUTT, CURSE, TOXIC, ROCK_SMASH, HIDDEN_POWER, SUNNY_DAY, SWEET_SCENT, SNORE, HYPER_BEAM, PROTECT, GIGA_DRAIN, ENDURE, FRUSTRATION, SOLARBEAM, DRAGONBREATH, EARTHQUAKE, RETURN, DIG, MUD_SLAP, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, SANDSTORM, SWIFT, REST, ATTRACT, STEEL_WING, FURY_CUTTER, FLY, STRENGTH
; end
| 34.909091 | 306 | 0.721354 |
280a50b91b7d648a2249be14650cdbc4348b3b7e | 11,073 | asm | Assembly | examples/6_fibonacci_sequence/src/main.asm | AgileEhsan/libasm_io | 2ce2cf5614fa59ea49a5ec27423a8eccb2cff98d | [
"BSD-3-Clause"
] | null | null | null | examples/6_fibonacci_sequence/src/main.asm | AgileEhsan/libasm_io | 2ce2cf5614fa59ea49a5ec27423a8eccb2cff98d | [
"BSD-3-Clause"
] | null | null | null | examples/6_fibonacci_sequence/src/main.asm | AgileEhsan/libasm_io | 2ce2cf5614fa59ea49a5ec27423a8eccb2cff98d | [
"BSD-3-Clause"
] | 1 | 2021-01-21T06:24:07.000Z | 2021-01-21T06:24:07.000Z | ;=================================================================
;
; Copyright (c) 2014, Eric Blundell
; Copyright (c) 2014, Vincent Merriman
;
; All rights reserved.
;
; libasm_io is distributed under the following BSD 3-Clause License
;
; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
;
; 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
;
; 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from
; this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
; ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
;==================================================================
;the following is defined when the library examples are being built with the library
%ifdef _LIBASM_IO_BUILDING_
;if the library build system is building the examples, then an option to NASM specifies the directory
;to find this include, so we can include it by its name only
%include "libasm_io.inc"
%else
;otherwise if this code is compiled against the already installed library
;it's header needs to be included from its installed location
%include "/usr/local/include/libasm_io.inc"
%endif
cglobal main
section .data
start_msg: db "Enter a number to calculate all the fibonacci numbers from 0 up to and including that number.",0
rec_msg: db "Calculating recursively...",0
itr_msg: db "Calculating iteratively...",0
section .text
;===============================================================================
;fibs takes a number in RDI and calculates the Fibonacci number for it recursively
;fibs returns the result in RAX
fibs:
;set up a new stack frame for this functions
push rbp
mov rbp, rsp
;we need 3 local variables, each of them 8 bytes wide (64bit)
;3*8=24 so we move RSP down by 24 bytes to make space for them, we align it to 16 bytes by adding 8, because (24+8)/16 = 2 which is even
sub rsp, 24+8
;there will be three local variables
;[rsp] = variable 1 = RDI-1
;[rsp+8] = variable 2 = RDI-2
;[rsp+16] = variable 3 = fibs([rsp])
;
;there is not a fourth variable to hold fibs([rsp+8]) but we dont need one
;we are just going to use the value returned from fibs([rsp+8]) directly from RAX (see line 77 and 82)
cmp rdi,0 ;check for 0, fibs(0) = 0 so jump to fibs_0, it returns 0 in RAX and exits this function
je .fibs_0 ;jump if equal
cmp rdi,1 ;check for 1, fibs(1) = 1 so jump to fibs_1, it returns 1 in RAX and exits this function
je .fibs_1 ;jump if equal
cmp rdi,2 ;check for 2, fibs(2) = 1 so jump to fibs_1 just like if we encounter a 1
je .fibs_1 ;jump if equal
mov [rsp], rdi ;these two instructions set [RSP] to N-1 (N is in RDI, so we need to move RDI into [rsp] on the stack first)
sub QWORD [rsp], 1 ;sub subtracts the right operand from the left, and puts the result in the left.
;the QWORD before the memory address tells the assembler [rsp] contains a 64 bit quadword type, the type specification is required here
mov [rsp+8], rdi ;these two instructions set [RSP+8] to N-2 in a similar manner as above
sub QWORD [rsp+8], 2
mov rdi, [rsp] ;move N-1 from [RSP] (variable 1) into RDI, and call fibs on it to get the first term
call fibs
mov [rsp+16], rax ;move the result from to [RSP+16] on the stack (variable 3)
mov rdi, [rsp+8] ;move N-2 from [RSP+8] (variable 2) into RDI, and call fibs on it to get the second term
call fibs
;add the two terms, RAX already contains the second term, the call to fibs right above set RAX for us (on line 68)
add rax, QWORD [rsp+16] ;and [rsp+16] (variable 3) contains the first term because we moved it there above (on line 114)
;so we add them together, making sure RAX is on the left, so that RAX contains the result of the addition
;again, the QWORD before the memory address is required to tell the ADD insruction [rsp+16] is a pointer to a 64 bit quadword type
add rsp, 24+8
pop rbp
ret ;return, leaving the result of fibs in the RAX register
;the dot in front of the fibs_0 label makes it local to fibs, so the label name can be reused elsewhere if needed
;without causing a symbol naming conflict
.fibs_0:
mov rax, 0 ;RAX is the return value for fibs, return 0
;return the stack to its state prior to calling fibs, we could also use 'leave'
mov rsp, rbp
pop rbp
ret
.fibs_1:
mov rax, 1 ;RAX is the return value for fibs, return 1
;return the stack to its state prior to calling fibs, we could also use 'leave'
mov rsp, rbp
pop rbp
ret
;===============================================================================
;calculate all the Fibonacci numbers up to N
;the parameter for this function is RDI
print_fibs_up_to_n:
push rbp ;set up a new stack frame for this functions
mov rbp, rsp
;we need 2x 64bit integer variables, they are 8 bytes a piece so we need 16 bytes of space on the stack, we can subtract 32, because that is the minimum on windows
;and we want to be compatible
sub rsp, 32
;we are going to do a loop like this:
;FOR([RSP+8]=0; [RSP+8] <= [RSP]; [RSP+8]++) { RDI=[RSP+8]; fibs(RDI); }
mov [rsp], rdi ;[RSP] will be our upper limit for our for loop, move the parameter from rdi into it
mov QWORD [rsp+8], 0 ;[RSP+8] will be our counter, we also need to specify the datatype (QWORD here) when moving an immediate value (0) into memory
;the dot in front of .loop makes it local to print_fibs_up_n so we can use the label in other functions
.loop:
mov rdi, [rsp+8] ;make the parameter to fibs the value of the counter
call fibs ;call fibs on the RDI parameter (which is the set to the value of the counter)
mov rdi, rax ;put the result of fibs in RDI so we can print it, we dont need to push or pop anything before our calls
;because we are using stack memory for our counter and upper limit variable, which should never be modified by a calling function
call print_int ;print the result
call print_nl ;print new line
inc QWORD [rsp+8] ;increment the counter in memory by 1, we need the data type QWORD keyword here to tell INC we are incrementing a 64 bit value in memory
mov rcx, [rsp] ;we cannot compare two memory operands like this: CMP [RSP], [RSP+8]
;that would be a syntax error, one of the two operands must be a register, it can be either one (left or right but not both)
;therefore we are going to move our upper limit variable into the rcx register, so we can compare it to [RSP+8] which is our counter
cmp [rsp+8], rcx ;compare the counter to the upper limit, [RSP+8] is the counter, RCX now contains the upper limit from the instruction above
jle .loop ;jump to fib_loop if counter less than or equal to upper limit
;end fib_loop
add rsp, 32
pop rbp
ret
;calculate all the Fibonacci numbers up to N without using recursion
;the parameter for this function is RDI
print_fibs_up_to_n_without_recursion:
; this is the algorithm we are going to use, as written in C code
;
;int n, first = 0, second = 1, next, c;
;for ( c = 0 ; c < n ; c++ )
;{
; if ( c <= 1 )
; {
; next = c;
; }
; else
; {
; next = first + second;
; first = second;
; second = next;
; }
; printf("%d\n",next);
;}
push rbp ;set up a new stack frame for this functions
mov rbp, rsp
sub rsp, 40+8 ;room for 5x 64 bit variables, 8*5=40, we add 8 to align 40 to 16 bytes, because 48/16=3 which is even
mov [rsp], rdi ;[RSP] is the upper limit (n)
mov QWORD [rsp+8], 0 ;[RSP+8] is the counter (c)
mov QWORD [rsp+16], 0 ;[RSP+16] is (next)
mov QWORD [rsp+24], 0 ;[RSP+24] is (first)
mov QWORD [rsp+32], 1 ;[RSP+32] is (second)
.loop:
cmp QWORD [RSP+8], 1 ;compare [RSP+8] (c) to 1
jnle .else ;if !(c<=1), jump to the else branch, jnle stands for 'jump if not less than or equal to'
;this may seem like a bit of an inversion to whats seen in the C code above, but it accomplishes the same thing
mov rcx, [rsp+8] ;this moves [rsp+8] into [rsp+16], this represents: next=c; in the C code
mov [rsp+16], rcx
jmp .end_else
.else: ;this is the else branch
mov rcx, [rsp+24] ;mov [rsp+24] (first) into RCX so we can add it to [rsp+32] (second)
add rcx, QWORD [rsp+32]
mov [rsp+16], rcx ;assign the result of the addition to [rsp+16], this represents: next = first+second; in the C code
mov rcx, [rsp+32] ;mov [rsp+32] (second) into RCX, so we can assign RCX to [rsp+24] (first), this represents: first = second; in the C code
mov [rsp+24], rcx
mov rcx, [rsp+16] ;mov [rsp+16] (next) into RCX, so we can assign RCX to [rsp+32] (second), this represents: second = next; in the C code
mov [rsp+32], rcx
.end_else:
mov rdi, [rsp+16] ;mov [rsp+16] (next) into RDI so we can print it with print_int, this represents: printf("%d\n",next); in the C code
call print_int ;prints the value in RDI
call print_nl ;print a new line
inc QWORD [rsp+8] ;increment [rsp+8] (counter) by 1 after the comparison
mov rcx, [rsp+8] ;mov [rsp+8] (c) into rcx, (its the counter)
cmp rcx, [rsp] ;compare [rsp+8] (c) counter to [rsp] (n) (the upper limit)
jle .loop ;if RCX (c) is less than or equal to [rsp] (n) jump to .loop
add rsp, 40+8 ;restore the stack to its previous state, before we called print_fibs_up_n, we could also use the 'leave' opcode
pop rbp
ret
;===============================================================================
main:
push rbp ;set up a new stack frame for this functions
mov rbp, rsp
sub rsp, 32
mov rdi, QWORD start_msg
call print_string
call print_nl
call read_int
mov [rsp], rax
mov rdi, QWORD itr_msg
call print_string
call print_nl
mov rdi,[rsp]
call print_fibs_up_to_n_without_recursion
mov rdi, QWORD rec_msg
call print_string
call print_nl
mov rdi,[rsp]
call print_fibs_up_to_n
add rsp, 32
pop rbp
ret
| 34.281734 | 165 | 0.680574 |
c6b75262c3c6196773cf178051b744610af3cd59 | 16,296 | asm | Assembly | src/test/ref/examples/mega65/dypp65.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | 2 | 2022-03-01T02:21:14.000Z | 2022-03-01T04:33:35.000Z | src/test/ref/examples/mega65/dypp65.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/test/ref/examples/mega65/dypp65.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | // DYPP (Different Y Pixel Position) LOGO created using DMA
// Graphics mode is 45x25 full-colour super extended attribute mode text-mode
// Character layout is column-wise giving linear addressing of the graphics (one byte per pixel)
.cpu _45gs02
// MEGA65 platform PRG executable starting in MEGA65 mode.
.file [name="dypp65.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$2001]
.segmentdef Code [start=$2017]
.segmentdef Data [startAfter="Code"]
.segment Basic
.byte $0a, $20, $0a, $00, $fe, $02, $20, $30, $00 // 10 BANK 0
.byte $15, $20, $14, $00, $9e, $20 // 20 SYS
.text toIntString(main) // NNNN
.byte $00, $00, $00 //
/// DMA command fill
.const DMA_COMMAND_FILL = 3
/// $00 = End of options
.const DMA_OPTION_END = 0
/// $0B = Use F018B list format
.const DMA_OPTION_FORMAT_F018B = $a
/// $81 $xx = Set MB of destination address
.const DMA_OPTION_DEST_MB = $81
.const WHITE = 1
.const SIZEOF_UNSIGNED_INT = 2
.const OFFSET_STRUCT_F018_DMAGIC_EN018B = 3
.const OFFSET_STRUCT_DMA_LIST_F018B_COUNT = 1
.const OFFSET_STRUCT_DMA_LIST_F018B_SRC = 3
.const OFFSET_STRUCT_DMA_LIST_F018B_DEST = 6
.const OFFSET_STRUCT_F018_DMAGIC_ADDRMB = 4
.const OFFSET_STRUCT_F018_DMAGIC_ADDRBANK = 2
.const OFFSET_STRUCT_F018_DMAGIC_ADDRMSB = 1
.const OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK = 8
.const OFFSET_STRUCT_F018_DMAGIC_ETRIG = 5
.const OFFSET_STRUCT_MEGA65_VICIV_CONTROLB = $31
.const OFFSET_STRUCT_MEGA65_VICIV_CONTROLC = $54
.const OFFSET_STRUCT_MEGA65_VICIV_KEY = $2f
.const OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO = $5c
.const OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_HI = $5d
.const OFFSET_STRUCT_MEGA65_VICIV_TBDRPOS_LO = $48
.const OFFSET_STRUCT_MEGA65_VICIV_TBDRPOS_HI = $49
.const OFFSET_STRUCT_MEGA65_VICIV_BBDRPOS_LO = $4a
.const OFFSET_STRUCT_MEGA65_VICIV_BBDRPOS_HI = $4b
.const OFFSET_STRUCT_MEGA65_VICIV_CHARSTEP_LO = $58
.const OFFSET_STRUCT_MEGA65_VICIV_CHARSTEP_HI = $59
.const OFFSET_STRUCT_MEGA65_VICIV_TEXTXPOS_LO = $4c
.const OFFSET_STRUCT_MEGA65_VICIV_TEXTXPOS_HI = $4d
.const OFFSET_STRUCT_MEGA65_VICIV_CHRCOUNT = $5e
.const OFFSET_STRUCT_MEGA65_VICIV_SCRNPTR_LOLO = $60
.const OFFSET_STRUCT_MEGA65_VICIV_SCRNPTR_LOHI = $61
.const OFFSET_STRUCT_MEGA65_VICIV_SCRNPTR_HILO = $62
.const OFFSET_STRUCT_MEGA65_VICIV_SCRNPTR_HIHI = $63
.const OFFSET_STRUCT_MEGA65_VICIV_CHARPTR_LOLO = $68
.const OFFSET_STRUCT_MEGA65_VICIV_CHARPTR_LOHI = $69
.const OFFSET_STRUCT_MEGA65_VICIV_CHARPTR_HILO = $6a
.const OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
.const OFFSET_STRUCT_MEGA65_VICIV_BG_COLOR = $21
/// The VIC-II MOS 6567/6569
.label VICII = $d000
/// The VIC IV
.label VICIV = $d000
/// DMAgic F018 Controller
.label DMA = $d700
// The screen address (45*25*2=0x08ca bytes)
.label SCREEN = $5000
// The charset address (45*32*8=0x2d00 bytes)
.label CHARSET = $6000
.segment Code
main: {
.label c = 2
// Fill extended screen to achieve column-wise linear addressing
.label erow = 8
// Copy the LOGO to the CHARSET
.label logo_dest = 6
.label logo_src = 4
// asm
sei
// memoryRemap(0,0,0)
// Map memory to BANK 0 : 0x00XXXX - giving access to I/O
jsr memoryRemap
// VICIV->CONTROLB |= 0x40
// Enable 48MHz fast mode
lda #$40
ora VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLB
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLB
// VICIV->CONTROLC |= 0x40
lda #$40
ora VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLC
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLC
// VICIV->KEY = 0x47
// Enable the VIC 4
ldz #$47
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_KEY
// VICIV->KEY = 0x53
ldz #$53
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_KEY
// VICIV->SIDBDRWD_LO = 0
// Set sideborder width=0, disable raster delay and hot registers
ldz #0
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO
// VICIV->SIDBDRWD_HI = 0
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_HI
// VICIV->TBDRPOS_LO = 0
// Disable top/bottom borders
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_TBDRPOS_LO
// VICIV->TBDRPOS_HI = 0
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_TBDRPOS_HI
// VICIV->BBDRPOS_LO = 0
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_BBDRPOS_LO
// VICIV->BBDRPOS_HI = 2
ldz #2
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_BBDRPOS_HI
// VICIV->CONTROLC |= 1
// Enable Super Extended Attribute Mode
lda #1
ora VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLC
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLC
// VICIV->CONTROLB &= 0x7f
// Mode 40x25 chars - will be 45*25 when utilizing the borders
lda #$7f
and VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLB
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLB
// VICIV->CHARSTEP_LO = 90
ldz #$5a
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_CHARSTEP_LO
// VICIV->CHARSTEP_HI = 0
ldz #0
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_CHARSTEP_HI
// VICIV->TEXTXPOS_LO = 40
// Start text in the left border
ldz #$28
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_TEXTXPOS_LO
// VICIV->TEXTXPOS_HI = 0
ldz #0
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_TEXTXPOS_HI
// VICIV->CHRCOUNT = 45
// Set number of characters to display per row
ldz #$2d
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_CHRCOUNT
// VICIV->SCRNPTR_LOLO = BYTE0(SCREEN)
// Set exact screen address
ldz #0
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_SCRNPTR_LOLO
// VICIV->SCRNPTR_LOHI = BYTE1(SCREEN)
ldz #>SCREEN
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_SCRNPTR_LOHI
// VICIV->SCRNPTR_HILO = 0
ldz #0
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_SCRNPTR_HILO
// VICIV->SCRNPTR_HIHI = 0
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_SCRNPTR_HIHI
// VICIV->CHARPTR_LOLO = BYTE0(CHARSET)
// Set exact charset address
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_CHARPTR_LOLO
// VICIV->CHARPTR_LOHI = BYTE1(CHARSET)
ldz #>CHARSET
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_CHARPTR_LOHI
// VICIV->CHARPTR_HILO = 0
ldz #0
stz VICIV+OFFSET_STRUCT_MEGA65_VICIV_CHARPTR_HILO
// memset_dma(SCREEN, 0, 45*25*2)
// Fill the screen with 0
lda #<SCREEN
sta.z memset_dma.dest
lda #>SCREEN
sta.z memset_dma.dest+1
lda #<$2d*$19*2
sta.z memset_dma.num
lda #>$2d*$19*2
sta.z memset_dma.num+1
jsr memset_dma
// memset_dma256(0xff,0x08,(void*)0x0000, WHITE, 45*25*2)
// Fill the colours with WHITE - directly into $ff80000
jsr memset_dma256
// memset_dma(CHARSET, 0x55, 45*32*8)
// Fill the charset with 0x55
lda #<CHARSET
sta.z memset_dma.dest
lda #>CHARSET
sta.z memset_dma.dest+1
ldz #$55
lda #<$2d*$20*8
sta.z memset_dma.num
lda #>$2d*$20*8
sta.z memset_dma.num+1
jsr memset_dma
lda #<SCREEN
sta.z erow
lda #>SCREEN
sta.z erow+1
ldx #0
__b1:
// for(char r=0; r<25; r++)
cpx #$19
bcc __b2
lda #<CHARSET
sta.z logo_dest
lda #>CHARSET
sta.z logo_dest+1
lda #<LOGO
sta.z logo_src
lda #>LOGO
sta.z logo_src+1
ldx #0
__b6:
// for(char col=0;col<45;col++)
cpx #$2d
bcc __b5
__b10:
// VICIV->BG_COLOR = VICII->RASTER
lda VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_BG_COLOR
jmp __b10
__b5:
ldy #0
__b7:
// for(char y=0;y<25*8;y++)
cpy #$19*8
bcc __b8
// logo_dest += 32*8
lda.z logo_dest
clc
adc #<$20*8
sta.z logo_dest
lda.z logo_dest+1
adc #>$20*8
sta.z logo_dest+1
// logo_src += 25*8
lda #$19*8
clc
adc.z logo_src
sta.z logo_src
bcc !+
inc.z logo_src+1
!:
// for(char col=0;col<45;col++)
inx
jmp __b6
__b8:
// logo_dest[y] = logo_src[y]
lda (logo_src),y
sta (logo_dest),y
// for(char y=0;y<25*8;y++)
iny
jmp __b7
__b2:
// unsigned int c = r
txa
sta.z c
lda #0
sta.z c+1
taz
__b3:
// for(char i=0; i<45; i++)
cpz #$2d
bcc __b4
// erow += 45
lda #$2d*SIZEOF_UNSIGNED_INT
clc
adc.z erow
sta.z erow
bcc !+
inc.z erow+1
!:
// for(char r=0; r<25; r++)
inx
jmp __b1
__b4:
// erow[i] = c
tza
asl
tay
lda.z c
sta (erow),y
iny
lda.z c+1
sta (erow),y
// c += 32
lda #$20
clc
adc.z c
sta.z c
bcc !+
inc.z c+1
!:
// for(char i=0; i<45; i++)
inz
jmp __b3
}
// Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
// void memoryRemap(char remapBlocks, unsigned int lowerPageOffset, unsigned int upperPageOffset)
memoryRemap: {
.label aVal = $f
.label xVal = $e
.label yVal = $d
.label zVal = $a
// char aVal = BYTE0(lowerPageOffset)
// lower blocks offset page low
ldz #0
stz.z aVal
// char xVal = (remapBlocks << 4) | (BYTE1(lowerPageOffset) & 0xf)
// lower blocks to map + lower blocks offset high nibble
stz.z xVal
// char yVal = BYTE0(upperPageOffset)
// upper blocks offset page
stz.z yVal
// char zVal = (remapBlocks & 0xf0) | (BYTE1(upperPageOffset) & 0xf)
// upper blocks to map + upper blocks offset page high nibble
stz.z zVal
// asm
lda aVal
ldx xVal
ldy yVal
map
eom
// }
rts
}
// Fill a memory block within the first 64K memory space using MEGA65 DMagic DMA
// Fills the values of num bytes at the destination with a single byte value.
// - dest The destination address (within the MB and bank)
// - fill The char to fill with
// - num The number of bytes to copy
// void memset_dma(__zp($10) void *dest, __register(Z) char fill, __zp($b) unsigned int num)
memset_dma: {
.label num = $b
.label dest = $10
// char dmaMode = DMA->EN018B
// Remember current F018 A/B mode
ldx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// memset_dma_command.count = num
// Set up command
lda.z num
sta memset_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_COUNT
lda.z num+1
sta memset_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_COUNT+1
// memset_dma_command.src = (char*)fill
tza
sta memset_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_SRC
lda #0
sta memset_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_SRC+1
// memset_dma_command.dest = dest
lda.z dest
sta memset_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_DEST
lda.z dest+1
sta memset_dma_command+OFFSET_STRUCT_DMA_LIST_F018B_DEST+1
// DMA->EN018B = 1
// Set F018B mode
ldz #1
stz DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// DMA->ADDRMB = 0
// Set address of DMA list
ldz #0
stz DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB
// DMA->ADDRBANK = 0
stz DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK
// DMA-> ADDRMSB = BYTE1(&memset_dma_command)
ldz #>memset_dma_command
stz DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB
// DMA-> ADDRLSBTRIG = BYTE0(&memset_dma_command)
// Trigger the DMA (without option lists)
ldz #<memset_dma_command
stz DMA
// DMA->EN018B = dmaMode
// Re-enable F018A mode
stx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// }
rts
}
// Set a memory block anywhere in the entire 256MB memory space using MEGA65 DMagic DMA
// Sets the values of num bytes to the memory block pointed to by destination.
// - dest_mb The MB value for the destination (0-255)
// - dest_bank The 64KB bank for the destination (0-15)
// - dest The destination address (within the MB and bank)
// - num The number of bytes to copy
// void memset_dma256(char dest_mb, char dest_bank, void *dest, char fill, unsigned int num)
memset_dma256: {
.const dest_mb = $ff
.const dest_bank = 8
.const num = $2d*$19*2
.label dest = 0
.label f018b = memset_dma_command256+4
// char dmaMode = DMA->EN018B
// Remember current F018 A/B mode
ldx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// memset_dma_command256[1] = dest_mb
// Set up command
ldz #dest_mb
stz memset_dma_command256+1
// f018b->count = num
lda #<num
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_COUNT
lda #>num
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_COUNT+1
// f018b->dest_bank = dest_bank
ldz #dest_bank
stz f018b+OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK
// f018b->dest = dest
lda #<dest
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_DEST
lda #>dest
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_DEST+1
// f018b->src = (char*)fill
// Set fill byte
lda #<WHITE
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_SRC
lda #>WHITE
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_SRC+1
// DMA->EN018B = 1
// Set F018B mode
ldz #1
stz DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// DMA->ADDRMB = 0
// Set address of DMA list
ldz #0
stz DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB
// DMA->ADDRBANK = 0
stz DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK
// DMA-> ADDRMSB = BYTE1(memset_dma_command256)
ldz #>memset_dma_command256
stz DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB
// DMA-> ETRIG = BYTE0(memset_dma_command256)
// Trigger the DMA (with option lists)
ldz #<memset_dma_command256
stz DMA+OFFSET_STRUCT_F018_DMAGIC_ETRIG
// DMA->EN018B = dmaMode
// Re-enable F018A mode
stx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// }
rts
}
.segment Data
// DMA list entry with options for setting data in the 256MB memory space
// Contains DMA options options for setting MB followed by DMA_LIST_F018B struct.
memset_dma_command256: .byte DMA_OPTION_DEST_MB, 0, DMA_OPTION_FORMAT_F018B, DMA_OPTION_END, DMA_COMMAND_FILL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
// A logo in column-wide linear single-color memory layout
LOGO:
.var pic = LoadPicture("camelot.png", List().add($ffffff, $000000))
.for (var x=0;x<45; x++)
.for (var y=0; y<25*8; y++)
.byte pic.getSinglecolorByte(x,y)
// DMA list entry for filling data
memset_dma_command: .byte DMA_COMMAND_FILL
.word 0, 0
.byte 0
.word 0
.byte 0, 0
.word 0
| 34.452431 | 149 | 0.688574 |
8a8dfaaef28ac18bb5f15e0acc9c552001bc47ae | 2,794 | asm | Assembly | Kernel/src/main.asm | NudelErde/Kernel | 875a0635b5bbd910680970a9446cb86b96b62323 | [
"MIT"
] | null | null | null | Kernel/src/main.asm | NudelErde/Kernel | 875a0635b5bbd910680970a9446cb86b96b62323 | [
"MIT"
] | null | null | null | Kernel/src/main.asm | NudelErde/Kernel | 875a0635b5bbd910680970a9446cb86b96b62323 | [
"MIT"
] | 1 | 2021-04-28T10:13:53.000Z | 2021-04-28T10:13:53.000Z | global start
global multiboot_information_structure
global page_table_l4
global page_table_l3
global page_table_l2
global gdt64
extern long_mode_start
section .text
bits 32
start:
mov esp, stack_top
call check_multiboot
mov dword[multiboot_information_structure], ebx
call check_cpuid
call check_long_mode
call setup_page_tables
call enable_paging
lgdt [gdt64.pointer]
jmp 0b1000:long_mode_start
hlt
check_multiboot:
cmp eax, 0x36d76289
jne .no_multiboot
ret
.no_multiboot:
mov edx, .no_multiboot_string
jmp error
.no_multiboot_string:
db "Not started by multiboot", 0
check_cpuid:
pushfd
pop eax
mov ecx, eax
xor eax, 1 << 21
push eax
popfd
pushfd
pop eax
push ecx
popfd
cmp eax, ecx
je .no_cpuid
ret
.no_cpuid:
mov edx, .no_cpuid_string
jmp error
.no_cpuid_string:
db "No cpuid string", 0
check_long_mode:
mov eax, 0x80000000
cpuid
cmp eax, 0x80000001
jb .no_long_mode
mov eax, 0x80000001
cpuid
test edx, 1 << 29
jz .no_long_mode
ret
.no_long_mode:
mov edx, .no_long_mode_string
jmp error
.no_long_mode_string:
db "No long mode supported", 0
setup_page_tables:
mov eax, page_table_l3
or eax, 0b11 ; present, writable
mov [page_table_l4], eax
mov eax, page_table_l2
or eax, 0b11 ; present, writable
mov [page_table_l3], eax
mov ecx, 0 ; counter
.loop:
mov eax, 0x200000 ; 2MiB
mul ecx
or eax, 0b10000011 ; present, writable, huge page
mov [page_table_l2 + ecx * 8], eax
inc ecx ; increment counter
cmp ecx, 512 ; checks if the whole table is mapped
jne .loop ; if not, continue
ret
enable_paging:
; pass page table location to cpu
mov eax, page_table_l4
mov cr3, eax
; enable PAE
mov eax, cr4
or eax, 1 << 5
mov cr4, eax
; enable long mode
mov ecx, 0xC0000080
rdmsr
or eax, 1 << 8
wrmsr
; enable paging
mov eax, cr0
or eax, 1 << 31
mov cr0, eax
ret
error:
mov ESI, edx ; clone edx to esi
mov EDI, 0xB8000 ; output to edi
.loop:
mov al, [ESI] ; current char in eax
mov byte [EDI], al ; char in output address
mov byte [EDI+1], 4 ; color red
inc ESI
inc EDI
inc EDI
cmp al, 0
je .error_end
jmp .loop
.error_end:
hlt
section .bss
align 4096
page_table_l4:
resb 4096
page_table_l3:
resb 4096
page_table_l2:
resb 4096
stack_bottom:
resb 4096 * 4
stack_top:
multiboot_information_structure:
resb 4
section .rodata
gdt64:
dq 0 ; zero entry
.code_segment: equ $ - gdt64
dq (1 << 43) | (1 << 44) | (1 << 47) | (1 << 53) ; code segment
.code_segment_ring3: equ $ - gdt64
dq (1 << 43) | (1 << 44) | (1 << 45) | (1 << 46) | (1 << 47) | (1 << 53) ; ring 3 code segment
.data_segment_ring3: equ $ - gdt64
dq (1 << 41) | (1 << 44) | (1 << 45) | (1 << 46) | (1 << 47)
.task_state_segment: equ $ - gdt64
dq 0
dq 0
.pointer:
dw $ - gdt64 - 1 ; length
dq gdt64 ; address
| 16.150289 | 95 | 0.697566 |
28b8d2f2822e0c4d6258449a463ae1240175a40d | 634 | asm | Assembly | oeis/163/A163433.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/163/A163433.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/163/A163433.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A163433: Number of different fixed (possibly) disconnected trominoes bounded tightly by an n X n square.
; 0,4,22,52,94,148,214,292,382,484,598,724,862,1012,1174,1348,1534,1732,1942,2164,2398,2644,2902,3172,3454,3748,4054,4372,4702,5044,5398,5764,6142,6532,6934,7348,7774,8212,8662,9124,9598,10084,10582,11092,11614,12148,12694,13252,13822,14404,14998,15604,16222,16852,17494,18148,18814,19492,20182,20884,21598,22324,23062,23812,24574,25348,26134,26932,27742,28564,29398,30244,31102,31972,32854,33748,34654,35572,36502,37444,38398,39364,40342,41332,42334,43348,44374,45412,46462,47524,48598,49684,50782
pow $0,2
mul $0,6
trn $0,2
| 90.571429 | 498 | 0.794953 |
b1e2e833b0ed8533faa5610ad70c0ddde0c8c511 | 243 | asm | Assembly | pwnlib/shellcraft/templates/arm/linux/iopl.asm | zaratec/pwntools | 8793decd1c9b8c822e3db6c27b9cbf6e8cddfeba | [
"MIT"
] | 5 | 2018-05-15T13:00:56.000Z | 2020-02-09T14:29:00.000Z | pwnlib/shellcraft/templates/arm/linux/iopl.asm | FDlucifer/binjitsu | 999ad632004bfc3e623eead20eb11de98fc1f4dd | [
"MIT"
] | null | null | null | pwnlib/shellcraft/templates/arm/linux/iopl.asm | FDlucifer/binjitsu | 999ad632004bfc3e623eead20eb11de98fc1f4dd | [
"MIT"
] | 6 | 2017-09-07T02:31:11.000Z | 2021-07-05T16:59:18.000Z |
<%
from pwnlib.shellcraft.arm.linux import syscall
%>
<%page args="level"/>
<%docstring>
Invokes the syscall iopl. See 'man 2 iopl' for more information.
Arguments:
level(int): level
</%docstring>
${syscall('SYS_iopl', level)}
| 17.357143 | 65 | 0.674897 |
281f330eb40b6dd36eeec3f4d3198b5a9c884c81 | 428 | asm | Assembly | oeis/028/A028077.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/028/A028077.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/028/A028077.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A028077: Expansion of 1/((1-3x)(1-6x)(1-7x)(1-11x)).
; Submitted by Jon Maiga
; 1,27,472,6822,88963,1091349,12886714,148484664,1683799645,18895210191,210582084076,2336271745626,25842423980647,285296827032153,3145632963614158,34654478019199308,381572508324065569
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
mul $1,11
sub $2,1
sub $0,$2
seq $0,17931 ; Expansion of 1/((1-3x)(1-6x)(1-7x)).
add $1,$0
lpe
mov $0,$1
| 25.176471 | 183 | 0.698598 |
cc6abc24cc2138fb9e676e5643b55acfdc765314 | 5,720 | asm | Assembly | data/dmg-rom.asm | earaujoassis/oh-boy | 81865e021c1c67fe14226786f6127cdc3fde4901 | [
"MIT"
] | null | null | null | data/dmg-rom.asm | earaujoassis/oh-boy | 81865e021c1c67fe14226786f6127cdc3fde4901 | [
"MIT"
] | null | null | null | data/dmg-rom.asm | earaujoassis/oh-boy | 81865e021c1c67fe14226786f6127cdc3fde4901 | [
"MIT"
] | null | null | null | ; This code may be copyrighted. It was made available as a mean of learning and sharing knowledge.
; It was obtained through the following web address: https://gist.github.com/drhelius/6063288
; If you're the author/copyright holder, please let me know if you want me to remove this code.
LD SP,$FFFE ; $0000 Setup Stack
XOR A ; $0003 Zero the memory from $8000-$9FFF (VRAM)
LD HL,$9FFF ; $0004
Addr_0007:
LD (HL-),A ; $0007
BIT 7,H ; $0008
JR NZ, Addr_0007 ; $000A
LD HL,$FF26 ; $000C Setup Audio
LD C,$11 ; $000F
LD A,$80 ; $0011
LD (HL-),A ; $0013
LD ($FF00+C),A ; $0014
INC C ; $0015
LD A,$F3 ; $0016
LD ($FF00+C),A ; $0018
LD (HL-),A ; $0019
LD A,$77 ; $001A
LD (HL),A ; $001C
LD A,$FC ; $001D Setup BG Palette
LD ($FF00+$47),A ; $001F
LD DE,$0104 ; $0021 Convert and load logo data from cart into Video RAM
LD HL,$8010 ; $0024
Addr_0027:
LD A,(DE) ; $0027
CALL Addr_0095 ; $0028
CALL Addr_0096 ; $002B
INC DE ; $002E
LD A,E ; $002F
CP $34 ; $0030
JR NZ, Addr_0027 ; $0032
LD DE,$00D8 ; $0034 Load 8 additional bytes into Video RAM
LD B,$08 ; $0037
Addr_0039:
LD A,(DE) ; $0039
INC DE ; $003A
LD (HL+),A ; $003B
INC HL ; $003C
DEC B ; $003D
JR NZ, Addr_0039 ; $003E
LD A,$19 ; $0040 Setup Background Tilemap
LD ($9910),A ; $0042
LD HL,$992F ; $0045
Addr_0048:
LD C,$0C ; $0048
Addr_004A:
DEC A ; $004A
JR Z, Addr_0055 ; $004B
LD (HL-),A ; $004D
DEC C ; $004E
JR NZ, Addr_004A ; $004F
LD L,$0F ; $0051
JR Addr_0048 ; $0053
; === Scroll logo on screen, and play logo sound ===
Addr_0055:
LD H,A ; $0055 Initialize scroll count, H=0
LD A,$64 ; $0056
LD D,A ; $0058 Set loop count, D=$64
LD ($FF00+$42),A ; $0059 Set vertical scroll register
LD A,$91 ; $005B
LD ($FF00+$40),A ; $005D Turn on LCD, showing Background
INC B ; $005F Set B=1
Addr_0060:
LD E,$02 ; $0060
Addr_0062:
LD C,$0C ; $0062
Addr_0064:
LD A,($FF00+$44) ; $0064 Wait for screen frame
CP $90 ; $0066
JR NZ, Addr_0064 ; $0068
DEC C ; $006A
JR NZ, Addr_0064 ; $006B
DEC E ; $006D
JR NZ, Addr_0062 ; $006E
LD C,$13 ; $0070 Setup for scroll
INC H ; $0072 Increment scroll count
LD A,H ; $0073
LD E,$83 ; $0074
CP $62 ; $0076 $62 counts in, play sound #1
JR Z, Addr_0080 ; $0078
LD E,$C1 ; $007A
CP $64 ; $007C
JR NZ, Addr_0086 ; $007E $64 counts in, play sound #2
Addr_0080:
LD A,E ; $0080 Play sound
LD ($FF00+C),A ; $0081
INC C ; $0082
LD A,$87 ; $0083
LD ($FF00+C),A ; $0085
Addr_0086:
LD A,($FF00+$42) ; $0086
SUB B ; $0088
LD ($FF00+$42),A ; $0089 Scroll logo up if B=1
DEC D ; $008B
JR NZ, Addr_0060 ; $008C
DEC B ; $008E Set B=0 First time
JR NZ, Addr_00E0 ; $008F ... Next time, cause jump to "Nintendo Logo check"
LD D,$20 ; $0091 Use scrolling loop to pause
JR Addr_0060 ; $0093
; ==== Graphic Routine ====
Addr_0095:
LD C,A ; $0095 "Double up" all the bits of the graphics data and store in Video RAM
Addr_0096:
LD B,$04 ; $0096
Addr_0098:
PUSH BC ; $0098
RL C ; $0099
RLA ; $009B
POP BC ; $009C
RL C ; $009D
RLA ; $009F
DEC B ; $00A0
JR NZ, Addr_0098 ; $00A1
LD (HL+),A ; $00A3
INC HL ; $00A4
LD (HL+),A ; $00A5
INC HL ; $00A6
RET ; $00A7
Addr_00A8:
;Nintendo Logo
.DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D
.DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99
.DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E
Addr_00D8:
;More video data
.DB $3C,$42,$B9,$A5,$B9,$A5,$42,$3C
; ===== Nintendo logo comparison routine =====
Addr_00E0:
LD HL,$0104 ; $00E0 Point HL to Nintendo logo in cart
LD DE,$00A8 ; $00E3 Point DE to Nintendo logo in DMG ROM
Addr_00E6:
LD A,(DE) ; $00E6
INC DE ; $00E7
CP (HL) ; $00E8 Compare logo data in cart to DMG ROM
JR NZ,$FE ; $00E9 If not a match, lock up here
INC HL ; $00EB
LD A,L ; $00EC
CP $34 ; $00ED Do this for $30 bytes
JR NZ, Addr_00E6 ; $00EF
LD B,$19 ; $00F1
LD A,B ; $00F3
Addr_00F4:
ADD (HL) ; $00F4
INC HL ; $00F5
DEC B ; $00F6
JR NZ, Addr_00F4 ; $00F7
ADD (HL) ; $00F9
JR NZ,$FE ; $00FA If $19 + bytes from $0134-$014D don't add to $00 lock up
LD A,$01 ; $00FC
LD ($FF00+$50),A ; $00FE Turn-off DMG ROM
| 35.308642 | 101 | 0.446853 |
67e357ec3918239f974b39333b97e798fbaf3273 | 2,321 | asm | Assembly | DE-LAB-3/main.asm | tustunkok/CMPE236-Labs | 0592cf993a9c0b360973654bc6171a29a0e3335c | [
"MIT"
] | null | null | null | DE-LAB-3/main.asm | tustunkok/CMPE236-Labs | 0592cf993a9c0b360973654bc6171a29a0e3335c | [
"MIT"
] | null | null | null | DE-LAB-3/main.asm | tustunkok/CMPE236-Labs | 0592cf993a9c0b360973654bc6171a29a0e3335c | [
"MIT"
] | null | null | null | ; GLOBAL 7SEG CONSTANTS
N0 EQU 11000000B ; #DEFINE N0 11000000B
N1 EQU 11111001B
N2 EQU 10100100B
N3 EQU 10110000B
N4 EQU 10011001B
N5 EQU 10010010B
N6 EQU 10000010B
N7 EQU 11111000B
N8 EQU 10000000B
N9 EQU 10010000B
NA EQU 10001000B
NB EQU 10000011B
NC EQU 11000110B
ND EQU 10100001B
NE_ EQU 10000110B
NF EQU 10001110B
ORG 00H
SJMP MAIN
ORG 30H
MAIN: ACALL WAIT
ACALL DECODE_KEY ; INT R2 = DECODE_KEY();
MOV R2, A
ACALL WRT2LED ; WRT2LED(R2);
SJMP MAIN
; ===================================================
; WAIT FOR AN INPUT
; PARAMS: NONE
; RETURN: NONE
WAIT: MOV P1, #0F0H
MOV A, P1
ORL A, #0FH
CPL A
JZ WAIT
RET
; ===================================================
; GETS THE COLUMN VALUE AND CALCULATES THE EXACT BUTTON
; PARAMS: COLUMN INDEX
; RETURN: ASCII/VALUE OF THE CLICKED NUMBER
DECODE_KEY: MOV P1, #0F0H
MOV R2, #00D
ACALL FIND_ROW_COL ; FINDING THE INDEX OF THE COL
PUSH A ; SAVE THE RETURN VALUE IN THE LOCAL VARIABLE (R3)
MOV P1, #0FH
MOV R2, #01D
ACALL FIND_ROW_COL ;FINDING THE INDEX OF THE ROW
POP 03H
MOV B, #04D ;LOADING THE B WITH THE MAX. COL COUNT IN A ROW
MUL AB
ADD A, R3 ;A IS THE OFFSET VALUE FOR THE FLATTENED VECTOR
MOV DPTR, #MATRIX_LOOKUP
MOVC A, @A+DPTR
RET
; ===================================================
; ACCORDING TO GIVEN PARAMETER FIND WHICH COL/ROW IS ACTIVATED
; PARAMS: STATE (0/1)
; RETURN: THE COLUMN/ROW NUMBER
FIND_ROW_COL: CJNE R2, #00H, PASS_ROW_DATA
MOV DPTR, #COL_DATA
SJMP CNT1
PASS_ROW_DATA: MOV DPTR, #ROW_DATA
CNT1: MOV R2, P1
MOV R3, #04D
MOV R4, #00D
LP2: MOV A, R4
MOVC A, @A+DPTR
CLR C
SUBB A, R2
JZ FOUND
INC R4
DJNZ R3, LP2
FOUND: MOV A, R4
RET
; ==================================================
WRT2LED: MOV DPTR, #LED_DATA
MOV A, #10H
CLR C
SUBB A, R2
JC EXT1
MOV A, R2
MOVC A, @A+DPTR
MOV P2, A
EXT1: RET
; ==================================================
ORG 0200H
COL_DATA: DB 70H, 0B0H, 0D0H, 0E0H
ROW_DATA: DB 07H, 0BH, 0DH, 0EH
LED_DATA: DB N0, N1, N2, N3, N4, N5, N6, N7, N8, N9, NA, NB, NC, ND, NE_, NF
;MATRIX_LOOKUP: DB '1', '2', '3', 'A', '4', '5', '6', 'B', '7', '8', '9', 'C', '*', '0', '#', 'D'
MATRIX_LOOKUP: DB 01, 02, 03, 0AH, 04, 05, 06, 0BH, 07, 08, 09, 0CH, 0EH, 00, 0EH, 0DH
END | 21.896226 | 97 | 0.580353 |
ede166077a677e0ccda4f7f38345bc4dd08c8bd4 | 301 | asm | Assembly | programs/oeis/132/A132954.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/132/A132954.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/132/A132954.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A132954: Period 6: repeat [1, 2, 4, -1, -2, -4].
; 1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2,4,-1,-2,-4,1,2
lpb $0
mod $0,6
lpe
mov $1,2
pow $1,$0
lpb $1
sub $1,9
lpe
| 25.083333 | 185 | 0.445183 |
9316e23c493939d8dd02174c3a3fc7d0b227ff30 | 432 | asm | Assembly | tests/nasm/cmpxchg.asm | brenden7158/v86 | c9e274dc6e8cc619d1b36d57a69299aee6a45a91 | [
"BSD-2-Clause"
] | 12,700 | 2015-01-04T15:03:42.000Z | 2022-03-31T06:43:06.000Z | tests/nasm/cmpxchg.asm | brenden7158/v86 | c9e274dc6e8cc619d1b36d57a69299aee6a45a91 | [
"BSD-2-Clause"
] | 566 | 2015-01-01T18:16:40.000Z | 2022-03-31T19:59:10.000Z | tests/nasm/cmpxchg.asm | brenden7158/v86 | c9e274dc6e8cc619d1b36d57a69299aee6a45a91 | [
"BSD-2-Clause"
] | 1,182 | 2015-01-05T09:20:48.000Z | 2022-03-31T12:16:52.000Z | global _start
section .data
%include "header.inc"
mov eax, 123456789
mov ebx, 123456789
mov edx, 123456789
cmpxchg edx, ebx
push eax
push edx
push ebx
pushf
and dword [esp], 8ffh
cmpxchg ax, bx
push eax
push edx
push ebx
pushf
and dword [esp], 8ffh
cmpxchg al, bh
push eax
push edx
push ebx
pushf
and dword [esp], 8ffh
%include "footer.inc"
| 13.090909 | 25 | 0.597222 |
d9e36041883a561e665ef56e4134935176c0a0f2 | 286 | asm | Assembly | libsrc/stdio/aquarius/fgetc_cons.asm | andydansby/z88dk-mk2 | 51c15f1387293809c496f5eaf7b196f8a0e9b66b | [
"ClArtistic"
] | 1 | 2020-09-15T08:35:49.000Z | 2020-09-15T08:35:49.000Z | libsrc/stdio/aquarius/fgetc_cons.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | libsrc/stdio/aquarius/fgetc_cons.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | ;
; Mattel AQUARIUS Routines
;
; getkey() Wait for keypress
;
; Dec 2001 - Stefano Bodrato
;
;
; $Id: fgetc_cons.asm,v 1.1 2001/12/24 13:23:08 stefano Exp $
;
XLIB fgetc_cons
.fgetc_cons
call $1e80
and a
jr nz,fgetc_cons
.wkey
call $1e80
and a
jr z,wkey
ld l,a
ld h,0
ret
| 10.592593 | 61 | 0.664336 |
d7d3d862ddc943fbb3c3acf66e6c0a4e4b758b7c | 965 | asm | Assembly | data/pokemon/base_stats/lickilicky.asm | TastySnax12/pokecrystal16-493-plus | 9de36c8803c9bdf4b8564ed547f988b0b66f0c41 | [
"blessing"
] | 2 | 2021-07-31T07:05:06.000Z | 2021-10-16T03:32:26.000Z | data/pokemon/base_stats/lickilicky.asm | TastySnax12/pokecrystal16-493-plus | 9de36c8803c9bdf4b8564ed547f988b0b66f0c41 | [
"blessing"
] | null | null | null | data/pokemon/base_stats/lickilicky.asm | TastySnax12/pokecrystal16-493-plus | 9de36c8803c9bdf4b8564ed547f988b0b66f0c41 | [
"blessing"
] | 3 | 2021-01-15T18:45:40.000Z | 2021-10-16T03:35:27.000Z | db 0 ; species ID placeholder
db 110, 85, 95, 50, 80, 95
; hp atk def spd sat sdf
db NORMAL, NORMAL ; type
db 30 ; catch rate
db 180 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F50 ; gender ratio
db 100 ; unknown 1
db 20 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/lickilicky/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_MEDIUM_FAST ; growth rate
dn EGG_MONSTER, EGG_MONSTER ; egg groups
; tm/hm learnset
tmhm DYNAMICPUNCH, HEADBUTT, CURSE, ROLLOUT, TOXIC, ZAP_CANNON, ROCK_SMASH, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, BLIZZARD, HYPER_BEAM, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, SOLARBEAM, IRON_TAIL, THUNDER, EARTHQUAKE, RETURN, DIG, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, ICE_PUNCH, SWAGGER, SLEEP_TALK, SANDSTORM, FIRE_BLAST, DEFENSE_CURL, THUNDERPUNCH, DREAM_EATER, REST, ATTRACT, THIEF, FIRE_PUNCH, NIGHTMARE, CUT, SURF, STRENGTH, WHIRLPOOL, FLAMETHROWER, THUNDERBOLT, ICE_BEAM
; end
| 43.863636 | 493 | 0.744041 |
75db1c8e305110e802a83a2e23b6fe44f4078071 | 14,570 | asm | Assembly | src/spread/formular.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | src/spread/formular.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | src/spread/formular.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | * Spreadsheet 28/12-91
* - formular action routine
section prog
include win1_keys_wman
include win1_keys_wstatus
include win1_keys_wwork
include win1_keys_qdos_pt
include win1_keys_err
include win1_keys_k
include win1_keys_qdos_io
include win1_mac_oli
include win1_spread_keys
include win1_mac_assert
xdef mea_newd ; action routine for data entry
xdef mea_newddo ; action routine for "big" data entry
; xdef dta_edit ; go here after cell selection mode
xdef dta_cell ; update formular string
xdef dta_entr ; make an value entry
xdef dta_madr ; get ptr to cell menu item
xdef dta_vadr ; get adr of item value block
xdef dta_fbuf ; put formular into buffer
xdef dta_prcs ; process one cell
xdef dta_rmvf,dta_rmvc ; remove cell, remove cell+formular
xdef data_edt,do_edit ; identification entry point
xref.s mli.data,mli.call
xref.l mlo.data,wwa.eddo,wst_eddo
assert k.do+2,mact.doed
mea_newddo
moveq #k.do,d2 ; DO it all the time
bra.s skip_alt_tab
mea_newd
tst.b v_altbuff(a6) ; was ALT TAB pressed?
beq.s skip_alt_tab ; no
clr.b v_altbuff(a6)
move.l #$00180020,d1
tst.w da_toolb(a6) ; toolbar enabled?
bne.s alt_tab_set
sub.w #14,d1 ; move a bit up
alt_tab_set
moveq #iop.sptr,d0
moveq #1,d2
trap #do.io ; reposition pointer
xjmp ut_rdwci
skip_alt_tab
move.l d7,-(sp)
move.w d2,d7 ; keep selection keystroke
move.l da_cbx0(a6),d1 ; first selected cell
bsr dta_cell
xjsr mod_norm
bsr unselect
moveq #0,d4 ; no event
move.w d7,d0
move.l (sp)+,d7
addq.w #mact.edit,d0
;; moveq #mact.edit,d0 ; no error, but do the actual editing
;; add.w d7,d0 ; 2 for HIT, 4 for DO
;; move.l (sp)+,d7
rts
;
; outside edit routine... a4:wwork
do_edit
move.w d0,d4
move.l da_ccell(a6),d1 ; first selected cell
xjsr is_proct
beq data_bye1
tst.w da_buff(a6)
bne.s data_edt
data_lp
bsr dta_fbuf ; no, put formular into buffer
data_edt
move.l d1,da_ccell(a6) ; is current cell
xjsr cel_highl ; highlight cell
bsr dta_edit ; edit data/formular string
move.b d2,d7 ; preserve keystroke
xjsr cel_nohigh
tst.l d0
bne.s data_next ; string too long, take next one
cmpi.b #k.esc,d7 ; check termination codes
beq.s data_exit ; ESCaped ?
cmpi.b #k.up,d7 ; cell selection mode?
bne.s noterm
xjsr mod_selc
xjmp do_window
noterm
tst.b ws_litem+mli.call(a1) ; all.. ?
beq.s data_act
addq.w #1,da_dupdt(a6) ; no display update
xjsr mon_strt ; invoke monitor
;
; action required for one cell
data_act
move.l d1,da_ccell(a6) ; set actual cell
move.l d1,da_moncl(a6) ; monitor cell
bsr.s dta_prcs ; process new/changed cell
bne.s data_exit
;
; now check if recalculation of grid is required
tst.b ws_litem+mli.call(a1) ; don't calc on all
bne.s data_next
tst.w da_autoc(a6) ; auto calculate on ?
beq.s data_next
xjsr grd_calc
;
; proceed to following cell
data_next
move.l d1,d2 ; previous cell
xjsr cel_next ; get next cell in block
bmi.s data_exit ; ..end of block reached
;
; allow editing of the new cell..
tst.b ws_litem+mli.call(a1) ; is all item selected
beq.s data_lp ; ..no, normal editing
;
; ..or if all, re-use last cell's formula
exg d1,d2
bsr dta_fbuf ; re-use last formular
exg d1,d2
bra.s data_act
;
; final end of editing
data_exit
clr.w da_dupdt(a6) ; allow display update
;
; if all was selected, remove monitor..
tst.b ws_litem+mli.call(a1)
beq.s data_bye
xjsr mon_stop
;
; ..and if auto calculation was requested, here is the final calc to do
tst.w da_autoc(a6)
xjsr grd_calc
;
; and bye now
data_bye
cmpi.b #k.esc,d7 ; ESCaped?
beq.s data_bye1
tst.l da_cbx1(a6) ; test for one cell
bpl.s data_bye1
xjsr cel_nxtav ; go to next cell depending on status setting
xjsr cel_topl
data_bye1
bsr dta_cell ; update formular item
xjsr cel_info ; update cell info
xjmp do_window
*+++
* process a new/changed data / formular item
* formular has to be in buffer!
*
* Entry Exit
* d1.l c|r of cell for item preserved
*---
dta_prcs subr a0/a3
clr.w da_saved(a6)
tst.w da_buff(a6) ; any formular in buffer?
beq.s prcs_nof ; ..no, clear cell
move.l d1,da_ccell(a6) ; set current cell number
bsr dta_bufd ; store new formular in dma
bmi.s prcs_exit
xjsr prc_data ; process data
prcs_exit
tst.l d0
subend
prcs_nof
bsr.s dta_rmvf ; clear cell and its formular
bra.s prcs_exit
*+++
* make an entry in the menu area
*
* Entry Exit
* a0 value block preserved
* a4 wwork preserved
* d1.l c|r of cell preserved
*
*---
r_entr reg d2/d1/a0/a3
dta_entr
movem.l r_entr,-(sp)
bsr.s dta_used ; set new grid used values
bsr.s entr_rmv ; remove any cell contents
bsr dta_madr ; get address of cell
move.w val_fwrd(a0),d1 ; get format word
adda.l #val_strg,a0
move.l a0,wwm_pobj(a3) ; set pointer to object
moveq #1,d2 ; left justified
btst #fw..just,d1
bne.s entr_set
neg.b d2
entr_set
btst #fw..strg,d1
beq.s entr_ok
neg.b d2
entr_ok
move.b d2,wwm_xjst(a3) ; justfiy object
moveq #0,d0
movem.l (sp)+,r_entr
rts
entr_rmv
bsr dta_vadr ; value block
bmi.s entr_rx ; ..no value connected
move.l val_form(a3),d0 ; old formular = new formular
beq.s entr_kf ; ..value without formular
sub.l val_form(a0),d0
beq.s entr_kf
bsr.s dta_rmvf ; remove contents and formular
entr_rx
rts
entr_kf
bsr.s dta_rmvc
rts
*+++
* set new grid used values (is necessary)
*
* Entry Exit
* d1.l c|r of new cell preserved
*---
r_used reg d2
dta_used
movem.l r_used,-(sp)
move.l da_usedx(a6),d2 ; current used ranged
cmp.w d1,d2
bpl.s used_x
move.w d1,d2
used_x
swap d1
swap d2
cmp.w d1,d2
bpl.s used_y
move.w d1,d2
used_y
swap d1
swap d2
move.l d2,da_usedx(a6)
movem.l (sp)+,r_used
rts
*+++
* dta_rmvc: remove cell(s)
* dta_rmvf: remove cell(s) and their formulars
*
* Entry Exit
* a4 wwork preserved
* d1.l c|r of cell preserved
*---
dta_rmvf
move.l d2,-(sp)
moveq #0,d2
rmvf_do
xjsr is_proct
beq.s rmvf_x
bsr.s dta_rmvm
rmvf_x
move.l (sp)+,d2
rts
dta_rmvc
move.l d2,-(sp)
moveq #1,d2
bra.s rmvf_do
*+++
* remove cell(s), take care of strings
*
* Entry Exit
* a4 wwork preserved
* d1.l c|r of cell preserved
* d2.b <>0, keep formular preserved
*
* error codes: none
*---
r_rmvm reg d1/d3
dta_rmvm
movem.l r_rmvm,-(sp)
rmvm_lp
move.w da_fword(a6),d3 ; global format
bsr.s dta_rmvo ; remove one cell
bne.s rmvm_exit ; ..no cell connected
xjsr rdw_cchg
btst #fw..strg,d3 ; was it a string?
beq.s rmvm_exit ; ..no, so don't check following
btst #fw..cont,d3 ; is it longer than one cell?
beq.s rmvm_exit ; ..no
xjsr cel_nxtc ; next column cell
bne.s rmvm_exit
xjsr acc_tstf ; any formula in the next cell
bne.s rmvm_lp ; ..no, continue looping
rmvm_exit ; ..yes, so stop here
movem.l (sp)+,r_rmvm
moveq #0,d0
rts
*+++
* remove one cell cell
*
* Entry Exit
* a4 wwork preserved
* d1.l c|r of cell preserved
* d2.b <>0, keep formular preserved
* d3.w format word of formular
*
* error codes: err.itnf there was no item connected
*---
r_rmvo reg a0/a3
dta_rmvo
movem.l r_rmvo,-(sp)
move.w da_fword(a6),d3
moveq #err.itnf,d0
bsr.s dta_madr
move.l wwm_pobj(a3),d0 ; any object connected?
beq.s rmvo_exit ; ..no, work is done
clr.l wwm_pobj(a3) ; disconnect cell from object
sub.l #val_strg,d0 ; base of value entry
move.l d0,a3
tst.b d2 ; keep formular?
bne.s rmvo_lb1 ; ..yes, skip the following
move.l val_form(a3),d0 ; remove formular
beq.s rmvo_lb1 ; no formular connected!
move.l d0,a0
xjsr dma_free ; free formular area
rmvo_lb1
move.w val_fwrd(a3),d3 ; set format word
rmvo_lb2
move.l a3,a0
xjsr dma_free ; free value block
moveq #0,d0
rmvo_exit
movem.l (sp)+,r_rmvo
tst.l d0
rts
*+++
* get address of menu item
*
* Entry Exit
* a3 ptr to menu item
* a4 wwork preserved
* d1 c|r of menu item preserved
*---
dta_madr subr d1
xjsr cel_numb ; convert c|r to number
mulu #wwm.olen,d1 ; and now offset in list
move.l da_miobl(a6),a3
adda.l d1,a3 ; this is the object we want
subend
*+++
* get address of item value block
*
* Entry Exit
* a3 base of value block
* a4 wwork preserved
* d1 c|r of menu item preserved
*
* error codes: err.itnf no value block connected
*---
r_vadr reg d1
dta_vadr
movem.l r_vadr,-(sp)
bsr dta_madr
moveq #err.itnf,d0
move.l wwm_pobj(a3),d1
beq.s vadr_exit ; no object connected
sub.l #val_strg,d1
move.l d1,a3
moveq #0,d0
vadr_exit
movem.l (sp)+,r_vadr
tst.l d0
rts
*+++
* copy string from buffer area into data area
*
* Entry Exit
* a3 address of string in dma
* a4 wwork preserved
*
* error codes: err.imem not enough memory left for entry
* err.orng string is too long
*---
r_bufd reg d1/a0/a1
dta_bufd
movem.l r_bufd,-(sp)
lea da_buff(a6),a1
move.w (a1),d1 ; get string length
beq.s bufd_nos ; zero, no space allocated
ext.l d1
addq.l #3,d1 ; find total length and
bclr #0,d1 ; make it even
xjsr dma_aloc
bmi.s bufd_exit ; allocation went wrong!
xjsr ut_cpyst ; copy string to dma
move.l a0,a3
bufd_exit
movem.l (sp)+,r_bufd
tst.l d0
rts
bufd_nos
moveq #0,d0
suba.l a3,a3
bra.s bufd_exit
*+++
* copy formular string of a cell into buffer area for editing
*
* Entry Exit
* a4 wwork preserved
* d1.l c|r of cell preserved
*---
r_fbuf reg d1/a0/a1/a3
dta_fbuf
movem.l r_fbuf,-(sp)
bsr dta_madr ; find address of menu item
move.l wwm_pobj(a3),d1
beq.s fbuf_nos ; no item at all
subi.l #val_strg,d1 ; is there a formular?
move.l d1,a1
move.l val_form(a1),d1
beq.s fbuf_nos ; no formular
move.l d1,a1 ; copy formular string into buffer
lea da_buff(a6),a0
xjsr ut_cpyst
fbuf_exit
movem.l (sp)+,r_fbuf
rts
fbuf_nos
clr.w da_buff(a6) ; zero length string
bra.s fbuf_exit
*+++
* edit data string given in data area buffer
*
* Entry Exit
* d2 terminating character
* a4 wwork preserved
* a6 data area preserved
*
* error codes : +1 = string too long to edit
* condition codes set
*---
r_edit reg a0/d1/d6-d7
dta_edit
movem.l r_edit,-(sp)
move.l ww_plitm(a4),a3 ; get down to loose item
moveq #mlo.data,d0
mulu #wwl.elen,d0
add.l d0,a3
move.w wwl_xsiz(a3),d6 ; window size
moveq #0,d0
move.l ww_chid(a4),a0
move.w wwl_item(a3),d1 ; loose menu item number
move.w wwl_xjst(a3),d7 ; store item justification
clr.w wwl_xjst(a3) ; because wman sets cursor!
move.l a3,-(sp)
lea da_buff(a6),a3 ; string buffer area
ext.l d6 ; window size into chars
divu #qs.xchar,d6 ; size of loose item
sub.w (a3),d6 ; minus string length
subq.w #1,d6 ; minus cursor
bmi.s f_bigedit
sub.w #mact.doed,d4 ; big edit mode in separate window?
beq.s f_bigedit ; yes, please!
tst.l da_cbx1(a6) ; single entry or block entry?
bmi.s edit_single
move.l da_ccell(a6),d0
sub.l da_cbx0(a6),d0 ; first cell? MAY contain something,
beq.s edit_single ; which we don't need to want overwritten
xjsr mu_swrds ; read string for block entry
bra.s f_cont
edit_single
xjsr mu_sweds ; edit string for single entry
f_cont
bmi kill
move.l (sp)+,a3 ; restore item address
move.w d7,wwl_xjst(a3) ; and restore justifiaction
move.l d1,d2
edit_exit
movem.l (sp)+,r_edit
tst.l d0
rts
f_bigedit
r_pld reg d7/a0-a4
movem.l r_pld,-(sp)
move.l ww_xorg(a4),d7 ; window origin
move.l #0,d4
move.l #wwa.eddo,d1
lea wst_eddo(a6),a1
xlea men_eddo,a3
xjsr ut_setup_l
move.l #$00200020,d1 ; offset
add.l d7,d1 ; plus main window origin
jsr wm.pulld(a2)
bmi kill
jsr wm.wdraw(a2)
bmi kill
moveq #1,d1
moveq #0,d2 ; ink colour/no reset
jsr wm.swinf(a2) ; set window to inf. window
moveq #-1,d3 ; timeout
moveq #iow.clra,d0 ; ...and clear it
trap #do.io
lea da_buff(a6),a1 ; string buffer area
move.w (a1)+,d2 ; number of bytes
moveq #iob.smul,d0 ; send a string of bytes
trap #do.io
lea da_buff(a6),a1 ; string buffer area
move.w (a1)+,d1 ; get len
add.l d1,a1 ; end of line
move.b #' ',(a1)
swap d1 ; in high word
move.w d2,d1 ; number of chars
move.w #3*80,d2 ; length of buffer
moveq #iob.elin,d0
trap #do.io
moveq #0,d2
cmp.b #$0a,-1(a1) ; test termination character
beq.s take_it
move.b #k.esc,d2 ; default don't change it
take_it
lea da_buff(a6),a1 ; string buffer area
subq.w #1,d1
move.w d1,(a1)
move.w d2,-(sp) ; save termination code
xjsr ut_unset
xjsr gu_fclos
move.w (sp)+,d1 ; do it right register
movem.l (sp)+,r_pld
bra f_cont
*+++
* set data item to cell formular string and redraw it
*
* Entry Exit
* a4 wwork preserved
* d1.l c|r of cell preserved
*---
r_cell reg a0/a1/a3/d1
dta_cell
move.l d1,da_ccell(a6)
tst.w da_dupdt(a6) ; display update allowed?
bne.s cell_exit
movem.l r_cell,-(sp)
bsr dta_fbuf ; put formular into buffer
move.l ww_chid(a4),a0
moveq #mli.data,d1
lea da_buff(a6),a1
jsr wm.stlob(a2)
bmi kill
xjsr rdw_lchg ; redraw item
movem.l (sp)+,r_cell
cell_exit
rts
do_kill
xjmp kill
*
* deselect current item and return from action routine
unselect
xjsr ut_rdwci
rts
end
| 21.617211 | 71 | 0.621002 |
d0fbdd771bbb2e96b9b697160112e9d9f44be271 | 302 | asm | Assembly | src/test_include/sub_repeat_macro.asm | hra1129/zma | c2bfc79df45e1d4d01c6faa1b69216245a4e1d2c | [
"MIT"
] | 8 | 2021-03-19T23:44:14.000Z | 2022-03-22T07:29:02.000Z | src/test_include/sub_repeat_macro.asm | hra1129/zma | c2bfc79df45e1d4d01c6faa1b69216245a4e1d2c | [
"MIT"
] | null | null | null | src/test_include/sub_repeat_macro.asm | hra1129/zma | c2bfc79df45e1d4d01c6faa1b69216245a4e1d2c | [
"MIT"
] | 1 | 2021-11-27T22:37:24.000Z | 2021-11-27T22:37:24.000Z | ; -----------------------------------------------------------------------------
; test program
; -----------------------------------------------------------------------------
PAGE_ALIGN macro
if FILE_ADDRESS % 256
repeat I, 256 - (FILE_ADDRESS % 256)
defb 0
endr
endif
endm
| 25.166667 | 79 | 0.284768 |
1652d694021309a326baad9e4f79de89200f8b01 | 1,281 | asm | Assembly | examples/asm/fsm_7.asm | ptorru/reticle | b46d960201e75f4c15b87c143ebabf9149ff67c0 | [
"Apache-2.0"
] | 35 | 2020-06-19T13:51:33.000Z | 2022-03-14T17:37:09.000Z | examples/asm/fsm_7.asm | ptorru/reticle | b46d960201e75f4c15b87c143ebabf9149ff67c0 | [
"Apache-2.0"
] | null | null | null | examples/asm/fsm_7.asm | ptorru/reticle | b46d960201e75f4c15b87c143ebabf9149ff67c0 | [
"Apache-2.0"
] | 4 | 2021-05-08T20:04:30.000Z | 2021-08-31T17:33:04.000Z | def main(i0:bool, i1:bool, i2:bool, i3:bool, i4:bool, i5:bool, i6:bool) -> (y:i4) {
t29:i4 = lmuxrega_i4(t21, t0, t27, t7) @lut(??, ??);
t7:bool = const[1];
t21:bool = land_bool(t14, i6) @lut(??, ??);
t0:i4 = const[0];
t27:i4 = lmux_i4(t20, t6, t26) @lut(??, ??);
t14:bool = leq_i4(t29, t6) @lut(??, ??);
t20:bool = land_bool(t13, i5) @lut(??, ??);
t6:i4 = const[6];
t26:i4 = lmux_i4(t19, t5, t25) @lut(??, ??);
t13:bool = leq_i4(t29, t5) @lut(??, ??);
t19:bool = land_bool(t12, i4) @lut(??, ??);
t5:i4 = const[5];
t25:i4 = lmux_i4(t18, t4, t24) @lut(??, ??);
t12:bool = leq_i4(t29, t4) @lut(??, ??);
t18:bool = land_bool(t11, i3) @lut(??, ??);
t4:i4 = const[4];
t24:i4 = lmux_i4(t17, t3, t23) @lut(??, ??);
t11:bool = leq_i4(t29, t3) @lut(??, ??);
t17:bool = land_bool(t10, i2) @lut(??, ??);
t3:i4 = const[3];
t23:i4 = lmux_i4(t16, t2, t22) @lut(??, ??);
t10:bool = leq_i4(t29, t2) @lut(??, ??);
t16:bool = land_bool(t9, i1) @lut(??, ??);
t2:i4 = const[2];
t22:i4 = lmux_i4(t15, t1, t29) @lut(??, ??);
t9:bool = leq_i4(t29, t1) @lut(??, ??);
t15:bool = land_bool(t8, i0) @lut(??, ??);
t1:i4 = const[1];
t8:bool = leq_i4(t29, t0) @lut(??, ??);
y:i4 = id(t29);
} | 40.03125 | 83 | 0.483997 |
c9e9a285e620557fc143302e58a7f536e199436c | 227 | asm | Assembly | programs/oeis/016/A016797.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/016/A016797.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/016/A016797.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A016797: (3n+2)^9.
; 512,1953125,134217728,2357947691,20661046784,118587876497,512000000000,1801152661463,5429503678976,14507145975869,35184372088832,78815638671875,165216101262848,327381934393961
mul $0,3
add $0,2
pow $0,9
| 32.428571 | 177 | 0.828194 |
1d1d6d1c139c01ce73a09734af4d0b55617fc054 | 2,161 | asm | Assembly | text/maps/CeruleanGym.asm | AmateurPanda92/pokemon-rby-dx | f7ba1cc50b22d93ed176571e074a52d73360da93 | [
"MIT"
] | 9 | 2020-07-12T19:44:21.000Z | 2022-03-03T23:32:40.000Z | text/maps/CeruleanGym.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 7 | 2020-07-16T10:48:52.000Z | 2021-01-28T18:32:02.000Z | text/maps/CeruleanGym.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 2 | 2021-03-28T18:33:43.000Z | 2021-05-06T13:12:09.000Z | _CeruleanGymText_5c7be::
text "Hi, you're a new"
line "face!"
para "Trainers who want"
line "to turn pro have"
cont "to have a policy"
cont "about #MON!"
para "What is your"
line "approach when you"
cont "catch #MON?"
para "My policy is an"
line "all-out offensive"
cont "with water-type"
cont "#MON!"
done
_CeruleanGymText_5c7c3::
text "TM11 teaches"
line "BUBBLEBEAM!"
para "Use it on an"
line "aquatic #MON!"
done
_CeruleanGymText_5c7c8::
text "The CASCADEBADGE"
line "makes all #MON"
cont "up to L30 obey!"
para "That includes"
line "even outsiders!"
para "There's more, you"
line "can now use CUT"
cont "any time!"
para "You can CUT down"
line "small bushes to"
cont "open new paths!"
para "You can also have"
line "my favorite TM!"
done
_ReceivedTM11Text::
text "<PLAYER> received"
line "TM11!@@"
_CeruleanGymText_5c7d3::
text "You better make"
line "room for this!"
done
_CeruleanGymText_5c7d8::
text "Wow!"
line "You're too much!"
para "All right!"
para "You can have the"
line "CASCADEBADGE to"
cont "show you beat me!@@"
_CeruleanGymBattleText1::
text "I'm more than good"
line "enough for you!"
para "MISTY can wait!"
done
_CeruleanGymEndBattleText1::
text "You"
line "overwhelmed me!"
prompt
_CeruleanGymAfterBattleText1::
text "You have to face"
line "other trainers to"
cont "find out how good"
cont "you really are."
done
_CeruleanGymBattleText2::
text "Splash!"
para "I'm first up!"
line "Let's do it!"
done
_CeruleanGymEndBattleText2::
text "That"
line "can't be!"
prompt
_CeruleanGymAfterBattleText2::
text "MISTY is going to"
line "keep improving!"
para "She won't lose to"
line "someone like you!"
done
_CeruleanGymText_5c82a::
text "Yo! Champ in"
line "making!"
para "Here's my advice!"
para "The LEADER, MISTY,"
line "is a pro who uses"
cont "water #MON!"
para "You can drain all"
line "their water with"
cont "plant #MON!"
para "Or, zap them with"
line "electricity!"
done
_CeruleanGymText_5c82f::
text "You beat MISTY!"
line "What'd I tell ya?"
para "You and me kid,"
line "we make a pretty"
cont "darn good team!"
done
| 16.371212 | 30 | 0.691347 |
1fff3bf8e2c0c517bb2b976149ba88bedda02498 | 446 | asm | Assembly | Source Codes/Palindrome check.asm | kaazima/Emulator-8086 | 2137954ecd35418b3720ac32e2577c7191006947 | [
"MIT"
] | null | null | null | Source Codes/Palindrome check.asm | kaazima/Emulator-8086 | 2137954ecd35418b3720ac32e2577c7191006947 | [
"MIT"
] | null | null | null | Source Codes/Palindrome check.asm | kaazima/Emulator-8086 | 2137954ecd35418b3720ac32e2577c7191006947 | [
"MIT"
] | null | null | null | .MODEL small
.STACK
.DATA
str1 db "madam$"
strlen db 0h
pal db 1h
.CODE
.STARTUP
;Finding length of first string
mov si,offset str1
check1:cmp [si],'$'
jz compare
inc strlen
inc si
jmp check1
;Palindrome check
compare:
mov cx,0h
mov cl,strlen
mov dx,ds
mov es,dx
mov si,offset str1
mov di,offset str1
mov ax,0h
mov al,strlen
dec al
add di,ax
loop1:cmpsb
jnz exit1
dec di
dec di
loop loop1
exit1:cmp cl,0h
jz exit
mov pal,0h
exit:
.EXIT
end
| 9.911111 | 31 | 0.73991 |
e0be5fcec97ab00d2487f47c16dff3cadea25753 | 3,163 | asm | Assembly | 45/beef/cw/kernel/keyboard.asm | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | 45/beef/cw/kernel/keyboard.asm | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | 45/beef/cw/kernel/keyboard.asm | minblock/msdos | 479ffd237d9bb7cc83cb06361db2c4ef42dfbac0 | [
"Apache-2.0"
] | null | null | null | ;*
;* CW : Character Windows
;*
;* keyboard.asm : keyboard interface layer for installable keyboard drivers
include kernel.inc
include indrv.inc
include inkbd.inc
;*****************************************************************************
;* * App supplied callbacks
externFP <UpdateShiftKk>
;* * CW entries for callbacks
externFP <KeyboardMessage, FTestKeyboardEmpty, SpecialTsrAbort>
;*****************************************************************************
sBegin DATA
assumes DS,DGROUP
;* * INKJ structure
externB inkj
;* * INKB structure (maps to structure in "ihnkbd.h")
;* * exported flags are mapped in to middle of structure !!!!
PUBLIC inkb
PUBLIC fAbort, fPollKeyboard, fKeyIsUp, fKeyWasUp ;* PUBLIC
PUBLIC fNormalKeyboard, fNonAltKey, wRateKeyRepeat
inkb EQU THIS BYTE
;* * Function pointers
DD KeyboardMessage
DD FTestKeyboardEmpty
DD SpecialTsrAbort
fAbort DW 0
fPollKeyboard DW 1 ;* do it at least once
fKeyIsUp DB 1
fKeyWasUp DB 1
wRateKeyRepeat DW -1 ;* key rate (-1 => default)
fNormalKeyboard DW 1 ;* => non-TSR
fNonAltKey DB 1 ;* => non alt key hit
fDisableExtended DW 0 ;* => disable extended
sEnd DATA
;*****************************************************************************
sBegin KERNEL
assumes CS,KERNEL
assumes DS,DGROUP
assumes SS,DGROUP
;*****************************************************************************
;* Init/Enable/Poll
;********** EnableKeyboard **********
;* entry: fOn => enable else disable
;* * Enable or disable the keyboard
;* exit: n/a
cProc EnableKeyboard, <PUBLIC,FAR,ATOMIC>
parmW fOn
localW hModule
cBegin EnableKeyboard
mov bx,dataOffset inkb
cCall inkj.pfnEnableKeyboardKbdInkj, <bx, fOn, sp>
;* (pinkb, fOn, fExit)
cEnd EnableKeyboard
;********** PollKeyboard **********
;* entry: n/a
;* * poll the keyboard (for non-interrupt driven systems)
;* exit: n/a
labelFP <PUBLIC, PollKeyboard>
jmp inkj.pfnPollKeyboardKbdInkj
;********** DisableExtendedKeyboard **********
;* entry/exit: n/a
;* * disable extended keyboard operation
;* * will be valid after next EnableKeyboard(TRUE)
cPublic DisableExtendedKeyboard, <ATOMIC>
cBegin DisableExtendedKeyboard
mov fDisableExtended,sp ;* set flag
cEnd DisableExtendedKeyboard
;*****************************************************************************
;********** MkGetShiftStates **********
;* entry: n/a
;* * get current shift states
;* exit: AX = current shift states (MK_ format)
labelFP <PUBLIC, MkGetShiftStates>
jmp inkj.pfnMkGetShiftStatesKbdInkj
;********** SetShiftKk **********
;* entry: kk = new shift states
;* * set shift states
;* exit: n/a
labelFP <PUBLIC, SetShiftKk>
jmp inkj.pfnSetShiftKkKbdInkj
;*****************************************************************************
;* Kanji support
IFDEF KANJI
;********** ChAlternateKeytop **********
;* entry: chIn
;* * return alternate key for "alt"ed key
;* exit: AL = other VK (or 0 if none)
labelFP <PUBLIC, ChAlternateKeytop>
jmp inkj.pfnChAlternateKeytopKbdInkj
ENDIF ;KANJI
sEnd KERNEL
;*****************************************************************************
END
| 22.118881 | 78 | 0.5773 |
466f811364f26a205888686312e972e05f5ae8b1 | 3,251 | asm | Assembly | ASM/src/rainbow_bridge.asm | Triaphlax/OoT-Randomizer | d6755f8e4b1c6b5d5612e583f8f91fa303f1669b | [
"MIT"
] | 344 | 2018-07-07T07:36:26.000Z | 2022-03-27T22:48:10.000Z | ASM/src/rainbow_bridge.asm | Triaphlax/OoT-Randomizer | d6755f8e4b1c6b5d5612e583f8f91fa303f1669b | [
"MIT"
] | 1,076 | 2018-07-09T04:01:39.000Z | 2022-03-31T17:18:22.000Z | ASM/src/rainbow_bridge.asm | Triaphlax/OoT-Randomizer | d6755f8e4b1c6b5d5612e583f8f91fa303f1669b | [
"MIT"
] | 320 | 2018-07-02T01:19:41.000Z | 2022-03-25T01:28:30.000Z | rainbow_bridge:
lw t2, RAINBOW_BRIDGE_CONDITION
beq t2, r0, @@open
li at, 1
beq t2, at, @@medallions
li at, 2
beq t2, at, @@dungeons
li at, 3
beq t2, at, @@stones
li at, 4
beq t2, at, @@vanilla
li at, 5
beq t2, at, @@tokens
@@open:
li at, 0
jr ra
li t2, 0
@@medallions:
li at, 0x3F ; medallions
and t2, v0, at
li t7, 0
andi t8, t2, 0x01
beqz t8, @@medallions_1
nop
addiu t7, 1
@@medallions_1:
andi t8, t2, 0x02
beqz t8, @@medallions_2
nop
addiu t7, 1
@@medallions_2:
andi t8, t2, 0x04
beqz t8, @@medallions_3
nop
addiu t7, 1
@@medallions_3:
andi t8, t2, 0x08
beqz t8, @@medallions_4
nop
addiu t7, 1
@@medallions_4:
andi t8, t2, 0x10
beqz t8, @@medallions_5
nop
addiu t7, 1
@@medallions_5:
andi t8, t2, 0x20
beqz t8, @@medallions_6
nop
addiu t7, 1
@@medallions_6:
b @@count
nop
@@dungeons:
li at, 0x1C003F ; stones and medallions
and t2, v0, at
li t7, 0
andi t8, t2, 0x01
beqz t8, @@dungeons_1
nop
addiu t7, 1
@@dungeons_1:
andi t8, t2, 0x02
beqz t8, @@dungeons_2
nop
addiu t7, 1
@@dungeons_2:
andi t8, t2, 0x04
beqz t8, @@dungeons_3
nop
addiu t7, 1
@@dungeons_3:
andi t8, t2, 0x08
beqz t8, @@dungeons_4
nop
addiu t7, 1
@@dungeons_4:
andi t8, t2, 0x10
beqz t8, @@dungeons_5
nop
addiu t7, 1
@@dungeons_5:
andi t8, t2, 0x20
beqz t8, @@dungeons_6
nop
addiu t7, 1
@@dungeons_6:
lui t8, 0x04
and t8, t2, t8
beqz t8, @@dungeons_7
nop
addiu t7, 1
@@dungeons_7:
lui t8, 0x08
and t8, t2, t8
beqz t8, @@dungeons_8
nop
addiu t7, 1
@@dungeons_8:
lui t8, 0x10
and t8, t2, t8
beqz t8, @@dungeons_9
nop
addiu t7, 1
@@dungeons_9:
b @@count
nop
@@stones:
li at, 0x1C0000 ; stones
and t2, v0, at
li t7, 0
lui t8, 0x04
and t8, t2, t8
beqz t8, @@stones_1
nop
addiu t7, 1
@@stones_1:
lui t8, 0x08
and t8, t2, t8
beqz t8, @@stones_2
nop
addiu t7, 1
@@stones_2:
lui t8, 0x10
and t8, t2, t8
beqz t8, @@stones_3
nop
addiu t7, 1
@@stones_3:
b @@count
nop
@@tokens:
lh t7, 0xD0(a3) ; Gold Skulltulas
@@count:
li at, 0
lh t8, RAINBOW_BRIDGE_COUNT
jr ra
slt t2, t7, t8
@@vanilla:
li at, 0x18 ; shadow and spirit medallions
and t2, v0, at
bne t2, at, @@return
nop
lbu t7, 0x84(a3) ; Light arrow slot
li t2, 0x12 ; light arrow item id
beq t2, t7, @@return
nop
li at, 0xFFFF
@@return:
jr ra
and t2, v0, at
| 19.70303 | 53 | 0.459551 |
7445c1995f0dbc6ffed6c1b61fb1aa22b9e79111 | 6,430 | asm | Assembly | 1571/64tass/lccread1.asm | silverdr/assembly | c2851f7033223e089285dce22443b7e219ed4f61 | [
"Unlicense"
] | 23 | 2015-03-23T15:16:57.000Z | 2022-03-18T12:43:42.000Z | 1571/64tass/lccread1.asm | silverdr/assembly | c2851f7033223e089285dce22443b7e219ed4f61 | [
"Unlicense"
] | null | null | null | 1571/64tass/lccread1.asm | silverdr/assembly | c2851f7033223e089285dce22443b7e219ed4f61 | [
"Unlicense"
] | 8 | 2016-04-13T11:19:35.000Z | 2021-12-22T07:39:00.000Z |
;=============================================================
;= 8 = 8 = 8 = 8 = 8 =
;=============================================================
; (5) (3 + 2) (5) (1+ 4) (4 +1) (5) (2 + 3) (5)
; a b c d e f g h
;=============================================================
; read in track,sector specified
; in header
.align 256 ; even page
jdstrt jsr jsrch ; find header
jmp jsync ; and then data block sync
jread cmp #0 ; test if read job
beq jread01 ; go test if write
jmp jwright
jread01 .proc
jsr jdstrt ; find header and start reading data
; sync routine sets y to 0
- bit pota1 ; 4
bmi - ; 3 + 2
lda data2 ; 4
tax ; 2 reg x = xxxxx000
lda gcrtb1,x ; 4 nibble a
sta btab ; 3
txa ; 2
and #%00000111 ; 2
sta btab+1 ; 3 extract 3 bits nibble b
- bit pota1 ; 4
bmi - ; 3 + 2
lda data2 ; 4
sta btab+2 ; 3
and #%11000000 ; 2 extract 2 bits nibble b
ora btab+1 ; 3
tax ; 2 reg x = xx000xxx
lda gcrtba,x ; 4 nibble b
ora btab ; 3
pha ; 3
jmp m5 ; 3
;********************************************************************
m3 bit pota1 ; 4
bmi m3 ; 3 + 2
lda data2 ; 4
tax ; 2 reg x = xxxxx000
lda gcrtb1,x ; 4 nibble a
sta btab ; 3
txa ; 2
and #%00000111 ; 2
sta btab+1 ; 3 extract 3 bits nibble b
- bit pota1 ; 4
bmi - ; 3 + 2
lda data2 ; 4
sta btab+2 ; 3
and #%11000000 ; 2
ora btab+1 ; 3
tax ; 2 reg x = xx000xxx
lda gcrtba,x ; 4 nibble b
ora btab ; 3
sta (bufpnt),y ; 6
iny ; 2
beq m6 ; 2
m5 lda btab+2 ; 3
tax ; 2 reg x = 00xxxxx0
lda gcrtb2,x ; 4 nibble c
sta btab ; 3
txa ; 2
and #%00000001 ; 2
sta btab+2 ; 3 extract 1 bits nibble d
- bit pota1 ; 4
bmi - ; 3 + 2
lda data2 ; 4
sta btab+3 ; 3
and #%11110000 ; 2
ora btab+2 ; 3
tax ; 2 reg x = xxxx000x
lda gcrtbd,x ; 4 nibble d
ora btab ; 3
sta (bufpnt),y ; 6
iny ; 2
lda btab+3 ; 3
and #%00001111 ; 2
sta btab+3 ; 3 extract 4 bits nibble e
- bit pota1 ; 4
bmi - ; 3 + 2
lda data2 ; 4
sta chksum ; 3
and #%10000000 ; 2
ora btab+3 ; 3
tax ; 2 reg x = x000xxxx
lda gcrtbe,x ; 4 nibble e
sta btab ; 3
lda chksum ; 3
tax ; 2 reg x = 0xxxxx00
lda gcrtb3,x ; 4 nibble f
ora btab ; 3
sta (bufpnt),y ; 6
iny ; 2
txa ; 2
and #%00000011 ; 2
sta chksum ; 3 extract 2 bits nibble g
- bit pota1 ; 4
bmi - ; 3 + 2
lda data2 ; 4
sta btab+1 ; 3
and #%11100000 ; 2
ora chksum ; 3
tax ; 2 reg x = xxx000xx
lda gcrtbg,x ; 4 nibble g
sta btab ; 3
lda btab+1 ; 3
tax ; 2 reg x = 000xxxxx
lda gcrtb4,x ; 4 nibble h
ora btab ; 3
sta (bufpnt),y ; 6
iny ; 2
jmp m3 ; 4
;*******************************************************************
m6 lda btab+2 ; 3
tax ; 2 reg x = 00xxxxx0
lda gcrtb2,x ; 4 nibble c
sta btab ; 3
txa ; 2
and #%00000001 ; 2
sta btab+2 ; 3
- bit pota1 ; 4
bmi - ; 3 + 2
lda data2 ; 4
and #%11110000 ; 2
ora btab+2 ; 3
tax ; 2 reg x = xxxx000x
lda gcrtbd,x ; 4 nibble d
ora btab ; 3
sta btab+1 ; 3 store off cs byte
pla ; retrieve first byte off of disk
cmp dbid ; see if it is a 7
bne m12 ; br, nope
jsr chkblk ; calc checksum
cmp btab+1
beq m11
lda #5 ; data block checksum error
.byte skip2
m12 lda #4
.byte skip2
m11 lda #1 ; read data block ok
jmp jerrr
.pend
jsrch .proc
lda dskid ; get master id for the drive
sta header
lda dskid+1
sta header+1
ldy #0 ; get track,sectr
lda (hdrpnt),y
sta header+2
iny
lda (hdrpnt),y
sta header+3
lda #0
eor header
eor header+1
eor header+2
eor header+3
sta header+4 ; store the checksum
jsr conhdr ; convert header to gcr
lda #90 ; search 90 sync chars
sta tmp
m1 jsr jsync ; find sync
m2 lda stab,y ; what it should be
- bit pota1
bmi -
cmp data2 ; is it the same .cmp absolute
bne m4 ; nope
iny
cpy #8
bne m2
rts
m4 dec tmp ; try again
bne m1
lda #2 ; cant find this header
jmp jerrr
.pend
jsync ldx #15
ldy #0 ; s/w timers ok
- bit dskcnt ; sync a synch ?
bpl +
dey
bne -
dex
bne -
lda #3
jmp jerrr ; sync error
+ lda data2 ; clear pa latch
ldy #0 ; clear pointer
rts
| 26.903766 | 69 | 0.348523 |
49de834c13a9aa9ee91820a34b41770129e0e965 | 549 | asm | Assembly | oeis/171/A171757.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/171/A171757.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/171/A171757.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A171757: Even numbers whose binary expansion begins 10.
; Submitted by Simon Strandgaard
; 2,4,8,10,16,18,20,22,32,34,36,38,40,42,44,46,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,256,258,260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,312,314,316,318,320,322,324,326
mov $1,1
sub $2,$0
div $0,2
lpb $0
div $0,2
mul $1,2
lpe
sub $1,$2
mov $0,$1
mul $0,2
| 36.6 | 366 | 0.701275 |
f40f998e46f01ea9c07f16d210b3ab1e8ce3771d | 374 | asm | Assembly | oeis/120/A120156.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/120/A120156.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/120/A120156.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A120156: a(1)=11; a(n)=floor((35+sum(a(1) to a(n-1)))/3).
; Submitted by Jon Maiga
; 11,15,20,27,36,48,64,85,113,151,201,268,358,477,636,848,1131,1508,2010,2680,3574,4765,6353,8471,11295,15060,20080,26773,35697,47596,63462,84616,112821,150428,200571,267428,356570,475427,633903,845204
add $0,1
mov $3,35
lpb $0
sub $0,1
add $2,$3
mov $3,$2
div $2,3
lpe
mov $0,$2
| 26.714286 | 201 | 0.676471 |
3ab9c68a4ffd9be344bf4e4fecbe469c27a04c99 | 989 | asm | Assembly | _build/dispatcher/jmp_ippsDLPUnpack_51e46445.asm | zyktrcn/ippcp | b0bbe9bbb750a7cf4af5914dd8e6776a8d544466 | [
"Apache-2.0"
] | 1 | 2021-10-04T10:21:54.000Z | 2021-10-04T10:21:54.000Z | _build/dispatcher/jmp_ippsDLPUnpack_51e46445.asm | zyktrcn/ippcp | b0bbe9bbb750a7cf4af5914dd8e6776a8d544466 | [
"Apache-2.0"
] | null | null | null | _build/dispatcher/jmp_ippsDLPUnpack_51e46445.asm | zyktrcn/ippcp | b0bbe9bbb750a7cf4af5914dd8e6776a8d544466 | [
"Apache-2.0"
] | null | null | null | extern m7_ippsDLPUnpack:function
extern n8_ippsDLPUnpack:function
extern y8_ippsDLPUnpack:function
extern e9_ippsDLPUnpack:function
extern l9_ippsDLPUnpack:function
extern n0_ippsDLPUnpack:function
extern k0_ippsDLPUnpack:function
extern ippcpJumpIndexForMergedLibs
extern ippcpSafeInit:function
segment .data
align 8
dq .Lin_ippsDLPUnpack
.Larraddr_ippsDLPUnpack:
dq m7_ippsDLPUnpack
dq n8_ippsDLPUnpack
dq y8_ippsDLPUnpack
dq e9_ippsDLPUnpack
dq l9_ippsDLPUnpack
dq n0_ippsDLPUnpack
dq k0_ippsDLPUnpack
segment .text
global ippsDLPUnpack:function (ippsDLPUnpack.LEndippsDLPUnpack - ippsDLPUnpack)
.Lin_ippsDLPUnpack:
db 0xf3, 0x0f, 0x1e, 0xfa
call ippcpSafeInit wrt ..plt
align 16
ippsDLPUnpack:
db 0xf3, 0x0f, 0x1e, 0xfa
mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc]
movsxd rax, dword [rax]
lea r11, [rel .Larraddr_ippsDLPUnpack]
mov r11, qword [r11+rax*8]
jmp r11
.LEndippsDLPUnpack:
| 25.358974 | 79 | 0.777553 |
35791b0e6f2b834ef355e6f17f0e50725d52d636 | 697 | asm | Assembly | programs/oeis/253/A253608.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/253/A253608.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/253/A253608.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A253608: The binary representation of a(n) is the concatenation of n and the binary complement of n, A035327(n).
; 2,9,12,35,42,49,56,135,150,165,180,195,210,225,240,527,558,589,620,651,682,713,744,775,806,837,868,899,930,961,992,2079,2142,2205,2268,2331,2394,2457,2520,2583,2646,2709,2772,2835,2898,2961,3024,3087,3150,3213,3276,3339,3402,3465,3528,3591,3654,3717,3780,3843,3906,3969,4032,8255,8382,8509,8636,8763,8890,9017,9144,9271,9398,9525,9652,9779,9906,10033,10160,10287,10414,10541,10668,10795,10922,11049,11176,11303,11430,11557,11684,11811,11938,12065,12192,12319,12446,12573,12700,12827
mov $1,$0
mov $2,$0
lpb $1
mul $0,2
add $0,4
add $0,$2
sub $1,1
div $1,2
lpe
add $0,2
| 49.785714 | 484 | 0.743185 |
0e920f46e83558108ab6cd4bb2e6de732c33a7d6 | 1,179 | asm | Assembly | assembly_code/chp5_03.asm | Nabeegh-Ahmed/BelalHashmi-Assembly-Exercise-Solutions | a990de801ea136395904bd40b6ba162f3e1fa966 | [
"MIT"
] | 104 | 2018-08-25T00:01:41.000Z | 2022-01-26T14:07:32.000Z | assembly_code/chp5_03.asm | Nabeegh-Ahmed/BelalHashmi-Assembly-Exercise-Solutions | a990de801ea136395904bd40b6ba162f3e1fa966 | [
"MIT"
] | 5 | 2021-01-14T14:04:39.000Z | 2021-06-14T10:48:35.000Z | assembly_code/chp5_03.asm | Nabeegh-Ahmed/BelalHashmi-Assembly-Exercise-Solutions | a990de801ea136395904bd40b6ba162f3e1fa966 | [
"MIT"
] | 29 | 2018-09-19T19:26:34.000Z | 2021-04-29T21:01:26.000Z | [org 0x0100]
start: mov ax, 4
sub sp,2
push ax
call fibonacci
pop ax
end: mov ax, 0x4c00
int 21h
fibonacci: push bp
mov bp,sp
sub sp,2
pusha
mov ax, [bp + 4]
basecase1: cmp ax,1
jnz basecase2
mov word [bp + 6],1
jmp return
basecase2: cmp ax,0
jnz calls
mov word [bp + 6],0
jmp return
calls: sub sp,2
dec ax
push ax
call1: call fibonacci
pop word [bp - 2] ;A local variable used to store the return value from the first
;recursive call
sub sp,2
dec ax
push ax
call2: call fibonacci
pop dx
add dx, [bp - 2]
mov [bp + 6],dx
return: popa
add sp,2
pop bp
ret 2
;--------------------------------------------------------
;Logic Explained
;Carefully read this function
; int fibonacci (int n)
; {
; int x; ;The local variable made to store the result from first recursive call
;
; if( n == 1 )
; return 1;
;
; if( n == 0 )
; return 0;
;
;
; x = fibonacci (n - 1);
; x = x + fibonacci (n - 2);
;
; return x;
; }
;-------------------------------------------------------
| 13.551724 | 98 | 0.480916 |
e56b10ce0ef6bd5d503507dd5f848970cec26ed2 | 5,454 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_ht_st_zr_un_/i9-9900K_12_0xca.log_21829_1040.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_ht_st_zr_un_/i9-9900K_12_0xca.log_21829_1040.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_ht_st_zr_un_/i9-9900K_12_0xca.log_21829_1040.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1a4c3, %rsi
lea addresses_UC_ht+0x1b9ff, %rdi
nop
nop
nop
add %r13, %r13
mov $61, %rcx
rep movsb
nop
nop
and %r13, %r13
lea addresses_WC_ht+0xe63, %rsi
lea addresses_UC_ht+0x19663, %rdi
clflush (%rsi)
nop
nop
nop
add %r8, %r8
mov $4, %rcx
rep movsq
nop
nop
nop
nop
mfence
lea addresses_WT_ht+0x3beb, %rdi
add $27284, %rcx
mov (%rdi), %esi
nop
nop
xor %rdi, %rdi
lea addresses_D_ht+0x1a2e3, %r8
nop
nop
nop
nop
nop
xor %r13, %r13
movw $0x6162, (%r8)
nop
nop
nop
nop
and $7591, %r13
lea addresses_WC_ht+0x19625, %r8
nop
nop
xor %rax, %rax
mov $0x6162636465666768, %rdi
movq %rdi, (%r8)
nop
nop
cmp $7615, %rcx
lea addresses_normal_ht+0x7e63, %rsi
nop
nop
nop
sub $26928, %r9
movups (%rsi), %xmm4
vpextrq $1, %xmm4, %rax
dec %r13
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %r9
push %rbp
push %rdx
// Faulty Load
lea addresses_RW+0xca63, %rdx
nop
nop
nop
nop
nop
add %r15, %r15
movaps (%rdx), %xmm2
vpextrq $1, %xmm2, %r9
lea oracles, %r13
and $0xff, %r9
shlq $12, %r9
mov (%r13,%r9,1), %r9
pop %rdx
pop %rbp
pop %r9
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': True, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'44': 68, '35': 1, '30': 2, '45': 9925, '62': 6, '00': 11807, '48': 19, 'a9': 1}
45 00 45 00 00 45 00 00 45 00 00 45 00 00 00 45 45 45 00 00 45 00 45 00 00 00 45 00 00 00 45 45 45 00 00 45 00 00 45 00 00 44 45 45 45 00 00 45 00 00 45 00 00 45 00 00 45 00 45 00 00 45 45 45 45 45 00 00 45 00 00 45 00 00 45 00 00 00 45 00 00 45 45 45 45 45 45 45 00 00 45 00 00 45 00 00 45 00 00 00 00 00 00 45 45 45 00 00 45 00 45 00 00 00 45 00 00 45 00 00 00 45 00 45 45 45 00 00 45 00 00 45 00 00 45 00 00 45 00 45 00 00 45 45 45 45 45 00 00 45 00 45 45 00 00 00 45 45 45 45 45 00 45 00 45 00 45 00 00 45 45 45 45 00 00 00 45 00 00 00 45 00 00 00 45 45 45 45 00 00 45 00 00 45 00 00 00 00 00 45 45 00 00 00 45 00 00 00 00 00 45 45 45 00 00 45 00 45 00 00 00 45 00 00 00 45 45 45 45 45 45 00 00 45 00 00 45 00 00 00 45 45 45 45 45 45 00 00 45 00 00 45 00 45 45 45 00 45 45 45 00 45 00 00 45 00 00 45 00 45 45 45 45 45 00 00 45 00 45 00 45 00 00 45 00 45 00 45 00 00 45 00 00 45 45 00 45 00 00 45 00 45 45 00 00 45 45 00 45 00 00 45 00 00 45 00 00 00 45 00 45 00 45 45 00 00 45 45 00 45 00 00 45 00 00 00 45 45 45 00 00 45 00 45 00 45 00 45 45 00 45 00 00 00 00 45 00 45 45 00 00 45 00 00 00 45 00 45 00 00 45 00 45 45 45 00 00 00 45 00 45 00 45 00 00 45 00 00 45 00 00 45 00 00 44 45 00 45 00 00 45 00 45 45 45 00 00 45 00 00 45 45 00 45 00 00 45 00 00 45 00 00 00 45 45 45 00 00 45 00 45 00 00 00 45 00 00 00 45 45 00 45 00 45 45 45 00 00 45 00 00 45 00 00 45 00 00 45 00 00 00 45 45 45 45 45 00 00 00 45 00 45 00 45 00 00 45 00 00 45 45 45 45 00 00 45 00 00 45 00 45 00 45 00 00 45 00 00 44 45 45 45 45 45 45 00 00 45 00 00 45 00 45 00 00 45 45 45 45 45 00 00 45 00 00 45 00 00 45 45 00 00 45 00 00 45 00 00 00 00 00 45 45 00 00 00 45 00 00 45 00 45 00 45 00 00 00 00 00 45 45 00 00 00 45 00 45 00 45 45 00 45 00 00 45 00 45 00 00 45 45 45 00 45 00 00 45 00 00 45 00 00 45 00 00 45 45 45 00 00 00 45 45 00 45 00 45 00 45 00 00 45 00 00 00 45 00 45 00 45 45 45 45 00 45 00 00 45 00 00 45 00 00 00 45 00 45 00 00 45 00 45 00 45 00 45 00 45 00 00 45 00 00 00 45 00 00 00 00 45 00 45 00 45 45 00 45 00 00 45 00 00 45 45 45 45 00 00 45 00 45 00 00 00 45 00 45 00 00 45 45 45 45 45 00 00 45 00 00 45 00 00 45 45 45 45 45 45 45 00 00 45 45 45 45 45 00 00 45 00 00 45 00 00 45 45 45 45 00 45 45 45 00 00 00 45 00 45 00 00 45 45 00 00 45 00 00 45 00 00 45 00 45 45 45 45 45 00 00 45 00 00 45 45 45 45 45 45 45 00 00 45 48 45 45 45 00 00 45 00 00 45 45 45 45 00 45 45 00 00 45 00 00 45 00 00 00 00 00 45 00 00 45 00 45 00 45 00 00 45 00 00 00 00 00 45 45 45 00 00 45 48 45 45 45 00 00 45 00 00 00 00 45 48 45 45 00 00 00 45 45 00 45 00 00 45 00 00 00 45 45 45 00 00 45 00 00 45 00 00 00 45 45 45 45 45 00 00 45 00 45 45 45 00 00 45 00 00 45 00 00 45 45 45 45 45 45 45 00 00 45 45 45 45 00 00 45 00 00 45 00 00 00 45 00 00 45 45 45 45 00 00 00 45 00 00 45 00 00 45 45 45 00 00 45 00 45 45 00 00 00 45 00 00 00 45 45 45 45 45 45 00 00 45 00 00 45 00 00 45 00 00 45 00 00 00 45 45 45 45 45 45 00 00 45 00 00 45 45 45 45 45 45 45 00 00 45 00 00 45 00 00 00 00 00 45 00 00 45 00 00 45 45 45 45 00 00 45 00 00
*/
| 43.632 | 2,999 | 0.656032 |
173ef5e1edfeca2545a33489fef96a7910b38e43 | 687 | asm | Assembly | oeis/052/A052910.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/052/A052910.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/052/A052910.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A052910: Expansion of 1 + 2/(1-2*x-x^3).
; Submitted by Christian Krause
; 1,2,4,8,18,40,88,194,428,944,2082,4592,10128,22338,49268,108664,239666,528600,1165864,2571394,5671388,12508640,27588674,60848736,134206112,296000898,652850532,1439907176,3175815250,7004481032,15448869240,34073553730,75151588492,165752046224,365577646178,806306880848,1778365807920,3922309262018,8650925404884,19080216617688,42082742497394,92816410399672,204713037417032,451508817331458,995834045062588,2196381127542208,4844271072415874,10684376189894336,23565133507330880,51974538087077634
mov $2,1
mov $3,1
mov $4,1
lpb $0
sub $0,1
add $2,$1
add $1,$4
mov $4,$2
add $2,$3
mov $3,$1
lpe
mov $0,$2
| 40.411765 | 491 | 0.797671 |
5ba06b1587f43ae8e1a48277daa59211151ca9f6 | 5,991 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_432.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_432.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_432.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r15
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1ba35, %rsi
lea addresses_WT_ht+0x1020d, %rdi
nop
inc %r10
mov $83, %rcx
rep movsq
nop
nop
and $45205, %r9
lea addresses_WC_ht+0x6a4d, %rsi
lea addresses_UC_ht+0x1e579, %rdi
nop
sub $23820, %r10
mov $95, %rcx
rep movsw
nop
nop
nop
nop
nop
sub $20427, %rsi
lea addresses_UC_ht+0x17c4d, %rsi
lea addresses_normal_ht+0x11c4d, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor %r15, %r15
mov $0, %rcx
rep movsl
nop
nop
sub $12619, %rsi
lea addresses_D_ht+0x1a4d, %rcx
nop
nop
sub $64348, %r11
movw $0x6162, (%rcx)
nop
and $25227, %rdi
lea addresses_WT_ht+0x9527, %r11
nop
nop
nop
nop
nop
and %r10, %r10
mov $0x6162636465666768, %rsi
movq %rsi, (%r11)
nop
nop
nop
xor %r15, %r15
lea addresses_WT_ht+0x2d4d, %rsi
lea addresses_D_ht+0x1924d, %rdi
nop
nop
nop
nop
nop
and %rax, %rax
mov $90, %rcx
rep movsw
nop
nop
sub %rax, %rax
lea addresses_WC_ht+0xa4d9, %r11
nop
nop
nop
inc %r15
movw $0x6162, (%r11)
nop
nop
nop
nop
nop
and $60401, %r10
lea addresses_WT_ht+0x1b97d, %r11
nop
nop
nop
and %rsi, %rsi
mov $0x6162636465666768, %r15
movq %r15, (%r11)
nop
nop
nop
add $26597, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r8
push %r9
// Faulty Load
lea addresses_PSE+0x17a4d, %r12
nop
nop
nop
nop
add %r9, %r9
movb (%r12), %r11b
lea oracles, %r8
and $0xff, %r11
shlq $12, %r11
mov (%r8,%r11,1), %r11
pop %r9
pop %r8
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WC_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
| 38.902597 | 2,999 | 0.661826 |
6fe6825f9d53d9fa36dc6c44de5d616d409a7d12 | 228 | asm | Assembly | libsrc/_DEVELOPMENT/z80/c/sdcc/z80_otir_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/z80/c/sdcc/z80_otir_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/z80/c/sdcc/z80_otir_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; void *z80_otir_callee(void *src, uint8_t port, uint8_t num)
SECTION code_clib
SECTION code_z80
PUBLIC _z80_otir_callee
EXTERN asm_z80_otir
_z80_otir_callee:
pop af
pop hl
pop bc
push af
jp asm_z80_otir
| 12 | 61 | 0.741228 |
903ee8408ffa80f979b99c2fd272c99716f64929 | 449 | asm | Assembly | libsrc/stdio/msx/fputc_cons.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | 1 | 2018-09-04T23:07:24.000Z | 2018-09-04T23:07:24.000Z | libsrc/stdio/msx/fputc_cons.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | libsrc/stdio/msx/fputc_cons.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | ;
; MSX C Library
;
; Fputc_cons
;
; Stefano Bodrato - Apr. 2000
;
;
; $Id: fputc_cons.asm,v 1.4 2007/12/07 11:28:59 stefano Exp $
;
XLIB fputc_cons
LIB msxbios
INCLUDE "#msxbios.def"
;
; Entry: hl = points to char
;
.fputc_cons
ld hl,2
add hl,sp
ld a,(hl)
ld ix,CHPUT ; Print char
cp 13
jr nz,nocrlf
call msxbios
ld a,10
.nocrlf
cp 12 ; CLS ?
jr nz,nocls
ld ix,CLS
.nocls
jp msxbios
| 11.512821 | 61 | 0.583519 |
a632bfdfa8f3cd9e16b71b73c3fa2cb61bfcc9bd | 7,883 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_944.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_944.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_944.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xf716, %r8
nop
nop
nop
nop
cmp %r9, %r9
mov $0x6162636465666768, %r10
movq %r10, %xmm4
vmovups %ymm4, (%r8)
nop
nop
nop
nop
nop
inc %rcx
lea addresses_D_ht+0x17416, %r15
nop
nop
inc %rax
mov $0x6162636465666768, %r12
movq %r12, %xmm7
vmovups %ymm7, (%r15)
nop
nop
nop
nop
nop
sub $62001, %r15
lea addresses_WC_ht+0x7056, %rsi
lea addresses_A_ht+0x36ce, %rdi
and $27684, %r12
mov $3, %rcx
rep movsl
nop
nop
nop
nop
nop
xor $12812, %r15
lea addresses_WC_ht+0xc116, %rsi
nop
cmp $16659, %r8
vmovups (%rsi), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %r12
nop
nop
add %rdi, %rdi
lea addresses_D_ht+0x14316, %rax
and %r12, %r12
mov $0x6162636465666768, %r10
movq %r10, (%rax)
dec %r10
lea addresses_normal_ht+0x17596, %rsi
nop
nop
nop
nop
nop
and %rcx, %rcx
movl $0x61626364, (%rsi)
nop
nop
nop
nop
and %r15, %r15
lea addresses_A_ht+0x11d16, %rsi
lea addresses_A_ht+0xb496, %rdi
nop
nop
nop
nop
sub %r8, %r8
mov $60, %rcx
rep movsb
nop
nop
nop
nop
nop
xor %r10, %r10
lea addresses_D_ht+0xf772, %r8
add %r15, %r15
movl $0x61626364, (%r8)
nop
lfence
lea addresses_normal_ht+0x1e8e2, %rax
nop
nop
dec %r9
mov $0x6162636465666768, %r12
movq %r12, %xmm4
vmovups %ymm4, (%rax)
nop
nop
nop
inc %r10
lea addresses_A_ht+0x9916, %rsi
lea addresses_A_ht+0xd316, %rdi
add %r12, %r12
mov $44, %rcx
rep movsw
add $10827, %rax
lea addresses_normal_ht+0x958e, %rcx
nop
nop
nop
xor $30904, %r8
and $0xffffffffffffffc0, %rcx
vmovaps (%rcx), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %r15
nop
add $43403, %r10
lea addresses_UC_ht+0x72e6, %rcx
and $24488, %rsi
movw $0x6162, (%rcx)
nop
nop
nop
nop
add %r8, %r8
lea addresses_UC_ht+0x17f26, %rsi
nop
xor $40649, %r15
mov (%rsi), %di
nop
and %rsi, %rsi
lea addresses_UC_ht+0x1c72c, %rcx
nop
nop
nop
nop
xor %rax, %rax
vmovups (%rcx), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %rsi
nop
nop
nop
add $51173, %r15
lea addresses_normal_ht+0x1386, %rsi
lea addresses_D_ht+0x3b16, %rdi
nop
nop
and %rax, %rax
mov $85, %rcx
rep movsb
nop
xor %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r8
push %r9
push %rax
push %rbp
push %rdi
push %rsi
// Faulty Load
lea addresses_PSE+0xb16, %rdi
nop
nop
add $18051, %r12
movb (%rdi), %r8b
lea oracles, %rbp
and $0xff, %r8
shlq $12, %r8
mov (%rbp,%r8,1), %r8
pop %rsi
pop %rdi
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}}
{'src': {'same': True, 'congruent': 9, 'NT': False, 'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}}
{'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': True}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 2, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
| 34.726872 | 2,999 | 0.658379 |
fe7adaf1eb90b9296850c1fa381bbce70157b683 | 8,196 | asm | Assembly | sse/mb_mgr_hmac_flush_ni_sse.asm | kingwelx/intel-ipsec-mb | f67b588d92a477952de8704bf6104812e1517f27 | [
"BSD-3-Clause"
] | null | null | null | sse/mb_mgr_hmac_flush_ni_sse.asm | kingwelx/intel-ipsec-mb | f67b588d92a477952de8704bf6104812e1517f27 | [
"BSD-3-Clause"
] | null | null | null | sse/mb_mgr_hmac_flush_ni_sse.asm | kingwelx/intel-ipsec-mb | f67b588d92a477952de8704bf6104812e1517f27 | [
"BSD-3-Clause"
] | null | null | null | ;;
;; Copyright (c) 2012-2018, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
;; In System V AMD64 ABI
;; calle saves: RBX, RBP, R12-R15
;; Windows x64 ABI
;; calle saves: RBX, RBP, RDI, RSI, RSP, R12-R15
;;
;; Registers: RAX RBX RCX RDX RBP RSI RDI R8 R9 R10 R11 R12 R13 R14 R15
;; -----------------------------------------------------------
;; Windows clobbers: RAX RCX RDX R8
;; Windows preserves: RBX RBP RSI RDI R9 R10 R11 R12 R13 R14 R15
;; -----------------------------------------------------------
;; Linux clobbers: RAX RSI RDI R8
;; Linux preserves: RBX RCX RDX RBP R9 R10 R11 R12 R13 R14 R15
;; -----------------------------------------------------------
;;
;; Linux/Windows clobbers: xmm0 - xmm15
;;
%include "os.asm"
%include "job_aes_hmac.asm"
%include "mb_mgr_datastruct.asm"
%include "reg_sizes.asm"
;%define DO_DBGPRINT
%include "dbgprint.asm"
extern sha1_ni
section .data
default rel
align 16
byteswap: ;ddq 0x0c0d0e0f08090a0b0405060700010203
dq 0x0405060700010203, 0x0c0d0e0f08090a0b
one:
dq 1
section .text
%ifdef LINUX
%define arg1 rdi
%define arg2 rsi
%else
%define arg1 rcx
%define arg2 rdx
%endif
%define state arg1
%define job arg2
%define len2 arg2
; idx needs to be in rbx, rbp, r12-r15
%define idx rbp
%define unused_lanes rbx
%define lane_data rbx
%define tmp2 rbx
%define job_rax rax
%define tmp1 rax
%define size_offset rax
%define tmp rax
%define start_offset rax
%define tmp3 arg1
%define extra_blocks arg2
%define p arg2
%define tmp4 r8
%define p2 r8
; This routine clobbers rbx, rbp
struc STACK
_gpr_save: resq 4
_rsp_save: resq 1
endstruc
%define APPEND(a,b) a %+ b
; JOB* flush_job_hmac_ni_sse(MB_MGR_HMAC_SHA_1_OOO *state)
; arg 1 : state
MKGLOBAL(flush_job_hmac_ni_sse,function,internal)
flush_job_hmac_ni_sse:
mov rax, rsp
sub rsp, STACK_size
and rsp, -16
mov [rsp + _gpr_save + 8*0], rbx
mov [rsp + _gpr_save + 8*1], rbp
%ifndef LINUX
mov [rsp + _gpr_save + 8*2], rsi
mov [rsp + _gpr_save + 8*3], rdi
%endif
mov [rsp + _rsp_save], rax ; original SP
DBGPRINTL "enter sha1-ni-sse flush"
mov unused_lanes, [state + _unused_lanes]
bt unused_lanes, 16+7
jc return_null
; find a lane with a non-null job, assume it is 0 then check 1
xor idx, idx
cmp qword [state + _ldata + 1 * _HMAC_SHA1_LANE_DATA_size + _job_in_lane], 0
cmovne idx, [rel one]
DBGPRINTL64 "idx:", idx
copy_lane_data:
; copy valid lane (idx) to empty lanes
mov tmp, [state + _args_data_ptr + PTR_SZ*idx]
movzx len2, word [state + _lens + idx*2]
DBGPRINTL64 "ptr", tmp
; there are only two lanes so if one is empty it is easy to determine which one
xor idx, 1
mov [state + _args_data_ptr + PTR_SZ*idx], tmp
xor idx, 1
; No need to find min length - only two lanes available
cmp len2, 0
je len_is_0
; Set length on both lanes to 0
mov dword [state + _lens], 0
; "state" and "args" are the same address, arg1
; len is arg2
call sha1_ni
; state is intact
len_is_0:
; process completed job "idx"
imul lane_data, idx, _HMAC_SHA1_LANE_DATA_size
lea lane_data, [state + _ldata + lane_data]
mov DWORD(extra_blocks), [lane_data + _extra_blocks]
cmp extra_blocks, 0
jne proc_extra_blocks
cmp dword [lane_data + _outer_done], 0
jne end_loop
proc_outer:
mov dword [lane_data + _outer_done], 1
mov DWORD(size_offset), [lane_data + _size_offset]
mov qword [lane_data + _extra_block + size_offset], 0
mov word [state + _lens + 2*idx], 1
DBGPRINTL64 "outer-block-index", idx
lea tmp, [lane_data + _outer_block]
DBGPRINTL64 "outer block ptr:", tmp
mov [state + _args_data_ptr + PTR_SZ*idx], tmp
;; idx determines which column
;; read off from consecutive rows
%if SHA1NI_DIGEST_ROW_SIZE != 20
%error "Below code has been optimized for SHA1NI_DIGEST_ROW_SIZE = 20!"
%endif
lea p2, [idx + idx*4]
movdqu xmm0, [state + _args_digest + p2*4]
pshufb xmm0, [rel byteswap]
mov DWORD(tmp), [state + _args_digest + p2*4 + 4*SHA1_DIGEST_WORD_SIZE]
bswap DWORD(tmp)
movdqa [lane_data + _outer_block], xmm0
mov [lane_data + _outer_block + 4*SHA1_DIGEST_WORD_SIZE], DWORD(tmp)
DBGPRINTL_XMM "sha1 outer hash input words[0-3]", xmm0
DBGPRINTL64 "sha1 outer hash input word 4", tmp
mov job, [lane_data + _job_in_lane]
mov tmp, [job + _auth_key_xor_opad]
movdqu xmm0, [tmp]
mov DWORD(tmp), [tmp + 4*SHA1_DIGEST_WORD_SIZE]
movdqu [state + _args_digest + p2*4], xmm0
mov [state + _args_digest + p2*4 + 4*SHA1_DIGEST_WORD_SIZE], DWORD(tmp)
jmp copy_lane_data
align 16
proc_extra_blocks:
mov DWORD(start_offset), [lane_data + _start_offset]
DBGPRINTL64 "extra blocks-start offset", start_offset
mov [state + _lens + 2*idx], WORD(extra_blocks)
DBGPRINTL64 "extra blocks-len", extra_blocks
lea tmp, [lane_data + _extra_block + start_offset]
DBGPRINTL64 "extra block ptr", tmp
mov [state + _args_data_ptr + PTR_SZ*idx], tmp
mov dword [lane_data + _extra_blocks], 0
jmp copy_lane_data
return_null:
xor job_rax, job_rax
jmp return
align 16
end_loop:
mov job_rax, [lane_data + _job_in_lane]
mov qword [lane_data + _job_in_lane], 0
or dword [job_rax + _status], STS_COMPLETED_HMAC
mov unused_lanes, [state + _unused_lanes]
shl unused_lanes, 8
or unused_lanes, idx
mov [state + _unused_lanes], unused_lanes
mov p, [job_rax + _auth_tag_output]
; copy 12 bytes
%if SHA1NI_DIGEST_ROW_SIZE != 20
%error "Below code has been optimized for SHA1NI_DIGEST_ROW_SIZE = 20!"
%endif
lea idx, [idx + idx*4]
mov DWORD(tmp2), [state + _args_digest + idx*4 + 0*SHA1_DIGEST_WORD_SIZE]
mov DWORD(tmp4), [state + _args_digest + idx*4 + 1*SHA1_DIGEST_WORD_SIZE]
bswap DWORD(tmp2)
bswap DWORD(tmp4)
mov [p + 0*4], DWORD(tmp2)
mov [p + 1*4], DWORD(tmp4)
mov DWORD(tmp2), [state + _args_digest + idx*4 + 2*SHA1_DIGEST_WORD_SIZE]
bswap DWORD(tmp2)
mov [p + 2*4], DWORD(tmp2)
cmp qword [job_rax + _auth_tag_output_len_in_bytes], 12
je return
;; copy remaining 8 bytes to return 20 byte digest
mov DWORD(tmp2), [state + _args_digest + idx*4 + 3*SHA1_DIGEST_WORD_SIZE]
mov DWORD(tmp4), [state + _args_digest + idx*4 + 4*SHA1_DIGEST_WORD_SIZE]
bswap DWORD(tmp2)
bswap DWORD(tmp4)
mov [p + 3*4], DWORD(tmp2)
mov [p + 4*4], DWORD(tmp4)
return:
mov rbx, [rsp + _gpr_save + 8*0]
mov rbp, [rsp + _gpr_save + 8*1]
%ifndef LINUX
mov rsi, [rsp + _gpr_save + 8*2]
mov rdi, [rsp + _gpr_save + 8*3]
%endif
mov rsp, [rsp + _rsp_save] ; original SP
ret
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
| 30.132353 | 81 | 0.690337 |
e8d4b43aa8bfd4bc599f55ff5f4057abfb7289cf | 429 | asm | Assembly | programs/oeis/130/A130260.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/130/A130260.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/130/A130260.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A130260: Minimal index k of an even Fibonacci number A001906 such that A001906(k) = Fib(2k) >= n (the 'upper' even Fibonacci Inverse).
; 0,1,2,2,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6
mov $2,$0
lpb $0
sub $0,$3
trn $0,1
add $1,1
add $3,$2
sub $3,$0
lpe
mov $0,$1
| 33 | 201 | 0.564103 |
6b3095d49c96519564035d40ce6d3edd953874ce | 332 | asm | Assembly | 4th SEM/MICROPROCESSOR AND MICROCONTROLLER LABORATORY - XXCSL48/LAB2.asm | AbhishekMali21/VTU-CSE-ISE-LAB-SOLUTIONS | 599916c270d285b3c9b1c8969cfb6cbcae8bd619 | [
"MIT"
] | 80 | 2019-02-12T19:30:15.000Z | 2022-03-28T14:38:55.000Z | 4th SEM/MICROPROCESSOR AND MICROCONTROLLER LABORATORY - XXCSL48/LAB2.asm | AbhishekMali21/VTU-CSE-ISE-LAB-SOLUTIONS | 599916c270d285b3c9b1c8969cfb6cbcae8bd619 | [
"MIT"
] | 1 | 2020-03-29T09:17:14.000Z | 2020-03-29T09:17:15.000Z | 4th SEM/MICROPROCESSOR AND MICROCONTROLLER LABORATORY - XXCSL48/LAB2.asm | AbhishekMali21/VTU-CSE-ISE-LAB-SOLUTIONS | 599916c270d285b3c9b1c8969cfb6cbcae8bd619 | [
"MIT"
] | 115 | 2019-02-20T13:32:44.000Z | 2022-03-28T17:19:29.000Z | .model small
.stack 10
.data
org 01h
a db 03h,01h,04h,02h
count dw 04
.code
mov ax,@data
mov ds,ax
mov bx,count
dec bx
outloop:mov cx,bx
mov si,0
inloop: mov al,a[si]
inc si
cmp al,a[si]
jl down
xchg al,a[si]
mov a[si-1],al
down: loop inloop
dec bx
jnz outloop
mov ah,4ch
int 21h
end
| 10.375 | 22 | 0.611446 |
be9109deb1dda10b8e9cfd8b3cd070d14351d45b | 532 | asm | Assembly | programs/oeis/125/A125117.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/125/A125117.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/125/A125117.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A125117: First differences of A034887.
; 0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0
mov $6,$0
mov $7,2
lpb $7
mov $0,$6
sub $7,1
add $0,$7
mov $5,7
mul $5,$0
mul $5,4
sub $5,1
mov $2,$5
lpb $0
mov $0,1
mov $4,$2
lpe
mov $3,$7
div $4,93
mov $8,$4
lpb $3
mov $1,$8
sub $3,1
lpe
lpe
lpb $6
sub $1,$8
mov $6,0
lpe
| 17.16129 | 213 | 0.492481 |
44bdd09eea09ba758d89cf0a12ff96728a2e3da5 | 2,686 | asm | Assembly | programs/oeis/172/A172137.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/172/A172137.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/172/A172137.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A172137: Number of ways to place 2 nonattacking zebras on an n X n board
; 0,6,36,112,276,582,1096,1896,3072,4726,6972,9936,13756,18582,24576,31912,40776,51366,63892,78576,95652,115366,137976,163752,192976,225942,262956,304336,350412,401526,458032,520296,588696,663622,745476,834672,931636,1036806,1150632,1273576,1406112,1548726,1701916,1866192,2042076,2230102,2430816,2644776,2872552,3114726,3371892,3644656,3933636,4239462,4562776,4904232,5264496,5644246,6044172,6464976,6907372,7372086,7859856,8371432,8907576,9469062,10056676,10671216,11313492,11984326,12684552,13415016,14176576,14970102,15796476,16656592,17551356,18481686,19448512,20452776,21495432,22577446,23699796,24863472,26069476,27318822,28612536,29951656,31337232,32770326,34252012,35783376,37365516,38999542,40686576,42427752,44224216,46077126,47987652,49956976,51986292,54076806,56229736,58446312,60727776,63075382,65490396,67974096,70527772,73152726,75850272,78621736,81468456,84391782,87393076,90473712,93635076,96878566,100205592,103617576,107115952,110702166,114377676,118143952,122002476,125954742,130002256,134146536,138389112,142731526,147175332,151722096,156373396,161130822,165995976,170970472,176055936,181254006,186566332,191994576,197540412,203205526,208991616,214900392,220933576,227092902,233380116,239796976,246345252,253026726,259843192,266796456,273888336,281120662,288495276,296014032,303678796,311491446,319453872,327567976,335835672,344258886,352839556,361579632,370481076,379545862,388775976,398173416,407740192,417478326,427389852,437476816,447741276,458185302,468810976,479620392,490615656,501798886,513172212,524737776,536497732,548454246,560609496,572965672,585524976,598289622,611261836,624443856,637837932,651446326,665271312,679315176,693580216,708068742,722783076,737725552,752898516,768304326,783945352,799823976,815942592,832303606,848909436,865762512,882865276,900220182,917829696,935696296,953822472,972210726,990863572,1009783536,1028973156,1048434982,1068171576,1088185512,1108479376,1129055766,1149917292,1171066576,1192506252,1214238966,1236267376,1258594152,1281221976,1304153542,1327391556,1350938736,1374797812,1398971526,1423462632,1448273896,1473408096,1498868022,1524656476,1550776272,1577230236,1604021206,1631152032,1658625576,1686444712,1714612326,1743131316,1772004592,1801235076,1830825702,1860779416,1891099176,1921787952,1952848726
mov $14,$0
mov $16,$0
lpb $16,1
clr $0,14
mov $0,$14
sub $16,1
sub $0,$16
mov $11,$0
mov $13,$0
lpb $13,1
mov $0,$11
sub $13,1
sub $0,$13
mov $5,$0
mul $5,$0
mov $2,$5
mov $6,6
mul $6,$5
lpb $2,1
mov $2,7
sub $6,8
lpe
add $12,$6
lpe
add $15,$12
lpe
mov $1,$15
| 86.645161 | 2,275 | 0.829114 |
88b8477d8d99100940dbd8db44a28ee1e5aa67df | 415 | asm | Assembly | programs/oeis/032/A032515.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/032/A032515.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/032/A032515.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A032515: Sum of the integer part of 5/2-th roots of integers less than or equal to n.
; 0,1,2,3,4,5,7,9,11,13,15,17,19,21,23,25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70,73,77,81,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,169,174,179,184,189,194,199
mov $1,$0
mov $3,1
lpb $0
add $3,2
sub $0,$3
trn $0,2
mov $2,$0
sub $0,1
add $1,$2
add $4,2
add $3,$4
lpe
| 25.9375 | 203 | 0.631325 |
3664df7d46448612d5fbde38f5198532f67d00e4 | 605 | asm | Assembly | libsrc/_DEVELOPMENT/stdio/c/sccz80/vfprintf_callee.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/stdio/c/sccz80/vfprintf_callee.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/stdio/c/sccz80/vfprintf_callee.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | 1 | 2019-12-03T23:57:48.000Z | 2019-12-03T23:57:48.000Z |
; int vfprintf(FILE *stream, const char *format, void *arg)
INCLUDE "clib_cfg.asm"
SECTION code_clib
SECTION code_stdio
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $02
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC vfprintf_callee
EXTERN asm_vfprintf
vfprintf_callee:
pop af
pop bc
pop de
pop ix
push af
jp asm_vfprintf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ELSE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC vfprintf_callee
EXTERN vfprintf_unlocked_callee
defc vfprintf_callee = vfprintf_unlocked_callee
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
| 15.125 | 59 | 0.523967 |
cca307ee7451c0567eaa0532518659c659f6237a | 1,312 | nasm | Assembly | src/boot/gdt_entry.nasm | maximsmol/nos | 386b4166b3fd1701b734bfcd50ace1b9e1ea38ee | [
"MIT"
] | 1 | 2019-04-29T05:10:52.000Z | 2019-04-29T05:10:52.000Z | src/boot/gdt_entry.nasm | maximsmol/nos | 386b4166b3fd1701b734bfcd50ace1b9e1ea38ee | [
"MIT"
] | null | null | null | src/boot/gdt_entry.nasm | maximsmol/nos | 386b4166b3fd1701b734bfcd50ace1b9e1ea38ee | [
"MIT"
] | 1 | 2021-12-06T23:49:27.000Z | 2021-12-06T23:49:27.000Z | %ifndef hguard_gdt_entry
%define hguard_gdt_entry
; base limit accessed=0 r/w conforming/direction exec ring present=1 size granularity=auto
; r (if code) - readable; never writable
; w (if data) - writable; always readable
; conforming (if code) - allow jump from lower ring
; direction (if data) - spans down (1)/up (0)
; exec - data (0)/code (1)
; size - 16-bit (0)/32-bit (1)
; granularity - limit in B (0)/4 KiB (1) blocks
%macro gdt_entry 7
%if (%2 > 1111_1111_1111_1111_1111) && ((%2 & 4*1024-1) != 4*1024-1)
%error "limit cannot be encoded"
%endif
%if (%2 > 1111_1111_1111_1111_1111) ; encode limit in 4KiBs blocks
db ((%2 / (4*1024) >> 0) & 0xff)
db ((%2 / (4*1024) >> 8) & 0xff)
%else
db ((%2 >> 0) & 0xff)
db ((%2 >> 8) & 0xff)
%endif
db ((%1 >> 0 ) & 0xff)
db ((%1 >> 8 ) & 0xff)
db ((%1 >> 16) & 0xff)
; present=1 ring 1 exec conforming/direction r/w accessed=0
db ((1 << 7) + ((%6 & 11b) << 5) + (1 << 4) + ((%5 & 1b) << 3) + ((%4 & 1b) << 2) + ((%3 & 1b) << 1) + 0)
%if (%2 > 1111_1111_1111_1111_1111) ; encode limit in 4KiBs blocks
db ((1 << 7) + (%7 << 6) + (0 << 5) + (0 << 4) + ((%2 / (4*1024) >> 16) & 0xf))
%else
db ((0 << 7) + (%7 << 6) + (0 << 5) + (0 << 4) + ((%2 >> 16) & 0xf))
%endif
db ((%1 >> 24) & 0xff)
%endmacro
%endif
| 32 | 107 | 0.536585 |
413f294ca1794dd648c8a4b432f9d5adbeb22bb0 | 12,457 | asm | Assembly | receiver/mod_lrk2.asm | lantti/orcu | 37e36b97f74d2d91aae5436b4bd215ba94d7e2bf | [
"MIT"
] | null | null | null | receiver/mod_lrk2.asm | lantti/orcu | 37e36b97f74d2d91aae5436b4bd215ba94d7e2bf | [
"MIT"
] | null | null | null | receiver/mod_lrk2.asm | lantti/orcu | 37e36b97f74d2d91aae5436b4bd215ba94d7e2bf | [
"MIT"
] | null | null | null | /*
* mod_lrk.asm
* Author: Lantti
*/
/*
Reg summary
r0, mainloop, init
r1, mainloop, init
r2, PWM
r3,
r4, gen_pwmlist
r5, gen_pwmlist
r6, gen_pwmlist
r7, gen_pwmlist
r8, gen_pwmlist
r9, gen_pwmlist
r10, gen_pwmlist, load_pwmlist
r11,
r12,
r13,
r14,
r15, spi_op
r16, mainloop, spi_op, init
r17, mainloop, init
r18, mainloop, init
r19, mainloop, init
r20, mainloop, spi_op, init
r21, mainloop, spi_op, init
r22, PWM
r23, PWM
r24, gen_pwmlist
r25, gen_pwmlist
r26 (Xl),
r27 (Xh),
r28 (Yl),
r29 (Yh),
r30 (Zl), init, mainloop, spi_op
r31 (Zh), init, mainloop, spi_op
*/
.INCLUDE "tn44Adef.inc"
.equ LEDB1 = PORTA0
.equ LEDB2 = PORTA1
.equ LEDG1 = PORTA2
.equ LEDG2 = PORTA3
.equ LEDR1 = PORTB1
.equ LEDR2 = PORTB2
.equ ENABLE_RAW = GPIOR00
.equ PRESCALER_MODE = 4
.equ PING_RESPONSE = 0x326B726C //"lrk2"
.equ BSWITCH = 0x10
.DSEG
.ORG 0xDE
msg_buffer: .BYTE 33
.ORG 0x100
userspace: .BYTE 1
.ORG 0x120
buffer0: .BYTE 14
.ORG 0x130
buffer1: .BYTE 14
.CSEG
;Interrupt vectors
rjmp 0x600 ; Reset Handler
rjmp INT0_H ; IRQ0 Handler
rjmp PCINT0_H ; PCINT0 Handler
rjmp PCINT1_H ; PCINT1 Handler
rjmp WDT_H ; Watchdog Interrupt Handler
rjmp TIM1_CAPT_H ; Timer1 Capture Handler
rjmp TIM1_COMPA_H ; Timer1 Compare A Handler
rjmp TIM1_COMPB_H ; Timer1 Compare B Handler
rjmp TIM1_OVF_H ; Timer1 Overflow Handler
rjmp TIM0_COMPA_H ; Timer0 Compare A Handler
rjmp TIM0_COMPB_H ; Timer0 Compare B Handler
rjmp TIM0_OVF_H ; Timer0 Overflow Handler
rjmp ANA_COMP_H ; Analog Comparator Handler
rjmp ADC_CONV_H ; ADC Conversion Handler
rjmp EE_RDY_H ; EEPROM Ready Handler
rjmp USI_STR_H ; USI STart Handler
rjmp USI_OVF_H ; USI Overflow Handler
;RF recieve pipe widths
PW_TABLE: .DB 15,7,2,2,0
;standard function vectors
SETUP_VECT: rjmp SETUP
PING_VECT: rjmp PING
ERROR_VECT: rjmp ERROR
;RF receive pipe callback vectors
PIPE_CB_VECT: rjmp PIPE1_CB
rjmp PIPE2_CB
rjmp PIPE3_CB
rjmp PIPE4_CB
rjmp PIPE5_CB
INT0_H: ; IRQ0 Handler
PCINT0_H: ; PCINT0 Handler
PCINT1_H: ; PCINT1 Handler
WDT_H: ; Watchdog Interrupt Handler
TIM1_CAPT_H: ; Timer1 Capture Handler
TIM1_COMPA_H: ; Timer1 Compare A Handler
TIM1_COMPB_H: ; Timer1 Compare B Handler
TIM1_OVF_H: ; Timer1 Overflow Handler
ANA_COMP_H: ; Analog Comparator Handler
ADC_CONV_H: ; ADC Conversion Handler
EE_RDY_H: ; EEPROM Ready Handler
USI_STR_H: ; USI STart Handler
USI_OVF_H: ; USI Overflow Handler
reti
PIPE1_CB: sbis GPIOR0,ENABLE_RAW
ret
ldi r19,0x00
ldi r18,msg_buffer+1
rjmp load_pwmlist
// rcall load_pwmlist
// ldi r16,160 //(20<<3)|0
// ldi r31,0x00
// ldi r30,msg_buffer
// st Z,r16
// ret
PIPE2_CB:
ldi r17,0x00
ldi r16,msg_buffer+1
ldi r19,0x00
ldi r18,msg_buffer+8
rcall gen_pwmlist
ldi r19,0x00
ldi r18,msg_buffer+8
rjmp load_pwmlist
// rcall load_pwmlist
// ldi r16,160 //(20<<3)|0
// ldi r31,0x00
// ldi r30,msg_buffer
// st Z,r16
// ret
PIPE3_CB: ldi r31,0x00
ldi r30,msg_buffer+1
ld r16,Z+
mov r17,r16
swap r17
andi r16,0x0F
andi r17,0x0F
movw r19:r18,r17:r16
lsl r16
lsl r17
add r16,r18
add r17,r19
subi r16,-3
subi r17,-3
ldi r20,3
eereadloop: out EEARL,r16
sbi EECR,EERE
in r18,EEDR
out EEARL,r17
sbi EECR,EERE
in r19,EEDR
st Z+,r18
st Z+,r19
inc r16
inc r17
dec r20
brne eereadloop
ldi r17,0x00
ldi r16,msg_buffer+2
ldi r19,0x00
ldi r18,msg_buffer+9
rcall gen_pwmlist
ldi r19,0x00
ldi r18,msg_buffer+9
rjmp load_pwmlist
// rcall load_pwmlist
// ldi r16,160 //(20<<3)|0
// ldi r31,0x00
// ldi r30,msg_buffer
// st Z,r16
// ret
PIPE4_CB: ldi r31,0x00
ldi r30,msg_buffer
ldd r16,Z+1
cpi r16,0xBA
breq set_en_raw
cbi GPIOR0,ENABLE_RAW
ret
set_en_raw: sbi GPIOR0,ENABLE_RAW
ret
PIPE5_CB:
ret
green: .DB 100,((1<<LEDG2)|(1<<LEDB1)),1,0,0,0,0,0,0,245,((1<<LEDR2)|(1<<LEDR1)),1,0,0
SETUP: ldi r23,LOW(buffer0)
ldi r16, (1<<PRUSI)+(1<<PRADC)
out PRR, r16
cbi GPIOR0,ENABLE_RAW
cbi PORTA,LEDB1
cbi PORTA,LEDB2
cbi PORTA,LEDG1
cbi PORTA,LEDG2
cbi PORTB,LEDR1
cbi PORTB,LEDR2
sbi DDRA,LEDB1
sbi DDRA,LEDB2
sbi DDRA,LEDG1
sbi DDRA,LEDG2
sbi DDRB,LEDR1
sbi DDRB,LEDR2
ldi r31,HIGH(green<<1)
ldi r30,LOW(green<<1)
ldi r27,HIGH(buffer0)
ldi r26,LOW(buffer0)
colorloop: lpm r16,Z+
st X+,r16
cpi r26,LOW(buffer0+14)
brlo colorloop
ldi r26,LOW(buffer0+1)
ldi r27,HIGH(buffer0+1)
ldi r28,LOW(buffer0+10)
ldi r29,HIGH(buffer0+10)
ldi r16, (1<<TOIE0)+(1<<OCIE0A)+(1<<OCIE0B)
out TIMSK0, r16 ;enable the PWM interrupts
ldi r16, PRESCALER_MODE
out TCCR0B, r16 ;start the timer and PWM routine
sei
ret
PING: ldi r31,0x00
ldi r30,msg_buffer
ldi r16,0x18
st Z+,r16
ldi r16,LOW(PING_RESPONSE)
st Z+,r16
ldi r16,HIGH(PING_RESPONSE)
st Z+,r16
ldi r16,BYTE3(PING_RESPONSE)
st Z+,r16
ldi r16,BYTE4(PING_RESPONSE)
st Z+,r16
ret
ERROR: cli
cbi PORTA,LEDB1
cbi PORTA,LEDB2
cbi PORTA,LEDG1
cbi PORTA,LEDG2
sbi PORTB,LEDR1
sbi PORTB,LEDR2
sbi DDRA,LEDB1
sbi DDRA,LEDB2
sbi DDRA,LEDG1
sbi DDRA,LEDG2
sbi DDRB,LEDR1
sbi DDRB,LEDR2
sleep
rjmp ERROR
//expects r19:18 pointing to the new pwmlist
load_pwmlist:
ldi r21,0x01
mov r20,r23
ldi r16,BSWITCH
eor r20,r16
ldi r16,7
mov r10,r16
copyloop: movw r31:r30,r19:r18
ld r16,Z+
ld r17,Z+
movw r19:r18,r31:r30
movw r31:r30,r21:r20
st Z+,r16
st Z+,r17
movw r21:r20,r31:r30
dec r10
brne copyloop
ldi r16,BSWITCH
eor r23,r16
ret
//expects r17:r16 pointing to colour list, r19:r18 to target buffer. Mangels r10, r9, r8, r7, r6, r5, r16, r17, r18, r19, r20, r21
PIN_TOGGLE_MASKS: .DB (1<<LEDG1),(1<<LEDG2),(1<<LEDB1),(1<<LEDB2),(1<<LEDR1),(1<<LEDR2)
gen_pwmlist: ldi r20,4
mov r10,r20
clr r5
movw r25:r24,r19:r18
movw r31:r30,r19:r18
st Z+,r5
st Z+,r5
st Z+,r5
st Z+,r5
ldi r21,HIGH(PIN_TOGGLE_MASKS<<1)
ldi r20,LOW(PIN_TOGGLE_MASKS<<1)
gen_pl_next: dec r10 //load next values to insert into the pwmlist or
brmi gen_pl_done //jump to end if none left
movw r31:r30,r17:r16
ld r6,Z+
movw r17:r16,r31:r30
movw r31:r30,r21:r20
lpm r7,Z+
movw r21:r20,r31:r30
tst r6
breq gen_pl_next
neg r6
movw r31:r30,r25:r24
gen_pl_sort: cp r30,r18 //insertion sort with merge for equal values
cpc r31,r19
breq gen_pl_place
sbiw r31:r30,2
ld r8,Z+
ld r9,Z+
cp r8,r6
breq gen_pl_merge
brlo gen_pl_place
st Z+,r8
st Z+,r9
sbiw r31:r30,4
rjmp gen_pl_sort
gen_pl_place: st Z+,r6
st Z+,r7
adiw r25:r24,2
rjmp gen_pl_next
gen_pl_merge: or r9,r7
st -Z,r9
rjmp gen_pl_next
gen_pl_done: movw r31:r30,r25:r24
clr r10
st Z+,r10
tst r5
brne gen_pl_ret
ldi r30,2
mov r10,r30
movw r25:r24,r19:r18
adiw r25:r24,9
movw r19:r18,r25:r24
movw r31:r30,r19:r18
st Z+,r5
st Z+,r5
st Z+,r5
st Z+,r5
inc r5
rjmp gen_pl_next
gen_pl_ret: ret
TIM0_COMPA_H:
ld r22, X+
out PINA, r22
ld r22, X+
out OCR0A, r22
reti
TIM0_COMPB_H:
ld r22, Y+
out PINB, r22
ld r22, Y+
out OCR0B, r22
reti
TIM0_OVF_H:
in r2, SREG
cbi PORTA, LEDB1
cbi PORTA, LEDB2
cbi PORTA, LEDG1
cbi PORTA, LEDG2
cbi PORTB, LEDR1
cbi PORTB, LEDR2
mov r26, r23
mov r28, r23
subi r28,-9
ld r22,X+
out OCR0A,r22
ld r22,Y+
out OCR0B,r22
out SREG,r2
reti
| 30.309002 | 130 | 0.40692 |
1c7e45905d507d0ae996a8322a15d2859c36fdb3 | 1,077 | asm | Assembly | Src/regs.asm | slowcorners/Minimal-FORTH | afb1bcac3018f5a72c5dcafa37c5dee497382d15 | [
"MIT"
] | 1 | 2021-06-13T18:31:19.000Z | 2021-06-13T18:31:19.000Z | Src/regs.asm | slowcorners/Minimal-FORTH | afb1bcac3018f5a72c5dcafa37c5dee497382d15 | [
"MIT"
] | null | null | null | Src/regs.asm | slowcorners/Minimal-FORTH | afb1bcac3018f5a72c5dcafa37c5dee497382d15 | [
"MIT"
] | null | null | null | ; ----------------------------------------------------------------------
; THE VIRTUAL FORTH MACHINE REGISTERS
IP: ; Instruction Pointer
IP.0: DB 0
IP.1: DB 0
WA: ; Word Address Register
WA.0: DB 0
WA.1: DB 0
SP: ; Data stack pointer
SP.0: DB 0
SP.1: DB 0
RP: ; Return stack pointer
RP.0: DB 0
RP.1: DB 0
UP: ; User area pointer
UP.0: DB 0
UP.1: DB 0
R1: ; Working register R1
R1.0: DB 0
R1.1: DB 0
R1H:
R1.2: DB 0
R1.3: DB 0
R2: ; Working register R2
R2.0: DB 0
R2.1: DB 0
R2H:
R2.2: DB 0
R2.3: DB 0
R3: ; Working register R3
R3.0: DB 0
R3.1: DB 0
R3H:
R3.2: DB 0
R3.3: DB 0
BC: DB 0 ; "Hidden" registers
TMP: DB 0 ; (used by _AND8 _OR8 _XOR8)
| 22.914894 | 72 | 0.344475 |
7baa6c32a947651cb72858b84f37f6cdc56ef612 | 5,677 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_843.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_843.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xca.log_21829_843.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x14cf4, %rsi
lea addresses_A_ht+0x3e99, %rdi
cmp $1160, %r12
mov $20, %rcx
rep movsq
nop
nop
cmp %r9, %r9
lea addresses_WC_ht+0x1b723, %rcx
xor %r8, %r8
mov (%rcx), %rsi
nop
and $5429, %r12
lea addresses_A_ht+0xc43f, %r12
dec %rbx
vmovups (%r12), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rsi
nop
nop
nop
nop
sub $8316, %r12
lea addresses_D_ht+0xbc57, %r12
nop
nop
nop
inc %rbx
mov $0x6162636465666768, %rcx
movq %rcx, (%r12)
add $16683, %r9
lea addresses_WC_ht+0x18417, %rsi
lea addresses_WC_ht+0x1d017, %rdi
nop
cmp %r15, %r15
mov $32, %rcx
rep movsl
nop
nop
nop
xor $51583, %rsi
lea addresses_WT_ht+0x1b567, %r15
nop
nop
nop
nop
dec %rsi
movw $0x6162, (%r15)
nop
nop
nop
nop
xor %r12, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r15
push %rbx
push %rdi
push %rdx
// Store
lea addresses_US+0xc817, %r11
nop
nop
nop
dec %r10
mov $0x5152535455565758, %rbx
movq %rbx, %xmm5
movups %xmm5, (%r11)
nop
nop
nop
nop
xor $4522, %rdi
// Faulty Load
lea addresses_WT+0x5017, %rdi
nop
nop
xor %r12, %r12
movb (%rdi), %bl
lea oracles, %rdi
and $0xff, %rbx
shlq $12, %rbx
mov (%rdi,%rbx,1), %rbx
pop %rdx
pop %rdi
pop %rbx
pop %r15
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 11}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 42.051852 | 2,999 | 0.659151 |
1fced0c567ca4895e5f6ececc5e9f116d4140f30 | 30,494 | asm | Assembly | eurasia/services4/srvinit/devices/sgx/3dcontextswitch.asm | shaqfu786/GFX_Linux_DDK | f184ac914561fa100a5c92a488df777de8785f93 | [
"FSFAP"
] | 3 | 2020-03-13T23:37:00.000Z | 2021-09-03T06:34:04.000Z | eurasia/services4/srvinit/devices/sgx/3dcontextswitch.asm | zzpianoman/GFX_Linux_DDK | f184ac914561fa100a5c92a488df777de8785f93 | [
"FSFAP"
] | null | null | null | eurasia/services4/srvinit/devices/sgx/3dcontextswitch.asm | zzpianoman/GFX_Linux_DDK | f184ac914561fa100a5c92a488df777de8785f93 | [
"FSFAP"
] | 6 | 2015-02-05T03:01:01.000Z | 2021-07-24T01:07:18.000Z | /*****************************************************************************
Name : 3dcontextswitch.asm
Title : SGX microkernel 3D context switch utility code
Author : Imagination Technologies
Created : 09/06/2008
Copyright : 2006 by Imagination Technologies Limited. All rights reserved.
No part of this software, either material or conceptual
may be copied or distributed, transmitted, transcribed,
stored in a retrieval system or translated into any
human or computer language in any form by any means,
electronic, mechanical, manual or other-wise, or
disclosed to third parties without the express written
permission of Imagination Technologies Limited, HomePark
Industrial Estate, King's Langley, Hertfordshire,
WD4 8LZ, U.K.
Description : SGX Microkernel utility code
Program Type : USSE assembly language
Modifications :
$Log: 3dcontextswitch.asm $
--- Revision Logs Removed ---
*****************************************************************************/
#include "usedefs.h"
/***************************
Sub-routine Imports
***************************/
.import MKTrace;
.import SwitchEDMBIFBank;
#if defined(SGX_FEATURE_ISP_CONTEXT_SWITCH)
.import Check3DQueues;
.import CheckTAQueue;
#if defined(SGX_FEATURE_MK_SUPERVISOR) && defined(FIX_HW_BRN_30701)
.import JumpToSupervisor;
#endif
.export RenderHalt;
.export ResumeRender;
#endif
.modulealign 2;
/*****************************************************************************
Macro definitions
*****************************************************************************/
/*****************************************************************************
Start of program
*****************************************************************************/
#if defined(SGX_FEATURE_ISP_CONTEXT_SWITCH_REV_3)
/*****************************************************************************
RenderHalt
This routine handles the storing of HW state during an ISP context switch
away from the current render.
inputs:
temps: r0, r1, r2, r3, r4, r5, r6, R_RTData
*****************************************************************************/
RenderHalt:
{
MK_TRACE(MKTC_RENDERHALT, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* This is a context switch so clear the flags */
MK_LOAD_STATE(r0, ui32IRenderFlags, drc0);
MK_WAIT_FOR_STATE_LOAD(drc0);
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
and.testnz p0, r0, #RENDER_IFLAGS_TRANSFERRENDER;
and r0, r0, ~#RENDER_IFLAGS_TRANSFERRENDER;
#endif
and r0, r0, #~(RENDER_IFLAGS_RENDERINPROGRESS | RENDER_IFLAGS_SPMRENDER | \
RENDER_IFLAGS_HALTRENDER | RENDER_IFLAGS_HALTRECEIVED | \
RENDER_IFLAGS_FORCEHALTRENDER);
MK_STORE_STATE(ui32IRenderFlags, r0);
MK_TRACE(MKTC_RH_CLEARFLAGS, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* Start loading the holding structure base address */
MK_LOAD_STATE(r0, s3DContext, drc1);
MK_WAIT_FOR_STATE_LOAD(drc1);
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
p0 ba RH_PDSStateSaved;
#endif
{
MK_MEM_ACCESS_BPCACHE(ldad) R_RTData, [R_TA3DCtl, #DOFFSET(SGXMK_TA3D_CTL.s3DRTData)], drc0;
wdf drc0;
#if defined(SGX_FEATURE_MP)
/* If the render was context switched before check PDS state before saving */
MK_MEM_ACCESS(ldad) r2, [R_RTData, #DOFFSET(SGXMKIF_HWRTDATA.sRTStatusDevAddr)], drc0;
wdf drc0;
MK_MEM_ACCESS(ldad) r2, [r2], drc0;
wdf drc0;
and.testz p2, r2, #SGXMKIF_HWRTDATA_RT_STATUS_ISPCTXSWITCH;
#endif
/* Offset to the save location in the context */
mov r1, #OFFSET(SGXMKIF_HWRENDERCONTEXT.asPDSStateBaseDevAddr[0][0]);
iaddu32 r1, r1.low, r0;
mov r2, #OFFSET(SGXMKIF_HWRENDERCONTEXT.ui32PDSStatus[0][0]);
iaddu32 r2, r2.low, r0;
#if defined(SGX_FEATURE_MP)
/* Need to set the check each cores status to see which streams are valid */
MK_LOAD_STATE_CORE_COUNT_3D(r6, drc0);
MK_WAIT_FOR_STATE_LOAD(drc0);
mov r3, #0;
RH_CheckNextCoreStatus:
#endif
{
/* If we have not context switched on this render before we must save the state */
#if defined(SGX_FEATURE_MP)
p2 ba RH_SavePDSState;
{
/* This render has been switched atleast once before */
/* Check if this core has already finished */
MK_MEM_ACCESS(ldad) r4, [r2], drc0;
wdf drc0;
and.testz p1, r4, #EUR_CR_PDS_STATUS_RENDER_COMPLETED_MASK;
p1 ba RH_SavePDSState;
{
/* This core has already completed so keep the current state */
REG_INCREMENT_BYVALUE(r2, p1, #sizeof(IMG_UINT32));
REG_INCREMENT_BYVALUE(r1, p1, #sizeof(IMG_UINT32));
ba RH_PDSStateUpdated;
}
}
RH_SavePDSState:
#endif
{
/* Read the core specific registers? */
READCORECONFIG(r4, r3, #EUR_CR_PDS_CONTEXT_STORE >> 2, drc0);
READCORECONFIG(r5, r3, #EUR_CR_PDS_STATUS >> 2, drc0);
wdf drc0;
/* Save the PDS_STATUS value to memory */
MK_MEM_ACCESS(stad) [r2, #1++], r5;
/* Clear the tile-mode bit */
and r4, r4, ~#EUR_CR_PDS_CONTEXT_STORE_TILE_ONLY_MASK;
/* Did the core store a valid stream */
and.testz p1, r4, #EUR_CR_PDS_CONTEXT_STORE_DISABLE_MASK;
p1 and.testnz p1, r5, #EUR_CR_PDS_STATUS_CSWITCH_COMPLETED_MASK;
!p1 and r4, r4, ~#EUR_CR_PDS_CONTEXT_RESUME_VALID_STREAM_MASK;
p1 or r4, r4, #EUR_CR_PDS_CONTEXT_RESUME_VALID_STREAM_MASK;
/* Save the value to memory */
MK_MEM_ACCESS(stad) [r1, #1++], r4;
}
RH_PDSStateUpdated:
#if defined(SGX_FEATURE_MP)
/* Is there another core to check? */
REG_INCREMENT(r3, p1);
xor.testnz p1, r3, r6;
p1 ba RH_CheckNextCoreStatus;
#endif
}
}
RH_PDSStateSaved:
#if defined(SGX_FEATURE_MP)
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
p0 ba RH_DPMStateSaved;
#endif
{
/* Offset to the save location in the context */
mov r1, #OFFSET(SGXMKIF_HWRENDERCONTEXT.ui32DPMFreeStatus[0]);
iaddu32 r1, r1.low, r0;
/* Need to set the check each cores status to see which streams are valid */
MK_LOAD_STATE_CORE_COUNT_3D(r2, drc0);
MK_WAIT_FOR_STATE_LOAD(drc0);
mov r3, #EUR_CR_MASTER_DPM_TSP0_MTILEFREE >> 2;
RH_SaveNextDPMState:
{
/* Read the registers */
ldr r4, r3, drc0;
wdf drc0;
/* Save the value to memory */
MK_MEM_ACCESS(stad) [r1, #1++], r4;
/* Increment the register */
REG_INCREMENT(r3, p1);
/* Have we saved all the cores yet? */
isub16.testnz r2, p1, r2, #1;
p1 ba RH_SaveNextDPMState;
}
READMASTERCONFIG(r3, #EUR_CR_MASTER_DPM_DEALLOCATE_MASK >> 2, drc0);
wdf drc0;
MK_MEM_ACCESS(stad) [r0, #DOFFSET(SGXMKIF_HWRENDERCONTEXT.ui32DPMDeallocMask)], r3;
}
RH_DPMStateSaved:
#endif
/* Save the ISP context switch registers to memory */
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
p0 mov r1, #OFFSET(SGXMKIF_HWTRANSFERCONTEXT.ui32ISP2CtxResume);
p0 mov r6, #offset(SGXMKIF_HWTRANSFERCONTEXT.ui32ISPRestart);
p0 ba RH_ISPStateOffsetReady;
#endif
{
mov r1, #OFFSET(SGXMKIF_HWRENDERCONTEXT.ui32ISP2CtxResume);
mov r6, #OFFSET(SGXMKIF_HWRENDERCONTEXT.ui32ISPRestart);
}
RH_ISPStateOffsetReady:
/* Add the offset to the base address */
iaddu32 r6, r6.low, r0;
iaddu32 r0, r1.low, r0;
#if defined(SGX_FEATURE_MP)
mov r1, #0;
MK_LOAD_STATE_CORE_COUNT_3D(r2, drc0);
MK_WAIT_FOR_STATE_LOAD(drc0);
#endif
RH_SaveNextCore:
{
#if defined(SGX_FEATURE_MP)
/* Check if we need to save the ISP status registers */
READCORECONFIG(r4, r1, #EUR_CR_PDS_CONTEXT_STORE >> 2, drc0);
READCORECONFIG(r5, r1, #EUR_CR_PDS_STATUS >> 2, drc0);
wdf drc0;
and.testnz p2, r4, #EUR_CR_PDS_CONTEXT_STORE_DISABLE_MASK;
p2 shl.testns p2, r5, #(31 - EUR_CR_PDS_STATUS_CSWITCH_COMPLETED_SHIFT);
/* Don't save the register is PDS store disabled and !CSWITCH_COMPLETED */
p2 ba RH_NoRegisterSave;
#endif
{
/* Read the next config register */
READCORECONFIG(r5, r1, #EUR_CR_ISP_STATUS2 >> 2, drc0);
wdf drc0;
shr r5, r5, #(EUR_CR_ISP_STATUS2_PRIM_NUM_SHIFT - EUR_CR_ISP_START_PRIM_NUM_SHIFT);
MK_MEM_ACCESS(stad) [r6, #1++], r5;
mov r3, #EUR_CR_ISP_CONTEXT_SWITCH2 >> 2;
#if defined(SGX_FEATURE_MP)
mov r4, #EUR_CR_ISP_CONTEXT_SWITCH9 >> 2;
#else
mov r4, #EUR_CR_ISP_CONTEXT_SWITCH3 >> 2;
#endif
RH_SaveNextReg:
{
/* Is this the last register to save for this core */
xor.testnz p2, r3, r4;
/* Read the next config register */
READCORECONFIG(r5, r1, r3, drc0);
wdf drc0;
MK_MEM_ACCESS(stad) [r0, #1++], r5;
iaddu32 r3, r3.low, #1;
p2 ba RH_SaveNextReg;
}
#if defined(SGX_FEATURE_MP)
ba RH_RegisterSaveDone;
#endif
}
#if defined(SGX_FEATURE_MP)
RH_NoRegisterSave:
{
/* Move the addresses on as if we had saved the register state */
mov r3, #(((EUR_CR_ISP_CONTEXT_SWITCH9 - EUR_CR_ISP_CONTEXT_SWITCH2) >> 2) + 1);
mov r4, #SIZEOF(IMG_UINT32);
imae r0, r3.low, #SIZEOF(IMG_UINT32), r0, u32;
iaddu32 r6, r4.low, r6;
}
RH_RegisterSaveDone:
/* Are there any more cores to save */
REG_INCREMENT(r1, p2);
xor.testnz p2, r1, r2;
p2 ba RH_SaveNextCore;
#endif
}
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
p0 ba RH_SetTransferRenderFlags;
{
#endif
/* Load the RT data structure for the render */
MK_MEM_ACCESS_BPCACHE(ldad) r0, [R_TA3DCtl, #DOFFSET(SGXMK_TA3D_CTL.s3DRTData)], drc1;
wdf drc1;
/* Make sure the RT status flags are loaded */
MK_MEM_ACCESS(ldad) r1, [r0, #DOFFSET(SGXMKIF_HWRTDATA.sRTStatusDevAddr)], drc1;
wdf drc1;
#if defined(SGX_FEATURE_RENDER_TARGET_ARRAYS)
MK_MEM_ACCESS_BPCACHE(ldad) r2, [R_TA3DCtl, #DOFFSET(SGXMK_TA3D_CTL.ui32ActiveRTIdx)], drc0;
wdf drc0;
imae r1, r2.low, #SIZEOF(IMG_UINT32), r1, u32;
#endif
MK_MEM_ACCESS(ldad) r2, [r1], drc0;
wdf drc0;
/* Record that we have context switched on this scene for later use */
or r2, r2, #SGXMKIF_HWRTDATA_RT_STATUS_ISPCTXSWITCH;
MK_MEM_ACCESS(stad) [r1], r2;
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
ba RH_FlagsSet;
}
RH_SetTransferRenderFlags:
{
MK_LOAD_STATE(r0, sTransferCCBCmd, drc1);
MK_WAIT_FOR_STATE_LOAD(drc1);
MK_MEM_ACCESS_BPCACHE(ldad) r1, [r0, #DOFFSET(SGXMKIF_TRANSFERCMD.ui32Flags)], drc0;
wdf drc0;
or r1, r1, #SGXMKIF_TQFLAGS_CTXSWITCH;
MK_MEM_ACCESS_BPCACHE(stad) [r0, #DOFFSET(SGXMKIF_TRANSFERCMD.ui32Flags)], r1;
}
RH_FlagsSet:
#endif
idf drc0, st;
wdf drc0;
#if defined(FIX_HW_BRN_30701) || (defined(FIX_HW_BRN_30656) || defined(FIX_HW_BRN_30700))
#if defined(FIX_HW_BRN_30701)
SGXMK_SPRV_WRITE_REG(#EUR_CR_SOFT_RESET >> 2, #EUR_CR_SOFT_RESET_ISP_RESET_MASK);
#endif
#if (defined(FIX_HW_BRN_30656) || defined(FIX_HW_BRN_30700))
SGXMK_SPRV_WRITE_REG(#EUR_CR_SOFT_RESET >> 2, #EUR_CR_SOFT_RESET_PBE_RESET_MASK);
#endif
SGXMK_SPRV_WRITE_REG(#EUR_CR_SOFT_RESET >> 2, #0);
#endif
/* Check the queues */
FIND3D();
FINDTA();
MK_TRACE(MKTC_RENDERHALT_END, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* branch back to calling code */
mov pclink, R_EDM_PCLink;
lapc;
}
/*****************************************************************************
ResumeRender
This routine handles the retoring of HW state when resuming a render
previously context switched.
inputs: r0 - SGXMKIF_HWRENDERCONTEXT of the render to be resumed
temps: r2, r3, r4, r5, r6, r7
*****************************************************************************/
ResumeRender:
{
MK_TRACE(MKTC_KICKRENDER_RESUME, MKTF_3D | MKTF_SCH);
#if defined(DEBUG)
/* Count number of resumes */
MK_MEM_ACCESS_BPCACHE(ldad) r2, [r0, #DOFFSET(SGXMKIF_HWRENDERCONTEXT.ui32Num3DContextResumes)], drc0;
wdf drc0;
mov r3, #1;
iaddu32 r2, r3.low, r2;
MK_MEM_ACCESS_BPCACHE(stad) [r0, #DOFFSET(SGXMKIF_HWRENDERCONTEXT.ui32Num3DContextResumes)], r2;
idf drc0, st;
wdf drc0;
#endif
/* We know that there is only 1 PDS per core */
mov r2, #OFFSET(SGXMKIF_HWRENDERCONTEXT.asPDSStateBaseDevAddr);
iaddu32 r2, r2.low, r0;
#if defined(SGX_FEATURE_MP)
/* Need to set the check each cores status to see which streams are valid */
mov r3, #0;
MK_LOAD_STATE_CORE_COUNT_3D(r6, drc0);
MK_WAIT_FOR_STATE_LOAD(drc0);
RR_PDSBaseNextCore:
#endif
{
MK_MEM_ACCESS(ldad) r4, [r2], drc0;
wdf drc0;
WRITECORECONFIG(r3, #EUR_CR_PDS_CONTEXT_RESUME >> 2, r4, r5);
/* Clear the VALID/DISABLE bit ready for the next store */
and r4, r4, ~#EUR_CR_PDS_CONTEXT_STORE_DISABLE_MASK;
MK_MEM_ACCESS(stad) [r2, #1++], r4;
#if defined(SGX_FEATURE_MP)
REG_INCREMENT(r3, p1);
xor.testnz p1, r3, r6;
p1 ba RR_PDSBaseNextCore;
#endif
}
/* Ensure the right have completed */
idf drc0, st;
wdf drc0;
#if defined(SGX_FEATURE_MP)
/* Offset to the save location in the context */
mov r2, #OFFSET(SGXMKIF_HWRENDERCONTEXT.ui32DPMFreeStatus[0]);
iaddu32 r2, r2.low, r0;
/* Need to set the check each cores status to see which streams are valid */
MK_LOAD_STATE_CORE_COUNT_3D(r3, drc0);
MK_WAIT_FOR_STATE_LOAD(drc0);
mov r4, #EUR_CR_MASTER_DPM_TSP0_START_OF_MTILEFREE >> 2;
RH_RestoreNextDPMState:
{
MK_MEM_ACCESS(ldad) r5, [r2, #1++], drc0;
wdf drc0;
str r4, r5;
/* Increment the register */
REG_INCREMENT(r4, p1);
/* Have we saved all the cores yet? */
isub16.testnz r3, p1, r3, #1;
p1 ba RH_RestoreNextDPMState;
}
MK_MEM_ACCESS(ldad) r3, [r0, #DOFFSET(SGXMKIF_HWRENDERCONTEXT.ui32DPMDeallocMask)], drc0;
wdf drc0;
WRITEMASTERCONFIG(#EUR_CR_MASTER_DPM_START_OF_DEALLOCATE_MASK >> 2, r3, r4);
#endif
/* reload the prim num to each core */
mov r2, #OFFSET(SGXMKIF_HWRENDERCONTEXT.ui32ISPRestart);
iaddu32 r2, r2.low, r0;
COPYMEMTOCONFIGREGISTER_3D(RR_PrimNum, EUR_CR_ISP_START, r2, r3, r4, r5);
/* Program the buffers to load depth from */
mov r2, #OFFSET(SGXMKIF_HWRENDERCONTEXT.sZLSCtxSwitchBaseDevAddr);
iaddu32 r2, r2.low, r0;
COPYMEMTOCONFIGREGISTER_3D(RR_ZBase, EUR_CR_ISP_CONTEXT_RESUME, r2, r3, r4, r5);
/* Restore the ISP context switch registers from memory */
mov r2, #OFFSET(SGXMKIF_HWRENDERCONTEXT.ui32ISP2CtxResume);
iaddu32 r2, r2.low, r0;
#if defined(SGX_FEATURE_MP)
mov r3, #OFFSET(SGXMKIF_HWRENDERCONTEXT.ui32PDSStatus[0][0]);
iaddu32 r3, r3.low, r0;
MK_LOAD_STATE_CORE_COUNT_3D(r8, drc0);
MK_WAIT_FOR_STATE_LOAD(drc0);
mov r7, #0;
RR_LoadNextCore:
#endif
{
MK_MEM_ACCESS(ldad) r5, [r2, #1++], drc0;
wdf drc0;
#if defined(SGX_FEATURE_MP)
/*
if PDS_RENDER_COMPLETE == 0
{
set CORE_WILL_END_RENDER
if PDS_EOR_STORED
{
// core not active but expect eor
set RESUME2_END_OF_RENDER
}
else
{
// core active expect eor
clear RESUME2_END_OF_RENDER
}
}
else
{
// core not active and not expect eor
set RESUME2_END_OF_RENDER
clear CORE_WILL_END_RENDER
}
*/
MK_MEM_ACCESS(ldad) r6, [r3, #1++], drc0;
wdf drc0;
and.testnz p2, r6, #EUR_CR_PDS_STATUS_RENDER_COMPLETED_MASK;
p2 ba RR_RenderCompleted;
{
/* The core has not completed yet and there for will generate an EOR */
or r5, r5, #EUR_CR_MASTER_ISP_CORE0_CONTEXT_RESUME2_CORE_ACTIVE_MASK;
/* Has the PDS has store the end of render? */
and.testnz p1, r6, #EUR_CR_PDS_STATUS_CSWITCH_STORE_END_RENDER_MASK;
p1 or r5, r5, #EUR_CR_MASTER_ISP_CORE0_CONTEXT_RESUME2_END_OF_RENDER_MASK;
!p1 and r5, r5, ~#EUR_CR_MASTER_ISP_CORE0_CONTEXT_RESUME2_END_OF_RENDER_MASK;
WRITECORECONFIG(r7, #EUR_CR_ISP_CONTEXT_RESUME2 >> 2, r5, r6);
ba RR_WriteMasterResume2;
}
RR_RenderCompleted:
{
/*
The Core is not active anymore from MIPF point of view and will also
not generate an EOR as it has already finished
*/
or r5, r5, #(EUR_CR_MASTER_ISP_CORE0_CONTEXT_RESUME2_END_OF_RENDER_MASK | \
EUR_CR_MASTER_ISP_CORE0_CONTEXT_RESUME2_END_OF_TILE_MASK);
and r5, r5, ~#EUR_CR_MASTER_ISP_CORE0_CONTEXT_RESUME2_CORE_ACTIVE_MASK;
WRITECORECONFIG(r7, #EUR_CR_ISP_CONTEXT_RESUME2 >> 2, r5, r6);
}
RR_WriteMasterResume2:
/* Write CONTEXT_RESUME2 to the master register */
mov r4, #EUR_CR_MASTER_ISP_CORE0_CONTEXT_RESUME2 >> 2;
imae r4, r7.low, #((EUR_CR_MASTER_ISP_CORE1_CONTEXT_RESUME2 \
- EUR_CR_MASTER_ISP_CORE0_CONTEXT_RESUME2) >> 2), r4, u32;
str r4, r5;
#endif
// CONTEXT_RESUME3
MK_MEM_ACCESS(ldad) r5, [r2, #1++], drc0;
wdf drc0;
WRITECORECONFIG(r7, #EUR_CR_ISP_CONTEXT_RESUME3 >> 2, r5, r6);
#if defined(SGX_FEATURE_MP)
// CONTEXT_RESUME4-9
mov r6, #(((EUR_CR_MASTER_ISP_CORE0_CONTEXT_RESUME9 - EUR_CR_MASTER_ISP_CORE0_CONTEXT_RESUME4) >> 2) + 1);
RR_LoadNextReg:
{
MK_MEM_ACCESS(ldad) r5, [r2, #1++], drc0;
/* Point to the next config */
REG_INCREMENT(r4, p2);
wdf drc0;
str r4, r5;
isub16.testnz r6, p2, r6, #1;
p2 ba RR_LoadNextReg;
}
/* Are there any more cores to save */
REG_INCREMENT(r7, p2);
xor.testnz p2, r7, r8;
p2 ba RR_LoadNextCore;
#endif
}
/* Indicate that this is a resumed render */
str #EUR_CR_ISP_RENDER >> 2, #EUR_CR_ISP_RENDER_TYPE_NORMAL3D_RESUME;
lapc;
}
#else /* SGX_FEATURE_ISP_CONTEXT_SWITCH_REV_3 */
#if defined(SGX_FEATURE_ISP_CONTEXT_SWITCH_REV_2)
/*****************************************************************************
RenderHalt
This routine handles the storing of HW state during an ISP context switch
away from the current render.
inputs: none
temps: r0, r1, r2, r3, r4, r5
*****************************************************************************/
RenderHalt:
{
MK_TRACE(MKTC_RENDERHALT, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* This is a context switch so clear the flags */
MK_LOAD_STATE(r0, ui32IRenderFlags, drc0);
MK_WAIT_FOR_STATE_LOAD(drc0);
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
and.testnz p2, r0, #RENDER_IFLAGS_TRANSFERRENDER;
and r0, r0, ~#RENDER_IFLAGS_TRANSFERRENDER;
#endif
and r0, r0, #~(RENDER_IFLAGS_RENDERINPROGRESS | RENDER_IFLAGS_SPMRENDER | \
RENDER_IFLAGS_HALTRENDER | RENDER_IFLAGS_HALTRECEIVED | \
RENDER_IFLAGS_FORCEHALTRENDER);
MK_STORE_STATE(ui32IRenderFlags, r0);
MK_TRACE(MKTC_RH_CLEARFLAGS, MKTF_3D | MKTF_SCH | MKTF_CSW);
/*
We are interrupting this render so it hasn't actually completed yet - do the
stuff required so we can resume it later
*/
ldr r0, #EUR_CR_ISP_STATUS2 >> 2, drc0;
ldr r2, #EUR_CR_ISP_STATUS3 >> 2, drc1;
ldr r1, #EUR_CR_ISP_STATUS1 >> 2, drc1;
wdf drc1;
/* combine status 1 and 3 */
shl r1, r1, #(EUR_CR_ISP_START_CTRL_STREAM_POS_SHIFT - EUR_CR_ISP_STATUS1_CTRL_STREAM_POS_SHIFT);
or r1, r2, r1;
wdf drc0;
MK_TRACE(MKTC_RH_RGN_ADDR, MKTF_3D | MKTF_SCH | MKTF_CSW);
MK_TRACE_REG(r0, MKTF_3D | MKTF_SCH | MKTF_CSW);
MK_TRACE(MKTC_RH_CTRL_ADDR, MKTF_3D | MKTF_SCH | MKTF_CSW);
MK_TRACE_REG(r1, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* This is a context switch so save the values for later */
ldr r2, #EUR_CR_ISP2_CONTEXT_SWITCH2 >> 2, drc0;
ldr r3, #EUR_CR_ISP2_CONTEXT_SWITCH3 >> 2, drc0;
/* load the PDS status register */
ldr r5, #EUR_CR_PDS >> 2, drc0;
wdf drc0;
/* check if PT was in flight for each pipe */
mov r4, #EUR_CR_PDS_1_STATUS_PTOFF_STORED_MASK;
and.testnz p0, r5, #EUR_CR_PDS_0_STATUS_PTOFF_STORED_MASK;
and.testnz p1, r5, r4;
/* Start loading the holding structure base address */
MK_LOAD_STATE(r4, s3DContext, drc1);
/* Set or clear the bits */
p0 or r2, r2, #EUR_CR_ISP2_CONTEXT_RESUME2_PT_IN_FLIGHT0_MASK;
!p0 and r2, r2, ~#EUR_CR_ISP2_CONTEXT_RESUME2_PT_IN_FLIGHT0_MASK;
p1 or r2, r2, #EUR_CR_ISP2_CONTEXT_RESUME2_PT_IN_FLIGHT1_MASK;
!p1 and r2, r2, ~#EUR_CR_ISP2_CONTEXT_RESUME2_PT_IN_FLIGHT1_MASK;
/* make sure the holding structure base address has loaded */
wdf drc1;
// ISP_RGN_BASE, ISP_START, ISP2_CONTEXT_SWITCH2, ISP2_CONTEXT_SWITCH3
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
p2 MK_MEM_ACCESS(stad.f4) [r4, #DOFFSET(SGXMKIF_HWTRANSFERCONTEXT.ui32NextRgnBase)-1], r0;
p2 ba RH_ISPStateSaved;
#endif
{
MK_MEM_ACCESS(stad.f4) [r4, #DOFFSET(SGXMKIF_HWRENDERCONTEXT.ui32NextRgnBase)-1], r0;
}
RH_ISPStateSaved:
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
p2 ba RH_PDSStateSaved;
#endif
{
/* Modify the PDS state resume data */
ldr r1, #EUR_CR_PDS0_CONTEXT_STORE >> 2, drc0;
ldr r2, #EUR_CR_PDS1_CONTEXT_STORE >> 2, drc0;
mov r3, #EUR_CR_PDS_1_STATUS_CSWITCH_COMPLETED_MASK;
and.testnz p0, r5, #EUR_CR_PDS_0_STATUS_CSWITCH_COMPLETED_MASK;
and.testnz p1, r5, r3;
wdf drc0;
p0 or r1, r1, #EUR_CR_PDS0_CONTEXT_RESUME_VALID_STREAM_MASK;
!p0 and r1, r1, ~#EUR_CR_PDS0_CONTEXT_RESUME_VALID_STREAM_MASK;
p1 or r2, r2, #EUR_CR_PDS1_CONTEXT_RESUME_VALID_STREAM_MASK;
!p1 and r2, r2, ~#EUR_CR_PDS1_CONTEXT_RESUME_VALID_STREAM_MASK;
MK_MEM_ACCESS(stad.f2) [r4, #DOFFSET(SGXMKIF_HWRENDERCONTEXT.asPDSStateBaseDevAddr[0][0])-1], r1;
}
RH_PDSStateSaved:
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
p2 ba RH_SetTransferRenderFlags;
{
#endif
MK_MEM_ACCESS_BPCACHE(ldad) r0, [R_TA3DCtl, #DOFFSET(SGXMK_TA3D_CTL.s3DRTData)], drc1;
wdf drc1;
/* Make sure the RT status flags are loaded */
MK_MEM_ACCESS(ldad) r1, [r0, #DOFFSET(SGXMKIF_HWRTDATA.sRTStatusDevAddr)], drc1;
wdf drc1;
#if defined(SGX_FEATURE_RENDER_TARGET_ARRAYS)
MK_MEM_ACCESS_BPCACHE(ldad) r2, [R_TA3DCtl, #DOFFSET(SGXMK_TA3D_CTL.ui32ActiveRTIdx)], drc0;
wdf drc0;
imae r1, r2.low, #SIZEOF(IMG_UINT32), r1, u32;
#endif
MK_MEM_ACCESS(ldad) r2, [r1], drc0;
wdf drc0;
/* Record that we have context switched on this scene for later use */
or r2, r2, #SGXMKIF_HWRTDATA_RT_STATUS_ISPCTXSWITCH;
MK_MEM_ACCESS(stad) [r1], r2;
#if defined(SGX_FEATURE_FAST_RENDER_CONTEXT_SWITCH)
ba RH_FlagsSet;
}
RH_SetTransferRenderFlags:
{
MK_LOAD_STATE(r0, sTransferCCBCmd, drc1);
MK_WAIT_FOR_STATE_LOAD(drc1);
MK_MEM_ACCESS_BPCACHE(ldad) r1, [r0, #DOFFSET(SGXMKIF_TRANSFERCMD.ui32Flags)], drc0;
wdf drc0;
or r1, r1, #SGXMKIF_TQFLAGS_CTXSWITCH;
MK_MEM_ACCESS_BPCACHE(stad) [r0, #DOFFSET(SGXMKIF_TRANSFERCMD.ui32Flags)], r1;
}
RH_FlagsSet:
#endif
idf drc0, st;
wdf drc0;
/* Check the queues */
FIND3D();
FINDTA();
MK_TRACE(MKTC_RENDERHALT_END, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* branch back to calling code */
mov pclink, R_EDM_PCLink;
lapc;
}
/*****************************************************************************
ResumeRender
This routine handles the retoring of HW state when resuming a render
previously context switched.
inputs: r0 - SGXMKIF_HWRENDERCONTEXT of the render to be resumed
temps: r2, r3, r4, r5, r6
*****************************************************************************/
ResumeRender:
{
MK_TRACE(MKTC_KICKRENDER_RESUME, MKTF_3D | MKTF_SCH);
/* Now setup the PDS state resume addresses and zls resume addr */
MK_MEM_ACCESS(ldad.f3) r2, [r0, #DOFFSET(SGXMKIF_HWRENDERCONTEXT.asPDSStateBaseDevAddr[0][0])-1], drc0;
wdf drc0;
str #EUR_CR_PDS0_CONTEXT_RESUME >> 2, r2;
str #EUR_CR_PDS1_CONTEXT_RESUME >> 2, r3;
/* Clear the VALID/DISABLE bit ready for the next store */
and r2, r2, ~#EUR_CR_PDS0_CONTEXT_STORE_DISABLE_MASK;
#if defined(EUR_CR_PDS1_CONTEXT_STORE_DISABLE_MASK)
and r3, r3, ~#EUR_CR_PDS1_CONTEXT_STORE_DISABLE_MASK;
#endif
MK_MEM_ACCESS(stad.f2) [r0, #DOFFSET(SGXMKIF_HWRENDERCONTEXT.asPDSStateBaseDevAddr[0][0])-1], r2;
str #EUR_CR_ISP2_CONTEXT_RESUME >> 2, r4;
MK_MEM_ACCESS(ldad.f4) r2, [r0, #DOFFSET(SGXMKIF_HWRENDERCONTEXT.ui32NextRgnBase)-1], drc0;
wdf drc0;
str #EUR_CR_ISP_RGN_BASE >> 2, r2;
str #EUR_CR_ISP_START >> 2, r3;
str #EUR_CR_ISP2_CONTEXT_RESUME2 >> 2, r4;
str #EUR_CR_ISP2_CONTEXT_RESUME3 >> 2, r5;
/* Indicate that this is a resumed render */
str #EUR_CR_ISP_RENDER >> 2, #EUR_CR_ISP_RENDER_TYPE_NORMAL3D_RESUME;
lapc;
}
#else /* SGX_FEATURE_ISP_CONTEXT_SWITCH_REV_2 */
#if !defined(FIX_HW_BRN_23761) && !defined(SGX_FEATURE_MP) && \
!defined(SGX_FEATURE_ISP_BREAKPOINT_RESUME_REV_2) && !defined(SGX_FEATURE_VISTEST_IN_MEMORY)
/*****************************************************************************
RenderHalt routine - process the render interrupted event
inputs: r7 - Occlusion entry value
temps: r0,r1,r2,r3,r4,r5,r6,r8,r9
*****************************************************************************/
.export RenderHalt;
RenderHalt:
{
MK_TRACE(MKTC_RENDERHALT, MKTF_3D | MKTF_SCH | MKTF_CSW);
/*
Must have received both the RenderHalt and the PixelBE to be here
*/
SWITCHEDMTO3D();
/*
We were only interrupting this render so it hasn't actually completed yet - do the
stuff required so we can resume it later and kick off the previously chosen one
*/
MK_MEM_ACCESS_BPCACHE(ldad) R_RTData, [R_TA3DCtl, #DOFFSET(SGXMK_TA3D_CTL.s3DRTData)], drc0;
ldr r0, #EUR_CR_ISP_STATUS1 >> 2, drc0;
ldr r1, #EUR_CR_ISP_STATUS2 >> 2, drc1;
wdf drc0;
wdf drc1;
/* Add EUR_CR_BIF_3D_REQ_BASE value to control stream offset in ISP status 1 register */
ldr r2, #EUR_CR_BIF_3D_REQ_BASE >> 2, drc0;
wdf drc0;
/* No way of doing a full 32-bit add :( */
shr r2, r2, #16;
mov r3, #0xFFFF;
imae r0, r2.low, r3.low, r0, u32;
iaddu32 r0, r2.low, r0;
MK_TRACE(MKTC_RH_CTRL_ADDR, MKTF_3D | MKTF_SCH | MKTF_CSW);
MK_TRACE_REG(r0, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* Convert tile x y into tile number */
MK_MEM_ACCESS_BPCACHE(ldad) r8, [R_TA3DCtl, #DOFFSET(SGXMK_TA3D_CTL.s3DRenderDetails)], drc0;
and r9, r1, #EUR_CR_ISP_STATUS2_TILE_X_MASK;
wdf drc0;
MK_MEM_ACCESS(ldad) r3, [r8, #DOFFSET(SGXMKIF_HWRENDERDETAILS.sHWRTDataSetDevAddr)], drc0;
shr r9, r9, #EUR_CR_ISP_STATUS2_TILE_X_SHIFT;
wdf drc0;
MK_MEM_ACCESS(ldad) r8, [r3, #DOFFSET(SGXMKIF_HWRTDATASET.ui32MTileWidth)], drc0;
and r5, r1, #EUR_CR_ISP_STATUS2_TILE_Y_MASK;
shr r5, r5, #EUR_CR_ISP_STATUS2_TILE_Y_SHIFT;
wdf drc0;
imae r3, r8.low, r5.low, r9, u32;
/* work out the address of the rgn header */
MK_MEM_ACCESS(ldad) r2, [R_RTData, #DOFFSET(SGXMKIF_HWRTDATA.sTileRgnLUTDevAddr)], drc0;
/* Set data size in top WORD of offset, ld with non-immediate uses src1.high * src1.low and doesn't multiply by data size */
or r3, r3, #0x00040000;
wdf drc0;
/* Read new region base */
MK_MEM_ACCESS_CACHED(ldad) r8, [r2, r3], drc0;
wdf drc0;
MK_TRACE(MKTC_RH_RGN_ADDR, MKTF_3D | MKTF_SCH | MKTF_CSW);
MK_TRACE_REG(r8, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* Check region header for empty tile bit */
MK_MEM_ACCESS_CACHED(ldad) r2, [r8], drc0;
mov r3, #EURASIA_REGIONHEADER0_EMPTY;
wdf drc0;
and.testz p0, r2, r3;
p0 ba RH_NotEmptyTile;
{
MK_TRACE(MKTC_RH_EMPTY_TILE, MKTF_3D | MKTF_SCH | MKTF_CSW);
RH_CheckLastTile:
/* Check region header for last tile bit */
MK_MEM_ACCESS_CACHED(ldad) r2, [r8], drc0;
mov r3, #EURASIA_REGIONHEADER0_LASTREGION;
wdf drc0;
and.testz p0, r2, r3;
p0 ba RH_NotLastTile;
{
MK_TRACE(MKTC_RH_EMPTY_LAST_TILE, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* Only Handling breakpoints */
mov r5, r0;
ba RH_InvalidateObjects;
}
RH_NotLastTile:
mov r5, r0;
ba RH_InvalidateObjects;
}
RH_NotEmptyTile:
MK_TRACE(MKTC_RH_NOT_EMPTY, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* Check if all primitives in the current object have been processed and if so just point to the next one */
MK_MEM_ACCESS_CACHED(ldad) r2, [r0], drc0;
MK_MEM_ACCESS_CACHED(ldad) r3, [r0, #1], drc0;
and r4, r1, #EUR_CR_ISP_STATUS2_PRIM_NUM_MASK;
shr r4, r4, #EUR_CR_ISP_STATUS2_PRIM_NUM_SHIFT;
wdf drc0;
and r5, r3, ~#EURASIA_PARAM_PB1_PRIMCOUNT_CLRMSK;
shr r5, r5, #EURASIA_PARAM_PB1_PRIMCOUNT_SHIFT;
xor.testnz p0, r4, r5;
p0 ba RH_ObjectIncomplete;
{
MK_TRACE(MKTC_RH_OBJECT_COMPLETE, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* Calculate the address of the next object */
mov r5, #EURASIA_PARAM_PB0_PRIMMASKPRES;
and.testnz p0, r2, r5;
!p0 mov r5, #8;
p0 mov r5, #12;
iaddu32 r0, r5.low, r0;
/* Check what the next object type in the control stream is */
MK_MEM_ACCESS_CACHED(ldad) r2, [r0], drc0;
wdf drc0;
and r4, r2, ~#EURASIA_PARAM_OBJTYPE_CLRMSK;
xor.testz p0, r4, #EURASIA_PARAM_OBJTYPE_STREAMLINK;
p0 ba RH_StreamLink;
{
mov r5, #EURASIA_PARAM_OBJTYPE_PRIMBLOCK;
xor.testz p0, r4, r5;
p0 ba RH_PrimBlock;
/* Must have been a terminate */
ba RH_CheckLastTile;
}
RH_StreamLink:
MK_TRACE(MKTC_RH_STREAM_LINK, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* Follow stream link to next block */
ldr r3, #EUR_CR_BIF_3D_REQ_BASE >> 2, drc0;
and r0, r2, ~#EURASIA_PARAM_STREAMLINK_CLRMSK;
wdf drc0;
/* No way of doing a full 32-bit add :( */
shr r3, r3, #16;
mov r2, #0xFFFF;
imae r0, r3.low, r2.low, r0, u32;
iaddu32 r0, r3.low, r0;
MK_MEM_ACCESS_CACHED(ldad) r2, [r0], drc0;
wdf drc0;
/* Drop through so ISP state load bit is set */
RH_PrimBlock:
/* Make sure ISP state is loaded */
or r2, r2, #EURASIA_PARAM_PB0_READISPSTATE;
MK_MEM_ACCESS_BPCACHE(stad) [r0], r2;
idf drc0, st;
wdf drc0;
mov r5, r0;
}
RH_ObjectIncomplete:
RH_InvalidateObjects:
/* Set preceding DWORDs in the same 64 byte block to dummy value so the HW just skips them */
and.testz p0, r0, #0x3F;
p0 ba RH_ObjectsInvalidated;
{
MK_TRACE(MKTC_RH_INVALIDATE_OBJECTS, MKTF_3D | MKTF_SCH | MKTF_CSW);
and r2, r0, #~0x3F;
mov r3, #4;
mov r4, #EURASIA_PARAM_OBJTYPE_DUMMY;
RH_MoreObjects:
{
MK_MEM_ACCESS_BPCACHE(stad) [r2], r4;
iaddu32 r2, r3.low, r2;
xor.testnz p0, r2, r0;
p0 ba RH_MoreObjects;
}
}
RH_ObjectsInvalidated:
MK_TRACE(MKTC_RH_OBJECTS_INVALIDATED, MKTF_3D | MKTF_SCH | MKTF_CSW);
/* write back the new region base, as it is needed on resume */
str #EUR_CR_ISP_RGN_BASE >> 2, r8;
/* Work out the new control stream offset */
ldr r0, #EUR_CR_BIF_3D_REQ_BASE >> 2, drc0;
wdf drc0;
xor r0, r0, #-1;
mov r1, #1;
iadd32 r0, r1.low, r0;
/* No way of doing a full 32-subtract add :( */
and r6, r5, #0xFFFF;
imae r0, r6.low, r1.low, r0, u32;
shr r5, r5, #16;
mov r1, #0xFFFF;
imae r0, r5.low, r1.low, r0, u32;
iaddu32 r0, r5.low, r0;
and r0, r0, #~EURASIA_REGIONHEADER1_CONTROLBASE_CLRMSK;
/* Update control stream pointer for this region */
MK_MEM_ACCESS_BPCACHE(stad) [r8, #1], r0;
idf drc0, st;
wdf drc0;
SWITCHEDMBACK();
RH_EmptyTileTerminate:
/* only handling breakpoints */
lapc;
}
#else
/* compiler throws an error if file is empty */
nop;
#endif
#endif /* SGX_FEATURE_ISP_CONTEXT_SWITCH_REV_2 */
#endif /* SGX_FEATURE_ISP_CONTEXT_SWITCH_REV_3 */
/*****************************************************************************
End of file (3dcontextswitch.asm)
*****************************************************************************/
| 31.665628 | 125 | 0.688201 |
49d5cc7c374e7b4d12b69a6ec1d2b1ee0e0a4326 | 3,450 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca_notsx.log_9_17.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca_notsx.log_9_17.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca_notsx.log_9_17.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x515c, %rsi
lea addresses_D_ht+0x13224, %rdi
nop
nop
dec %rbp
mov $36, %rcx
rep movsw
nop
nop
nop
nop
nop
sub %rdi, %rdi
lea addresses_WT_ht+0x4e5c, %rdi
cmp %r14, %r14
mov $0x6162636465666768, %rax
movq %rax, %xmm2
vmovups %ymm2, (%rdi)
nop
nop
nop
dec %rbp
lea addresses_A_ht+0x1ceea, %r14
nop
nop
nop
nop
nop
xor $33394, %r12
mov (%r14), %rdi
xor $37199, %rcx
lea addresses_A_ht+0x1e1bc, %rcx
nop
xor $38928, %r14
movb (%rcx), %al
sub %rbp, %rbp
lea addresses_UC_ht+0x4e5c, %rsi
lea addresses_WT_ht+0xf1cc, %rdi
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov $124, %rcx
rep movsl
nop
nop
nop
nop
sub $54151, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r8
push %rax
push %rcx
push %rdi
push %rdx
// Store
lea addresses_WT+0x10a5c, %rcx
nop
nop
nop
nop
inc %rdi
mov $0x5152535455565758, %rax
movq %rax, %xmm7
movntdq %xmm7, (%rcx)
nop
nop
nop
nop
nop
and %r10, %r10
// Store
lea addresses_normal+0xf4bb, %r8
nop
nop
nop
sub $56320, %r12
mov $0x5152535455565758, %rax
movq %rax, (%r8)
dec %rdi
// Store
lea addresses_UC+0x845c, %r8
nop
nop
nop
nop
add %rdi, %rdi
movw $0x5152, (%r8)
add $10728, %r10
// Store
mov $0x1dc, %r8
nop
nop
cmp $54192, %r10
mov $0x5152535455565758, %rcx
movq %rcx, %xmm3
movups %xmm3, (%r8)
nop
nop
and $34034, %rdi
// Load
lea addresses_US+0xae5c, %r10
nop
nop
nop
inc %rdx
mov (%r10), %eax
nop
sub $15738, %r12
// Faulty Load
lea addresses_US+0xae5c, %rdx
nop
nop
nop
nop
add $17715, %r12
movb (%rdx), %r8b
lea oracles, %rcx
and $0xff, %r8
shlq $12, %r8
mov (%rcx,%r8,1), %r8
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}}
{'00': 9}
00 00 00 00 00 00 00 00 00
*/
| 18.956044 | 149 | 0.644638 |
38aedd3c831636591203d2bb05d7422fa270bf51 | 2,113 | asm | Assembly | home/print_bcd.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | 1 | 2022-02-15T00:19:44.000Z | 2022-02-15T00:19:44.000Z | home/print_bcd.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | home/print_bcd.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | ; function to print a BCD (Binary-coded decimal) number
; de = address of BCD number
; hl = destination address
; c = flags and length
; bit 7: if set, do not print leading zeroes
; if unset, print leading zeroes
; bit 6: if set, left-align the string (do not pad empty digits with spaces)
; if unset, right-align the string
; bit 5: if set, print currency symbol at the beginning of the string
; if unset, do not print the currency symbol
; bits 0-4: length of BCD number in bytes
; Note that bits 5 and 7 are modified during execution. The above reflects
; their meaning at the beginning of the functions's execution.
PrintBCDNumber::
ld b, c ; save flags in b
res 7, c
res 6, c
res 5, c ; c now holds the length
bit 5, b
jr z, .loop
bit 7, b
jr nz, .loop
ld [hl], "¥"
inc hl
.loop
ld a, [de]
swap a
call PrintBCDDigit ; print upper digit
ld a, [de]
call PrintBCDDigit ; print lower digit
inc de
dec c
jr nz, .loop
bit 7, b ; were any non-zero digits printed?
jr z, .done ; if so, we are done
.numberEqualsZero ; if every digit of the BCD number is zero
bit 6, b ; left or right alignment?
jr nz, .skipRightAlignmentAdjustment
dec hl ; if the string is right-aligned, it needs to be moved back one space
.skipRightAlignmentAdjustment
bit 5, b
jr z, .skipCurrencySymbol
ld [hl], "¥"
inc hl
.skipCurrencySymbol
ld [hl], "0"
call PrintLetterDelay
inc hl
.done
ret
PrintBCDDigit::
and $f
and a
jr z, .zeroDigit
.nonzeroDigit
bit 7, b ; have any non-space characters been printed?
jr z, .outputDigit
; if bit 7 is set, then no numbers have been printed yet
bit 5, b ; print the currency symbol?
jr z, .skipCurrencySymbol
ld [hl], "¥"
inc hl
res 5, b
.skipCurrencySymbol
res 7, b ; unset 7 to indicate that a nonzero digit has been reached
.outputDigit
add "0"
ld [hli], a
jp PrintLetterDelay
.zeroDigit
bit 7, b ; either printing leading zeroes or already reached a nonzero digit?
jr z, .outputDigit ; if so, print a zero digit
bit 6, b ; left or right alignment?
ret nz
inc hl ; if right-aligned, "print" a space by advancing the pointer
ret
| 27.089744 | 78 | 0.706578 |
4d822c88d016c916d8821f0de6bd67e920de51e4 | 849 | asm | Assembly | oeis/060/A060635.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/060/A060635.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/060/A060635.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A060635: a(n) is the number of 2 X 1 domino tilings of the set S in the plane R^2 consisting of the union of the following two rectangles: rectangle1: |x| <= n, |y| <= 1, rectangle2: |x| <= 1, |y| <= n.
; 2,8,72,450,3200,21632,149058,1019592,6993800,47922050,328499712,2251473408,15432082562,105772401800,724976569800,4969058770242,34058447431808,233440040239232,1600021920672450,10966713178192200,75166970919070472,515202081704384258,3531247605071972352,24203531143169280000,165893470424943061250,1137050761758572070152,7793461862075811592008,53417182272272718665922,366126814045140640131200,2509470516040288889475200,17200166798245842783465282,117891697071657149875748808,808041712703415627306605192
add $0,1
seq $0,2878 ; Bisection of Lucas sequence: a(n) = L(2*n+1).
mul $0,6
div $0,15
add $0,1
mov $1,$0
div $1,2
pow $1,2
mov $0,$1
mul $0,2
| 60.642857 | 498 | 0.803298 |
93b59798a4d89fc29acce2f80703342415b388e8 | 806 | asm | Assembly | programs/oeis/081/A081192.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/081/A081192.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/081/A081192.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A081192: 10th binomial transform of (1,0,1,0,1,......), A059841.
; 1,10,101,1030,10601,110050,1151501,12135070,128702801,1372684090,14712104501,158346365110,1710428956601,18532288986130,201313313019101,2191569650755150,23901375026212001,261062105099480170,2855005974394615301,31254971083043769190,342453830195808469001,3754834466694836230210,41193760144511686173101,452146590687444936671230,4964749559442241802287601,54532478710787787315300250,599139367830973807879532501,6584071964251485213375925270,72366641869763297287444787801,795509712934368909624679154290,8745896713580811761036549093501,96162472691113713167887745595310,1057405679177773899015136551649601,11628028787135220376681844219056330,127877413504104791531138365767816101
mov $1,9
pow $1,$0
mov $2,11
pow $2,$0
add $1,$2
mov $0,$1
div $0,2
| 73.272727 | 669 | 0.882134 |
8828a14357301b0afe0b6e4f6a9f2ea3eed80661 | 835 | asm | Assembly | ee/button/french.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ee/button/french.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ee/button/french.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ; French text for buttons V0.02 1989 Tony Tebby QJUMP
section language
include 'dev8_mac_config02'
include 'dev8_ee_button_data'
xdef bt_french
xdef bt_xorg
xdef bt_yorg
xdef bt_xsiz
xdef bt_ysiz
xdef bt_rows
xref.l bt_vers
bt_french
mkcfhead {Boutons},{bt_vers}
mkcfitem 'Q2BX',word,0,bt_xorg,,,\
{Origine X de la structure Boutons},0,$7fff
mkcfitem 'Q2BY',word,0,bt_yorg,,,\
{Origine Y de la structure Boutons},0,$7fff
mkcfitem 'Q2BW',word,0,bt_xsiz,,,\
{Largeur de la structure Boutons},btt.minx,$7fff
mkcfitem 'Q2BH',word,0,bt_ysiz,,,\
{Hauteur de la structure Boutons},btt.miny,$7fff
mkcfitem 'Q2BO',code,0,bt_rows,,,{Organisation},0,C,{Colonnes},-1,L,{Lignes}
mkcfend
bt_xorg dc.w 0
bt_yorg dc.w 0
bt_xsiz dc.w 512
bt_ysiz dc.w 256
bt_rows dc.b -1
end
| 18.977273 | 77 | 0.693413 |
96c46ade7c6fe393d8c3ec17548f066da837d19c | 6,174 | asm | Assembly | engine/events/specials.asm | zavytar/pokecolorless | 5fa4930f9f90acaff7ae62367e3d9feae0404464 | [
"blessing"
] | null | null | null | engine/events/specials.asm | zavytar/pokecolorless | 5fa4930f9f90acaff7ae62367e3d9feae0404464 | [
"blessing"
] | null | null | null | engine/events/specials.asm | zavytar/pokecolorless | 5fa4930f9f90acaff7ae62367e3d9feae0404464 | [
"blessing"
] | null | null | null | Special::
; Run script special de.
ld hl, SpecialsPointers
add hl, de
add hl, de
add hl, de
ld b, [hl]
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
ld a, b
rst FarCall
ret
INCLUDE "data/special_pointers.asm"
DummySpecial_c224:
ret
SetPlayerPalette:
ld a, [wScriptVar]
ld d, a
farcall _SetPlayerPalette
ret
GameCornerPrizeMonCheckDex:
ld a, [wScriptVar]
dec a
call CheckCaughtMon
ret nz
ld a, [wScriptVar]
dec a
call SetSeenAndCaughtMon
call FadeToMenu
ld a, [wScriptVar]
ld [wNamedObjectIndexBuffer], a
farcall NewPokedexEntry
call ExitAllMenus
ret
UnusedSetSeenMon:
ld a, [wScriptVar]
dec a
call SetSeenMon
ret
FindPartyMonAboveLevel:
ld a, [wScriptVar]
ld b, a
farcall _FindPartyMonAboveLevel
jr z, FoundNone
jr FoundOne
FindPartyMonAtLeastThatHappy:
ld a, [wScriptVar]
ld b, a
farcall _FindPartyMonAtLeastThatHappy
jr z, FoundNone
jr FoundOne
FindPartyMonThatSpecies:
ld a, [wScriptVar]
ld b, a
farcall _FindPartyMonThatSpecies
jr z, FoundNone
jr FoundOne
FindPartyMonThatSpeciesYourTrainerID:
ld a, [wScriptVar]
ld b, a
farcall _FindPartyMonThatSpeciesYourTrainerID
jr z, FoundNone
jr FoundOne
FoundOne:
ld a, TRUE
ld [wScriptVar], a
ret
FoundNone:
xor a
ld [wScriptVar], a
ret
NameRival:
ld b, NAME_RIVAL
ld de, wRivalName
farcall _NamingScreen
; default to "SILVER"
ld hl, wRivalName
ld de, .default
call InitName
ret
.default
db "RED@"
NameRater:
farcall _NameRater
ret
OverworldTownMap:
call FadeToMenu
farcall _TownMap
call ExitAllMenus
ret
UnownPrinter:
call FadeToMenu
farcall _UnownPrinter
call ExitAllMenus
ret
DisplayLinkRecord:
call FadeToMenu
farcall _DisplayLinkRecord
call ExitAllMenus
ret
PlayersHousePC:
xor a
ld [wScriptVar], a
farcall _PlayersHousePC
ld a, c
ld [wScriptVar], a
ret
CheckMysteryGift:
ld a, BANK(sMysteryGiftItem)
call GetSRAMBank
ld a, [sMysteryGiftItem]
and a
jr z, .no
inc a
.no
ld [wScriptVar], a
call CloseSRAM
ret
GetMysteryGiftItem:
ld a, BANK(sMysteryGiftItem)
call GetSRAMBank
ld a, [sMysteryGiftItem]
ld [wCurItem], a
ld a, 1
ld [wItemQuantityChangeBuffer], a
ld hl, wNumItems
call ReceiveItem
jr nc, .no_room
xor a
ld [sMysteryGiftItem], a
call CloseSRAM
ld a, [wCurItem]
ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, .ReceiveItemText
call PrintText
ld a, TRUE
ld [wScriptVar], a
ret
.no_room
call CloseSRAM
xor a
ld [wScriptVar], a
ret
.ReceiveItemText:
; received item
text_far _ReceiveItemText
text_end
BugContestJudging:
farcall _BugContestJudging
ld a, b
ld [wScriptVar], a
ret
MapRadio:
ld a, [wScriptVar]
ld e, a
farcall PlayRadio
ret
UnownPuzzle:
call FadeToMenu
farcall _UnownPuzzle
ld a, [wSolvedUnownPuzzle]
ld [wScriptVar], a
call ExitAllMenus
ret
SlotMachine:
call CheckCoinsAndCoinCase
ret c
ld a, BANK(_SlotMachine)
ld hl, _SlotMachine
call StartGameCornerGame
ret
CardFlip:
call CheckCoinsAndCoinCase
ret c
ld a, BANK(_CardFlip)
ld hl, _CardFlip
call StartGameCornerGame
ret
DummyNonfunctionalGameCornerGame:
call CheckCoinsAndCoinCase
ret c
ld a, BANK(_DummyGame)
ld hl, _DummyGame
call StartGameCornerGame
ret
StartGameCornerGame:
call FarQueueScript
call FadeToMenu
ld hl, wQueuedScriptBank
ld a, [hli]
push af
ld a, [hli]
ld h, [hl]
ld l, a
pop af
rst FarCall
call ExitAllMenus
ret
CheckCoinsAndCoinCase:
ld hl, wCoins
ld a, [hli]
or [hl]
jr z, .no_coins
ld a, COIN_CASE
ld [wCurItem], a
ld hl, wNumItems
call CheckItem
jr nc, .no_coin_case
and a
ret
.no_coins
ld hl, .NoCoinsText
jr .print
.no_coin_case
ld hl, .NoCoinCaseText
.print
call PrintText
scf
ret
.NoCoinsText:
; You have no coins.
text_far _NoCoinsText
text_end
.NoCoinCaseText:
; You don't have a COIN CASE.
text_far _NoCoinCaseText
text_end
ClearBGPalettesBufferScreen:
call ClearBGPalettes
call BufferScreen
ret
ScriptReturnCarry:
jr c, .carry
xor a
ld [wScriptVar], a
ret
.carry
ld a, 1
ld [wScriptVar], a
ret
UnusedCheckUnusedTwoDayTimer:
farcall CheckUnusedTwoDayTimer
ld a, [wUnusedTwoDayTimer]
ld [wScriptVar], a
ret
ActivateFishingSwarm:
ld a, [wScriptVar]
ld [wFishingSwarmFlag], a
ret
StoreSwarmMapIndices::
ld a, c
and a
jr nz, .yanma
; swarm dark cave violet entrance
ld a, d
ld [wDunsparceMapGroup], a
ld a, e
ld [wDunsparceMapNumber], a
ret
.yanma
ld a, d
ld [wYanmaMapGroup], a
ld a, e
ld [wYanmaMapNumber], a
ret
CheckPokerus:
; Check if a monster in your party has Pokerus
farcall _CheckPokerus
jp ScriptReturnCarry
ResetLuckyNumberShowFlag:
farcall RestartLuckyNumberCountdown
ld hl, wLuckyNumberShowFlag
res LUCKYNUMBERSHOW_GAME_OVER_F, [hl]
farcall LoadOrRegenerateLuckyIDNumber
ret
CheckLuckyNumberShowFlag:
farcall _CheckLuckyNumberShowFlag
jp ScriptReturnCarry
SnorlaxAwake:
; Check if the Poké Flute channel is playing, and if the player is standing
; next to Snorlax.
; outputs:
; wScriptVar is 1 if the conditions are met, otherwise 0.
; check background music
ld a, [wMapMusic]
cp MUSIC_POKE_FLUTE_CHANNEL
jr nz, .nope
ld a, [wXCoord]
ld b, a
ld a, [wYCoord]
ld c, a
ld hl, .ProximityCoords
.loop
ld a, [hli]
cp -1
jr z, .nope
cp b
jr nz, .nextcoord
ld a, [hli]
cp c
jr nz, .loop
ld a, TRUE
jr .done
.nextcoord
inc hl
jr .loop
.nope
xor a
.done
ld [wScriptVar], a
ret
.ProximityCoords:
; x, y
db 33, 8 ; left
db 34, 10 ; below
db 35, 10 ; below
db 36, 8 ; right
db 36, 9 ; right
db -1
PlayCurMonCry:
ld a, [wCurPartySpecies]
jp PlayMonCry
GameboyCheck:
ldh a, [hCGB]
and a
jr nz, .cgb
ldh a, [hSGB]
and a
jr nz, .sgb
.gb
xor a ; GBCHECK_GB
jr .done
.sgb
ld a, GBCHECK_SGB
jr .done
.cgb
ld a, GBCHECK_CGB
.done
ld [wScriptVar], a
ret
FadeOutMusic:
ld a, LOW(MUSIC_NONE)
ld [wMusicFadeID], a
ld a, HIGH(MUSIC_NONE)
ld [wMusicFadeID + 1], a
ld a, $2
ld [wMusicFade], a
ret
Diploma:
call FadeToMenu
farcall _Diploma
call ExitAllMenus
ret
PrintDiploma:
call FadeToMenu
farcall _PrintDiploma
call ExitAllMenus
ret
TrainerHouse:
ld a, BANK(sMysteryGiftTrainerHouseFlag)
call GetSRAMBank
ld a, [sMysteryGiftTrainerHouseFlag]
ld [wScriptVar], a
jp CloseSRAM
| 14.35814 | 75 | 0.739067 |
26f5a22f3b437ff26c53afd7007d97c08e167304 | 1,037 | asm | Assembly | programs/oeis/047/A047227.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/047/A047227.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/047/A047227.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A047227: Numbers that are congruent to {1, 2, 3, 4} mod 6.
; 1,2,3,4,7,8,9,10,13,14,15,16,19,20,21,22,25,26,27,28,31,32,33,34,37,38,39,40,43,44,45,46,49,50,51,52,55,56,57,58,61,62,63,64,67,68,69,70,73,74,75,76,79,80,81,82,85,86,87,88,91,92,93,94,97,98,99,100,103,104,105,106,109,110,111,112,115,116,117,118,121,122,123,124,127,128,129,130,133,134,135,136,139,140,141,142,145,146,147,148,151,152,153,154,157,158,159,160,163,164,165,166,169,170,171,172,175,176,177,178,181,182,183,184,187,188,189,190,193,194,195,196,199,200,201,202,205,206,207,208,211,212,213,214,217,218,219,220,223,224,225,226,229,230,231,232,235,236,237,238,241,242,243,244,247,248,249,250,253,254,255,256,259,260,261,262,265,266,267,268,271,272,273,274,277,278,279,280,283,284,285,286,289,290,291,292,295,296,297,298,301,302,303,304,307,308,309,310,313,314,315,316,319,320,321,322,325,326,327,328,331,332,333,334,337,338,339,340,343,344,345,346,349,350,351,352,355,356,357,358,361,362,363,364,367,368,369,370,373,374
mov $1,$0
div $0,4
mul $0,2
add $1,$0
add $1,1
| 115.222222 | 927 | 0.714561 |
45493ab760812dbe9473616ea716db407b2720dd | 529 | asm | Assembly | ROM/include/funcs_prt.asm | mspeculatrix/Zolatron64 | 030c8c60ae4776bcc75c7b00cb061c265549e235 | [
"MIT"
] | null | null | null | ROM/include/funcs_prt.asm | mspeculatrix/Zolatron64 | 030c8c60ae4776bcc75c7b00cb061c265549e235 | [
"MIT"
] | null | null | null | ROM/include/funcs_prt.asm | mspeculatrix/Zolatron64 | 030c8c60ae4776bcc75c7b00cb061c265549e235 | [
"MIT"
] | 1 | 2021-12-01T17:51:03.000Z | 2021-12-01T17:51:03.000Z | \ funcs_prt.asm
\ ------------------------------------------------------------------------------
\ --- PRT_INIT
\ ------------------------------------------------------------------------------
\ Set up the VIA.
.prt_init
lda #PRT_CTRL_PT_DIR ; Set pin directions
sta PRT_CTRL_DDR
lda #$FF ; Set data port to output
sta PRT_DATA_DDR
stz PRT_DATA_PORT
lda PRT_CTRL_PORT ; Set outputs high to start
ora #%11010000
sta PRT_CTRL_PORT
rts | 29.388889 | 80 | 0.396975 |
0ca555ea72772633014dabda2503d3e8a2b4aba6 | 335 | asm | Assembly | oeis/214/A214315.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/214/A214315.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/214/A214315.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A214315: Floor of the real part of the zeros of the complex Fibonacci function on the right half-plane.
; 0,1,3,5,7,9,10,12,14,16,18,20,21,23,25,27,29,31,32,34,36,38,40,42,43,45,47,49,51,53,54,56,58,60,62,63,65,67,69,71,73,74,76,78,80,82,84,85,87,89,91,93,95,96,98,100,102,104,106,107,109,111,113,115,117,118
mul $0,1236
div $0,676
| 55.833333 | 204 | 0.701493 |
0a4b70047b0b30b0132fb760a46c6af15c726593 | 448 | asm | Assembly | programs/oeis/223/A223578.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/223/A223578.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/223/A223578.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A223578: Positive integers n for which f(-n-1) < f(-n) < f(-n+1), where f(m) = floor(cot(Pi/(2m))).
; 2,3,4,7,12,15,18,23,26,29,34,37,40,45,48,51,54,59,62,65,70,73,76,81,84,87,92,95,98,103,106,109,114,117,120,125,128,131,136,139,142,147,150,153,158,161,164,169,172,175,180,183,186,191,194,197
mov $2,$0
seq $0,223577 ; Positive integers n for which there is exactly one negative integer m such that -n = floor(cot(Pi/(2*m))).
mul $0,2
sub $0,$2
| 56 | 192 | 0.665179 |
c2e3156a84211d4b002a91cb3f708bdb581c16b8 | 332 | asm | Assembly | pwnlib/shellcraft/templates/powerpc/linux/ioperm.asm | IMULMUL/python3-pwntools | 61210a68cd88e9084c72292d3119c38c44f07966 | [
"MIT"
] | 325 | 2016-01-25T08:38:06.000Z | 2022-03-30T14:31:50.000Z | pwnlib/shellcraft/templates/powerpc/linux/ioperm.asm | IMULMUL/python3-pwntools | 61210a68cd88e9084c72292d3119c38c44f07966 | [
"MIT"
] | 8 | 2016-08-23T10:15:27.000Z | 2019-01-16T02:49:34.000Z | pwnlib/shellcraft/templates/powerpc/linux/ioperm.asm | IMULMUL/python3-pwntools | 61210a68cd88e9084c72292d3119c38c44f07966 | [
"MIT"
] | 71 | 2016-07-13T10:03:52.000Z | 2022-01-10T11:57:34.000Z | <%
from pwnlib.shellcraft.powerpc.linux import syscall
%>
<%page args="from_, num, turn_on"/>
<%docstring>
Invokes the syscall ioperm. See 'man 2 ioperm' for more information.
Arguments:
from(unsigned): from
num(unsigned): num
turn_on(int): turn_on
</%docstring>
${syscall('SYS_ioperm', from_, num, turn_on)}
| 22.133333 | 69 | 0.686747 |
dc08d3aa743ba2114510389c2d2131282bc5a2a4 | 5,425 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1799.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1799.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1799.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x5be, %rsi
lea addresses_WC_ht+0x1a0d5, %rdi
dec %rax
mov $98, %rcx
rep movsw
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_D_ht+0x125be, %rax
nop
nop
add %r10, %r10
movw $0x6162, (%rax)
sub %rsi, %rsi
lea addresses_A_ht+0x15096, %rsi
lea addresses_WC_ht+0x8bbe, %rdi
nop
nop
nop
nop
add $13129, %r9
mov $70, %rcx
rep movsl
dec %rcx
lea addresses_normal_ht+0xe9be, %rsi
lea addresses_UC_ht+0x1dd3e, %rdi
nop
cmp %r9, %r9
mov $125, %rcx
rep movsl
nop
nop
nop
nop
dec %r9
lea addresses_normal_ht+0x250e, %rax
add $48705, %rdx
movl $0x61626364, (%rax)
nop
nop
nop
nop
nop
add $54366, %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %r9
push %rax
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_D+0x1a826, %rsi
lea addresses_D+0x1dbe, %rdi
nop
inc %r15
mov $43, %rcx
rep movsw
xor $3457, %rax
// Faulty Load
lea addresses_WT+0x75be, %r9
nop
nop
nop
cmp %rsi, %rsi
movups (%r9), %xmm6
vpextrq $1, %xmm6, %rdi
lea oracles, %r15
and $0xff, %rdi
shlq $12, %rdi
mov (%r15,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D', 'congruent': 11, 'same': False}}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}}
{'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 4}}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
| 45.588235 | 2,999 | 0.661198 |
da2419bd361e2e5afe0261a8f61214b06348ccbf | 2,004 | asm | Assembly | programs/oeis/250/A250813.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/250/A250813.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/250/A250813.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A250813: Number of (1+1) X (n+1) 0..2 arrays with nondecreasing x(i,j)-x(i,j-1) in the i direction and nondecreasing min(x(i,j),x(i-1,j)) in the j direction.
; 36,100,225,441,784,1296,2025,3025,4356,6084,8281,11025,14400,18496,23409,29241,36100,44100,53361,64009,76176,90000,105625,123201,142884,164836,189225,216225,246016,278784,314721,354025,396900,443556,494209,549081,608400,672400,741321,815409,894916,980100,1071225,1168561,1272384,1382976,1500625,1625625,1758276,1898884,2047761,2205225,2371600,2547216,2732409,2927521,3132900,3348900,3575881,3814209,4064256,4326400,4601025,4888521,5189284,5503716,5832225,6175225,6533136,6906384,7295401,7700625,8122500,8561476,9018009,9492561,9985600,10497600,11029041,11580409,12152196,12744900,13359025,13995081,14653584,15335056,16040025,16769025,17522596,18301284,19105641,19936225,20793600,21678336,22591009,23532201,24502500,25502500,26532801,27594009,28686736,29811600,30969225,32160241,33385284,34644996,35940025,37271025,38638656,40043584,41486481,42968025,44488900,46049796,47651409,49294441,50979600,52707600,54479161,56295009,58155876,60062500,62015625,64016001,66064384,68161536,70308225,72505225,74753316,77053284,79405921,81812025,84272400,86787856,89359209,91987281,94672900,97416900,100220121,103083409,106007616,108993600,112042225,115154361,118330884,121572676,124880625,128255625,131698576,135210384,138791961,142444225,146168100,149964516,153834409,157778721,161798400,165894400,170067681,174319209,178649956,183060900,187553025,192127321,196784784,201526416,206353225,211266225,216266436,221354884,226532601,231800625,237160000,242611776,248157009,253796761,259532100,265364100,271293841,277322409,283450896,289680400,296012025,302446881,308986084,315630756,322382025,329241025,336208896,343286784,350475841,357777225,365192100,372721636,380367009,388129401,396010000,404010000,412130601,420373009,428738436,437228100,445843225,454585041,463454784,472453696,481583025,490844025,500237956,509766084
add $0,4
bin $0,2
pow $0,2
mov $1,$0
| 250.5 | 1,805 | 0.859281 |
00a6117eb6675f1f26efd65e9d8384c9e8aa28b7 | 1,126 | asm | Assembly | S5/AO/Assembler/math_operations/NombreDeDiviseurs.asm | Momellouky/S5 | 3357722927dd4a9f16968b10f1477d99afc4acfa | [
"MIT"
] | 1 | 2021-11-25T22:54:49.000Z | 2021-11-25T22:54:49.000Z | S5/AO/Assembler/math_operations/NombreDeDiviseurs.asm | Momellouky/S5 | 3357722927dd4a9f16968b10f1477d99afc4acfa | [
"MIT"
] | null | null | null | S5/AO/Assembler/math_operations/NombreDeDiviseurs.asm | Momellouky/S5 | 3357722927dd4a9f16968b10f1477d99afc4acfa | [
"MIT"
] | null | null | null | ; multi-segment executable file template.
data segment
nbr dw 24
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
mov ax, nbr
mov dx, 0
mov bx, 1
mov cx, 0
boucle:
mov ax, nbr
cmp bx, ax
jg exit
mov dx, 0
div bx
inc bx
cmp dx, 0
jne boucle
inc cx
jmp boucle
exit:
mov ax, cx
call affichage
jmp fin
affichage proc
mov cx, 0
mov bx, 10
empiler:
mov dx, 0
div bx
push dx
inc cx
cmp ax, 0
jne empiler
depiler:
pop dx
add dx, 48
mov ah, 2h
int 21h
dec cx
cmp cx, 0
jne depiler
ret
affichage endp
fin:
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.
| 15.424658 | 51 | 0.413854 |
2c9197ba34ce1e1b586170f3ece7e3f88b5cf2aa | 23,797 | asm | Assembly | deps/openssl/openssl/crypto/bn/asm/x86_64-win32-masm.asm | loganfsmyth/node | 3288bc953230ba94e2e8bb61c903bbcf60dd810c | [
"BSD-2-Clause"
] | 161 | 2015-01-03T23:21:54.000Z | 2022-02-05T16:48:47.000Z | deps/openssl/openssl/crypto/bn/asm/x86_64-win32-masm.asm | soldair/node | e92f4879eb6c21d66ceaa819ae8f045226b74a3e | [
"0BSD"
] | 56 | 2015-01-14T07:42:55.000Z | 2020-12-09T07:40:38.000Z | deps/openssl/openssl/crypto/bn/asm/x86_64-win32-masm.asm | soldair/node | e92f4879eb6c21d66ceaa819ae8f045226b74a3e | [
"0BSD"
] | 71 | 2015-01-22T10:11:51.000Z | 2022-03-26T12:41:43.000Z |
_TEXT SEGMENT
ALIGN 16
PUBLIC bn_mul_add_words
bn_mul_add_words PROC
push rbp
push rdi
push rsi
push rbx
test r8d, r8d
jle label0
xor ebx, ebx
test r8d, -4
mov r10, rdx
je label1
lea rbp, qword ptr [rcx + 8]
lea rdi, qword ptr [rcx + 16]
lea rsi, qword ptr [rcx + 24]
sub rbp, rdx
sub rdi, rdx
sub rsi, rdx
label2:
sub r8d, 4
mov rax, r9
mul qword ptr [r10]
add rbx, rax
adc rdx, 0
mov rax, r9
add qword ptr [rcx], rbx
adc rdx, 0
add rcx, 32
mov r11, rdx
mul qword ptr [r10 + 8]
add r11, rax
adc rdx, 0
mov rax, r9
add qword ptr [r10 + rbp], r11
adc rdx, 0
mov rbx, rdx
mul qword ptr [r10 + 16]
add rbx, rax
adc rdx, 0
mov rax, r9
add qword ptr [r10 + rdi], rbx
adc rdx, 0
mov r11, rdx
mul qword ptr [r10 + 24]
add r11, rax
adc rdx, 0
add qword ptr [r10 + rsi], r11
adc rdx, 0
add r10, 32
test r8d, -4
mov rbx, rdx
jne label2
test r8d, r8d
mov r11, rdx
je label3
label1:
mov rax, r9
mul qword ptr [r10]
add rbx, rax
adc rdx, 0
add qword ptr [rcx], rbx
adc rdx, 0
sub r8d, 1
mov r11, rdx
je label3
mov rax, r9
mul qword ptr [r10 + 8]
add r11, rax
adc rdx, 0
add qword ptr [rcx + 8], r11
adc rdx, 0
cmp r8d, 1
mov rbx, rdx
je label4
mov rax, r9
mul qword ptr [r10 + 16]
add rbx, rax
adc rdx, 0
add qword ptr [rcx + 16], rbx
adc rdx, 0
mov r11, rdx
label3:
mov rax, r11
pop rbx
pop rsi
pop rdi
pop rbp
ret
label0:
xor r11d, r11d
mov rax, r11
pop rbx
pop rsi
pop rdi
pop rbp
ret
label4:
mov r11, rdx
jmp label3
bn_mul_add_words ENDP
ALIGN 16
PUBLIC bn_mul_words
bn_mul_words PROC
push rsi
push rbx
test r8d, r8d
mov r10, rdx
jle label5
xor ebx, ebx
test r8d, -4
je label6
label7:
sub r8d, 4
mov rax, r9
mul qword ptr [r10]
add rbx, rax
adc rdx, 0
mov rax, r9
mov qword ptr [rcx], rbx
mov r11, rdx
mul qword ptr [r10 + 8]
add r11, rax
adc rdx, 0
mov rax, r9
mov qword ptr [rcx + 8], r11
mov rbx, rdx
mul qword ptr [r10 + 16]
add rbx, rax
adc rdx, 0
mov rax, r9
mov qword ptr [rcx + 16], rbx
mov r11, rdx
mul qword ptr [r10 + 24]
add r10, 32
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 24], r11
add rcx, 32
test r8d, -4
mov rbx, rdx
jne label7
test r8d, r8d
mov r11, rdx
jne label6
label8:
mov rax, r11
pop rbx
pop rsi
ret
label6:
mov rax, r9
mul qword ptr [r10]
add rbx, rax
adc rdx, 0
sub r8d, 1
mov qword ptr [rcx], rbx
mov r11, rdx
je label8
mov rax, r9
mul qword ptr [r10 + 8]
add r11, rax
adc rdx, 0
cmp r8d, 1
mov rbx, rdx
mov qword ptr [rcx + 8], r11
je label9
mov rax, r9
mul qword ptr [r10 + 16]
add rbx, rax
adc rdx, 0
mov r11, rdx
mov qword ptr [rcx + 16], rbx
mov rax, r11
pop rbx
pop rsi
ret
label9:
mov r11, rdx
jmp label8
label5:
xor r11d, r11d
mov rax, r11
pop rbx
pop rsi
ret
bn_mul_words ENDP
ALIGN 16
PUBLIC bn_sqr_words
bn_sqr_words PROC
test r8d, r8d
mov r9, rdx
jle label10
test r8d, -4
je label11
label12:
sub r8d, 4
mov rax, qword ptr [r9]
mul rax
mov qword ptr [rcx + 8], rdx
mov qword ptr [rcx], rax
mov rax, qword ptr [r9 + 8]
mul rax
mov qword ptr [rcx + 24], rdx
mov qword ptr [rcx + 16], rax
mov rax, qword ptr [r9 + 16]
mul rax
mov qword ptr [rcx + 40], rdx
mov qword ptr [rcx + 32], rax
mov rax, qword ptr [r9 + 24]
add r9, 32
mul rax
mov qword ptr [rcx + 48], rax
mov qword ptr [rcx + 56], rdx
add rcx, 64
test r8d, -4
jne label12
test r8d, r8d
je label10
label11:
mov rax, qword ptr [r9]
mul rax
sub r8d, 1
mov qword ptr [rcx], rax
mov qword ptr [rcx + 8], rdx
je label10
mov rax, qword ptr [r9 + 8]
mul rax
cmp r8d, 1
mov qword ptr [rcx + 16], rax
mov qword ptr [rcx + 24], rdx
je label10
mov rax, qword ptr [r9 + 16]
mul rax
mov qword ptr [rcx + 32], rax
mov qword ptr [rcx + 40], rdx
label10:
ret 0
bn_sqr_words ENDP
ALIGN 16
PUBLIC bn_div_words
bn_div_words PROC
mov rax, rdx
mov rdx, rcx
div r8
ret
bn_div_words ENDP
ALIGN 16
PUBLIC bn_add_words
bn_add_words PROC
test r9d, r9d
mov r10, rcx
jle label13
mov ecx, r9d
sub r11, r11
label14:
mov rax, qword ptr [rdx + r11 * 8]
adc rax, qword ptr [r8 + r11 * 8]
mov qword ptr [r10 + r11 * 8], rax
lea r11, qword ptr [r11 + 1]
loop label14
sbb rax, rax
and eax, 1
ret
label13:
xor eax, eax
ret
bn_add_words ENDP
ALIGN 16
PUBLIC bn_sub_words
bn_sub_words PROC
test r9d, r9d
mov r10, rcx
jle label15
mov ecx, r9d
sub r11, r11
label16:
mov rax, qword ptr [rdx + r11 * 8]
sbb rax, qword ptr [r8 + r11 * 8]
mov qword ptr [r10 + r11 * 8], rax
lea r11, qword ptr [r11 + 1]
loop label16
sbb rax, rax
and eax, 1
ret
label15:
xor eax, eax
ret
bn_sub_words ENDP
ALIGN 16
PUBLIC bn_mul_comba8
bn_mul_comba8 PROC
push rsi
push rbx
xor r10d, r10d
mov rax, qword ptr [rdx]
mov r9, rdx
mov rsi, r10
mov r11, r10
mul qword ptr [r8]
mov rbx, r10
add rsi, rax
adc rdx, 0
mov qword ptr [rcx], rsi
mov rax, qword ptr [r9]
add r11, rdx
adc rbx, 0
mul qword ptr [r8 + 8]
mov rsi, r11
mov r11, r10
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add rbx, rdx
adc r11, 0
mul qword ptr [r8]
add rsi, rax
adc rdx, 0
mov qword ptr [rcx + 8], rsi
mov rsi, r10
mov rax, qword ptr [r9 + 16]
add rbx, rdx
adc r11, 0
mul qword ptr [r8]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 8]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 16]
add rbx, rax
adc rdx, 0
mov qword ptr [rcx + 16], rbx
mov rbx, r10
mov rax, qword ptr [r9]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 24]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 16]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 16]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 8]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 24]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8]
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 24], r11
mov rax, qword ptr [r9 + 32]
mov r11, r10
add rsi, rdx
adc rbx, 0
mul qword ptr [r8]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 24]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 8]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 16]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 16]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 24]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 32]
add rsi, rax
adc rdx, 0
mov qword ptr [rcx + 32], rsi
mov rsi, r10
mov rax, qword ptr [r9]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 40]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 32]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 16]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 24]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 24]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 16]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 32]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 8]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 40]
add r11, rdx
adc rsi, 0
mul qword ptr [r8]
add rbx, rax
adc rdx, 0
mov qword ptr [rcx + 40], rbx
mov rax, qword ptr [r9 + 48]
mov rbx, r10
add r11, rdx
adc rsi, 0
mul qword ptr [r8]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 40]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 8]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 32]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 16]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 24]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 24]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 16]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 32]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 40]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 48]
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 48], r11
mov r11, r10
mov rax, qword ptr [r9]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 56]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 48]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 16]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 40]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 24]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 32]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 32]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 24]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 40]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 16]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 48]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 8]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 56]
add rbx, rdx
adc r11, 0
mul qword ptr [r8]
add rsi, rax
adc rdx, 0
mov qword ptr [rcx + 56], rsi
mov rax, qword ptr [r9 + 56]
mov rsi, r10
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 8]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 48]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 16]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 40]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 24]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 32]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 32]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 24]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 40]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 16]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 48]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 56]
add rbx, rax
adc rdx, 0
mov qword ptr [rcx + 64], rbx
mov rbx, r10
mov rax, qword ptr [r9 + 16]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 56]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 24]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 48]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 32]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 40]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 40]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 32]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 48]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 24]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 56]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 16]
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 72], r11
mov rax, qword ptr [r9 + 56]
mov r11, r10
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 24]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 48]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 32]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 40]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 40]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 32]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 48]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 24]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 56]
add rsi, rax
adc rdx, 0
mov qword ptr [rcx + 80], rsi
mov rsi, r10
mov rax, qword ptr [r9 + 32]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 56]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 40]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 48]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 48]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 40]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 56]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 32]
add rbx, rax
adc rdx, 0
mov qword ptr [rcx + 88], rbx
mov rbx, r10
mov rax, qword ptr [r9 + 56]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 40]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 48]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 48]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 40]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 56]
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 96], r11
mov rax, qword ptr [r9 + 48]
mov r11, r10
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 56]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 56]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 48]
add rsi, rax
adc rdx, 0
add rbx, rdx
adc r11, 0
mov qword ptr [rcx + 104], rsi
mov rax, qword ptr [r9 + 56]
mul qword ptr [r8 + 56]
mov r8, rbx
add r8, rax
adc rdx, 0
add r11, rdx
adc r10, 0
mov qword ptr [rcx + 112], r8
mov qword ptr [rcx + 120], r11
pop rbx
pop rsi
ret
bn_mul_comba8 ENDP
ALIGN 16
PUBLIC bn_mul_comba4
bn_mul_comba4 PROC
push rsi
push rbx
xor r10d, r10d
mov rax, qword ptr [rdx]
mov r9, rdx
mov rbx, r10
mov r11, r10
mul qword ptr [r8]
mov rsi, r10
add rbx, rax
adc rdx, 0
mov qword ptr [rcx], rbx
mov rbx, r10
mov rax, qword ptr [r9]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 8]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8]
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 8], r11
mov r11, r10
mov rax, qword ptr [r9 + 16]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 8]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 16]
add rsi, rax
adc rdx, 0
mov qword ptr [rcx + 16], rsi
mov rsi, r10
mov rax, qword ptr [r9]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 24]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 16]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 16]
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 8]
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r9 + 24]
add r11, rdx
adc rsi, 0
mul qword ptr [r8]
add rbx, rax
adc rdx, 0
mov qword ptr [rcx + 24], rbx
mov rax, qword ptr [r9 + 24]
mov rbx, r10
add r11, rdx
adc rsi, 0
mul qword ptr [r8 + 8]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 16]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 16]
add r11, rax
adc rdx, 0
mov rax, qword ptr [r9 + 8]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 24]
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 32], r11
mov r11, r10
mov rax, qword ptr [r9 + 16]
add rsi, rdx
adc rbx, 0
mul qword ptr [r8 + 24]
add rsi, rax
adc rdx, 0
mov rax, qword ptr [r9 + 24]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 16]
add rsi, rax
adc rdx, 0
add rbx, rdx
adc r11, 0
mov qword ptr [rcx + 40], rsi
mov rax, qword ptr [r9 + 24]
mul qword ptr [r8 + 24]
mov r8, rbx
add r8, rax
adc rdx, 0
add r11, rdx
adc r10, 0
mov qword ptr [rcx + 48], r8
mov qword ptr [rcx + 56], r11
pop rbx
pop rsi
ret
bn_mul_comba4 ENDP
ALIGN 16
PUBLIC bn_sqr_comba8
bn_sqr_comba8 PROC
push rsi
push rbx
xor r9d, r9d
mov rax, qword ptr [rdx]
mov r8, rdx
mov rbx, r9
mov r10, r9
mul rax
mov r11, r9
mov rsi, r9
add rbx, rax
adc rdx, 0
mov qword ptr [rcx], rbx
mov rax, qword ptr [r8 + 8]
add r10, rdx
adc r11, 0
mul qword ptr [r8]
mov rbx, r10
add rdx, rdx
adc rsi, 0
add rax, rax
adc rdx, 0
mov r10, rsi
add rbx, rax
adc rdx, 0
mov qword ptr [rcx + 8], rbx
mov rbx, r9
mov rax, qword ptr [r8 + 8]
add r11, rdx
adc r10, 0
mul rax
add r11, rax
adc rdx, 0
mov rax, qword ptr [r8 + 16]
add r10, rdx
adc rbx, 0
mul qword ptr [r8]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 16], r11
mov r11, r9
mov rax, qword ptr [r8 + 24]
add r10, rdx
adc rbx, 0
mul qword ptr [r8]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
mov rax, qword ptr [r8 + 16]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 8]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
mov qword ptr [rcx + 24], r10
mov r10, r9
mov rax, qword ptr [r8 + 16]
add rbx, rdx
adc r11, 0
mul rax
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r8 + 24]
add r11, rdx
adc r10, 0
mul qword ptr [r8 + 8]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r8 + 32]
add r11, rdx
adc r10, 0
mul qword ptr [r8]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
mov qword ptr [rcx + 32], rbx
mov rbx, r9
mov rax, qword ptr [r8 + 40]
add r11, rdx
adc r10, 0
mul qword ptr [r8]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov rax, qword ptr [r8 + 32]
add r10, rdx
adc rbx, 0
mul qword ptr [r8 + 8]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov rax, qword ptr [r8 + 24]
add r10, rdx
adc rbx, 0
mul qword ptr [r8 + 16]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 40], r11
mov rax, qword ptr [r8 + 24]
mov r11, r9
add r10, rdx
adc rbx, 0
mul rax
add r10, rax
adc rdx, 0
mov rax, qword ptr [r8 + 32]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 16]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
mov rax, qword ptr [r8 + 40]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 8]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
mov rax, qword ptr [r8 + 48]
add rbx, rdx
adc r11, 0
mul qword ptr [r8]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
mov qword ptr [rcx + 48], r10
mov r10, r9
mov rax, qword ptr [r8 + 56]
add rbx, rdx
adc r11, 0
mul qword ptr [r8]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r8 + 48]
add r11, rdx
adc r10, 0
mul qword ptr [r8 + 8]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r8 + 40]
add r11, rdx
adc r10, 0
mul qword ptr [r8 + 16]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r8 + 32]
add r11, rdx
adc r10, 0
mul qword ptr [r8 + 24]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
mov qword ptr [rcx + 56], rbx
mov rbx, r9
mov rax, qword ptr [r8 + 32]
add r11, rdx
adc r10, 0
mul rax
add r11, rax
adc rdx, 0
mov rax, qword ptr [r8 + 40]
add r10, rdx
adc rbx, 0
mul qword ptr [r8 + 24]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov rax, qword ptr [r8 + 48]
add r10, rdx
adc rbx, 0
mul qword ptr [r8 + 16]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov rax, qword ptr [r8 + 56]
add r10, rdx
adc rbx, 0
mul qword ptr [r8 + 8]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 64], r11
mov rax, qword ptr [r8 + 56]
mov r11, r9
add r10, rdx
adc rbx, 0
mul qword ptr [r8 + 16]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
mov rax, qword ptr [r8 + 48]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 24]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
mov rax, qword ptr [r8 + 40]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 32]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
mov qword ptr [rcx + 72], r10
mov r10, r9
mov rax, qword ptr [r8 + 40]
add rbx, rdx
adc r11, 0
mul rax
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r8 + 48]
add r11, rdx
adc r10, 0
mul qword ptr [r8 + 32]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r8 + 56]
add r11, rdx
adc r10, 0
mul qword ptr [r8 + 24]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
mov qword ptr [rcx + 80], rbx
mov rbx, r9
mov rax, qword ptr [r8 + 56]
add r11, rdx
adc r10, 0
mul qword ptr [r8 + 32]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov rax, qword ptr [r8 + 48]
add r10, rdx
adc rbx, 0
mul qword ptr [r8 + 40]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 88], r11
mov r11, r9
mov rax, qword ptr [r8 + 48]
add r10, rdx
adc rbx, 0
mul rax
add r10, rax
adc rdx, 0
mov rax, qword ptr [r8 + 56]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 40]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
mov qword ptr [rcx + 96], r10
mov r10, r9
mov rax, qword ptr [r8 + 56]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 48]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
add r11, rdx
adc r10, 0
mov qword ptr [rcx + 104], rbx
mov rax, qword ptr [r8 + 56]
mov r8, r11
mul rax
add r8, rax
adc rdx, 0
add r10, rdx
adc r9, 0
mov qword ptr [rcx + 112], r8
mov qword ptr [rcx + 120], r10
pop rbx
pop rsi
ret
bn_sqr_comba8 ENDP
ALIGN 16
PUBLIC bn_sqr_comba4
bn_sqr_comba4 PROC
push rbx
xor r9d, r9d
mov rax, qword ptr [rdx]
mov r8, rdx
mov r11, r9
mov r10, r9
mul rax
mov rbx, r9
add r11, rax
adc rdx, 0
mov qword ptr [rcx], r11
mov r11, r9
mov rax, qword ptr [r8 + 8]
add r10, rdx
adc rbx, 0
mul qword ptr [r8]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
mov qword ptr [rcx + 8], r10
mov r10, r9
mov rax, qword ptr [r8 + 8]
add rbx, rdx
adc r11, 0
mul rax
add rbx, rax
adc rdx, 0
mov rax, qword ptr [r8 + 16]
add r11, rdx
adc r10, 0
mul qword ptr [r8]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
mov qword ptr [rcx + 16], rbx
mov rbx, r9
mov rax, qword ptr [r8 + 24]
add r11, rdx
adc r10, 0
mul qword ptr [r8]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov rax, qword ptr [r8 + 16]
add r10, rdx
adc rbx, 0
mul qword ptr [r8 + 8]
add rdx, rdx
adc rbx, 0
add rax, rax
adc rdx, 0
add r11, rax
adc rdx, 0
mov qword ptr [rcx + 24], r11
mov r11, r9
mov rax, qword ptr [r8 + 16]
add r10, rdx
adc rbx, 0
mul rax
add r10, rax
adc rdx, 0
mov rax, qword ptr [r8 + 24]
add rbx, rdx
adc r11, 0
mul qword ptr [r8 + 8]
add rdx, rdx
adc r11, 0
add rax, rax
adc rdx, 0
add r10, rax
adc rdx, 0
add rbx, rdx
adc r11, 0
mov qword ptr [rcx + 32], r10
mov r10, r9
mov rax, qword ptr [r8 + 24]
mul qword ptr [r8 + 16]
add rdx, rdx
adc r10, 0
add rax, rax
adc rdx, 0
add rbx, rax
adc rdx, 0
add r11, rdx
adc r10, 0
mov qword ptr [rcx + 40], rbx
mov rax, qword ptr [r8 + 24]
mov r8, r11
mul rax
add r8, rax
adc rdx, 0
add r10, rdx
adc r9, 0
mov qword ptr [rcx + 48], r8
mov qword ptr [rcx + 56], r10
pop rbx
ret
bn_sqr_comba4 ENDP
_TEXT ENDS
END
| 14.164881 | 36 | 0.582678 |
1d2c4cedee9884769ff5c5f7b49f78338a49c5a4 | 438 | asm | Assembly | oeis/120/A120509.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/120/A120509.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/120/A120509.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A120509: Generalized meta-Fibonacci sequence a(n) with parameters s=2 and k=4.
; Submitted by Christian Krause
; 1,1,1,2,3,4,4,4,4,5,6,7,8,8,9,10,11,12,12,13,14,15,16,16,16,16,16,17,18,19,20,20,21,22,23,24,24,25,26,27,28,28,29,30,31,32,32,32,33,34,35,36,36,37,38,39,40,40,41,42
mov $6,$0
add $0,1
mov $2,$0
lpb $0
lpb $0,$6
mov $6,$2
lpb $0
sub $6,2
sub $6,$0
div $0,4
lpe
lpe
sub $0,1
lpe
add $0,1
| 21.9 | 166 | 0.593607 |
f40c018e4f6a4e4709b5bcca88cd815ecc4dff2c | 385 | asm | Assembly | oeis/155/A155196.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/155/A155196.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/155/A155196.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A155196: a(n)=7*a(n-1)+a(n-2), n>2 ; a(0)=1, a(1)=6, a(2)=42 .
; Submitted by Jon Maiga
; 1,6,42,300,2142,15294,109200,779694,5567058,39749100,283810758,2026424406,14468781600,103307895606,737624050842,5266676251500,37604357811342,268497180930894,1917084624327600,13688089551224094
mov $3,1
lpb $0
sub $0,1
add $3,$1
add $2,$3
mov $1,$2
mov $2,$3
mul $3,6
lpe
mov $0,$3
| 25.666667 | 193 | 0.690909 |
25819ea2d8757c9456b795941c97657e11d7a380 | 50,406 | asm | Assembly | xv6-pdx/time.asm | budiwa/CS333 | 3ceee2ce2ac6cf112444b53446093a08b5ebfdf6 | [
"Xnet",
"X11"
] | null | null | null | xv6-pdx/time.asm | budiwa/CS333 | 3ceee2ce2ac6cf112444b53446093a08b5ebfdf6 | [
"Xnet",
"X11"
] | null | null | null | xv6-pdx/time.asm | budiwa/CS333 | 3ceee2ce2ac6cf112444b53446093a08b5ebfdf6 | [
"Xnet",
"X11"
] | null | null | null |
_time: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#ifdef CS333_P2
#include "types.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
f: 83 ec 20 sub $0x20,%esp
12: 89 cb mov %ecx,%ebx
int start_time = uptime(); // for ticks
14: e8 cc 04 00 00 call 4e5 <uptime>
19: 89 45 f4 mov %eax,-0xc(%ebp)
int final_time;
int time_diff;
int result;
int reminder;
int knife = fork(); // to check fork
1c: e8 24 04 00 00 call 445 <fork>
21: 89 45 f0 mov %eax,-0x10(%ebp)
if (knife < 0) // knife value negative
24: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
28: 79 17 jns 41 <main+0x41>
{
printf(1, "error FAIL\n");
2a: 83 ec 08 sub $0x8,%esp
2d: 68 da 09 00 00 push $0x9da
32: 6a 01 push $0x1
34: e8 eb 05 00 00 call 624 <printf>
39: 83 c4 10 add $0x10,%esp
exit();
3c: e8 0c 04 00 00 call 44d <exit>
}
if (knife == 0) // knife is zero
41: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
45: 75 3d jne 84 <main+0x84>
{
if (argc == 1)
47: 83 3b 01 cmpl $0x1,(%ebx)
4a: 75 05 jne 51 <main+0x51>
exit();
4c: e8 fc 03 00 00 call 44d <exit>
++argv;
51: 83 43 04 04 addl $0x4,0x4(%ebx)
if (exec(argv[0], argv))
55: 8b 43 04 mov 0x4(%ebx),%eax
58: 8b 00 mov (%eax),%eax
5a: 83 ec 08 sub $0x8,%esp
5d: ff 73 04 pushl 0x4(%ebx)
60: 50 push %eax
61: e8 1f 04 00 00 call 485 <exec>
66: 83 c4 10 add $0x10,%esp
69: 85 c0 test %eax,%eax
6b: 74 17 je 84 <main+0x84>
{
printf(1, "error FAIL\n");
6d: 83 ec 08 sub $0x8,%esp
70: 68 da 09 00 00 push $0x9da
75: 6a 01 push $0x1
77: e8 a8 05 00 00 call 624 <printf>
7c: 83 c4 10 add $0x10,%esp
exit();
7f: e8 c9 03 00 00 call 44d <exit>
}
}
wait();
84: e8 cc 03 00 00 call 455 <wait>
final_time = uptime(); // get time
89: e8 57 04 00 00 call 4e5 <uptime>
8e: 89 45 ec mov %eax,-0x14(%ebp)
time_diff = final_time - start_time; // get the difference
91: 8b 45 ec mov -0x14(%ebp),%eax
94: 2b 45 f4 sub -0xc(%ebp),%eax
97: 89 45 e8 mov %eax,-0x18(%ebp)
result = time_diff/1000; // get the result
9a: 8b 4d e8 mov -0x18(%ebp),%ecx
9d: ba d3 4d 62 10 mov $0x10624dd3,%edx
a2: 89 c8 mov %ecx,%eax
a4: f7 ea imul %edx
a6: c1 fa 06 sar $0x6,%edx
a9: 89 c8 mov %ecx,%eax
ab: c1 f8 1f sar $0x1f,%eax
ae: 29 c2 sub %eax,%edx
b0: 89 d0 mov %edx,%eax
b2: 89 45 e4 mov %eax,-0x1c(%ebp)
reminder = time_diff%1000; // get the reminder
b5: 8b 4d e8 mov -0x18(%ebp),%ecx
b8: ba d3 4d 62 10 mov $0x10624dd3,%edx
bd: 89 c8 mov %ecx,%eax
bf: f7 ea imul %edx
c1: c1 fa 06 sar $0x6,%edx
c4: 89 c8 mov %ecx,%eax
c6: c1 f8 1f sar $0x1f,%eax
c9: 29 c2 sub %eax,%edx
cb: 89 d0 mov %edx,%eax
cd: 69 c0 e8 03 00 00 imul $0x3e8,%eax,%eax
d3: 29 c1 sub %eax,%ecx
d5: 89 c8 mov %ecx,%eax
d7: 89 45 e0 mov %eax,-0x20(%ebp)
if(argv[1] != 0)
da: 8b 43 04 mov 0x4(%ebx),%eax
dd: 83 c0 04 add $0x4,%eax
e0: 8b 00 mov (%eax),%eax
e2: 85 c0 test %eax,%eax
e4: 74 23 je 109 <main+0x109>
printf(1, "%s ran in %d.%d seconds.\n", argv[1], result, reminder); // displayin
e6: 8b 43 04 mov 0x4(%ebx),%eax
e9: 83 c0 04 add $0x4,%eax
ec: 8b 00 mov (%eax),%eax
ee: 83 ec 0c sub $0xc,%esp
f1: ff 75 e0 pushl -0x20(%ebp)
f4: ff 75 e4 pushl -0x1c(%ebp)
f7: 50 push %eax
f8: 68 e6 09 00 00 push $0x9e6
fd: 6a 01 push $0x1
ff: e8 20 05 00 00 call 624 <printf>
104: 83 c4 20 add $0x20,%esp
107: eb 15 jmp 11e <main+0x11e>
else
printf(1, "ran in %d.%d seconds.\n", result, reminder);
109: ff 75 e0 pushl -0x20(%ebp)
10c: ff 75 e4 pushl -0x1c(%ebp)
10f: 68 00 0a 00 00 push $0xa00
114: 6a 01 push $0x1
116: e8 09 05 00 00 call 624 <printf>
11b: 83 c4 10 add $0x10,%esp
exit();
11e: e8 2a 03 00 00 call 44d <exit>
00000123 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
123: 55 push %ebp
124: 89 e5 mov %esp,%ebp
126: 57 push %edi
127: 53 push %ebx
asm volatile("cld; rep stosb" :
128: 8b 4d 08 mov 0x8(%ebp),%ecx
12b: 8b 55 10 mov 0x10(%ebp),%edx
12e: 8b 45 0c mov 0xc(%ebp),%eax
131: 89 cb mov %ecx,%ebx
133: 89 df mov %ebx,%edi
135: 89 d1 mov %edx,%ecx
137: fc cld
138: f3 aa rep stos %al,%es:(%edi)
13a: 89 ca mov %ecx,%edx
13c: 89 fb mov %edi,%ebx
13e: 89 5d 08 mov %ebx,0x8(%ebp)
141: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
144: 90 nop
145: 5b pop %ebx
146: 5f pop %edi
147: 5d pop %ebp
148: c3 ret
00000149 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
149: 55 push %ebp
14a: 89 e5 mov %esp,%ebp
14c: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
14f: 8b 45 08 mov 0x8(%ebp),%eax
152: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
155: 90 nop
156: 8b 45 08 mov 0x8(%ebp),%eax
159: 8d 50 01 lea 0x1(%eax),%edx
15c: 89 55 08 mov %edx,0x8(%ebp)
15f: 8b 55 0c mov 0xc(%ebp),%edx
162: 8d 4a 01 lea 0x1(%edx),%ecx
165: 89 4d 0c mov %ecx,0xc(%ebp)
168: 0f b6 12 movzbl (%edx),%edx
16b: 88 10 mov %dl,(%eax)
16d: 0f b6 00 movzbl (%eax),%eax
170: 84 c0 test %al,%al
172: 75 e2 jne 156 <strcpy+0xd>
;
return os;
174: 8b 45 fc mov -0x4(%ebp),%eax
}
177: c9 leave
178: c3 ret
00000179 <strcmp>:
int
strcmp(const char *p, const char *q)
{
179: 55 push %ebp
17a: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
17c: eb 08 jmp 186 <strcmp+0xd>
p++, q++;
17e: 83 45 08 01 addl $0x1,0x8(%ebp)
182: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
186: 8b 45 08 mov 0x8(%ebp),%eax
189: 0f b6 00 movzbl (%eax),%eax
18c: 84 c0 test %al,%al
18e: 74 10 je 1a0 <strcmp+0x27>
190: 8b 45 08 mov 0x8(%ebp),%eax
193: 0f b6 10 movzbl (%eax),%edx
196: 8b 45 0c mov 0xc(%ebp),%eax
199: 0f b6 00 movzbl (%eax),%eax
19c: 38 c2 cmp %al,%dl
19e: 74 de je 17e <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
1a0: 8b 45 08 mov 0x8(%ebp),%eax
1a3: 0f b6 00 movzbl (%eax),%eax
1a6: 0f b6 d0 movzbl %al,%edx
1a9: 8b 45 0c mov 0xc(%ebp),%eax
1ac: 0f b6 00 movzbl (%eax),%eax
1af: 0f b6 c0 movzbl %al,%eax
1b2: 29 c2 sub %eax,%edx
1b4: 89 d0 mov %edx,%eax
}
1b6: 5d pop %ebp
1b7: c3 ret
000001b8 <strlen>:
uint
strlen(char *s)
{
1b8: 55 push %ebp
1b9: 89 e5 mov %esp,%ebp
1bb: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
1be: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
1c5: eb 04 jmp 1cb <strlen+0x13>
1c7: 83 45 fc 01 addl $0x1,-0x4(%ebp)
1cb: 8b 55 fc mov -0x4(%ebp),%edx
1ce: 8b 45 08 mov 0x8(%ebp),%eax
1d1: 01 d0 add %edx,%eax
1d3: 0f b6 00 movzbl (%eax),%eax
1d6: 84 c0 test %al,%al
1d8: 75 ed jne 1c7 <strlen+0xf>
;
return n;
1da: 8b 45 fc mov -0x4(%ebp),%eax
}
1dd: c9 leave
1de: c3 ret
000001df <memset>:
void*
memset(void *dst, int c, uint n)
{
1df: 55 push %ebp
1e0: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
1e2: 8b 45 10 mov 0x10(%ebp),%eax
1e5: 50 push %eax
1e6: ff 75 0c pushl 0xc(%ebp)
1e9: ff 75 08 pushl 0x8(%ebp)
1ec: e8 32 ff ff ff call 123 <stosb>
1f1: 83 c4 0c add $0xc,%esp
return dst;
1f4: 8b 45 08 mov 0x8(%ebp),%eax
}
1f7: c9 leave
1f8: c3 ret
000001f9 <strchr>:
char*
strchr(const char *s, char c)
{
1f9: 55 push %ebp
1fa: 89 e5 mov %esp,%ebp
1fc: 83 ec 04 sub $0x4,%esp
1ff: 8b 45 0c mov 0xc(%ebp),%eax
202: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
205: eb 14 jmp 21b <strchr+0x22>
if(*s == c)
207: 8b 45 08 mov 0x8(%ebp),%eax
20a: 0f b6 00 movzbl (%eax),%eax
20d: 3a 45 fc cmp -0x4(%ebp),%al
210: 75 05 jne 217 <strchr+0x1e>
return (char*)s;
212: 8b 45 08 mov 0x8(%ebp),%eax
215: eb 13 jmp 22a <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
217: 83 45 08 01 addl $0x1,0x8(%ebp)
21b: 8b 45 08 mov 0x8(%ebp),%eax
21e: 0f b6 00 movzbl (%eax),%eax
221: 84 c0 test %al,%al
223: 75 e2 jne 207 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
225: b8 00 00 00 00 mov $0x0,%eax
}
22a: c9 leave
22b: c3 ret
0000022c <gets>:
char*
gets(char *buf, int max)
{
22c: 55 push %ebp
22d: 89 e5 mov %esp,%ebp
22f: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
232: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
239: eb 42 jmp 27d <gets+0x51>
cc = read(0, &c, 1);
23b: 83 ec 04 sub $0x4,%esp
23e: 6a 01 push $0x1
240: 8d 45 ef lea -0x11(%ebp),%eax
243: 50 push %eax
244: 6a 00 push $0x0
246: e8 1a 02 00 00 call 465 <read>
24b: 83 c4 10 add $0x10,%esp
24e: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
251: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
255: 7e 33 jle 28a <gets+0x5e>
break;
buf[i++] = c;
257: 8b 45 f4 mov -0xc(%ebp),%eax
25a: 8d 50 01 lea 0x1(%eax),%edx
25d: 89 55 f4 mov %edx,-0xc(%ebp)
260: 89 c2 mov %eax,%edx
262: 8b 45 08 mov 0x8(%ebp),%eax
265: 01 c2 add %eax,%edx
267: 0f b6 45 ef movzbl -0x11(%ebp),%eax
26b: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
26d: 0f b6 45 ef movzbl -0x11(%ebp),%eax
271: 3c 0a cmp $0xa,%al
273: 74 16 je 28b <gets+0x5f>
275: 0f b6 45 ef movzbl -0x11(%ebp),%eax
279: 3c 0d cmp $0xd,%al
27b: 74 0e je 28b <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
27d: 8b 45 f4 mov -0xc(%ebp),%eax
280: 83 c0 01 add $0x1,%eax
283: 3b 45 0c cmp 0xc(%ebp),%eax
286: 7c b3 jl 23b <gets+0xf>
288: eb 01 jmp 28b <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
28a: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
28b: 8b 55 f4 mov -0xc(%ebp),%edx
28e: 8b 45 08 mov 0x8(%ebp),%eax
291: 01 d0 add %edx,%eax
293: c6 00 00 movb $0x0,(%eax)
return buf;
296: 8b 45 08 mov 0x8(%ebp),%eax
}
299: c9 leave
29a: c3 ret
0000029b <stat>:
int
stat(char *n, struct stat *st)
{
29b: 55 push %ebp
29c: 89 e5 mov %esp,%ebp
29e: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
2a1: 83 ec 08 sub $0x8,%esp
2a4: 6a 00 push $0x0
2a6: ff 75 08 pushl 0x8(%ebp)
2a9: e8 df 01 00 00 call 48d <open>
2ae: 83 c4 10 add $0x10,%esp
2b1: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
2b4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2b8: 79 07 jns 2c1 <stat+0x26>
return -1;
2ba: b8 ff ff ff ff mov $0xffffffff,%eax
2bf: eb 25 jmp 2e6 <stat+0x4b>
r = fstat(fd, st);
2c1: 83 ec 08 sub $0x8,%esp
2c4: ff 75 0c pushl 0xc(%ebp)
2c7: ff 75 f4 pushl -0xc(%ebp)
2ca: e8 d6 01 00 00 call 4a5 <fstat>
2cf: 83 c4 10 add $0x10,%esp
2d2: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
2d5: 83 ec 0c sub $0xc,%esp
2d8: ff 75 f4 pushl -0xc(%ebp)
2db: e8 95 01 00 00 call 475 <close>
2e0: 83 c4 10 add $0x10,%esp
return r;
2e3: 8b 45 f0 mov -0x10(%ebp),%eax
}
2e6: c9 leave
2e7: c3 ret
000002e8 <atoi>:
int
atoi(const char *s)
{
2e8: 55 push %ebp
2e9: 89 e5 mov %esp,%ebp
2eb: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
2ee: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ') s++;
2f5: eb 04 jmp 2fb <atoi+0x13>
2f7: 83 45 08 01 addl $0x1,0x8(%ebp)
2fb: 8b 45 08 mov 0x8(%ebp),%eax
2fe: 0f b6 00 movzbl (%eax),%eax
301: 3c 20 cmp $0x20,%al
303: 74 f2 je 2f7 <atoi+0xf>
sign = (*s == '-') ? -1 : 1;
305: 8b 45 08 mov 0x8(%ebp),%eax
308: 0f b6 00 movzbl (%eax),%eax
30b: 3c 2d cmp $0x2d,%al
30d: 75 07 jne 316 <atoi+0x2e>
30f: b8 ff ff ff ff mov $0xffffffff,%eax
314: eb 05 jmp 31b <atoi+0x33>
316: b8 01 00 00 00 mov $0x1,%eax
31b: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
31e: 8b 45 08 mov 0x8(%ebp),%eax
321: 0f b6 00 movzbl (%eax),%eax
324: 3c 2b cmp $0x2b,%al
326: 74 0a je 332 <atoi+0x4a>
328: 8b 45 08 mov 0x8(%ebp),%eax
32b: 0f b6 00 movzbl (%eax),%eax
32e: 3c 2d cmp $0x2d,%al
330: 75 2b jne 35d <atoi+0x75>
s++;
332: 83 45 08 01 addl $0x1,0x8(%ebp)
while('0' <= *s && *s <= '9')
336: eb 25 jmp 35d <atoi+0x75>
n = n*10 + *s++ - '0';
338: 8b 55 fc mov -0x4(%ebp),%edx
33b: 89 d0 mov %edx,%eax
33d: c1 e0 02 shl $0x2,%eax
340: 01 d0 add %edx,%eax
342: 01 c0 add %eax,%eax
344: 89 c1 mov %eax,%ecx
346: 8b 45 08 mov 0x8(%ebp),%eax
349: 8d 50 01 lea 0x1(%eax),%edx
34c: 89 55 08 mov %edx,0x8(%ebp)
34f: 0f b6 00 movzbl (%eax),%eax
352: 0f be c0 movsbl %al,%eax
355: 01 c8 add %ecx,%eax
357: 83 e8 30 sub $0x30,%eax
35a: 89 45 fc mov %eax,-0x4(%ebp)
n = 0;
while (*s == ' ') s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while('0' <= *s && *s <= '9')
35d: 8b 45 08 mov 0x8(%ebp),%eax
360: 0f b6 00 movzbl (%eax),%eax
363: 3c 2f cmp $0x2f,%al
365: 7e 0a jle 371 <atoi+0x89>
367: 8b 45 08 mov 0x8(%ebp),%eax
36a: 0f b6 00 movzbl (%eax),%eax
36d: 3c 39 cmp $0x39,%al
36f: 7e c7 jle 338 <atoi+0x50>
n = n*10 + *s++ - '0';
return sign*n;
371: 8b 45 f8 mov -0x8(%ebp),%eax
374: 0f af 45 fc imul -0x4(%ebp),%eax
}
378: c9 leave
379: c3 ret
0000037a <atoo>:
int
atoo(const char *s)
{
37a: 55 push %ebp
37b: 89 e5 mov %esp,%ebp
37d: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
380: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ') s++;
387: eb 04 jmp 38d <atoo+0x13>
389: 83 45 08 01 addl $0x1,0x8(%ebp)
38d: 8b 45 08 mov 0x8(%ebp),%eax
390: 0f b6 00 movzbl (%eax),%eax
393: 3c 20 cmp $0x20,%al
395: 74 f2 je 389 <atoo+0xf>
sign = (*s == '-') ? -1 : 1;
397: 8b 45 08 mov 0x8(%ebp),%eax
39a: 0f b6 00 movzbl (%eax),%eax
39d: 3c 2d cmp $0x2d,%al
39f: 75 07 jne 3a8 <atoo+0x2e>
3a1: b8 ff ff ff ff mov $0xffffffff,%eax
3a6: eb 05 jmp 3ad <atoo+0x33>
3a8: b8 01 00 00 00 mov $0x1,%eax
3ad: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
3b0: 8b 45 08 mov 0x8(%ebp),%eax
3b3: 0f b6 00 movzbl (%eax),%eax
3b6: 3c 2b cmp $0x2b,%al
3b8: 74 0a je 3c4 <atoo+0x4a>
3ba: 8b 45 08 mov 0x8(%ebp),%eax
3bd: 0f b6 00 movzbl (%eax),%eax
3c0: 3c 2d cmp $0x2d,%al
3c2: 75 27 jne 3eb <atoo+0x71>
s++;
3c4: 83 45 08 01 addl $0x1,0x8(%ebp)
while('0' <= *s && *s <= '7')
3c8: eb 21 jmp 3eb <atoo+0x71>
n = n*8 + *s++ - '0';
3ca: 8b 45 fc mov -0x4(%ebp),%eax
3cd: 8d 0c c5 00 00 00 00 lea 0x0(,%eax,8),%ecx
3d4: 8b 45 08 mov 0x8(%ebp),%eax
3d7: 8d 50 01 lea 0x1(%eax),%edx
3da: 89 55 08 mov %edx,0x8(%ebp)
3dd: 0f b6 00 movzbl (%eax),%eax
3e0: 0f be c0 movsbl %al,%eax
3e3: 01 c8 add %ecx,%eax
3e5: 83 e8 30 sub $0x30,%eax
3e8: 89 45 fc mov %eax,-0x4(%ebp)
n = 0;
while (*s == ' ') s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while('0' <= *s && *s <= '7')
3eb: 8b 45 08 mov 0x8(%ebp),%eax
3ee: 0f b6 00 movzbl (%eax),%eax
3f1: 3c 2f cmp $0x2f,%al
3f3: 7e 0a jle 3ff <atoo+0x85>
3f5: 8b 45 08 mov 0x8(%ebp),%eax
3f8: 0f b6 00 movzbl (%eax),%eax
3fb: 3c 37 cmp $0x37,%al
3fd: 7e cb jle 3ca <atoo+0x50>
n = n*8 + *s++ - '0';
return sign*n;
3ff: 8b 45 f8 mov -0x8(%ebp),%eax
402: 0f af 45 fc imul -0x4(%ebp),%eax
}
406: c9 leave
407: c3 ret
00000408 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
408: 55 push %ebp
409: 89 e5 mov %esp,%ebp
40b: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
40e: 8b 45 08 mov 0x8(%ebp),%eax
411: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
414: 8b 45 0c mov 0xc(%ebp),%eax
417: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
41a: eb 17 jmp 433 <memmove+0x2b>
*dst++ = *src++;
41c: 8b 45 fc mov -0x4(%ebp),%eax
41f: 8d 50 01 lea 0x1(%eax),%edx
422: 89 55 fc mov %edx,-0x4(%ebp)
425: 8b 55 f8 mov -0x8(%ebp),%edx
428: 8d 4a 01 lea 0x1(%edx),%ecx
42b: 89 4d f8 mov %ecx,-0x8(%ebp)
42e: 0f b6 12 movzbl (%edx),%edx
431: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
433: 8b 45 10 mov 0x10(%ebp),%eax
436: 8d 50 ff lea -0x1(%eax),%edx
439: 89 55 10 mov %edx,0x10(%ebp)
43c: 85 c0 test %eax,%eax
43e: 7f dc jg 41c <memmove+0x14>
*dst++ = *src++;
return vdst;
440: 8b 45 08 mov 0x8(%ebp),%eax
}
443: c9 leave
444: c3 ret
00000445 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
445: b8 01 00 00 00 mov $0x1,%eax
44a: cd 40 int $0x40
44c: c3 ret
0000044d <exit>:
SYSCALL(exit)
44d: b8 02 00 00 00 mov $0x2,%eax
452: cd 40 int $0x40
454: c3 ret
00000455 <wait>:
SYSCALL(wait)
455: b8 03 00 00 00 mov $0x3,%eax
45a: cd 40 int $0x40
45c: c3 ret
0000045d <pipe>:
SYSCALL(pipe)
45d: b8 04 00 00 00 mov $0x4,%eax
462: cd 40 int $0x40
464: c3 ret
00000465 <read>:
SYSCALL(read)
465: b8 05 00 00 00 mov $0x5,%eax
46a: cd 40 int $0x40
46c: c3 ret
0000046d <write>:
SYSCALL(write)
46d: b8 10 00 00 00 mov $0x10,%eax
472: cd 40 int $0x40
474: c3 ret
00000475 <close>:
SYSCALL(close)
475: b8 15 00 00 00 mov $0x15,%eax
47a: cd 40 int $0x40
47c: c3 ret
0000047d <kill>:
SYSCALL(kill)
47d: b8 06 00 00 00 mov $0x6,%eax
482: cd 40 int $0x40
484: c3 ret
00000485 <exec>:
SYSCALL(exec)
485: b8 07 00 00 00 mov $0x7,%eax
48a: cd 40 int $0x40
48c: c3 ret
0000048d <open>:
SYSCALL(open)
48d: b8 0f 00 00 00 mov $0xf,%eax
492: cd 40 int $0x40
494: c3 ret
00000495 <mknod>:
SYSCALL(mknod)
495: b8 11 00 00 00 mov $0x11,%eax
49a: cd 40 int $0x40
49c: c3 ret
0000049d <unlink>:
SYSCALL(unlink)
49d: b8 12 00 00 00 mov $0x12,%eax
4a2: cd 40 int $0x40
4a4: c3 ret
000004a5 <fstat>:
SYSCALL(fstat)
4a5: b8 08 00 00 00 mov $0x8,%eax
4aa: cd 40 int $0x40
4ac: c3 ret
000004ad <link>:
SYSCALL(link)
4ad: b8 13 00 00 00 mov $0x13,%eax
4b2: cd 40 int $0x40
4b4: c3 ret
000004b5 <mkdir>:
SYSCALL(mkdir)
4b5: b8 14 00 00 00 mov $0x14,%eax
4ba: cd 40 int $0x40
4bc: c3 ret
000004bd <chdir>:
SYSCALL(chdir)
4bd: b8 09 00 00 00 mov $0x9,%eax
4c2: cd 40 int $0x40
4c4: c3 ret
000004c5 <dup>:
SYSCALL(dup)
4c5: b8 0a 00 00 00 mov $0xa,%eax
4ca: cd 40 int $0x40
4cc: c3 ret
000004cd <getpid>:
SYSCALL(getpid)
4cd: b8 0b 00 00 00 mov $0xb,%eax
4d2: cd 40 int $0x40
4d4: c3 ret
000004d5 <sbrk>:
SYSCALL(sbrk)
4d5: b8 0c 00 00 00 mov $0xc,%eax
4da: cd 40 int $0x40
4dc: c3 ret
000004dd <sleep>:
SYSCALL(sleep)
4dd: b8 0d 00 00 00 mov $0xd,%eax
4e2: cd 40 int $0x40
4e4: c3 ret
000004e5 <uptime>:
SYSCALL(uptime)
4e5: b8 0e 00 00 00 mov $0xe,%eax
4ea: cd 40 int $0x40
4ec: c3 ret
000004ed <halt>:
SYSCALL(halt)
4ed: b8 16 00 00 00 mov $0x16,%eax
4f2: cd 40 int $0x40
4f4: c3 ret
000004f5 <date>:
SYSCALL(date)
4f5: b8 17 00 00 00 mov $0x17,%eax
4fa: cd 40 int $0x40
4fc: c3 ret
000004fd <getuid>:
SYSCALL(getuid)
4fd: b8 18 00 00 00 mov $0x18,%eax
502: cd 40 int $0x40
504: c3 ret
00000505 <getgid>:
SYSCALL(getgid)
505: b8 19 00 00 00 mov $0x19,%eax
50a: cd 40 int $0x40
50c: c3 ret
0000050d <getppid>:
SYSCALL(getppid)
50d: b8 1a 00 00 00 mov $0x1a,%eax
512: cd 40 int $0x40
514: c3 ret
00000515 <setuid>:
SYSCALL(setuid)
515: b8 1b 00 00 00 mov $0x1b,%eax
51a: cd 40 int $0x40
51c: c3 ret
0000051d <setgid>:
SYSCALL(setgid)
51d: b8 1c 00 00 00 mov $0x1c,%eax
522: cd 40 int $0x40
524: c3 ret
00000525 <getprocs>:
SYSCALL(getprocs)
525: b8 1d 00 00 00 mov $0x1d,%eax
52a: cd 40 int $0x40
52c: c3 ret
0000052d <setpriority>:
SYSCALL(setpriority)
52d: b8 1e 00 00 00 mov $0x1e,%eax
532: cd 40 int $0x40
534: c3 ret
00000535 <chmod>:
SYSCALL(chmod)
535: b8 1f 00 00 00 mov $0x1f,%eax
53a: cd 40 int $0x40
53c: c3 ret
0000053d <chown>:
SYSCALL(chown)
53d: b8 20 00 00 00 mov $0x20,%eax
542: cd 40 int $0x40
544: c3 ret
00000545 <chgrp>:
SYSCALL(chgrp)
545: b8 21 00 00 00 mov $0x21,%eax
54a: cd 40 int $0x40
54c: c3 ret
0000054d <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
54d: 55 push %ebp
54e: 89 e5 mov %esp,%ebp
550: 83 ec 18 sub $0x18,%esp
553: 8b 45 0c mov 0xc(%ebp),%eax
556: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
559: 83 ec 04 sub $0x4,%esp
55c: 6a 01 push $0x1
55e: 8d 45 f4 lea -0xc(%ebp),%eax
561: 50 push %eax
562: ff 75 08 pushl 0x8(%ebp)
565: e8 03 ff ff ff call 46d <write>
56a: 83 c4 10 add $0x10,%esp
}
56d: 90 nop
56e: c9 leave
56f: c3 ret
00000570 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
570: 55 push %ebp
571: 89 e5 mov %esp,%ebp
573: 53 push %ebx
574: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
577: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
57e: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
582: 74 17 je 59b <printint+0x2b>
584: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
588: 79 11 jns 59b <printint+0x2b>
neg = 1;
58a: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
591: 8b 45 0c mov 0xc(%ebp),%eax
594: f7 d8 neg %eax
596: 89 45 ec mov %eax,-0x14(%ebp)
599: eb 06 jmp 5a1 <printint+0x31>
} else {
x = xx;
59b: 8b 45 0c mov 0xc(%ebp),%eax
59e: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
5a1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
5a8: 8b 4d f4 mov -0xc(%ebp),%ecx
5ab: 8d 41 01 lea 0x1(%ecx),%eax
5ae: 89 45 f4 mov %eax,-0xc(%ebp)
5b1: 8b 5d 10 mov 0x10(%ebp),%ebx
5b4: 8b 45 ec mov -0x14(%ebp),%eax
5b7: ba 00 00 00 00 mov $0x0,%edx
5bc: f7 f3 div %ebx
5be: 89 d0 mov %edx,%eax
5c0: 0f b6 80 8c 0c 00 00 movzbl 0xc8c(%eax),%eax
5c7: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
5cb: 8b 5d 10 mov 0x10(%ebp),%ebx
5ce: 8b 45 ec mov -0x14(%ebp),%eax
5d1: ba 00 00 00 00 mov $0x0,%edx
5d6: f7 f3 div %ebx
5d8: 89 45 ec mov %eax,-0x14(%ebp)
5db: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
5df: 75 c7 jne 5a8 <printint+0x38>
if(neg)
5e1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
5e5: 74 2d je 614 <printint+0xa4>
buf[i++] = '-';
5e7: 8b 45 f4 mov -0xc(%ebp),%eax
5ea: 8d 50 01 lea 0x1(%eax),%edx
5ed: 89 55 f4 mov %edx,-0xc(%ebp)
5f0: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
5f5: eb 1d jmp 614 <printint+0xa4>
putc(fd, buf[i]);
5f7: 8d 55 dc lea -0x24(%ebp),%edx
5fa: 8b 45 f4 mov -0xc(%ebp),%eax
5fd: 01 d0 add %edx,%eax
5ff: 0f b6 00 movzbl (%eax),%eax
602: 0f be c0 movsbl %al,%eax
605: 83 ec 08 sub $0x8,%esp
608: 50 push %eax
609: ff 75 08 pushl 0x8(%ebp)
60c: e8 3c ff ff ff call 54d <putc>
611: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
614: 83 6d f4 01 subl $0x1,-0xc(%ebp)
618: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
61c: 79 d9 jns 5f7 <printint+0x87>
putc(fd, buf[i]);
}
61e: 90 nop
61f: 8b 5d fc mov -0x4(%ebp),%ebx
622: c9 leave
623: c3 ret
00000624 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
624: 55 push %ebp
625: 89 e5 mov %esp,%ebp
627: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
62a: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
631: 8d 45 0c lea 0xc(%ebp),%eax
634: 83 c0 04 add $0x4,%eax
637: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
63a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
641: e9 59 01 00 00 jmp 79f <printf+0x17b>
c = fmt[i] & 0xff;
646: 8b 55 0c mov 0xc(%ebp),%edx
649: 8b 45 f0 mov -0x10(%ebp),%eax
64c: 01 d0 add %edx,%eax
64e: 0f b6 00 movzbl (%eax),%eax
651: 0f be c0 movsbl %al,%eax
654: 25 ff 00 00 00 and $0xff,%eax
659: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
65c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
660: 75 2c jne 68e <printf+0x6a>
if(c == '%'){
662: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
666: 75 0c jne 674 <printf+0x50>
state = '%';
668: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
66f: e9 27 01 00 00 jmp 79b <printf+0x177>
} else {
putc(fd, c);
674: 8b 45 e4 mov -0x1c(%ebp),%eax
677: 0f be c0 movsbl %al,%eax
67a: 83 ec 08 sub $0x8,%esp
67d: 50 push %eax
67e: ff 75 08 pushl 0x8(%ebp)
681: e8 c7 fe ff ff call 54d <putc>
686: 83 c4 10 add $0x10,%esp
689: e9 0d 01 00 00 jmp 79b <printf+0x177>
}
} else if(state == '%'){
68e: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
692: 0f 85 03 01 00 00 jne 79b <printf+0x177>
if(c == 'd'){
698: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
69c: 75 1e jne 6bc <printf+0x98>
printint(fd, *ap, 10, 1);
69e: 8b 45 e8 mov -0x18(%ebp),%eax
6a1: 8b 00 mov (%eax),%eax
6a3: 6a 01 push $0x1
6a5: 6a 0a push $0xa
6a7: 50 push %eax
6a8: ff 75 08 pushl 0x8(%ebp)
6ab: e8 c0 fe ff ff call 570 <printint>
6b0: 83 c4 10 add $0x10,%esp
ap++;
6b3: 83 45 e8 04 addl $0x4,-0x18(%ebp)
6b7: e9 d8 00 00 00 jmp 794 <printf+0x170>
} else if(c == 'x' || c == 'p'){
6bc: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
6c0: 74 06 je 6c8 <printf+0xa4>
6c2: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
6c6: 75 1e jne 6e6 <printf+0xc2>
printint(fd, *ap, 16, 0);
6c8: 8b 45 e8 mov -0x18(%ebp),%eax
6cb: 8b 00 mov (%eax),%eax
6cd: 6a 00 push $0x0
6cf: 6a 10 push $0x10
6d1: 50 push %eax
6d2: ff 75 08 pushl 0x8(%ebp)
6d5: e8 96 fe ff ff call 570 <printint>
6da: 83 c4 10 add $0x10,%esp
ap++;
6dd: 83 45 e8 04 addl $0x4,-0x18(%ebp)
6e1: e9 ae 00 00 00 jmp 794 <printf+0x170>
} else if(c == 's'){
6e6: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
6ea: 75 43 jne 72f <printf+0x10b>
s = (char*)*ap;
6ec: 8b 45 e8 mov -0x18(%ebp),%eax
6ef: 8b 00 mov (%eax),%eax
6f1: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
6f4: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
6f8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
6fc: 75 25 jne 723 <printf+0xff>
s = "(null)";
6fe: c7 45 f4 17 0a 00 00 movl $0xa17,-0xc(%ebp)
while(*s != 0){
705: eb 1c jmp 723 <printf+0xff>
putc(fd, *s);
707: 8b 45 f4 mov -0xc(%ebp),%eax
70a: 0f b6 00 movzbl (%eax),%eax
70d: 0f be c0 movsbl %al,%eax
710: 83 ec 08 sub $0x8,%esp
713: 50 push %eax
714: ff 75 08 pushl 0x8(%ebp)
717: e8 31 fe ff ff call 54d <putc>
71c: 83 c4 10 add $0x10,%esp
s++;
71f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
723: 8b 45 f4 mov -0xc(%ebp),%eax
726: 0f b6 00 movzbl (%eax),%eax
729: 84 c0 test %al,%al
72b: 75 da jne 707 <printf+0xe3>
72d: eb 65 jmp 794 <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
72f: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
733: 75 1d jne 752 <printf+0x12e>
putc(fd, *ap);
735: 8b 45 e8 mov -0x18(%ebp),%eax
738: 8b 00 mov (%eax),%eax
73a: 0f be c0 movsbl %al,%eax
73d: 83 ec 08 sub $0x8,%esp
740: 50 push %eax
741: ff 75 08 pushl 0x8(%ebp)
744: e8 04 fe ff ff call 54d <putc>
749: 83 c4 10 add $0x10,%esp
ap++;
74c: 83 45 e8 04 addl $0x4,-0x18(%ebp)
750: eb 42 jmp 794 <printf+0x170>
} else if(c == '%'){
752: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
756: 75 17 jne 76f <printf+0x14b>
putc(fd, c);
758: 8b 45 e4 mov -0x1c(%ebp),%eax
75b: 0f be c0 movsbl %al,%eax
75e: 83 ec 08 sub $0x8,%esp
761: 50 push %eax
762: ff 75 08 pushl 0x8(%ebp)
765: e8 e3 fd ff ff call 54d <putc>
76a: 83 c4 10 add $0x10,%esp
76d: eb 25 jmp 794 <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
76f: 83 ec 08 sub $0x8,%esp
772: 6a 25 push $0x25
774: ff 75 08 pushl 0x8(%ebp)
777: e8 d1 fd ff ff call 54d <putc>
77c: 83 c4 10 add $0x10,%esp
putc(fd, c);
77f: 8b 45 e4 mov -0x1c(%ebp),%eax
782: 0f be c0 movsbl %al,%eax
785: 83 ec 08 sub $0x8,%esp
788: 50 push %eax
789: ff 75 08 pushl 0x8(%ebp)
78c: e8 bc fd ff ff call 54d <putc>
791: 83 c4 10 add $0x10,%esp
}
state = 0;
794: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
79b: 83 45 f0 01 addl $0x1,-0x10(%ebp)
79f: 8b 55 0c mov 0xc(%ebp),%edx
7a2: 8b 45 f0 mov -0x10(%ebp),%eax
7a5: 01 d0 add %edx,%eax
7a7: 0f b6 00 movzbl (%eax),%eax
7aa: 84 c0 test %al,%al
7ac: 0f 85 94 fe ff ff jne 646 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
7b2: 90 nop
7b3: c9 leave
7b4: c3 ret
000007b5 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
7b5: 55 push %ebp
7b6: 89 e5 mov %esp,%ebp
7b8: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
7bb: 8b 45 08 mov 0x8(%ebp),%eax
7be: 83 e8 08 sub $0x8,%eax
7c1: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7c4: a1 a8 0c 00 00 mov 0xca8,%eax
7c9: 89 45 fc mov %eax,-0x4(%ebp)
7cc: eb 24 jmp 7f2 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7ce: 8b 45 fc mov -0x4(%ebp),%eax
7d1: 8b 00 mov (%eax),%eax
7d3: 3b 45 fc cmp -0x4(%ebp),%eax
7d6: 77 12 ja 7ea <free+0x35>
7d8: 8b 45 f8 mov -0x8(%ebp),%eax
7db: 3b 45 fc cmp -0x4(%ebp),%eax
7de: 77 24 ja 804 <free+0x4f>
7e0: 8b 45 fc mov -0x4(%ebp),%eax
7e3: 8b 00 mov (%eax),%eax
7e5: 3b 45 f8 cmp -0x8(%ebp),%eax
7e8: 77 1a ja 804 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7ea: 8b 45 fc mov -0x4(%ebp),%eax
7ed: 8b 00 mov (%eax),%eax
7ef: 89 45 fc mov %eax,-0x4(%ebp)
7f2: 8b 45 f8 mov -0x8(%ebp),%eax
7f5: 3b 45 fc cmp -0x4(%ebp),%eax
7f8: 76 d4 jbe 7ce <free+0x19>
7fa: 8b 45 fc mov -0x4(%ebp),%eax
7fd: 8b 00 mov (%eax),%eax
7ff: 3b 45 f8 cmp -0x8(%ebp),%eax
802: 76 ca jbe 7ce <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
804: 8b 45 f8 mov -0x8(%ebp),%eax
807: 8b 40 04 mov 0x4(%eax),%eax
80a: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
811: 8b 45 f8 mov -0x8(%ebp),%eax
814: 01 c2 add %eax,%edx
816: 8b 45 fc mov -0x4(%ebp),%eax
819: 8b 00 mov (%eax),%eax
81b: 39 c2 cmp %eax,%edx
81d: 75 24 jne 843 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
81f: 8b 45 f8 mov -0x8(%ebp),%eax
822: 8b 50 04 mov 0x4(%eax),%edx
825: 8b 45 fc mov -0x4(%ebp),%eax
828: 8b 00 mov (%eax),%eax
82a: 8b 40 04 mov 0x4(%eax),%eax
82d: 01 c2 add %eax,%edx
82f: 8b 45 f8 mov -0x8(%ebp),%eax
832: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
835: 8b 45 fc mov -0x4(%ebp),%eax
838: 8b 00 mov (%eax),%eax
83a: 8b 10 mov (%eax),%edx
83c: 8b 45 f8 mov -0x8(%ebp),%eax
83f: 89 10 mov %edx,(%eax)
841: eb 0a jmp 84d <free+0x98>
} else
bp->s.ptr = p->s.ptr;
843: 8b 45 fc mov -0x4(%ebp),%eax
846: 8b 10 mov (%eax),%edx
848: 8b 45 f8 mov -0x8(%ebp),%eax
84b: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
84d: 8b 45 fc mov -0x4(%ebp),%eax
850: 8b 40 04 mov 0x4(%eax),%eax
853: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
85a: 8b 45 fc mov -0x4(%ebp),%eax
85d: 01 d0 add %edx,%eax
85f: 3b 45 f8 cmp -0x8(%ebp),%eax
862: 75 20 jne 884 <free+0xcf>
p->s.size += bp->s.size;
864: 8b 45 fc mov -0x4(%ebp),%eax
867: 8b 50 04 mov 0x4(%eax),%edx
86a: 8b 45 f8 mov -0x8(%ebp),%eax
86d: 8b 40 04 mov 0x4(%eax),%eax
870: 01 c2 add %eax,%edx
872: 8b 45 fc mov -0x4(%ebp),%eax
875: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
878: 8b 45 f8 mov -0x8(%ebp),%eax
87b: 8b 10 mov (%eax),%edx
87d: 8b 45 fc mov -0x4(%ebp),%eax
880: 89 10 mov %edx,(%eax)
882: eb 08 jmp 88c <free+0xd7>
} else
p->s.ptr = bp;
884: 8b 45 fc mov -0x4(%ebp),%eax
887: 8b 55 f8 mov -0x8(%ebp),%edx
88a: 89 10 mov %edx,(%eax)
freep = p;
88c: 8b 45 fc mov -0x4(%ebp),%eax
88f: a3 a8 0c 00 00 mov %eax,0xca8
}
894: 90 nop
895: c9 leave
896: c3 ret
00000897 <morecore>:
static Header*
morecore(uint nu)
{
897: 55 push %ebp
898: 89 e5 mov %esp,%ebp
89a: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
89d: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
8a4: 77 07 ja 8ad <morecore+0x16>
nu = 4096;
8a6: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
8ad: 8b 45 08 mov 0x8(%ebp),%eax
8b0: c1 e0 03 shl $0x3,%eax
8b3: 83 ec 0c sub $0xc,%esp
8b6: 50 push %eax
8b7: e8 19 fc ff ff call 4d5 <sbrk>
8bc: 83 c4 10 add $0x10,%esp
8bf: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
8c2: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
8c6: 75 07 jne 8cf <morecore+0x38>
return 0;
8c8: b8 00 00 00 00 mov $0x0,%eax
8cd: eb 26 jmp 8f5 <morecore+0x5e>
hp = (Header*)p;
8cf: 8b 45 f4 mov -0xc(%ebp),%eax
8d2: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
8d5: 8b 45 f0 mov -0x10(%ebp),%eax
8d8: 8b 55 08 mov 0x8(%ebp),%edx
8db: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
8de: 8b 45 f0 mov -0x10(%ebp),%eax
8e1: 83 c0 08 add $0x8,%eax
8e4: 83 ec 0c sub $0xc,%esp
8e7: 50 push %eax
8e8: e8 c8 fe ff ff call 7b5 <free>
8ed: 83 c4 10 add $0x10,%esp
return freep;
8f0: a1 a8 0c 00 00 mov 0xca8,%eax
}
8f5: c9 leave
8f6: c3 ret
000008f7 <malloc>:
void*
malloc(uint nbytes)
{
8f7: 55 push %ebp
8f8: 89 e5 mov %esp,%ebp
8fa: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
8fd: 8b 45 08 mov 0x8(%ebp),%eax
900: 83 c0 07 add $0x7,%eax
903: c1 e8 03 shr $0x3,%eax
906: 83 c0 01 add $0x1,%eax
909: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
90c: a1 a8 0c 00 00 mov 0xca8,%eax
911: 89 45 f0 mov %eax,-0x10(%ebp)
914: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
918: 75 23 jne 93d <malloc+0x46>
base.s.ptr = freep = prevp = &base;
91a: c7 45 f0 a0 0c 00 00 movl $0xca0,-0x10(%ebp)
921: 8b 45 f0 mov -0x10(%ebp),%eax
924: a3 a8 0c 00 00 mov %eax,0xca8
929: a1 a8 0c 00 00 mov 0xca8,%eax
92e: a3 a0 0c 00 00 mov %eax,0xca0
base.s.size = 0;
933: c7 05 a4 0c 00 00 00 movl $0x0,0xca4
93a: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
93d: 8b 45 f0 mov -0x10(%ebp),%eax
940: 8b 00 mov (%eax),%eax
942: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
945: 8b 45 f4 mov -0xc(%ebp),%eax
948: 8b 40 04 mov 0x4(%eax),%eax
94b: 3b 45 ec cmp -0x14(%ebp),%eax
94e: 72 4d jb 99d <malloc+0xa6>
if(p->s.size == nunits)
950: 8b 45 f4 mov -0xc(%ebp),%eax
953: 8b 40 04 mov 0x4(%eax),%eax
956: 3b 45 ec cmp -0x14(%ebp),%eax
959: 75 0c jne 967 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
95b: 8b 45 f4 mov -0xc(%ebp),%eax
95e: 8b 10 mov (%eax),%edx
960: 8b 45 f0 mov -0x10(%ebp),%eax
963: 89 10 mov %edx,(%eax)
965: eb 26 jmp 98d <malloc+0x96>
else {
p->s.size -= nunits;
967: 8b 45 f4 mov -0xc(%ebp),%eax
96a: 8b 40 04 mov 0x4(%eax),%eax
96d: 2b 45 ec sub -0x14(%ebp),%eax
970: 89 c2 mov %eax,%edx
972: 8b 45 f4 mov -0xc(%ebp),%eax
975: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
978: 8b 45 f4 mov -0xc(%ebp),%eax
97b: 8b 40 04 mov 0x4(%eax),%eax
97e: c1 e0 03 shl $0x3,%eax
981: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
984: 8b 45 f4 mov -0xc(%ebp),%eax
987: 8b 55 ec mov -0x14(%ebp),%edx
98a: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
98d: 8b 45 f0 mov -0x10(%ebp),%eax
990: a3 a8 0c 00 00 mov %eax,0xca8
return (void*)(p + 1);
995: 8b 45 f4 mov -0xc(%ebp),%eax
998: 83 c0 08 add $0x8,%eax
99b: eb 3b jmp 9d8 <malloc+0xe1>
}
if(p == freep)
99d: a1 a8 0c 00 00 mov 0xca8,%eax
9a2: 39 45 f4 cmp %eax,-0xc(%ebp)
9a5: 75 1e jne 9c5 <malloc+0xce>
if((p = morecore(nunits)) == 0)
9a7: 83 ec 0c sub $0xc,%esp
9aa: ff 75 ec pushl -0x14(%ebp)
9ad: e8 e5 fe ff ff call 897 <morecore>
9b2: 83 c4 10 add $0x10,%esp
9b5: 89 45 f4 mov %eax,-0xc(%ebp)
9b8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
9bc: 75 07 jne 9c5 <malloc+0xce>
return 0;
9be: b8 00 00 00 00 mov $0x0,%eax
9c3: eb 13 jmp 9d8 <malloc+0xe1>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
9c5: 8b 45 f4 mov -0xc(%ebp),%eax
9c8: 89 45 f0 mov %eax,-0x10(%ebp)
9cb: 8b 45 f4 mov -0xc(%ebp),%eax
9ce: 8b 00 mov (%eax),%eax
9d0: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
9d3: e9 6d ff ff ff jmp 945 <malloc+0x4e>
}
9d8: c9 leave
9d9: c3 ret
| 34.690984 | 85 | 0.422271 |
9685121fcd315ad53f59b640a831d816e208054d | 479 | asm | Assembly | programs/oeis/117/A117368.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/117/A117368.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/117/A117368.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A117368: a(n) = largest prime less than the smallest prime dividing (2n-1).
; 2,3,5,2,7,11,2,13,17,2,19,3,2,23,29,2,3,31,2,37,41,2,43,5,2,47,3,2,53,59,2,3,61,2,67,71,2,5,73,2,79,3,2,83,5,2,3,89,2,97,101,2,103,107,2,109,3,2,5,7,2,3,113,2,127,5,2,131,137,2,7,3,2,139,149,2,3,151,2,5,157,2,163,11,2,167,3,2,173,179,2,3,7,2,181,191,2,193,197,2
seq $0,38802 ; Factor 2n+1 = (2^m1)*(3^m2)*(5^m3)*...; a(n) = number of initial zero exponents.
sub $0,1
seq $0,40 ; The prime numbers.
| 68.428571 | 263 | 0.628392 |
ef74d5b35bf54702679d89dd5137cf09f383daec | 419 | asm | Assembly | programs/oeis/131/A131670.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/131/A131670.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/131/A131670.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A131670: Period 5: repeat [1, 0, -1, 0, 1].
; 1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1,1,0,-1,0,1
add $0,1
seq $0,105734 ; For n>2, a(n) > 0 is such that a(n-1)^2+4*a(n-2)*a(n) is a minimal square, with a(1)=1, a(2)=1.
mov $1,2
sub $1,$0
mov $0,$1
| 46.555556 | 221 | 0.498807 |
1649e5ab4a66c1a539b7aa7a12664aaa04a4011a | 927 | asm | Assembly | libsrc/_DEVELOPMENT/stdlib/z80/__dtoa_remove_zeroes.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/stdlib/z80/__dtoa_remove_zeroes.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/stdlib/z80/__dtoa_remove_zeroes.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | null | null | null |
SECTION code_clib
SECTION code_stdlib
PUBLIC __dtoa_remove_zeroes
__dtoa_remove_zeroes:
; HL = buffer_dst *
; IX = buffer *
; (IX-6) = flags, bit 7 = 'N', bit 4 = '#', bit 0 = precision==0
; (IX-5) = iz (number of zeroes to insert before .)
; (IX-4) = fz (number of zeroes to insert after .)
; (IX-3) = tz (number of zeroes to append)
; (IX-2) = ignore
; (IX-1) = '0' marks start of buffer
bit 4,(ix-6)
ret nz ; if # flag
ld (ix-3),0 ; eliminate trailing zeroes
ld a,'0'
loop_zeroes:
dec hl
cp (hl)
jr z, loop_zeroes
ld a,'.'
cp (hl)
inc hl
ret nz ; if not at decimal point
ld (ix-4),0 ; eliminate leading fraction zeroes
bit 0,(ix-6)
ret nz ; if precision != 0
dec hl ; remove decimal point
ret
| 21.068182 | 67 | 0.497303 |
52310ce57d1c89c55fdcc0078f927c1a5a862ee8 | 3,243 | asm | Assembly | SUMA 0.1.asm | Jon2G/ASMCalculator | f3181d12eae11f557965d43dfb48fecabecaef2e | [
"MIT"
] | null | null | null | SUMA 0.1.asm | Jon2G/ASMCalculator | f3181d12eae11f557965d43dfb48fecabecaef2e | [
"MIT"
] | null | null | null | SUMA 0.1.asm | Jon2G/ASMCalculator | f3181d12eae11f557965d43dfb48fecabecaef2e | [
"MIT"
] | null | null | null | .model small
.data
num1 db 1,1,'$',0,0,0,0,0,0
decimales_1 db 9,5,'$',0,0,0,0,0,0
num2 db 2,9,'$',0,0,0,0,0,0
decimales_2 db 9,5,'$',0,0,0,0,0,0
num_res db 0,0,0,0,0,0,0,0,0,'$'
decimales_Res db 0,0,0,0,0,0,0,0,0,'$'
Acarreo_ParaEntero db 0
posicion_ultimo_entero dw 0
.stack
.code
mov ax,@data
mov ds,ax
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;SUMAR PARTES ENTERAS SIN IMPORTAR ACARREOS
MOV SI,8h
JMP siguiente_entero
fin_enteros:
MOV num_res[SI],'$'
DEC SI
JMP siguiente_entero
siguiente_entero:
MOV AL,num1[SI]
CMP AL,24h ;si es el fin de cadena
JE fin_enteros
ADD AL,num2[SI]
MOV num_res[SI],AL
DEC SI
JNS siguiente_entero
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;SUMAR PARTES DECIMALES SIN IMPORTAR ACARREOS
MOV SI,8h
JMP siguiente_decimal
fin_decimales:
MOV decimales_Res[SI],'$'
DEC SI
JMP siguiente_decimal
siguiente_decimal:
MOV AL,decimales_1[SI]
CMP AL,24h ;si es el fin de cadena
JE fin_decimales
ADD AL,decimales_2[SI]
MOV decimales_Res[SI],AL
DEC SI
JNS siguiente_decimal
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;AJUSTAR LOS ACARREOS DECIMALES
MOV SI,8h
JMP siguiente_Acarreo_decimal
;
es_fin_decimal:
DEC SI
JMP siguiente_Acarreo_decimal
;
AcarreoDecimal:
MOV Al,decimales_Res[SI]
AAM
;;si es el primer numero decimal deselo a los enteros
cmp SI,0000h
JNE no_es_primero
JMP es_primero
;;
no_es_primero:
ADD decimales_Res[SI-1],Ah
MOV decimales_Res[SI],Al
DEC SI
JMP siguiente_Acarreo_decimal:
es_primero:
;;--> es primero
ADD Acarreo_ParaEntero,Ah
MOV decimales_Res[SI],Al
DEC SI
;;fin el primero
siguiente_Acarreo_decimal:
CMP decimales_Res[SI],'$'
JE es_fin_decimal
CMP decimales_Res[SI],0Ah
JAE AcarreoDecimal
DEC SI
JNS siguiente_Acarreo_decimal
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;AJUSTAR LOS ACARREOS ENTEROS
MOV SI,8h
JMP siguiente_Acarreo_entero
;
es_fin_entero:
DEC SI
MOV posicion_ultimo_entero,SI
JMP siguiente_Acarreo_entero
;
AcarreoEntero:
MOV Al,num_res[SI]
AAM
ADD num_res[SI-1],Ah
MOV num_res[SI],Al
DEC SI
siguiente_Acarreo_entero:
CMP decimales_Res[SI],'$'
JE es_fin_entero
CMP num_res[SI],0Ah
JAE AcarreoEntero
DEC SI
JNS siguiente_Acarreo_entero
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;AGREGAR ACARREOS PENDIENTES
MOV SI,posicion_ultimo_entero
MOV AL,num_res[SI]
ADD AL,Acarreo_ParaEntero
MOV num_res[SI],AL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;AJUSTAR PARA IMPRESION
;;ajustar la parte entera
MOV SI,8h
JMP inicia_ajuste
salta_fin:
DEC SI
JMP inicia_ajuste
inicia_ajuste:
MOV AL,num_res[SI]
CMP AL,24h
JE salta_fin
ADD AL,30h
MOV num_res[SI],AL
DEC SI
JNS inicia_ajuste
;;ajustar la parte decimal
MOV SI,8h
JMP inicia_ajuste_d
salta_fin_d:
DEC SI
JMP inicia_ajuste_d
inicia_ajuste_d:
MOV AL,decimales_Res[SI]
CMP AL,24h
JE salta_fin_d
ADD AL,30h
MOV decimales_Res[SI],AL
DEC SI
JNS inicia_ajuste_d
;;IMPRIMIR RESULTADO
LEA DX,num_res
MOV AH,09
INT 21H
MOV AH,02
MOV DL,'.'
INT 21H
LEA DX,decimales_Res
MOV AH,09
INT 21H | 17.721311 | 53 | 0.641998 |
b94c9ba90aa59b4014f1c0781d797f421e640eec | 2,575 | asm | Assembly | examples/matrix.asm | Dreistein/toyvm | 0a3697ec46a746ccb47cd4903e1b111fa59e1f28 | [
"MIT"
] | 2 | 2021-01-25T14:34:13.000Z | 2021-05-19T01:16:30.000Z | examples/matrix.asm | Dreistein/toyvm | 0a3697ec46a746ccb47cd4903e1b111fa59e1f28 | [
"MIT"
] | 6 | 2018-03-01T19:48:31.000Z | 2018-10-18T07:52:34.000Z | examples/matrix.asm | Dreistein/toyvm | 0a3697ec46a746ccb47cd4903e1b111fa59e1f28 | [
"MIT"
] | 2 | 2018-05-18T02:55:04.000Z | 2020-10-02T21:57:31.000Z |
_START:
PUSH $MAT_RES
PUSH $MAT_B
PUSH $MAT_A
PUSH @$P_SIZE
PUSH @$N_SIZE
PUSH @$M_SIZE
CALL $MUL_MAT
MOV R0 0
MOV R1 $MAT_RES
MOV R2 @$N_SIZE # n*m for max index
MUL R2 @$P_SIZE
ADD R2 $MAT_RES
OUTP_LOOP:
OUT @R1 0
INC R1
INC R0
MOV R3 @$P_SIZE
SUB R3 R0
JNZ $AFTER_ROW_END_CHECK
MOV R4 @$LF
OUT R4 1
MOV R0 0
AFTER_ROW_END_CHECK:
MOV R3 R2
SUB R3 R1
JNZ $OUTP_LOOP
MOV R0 $MAT_RES
HLT
# end _START
# calculates C = A x B
# expects m n p a_addr b_addr o_addr on stack
MUL_MAT:
# prolog
PUSH SB
MOV SB SP
PUSH SB
# stack pointer to general purpose
# register for easy addressing
MOV R0 SB
#@2[R0] # m
#@3[R0] # n
#@4[R0] # p
#@5[R0] # a_addr
#@6[R0] # b_addr
#@7[R0] # o_addr
# save st base
# we are using r12
MOV R3 0 # tmpAdd = 0
MOV R2 0 # i = 0 to N
OUTER_LOOP:
# move values to registers
MOV R5 @5[R0] # A_addr[tmpAdd]
ADD R5 R3
MOV R6 @7[R0] # O_addr[tmpAdd]
ADD R6 R3
CALL $MUL_ROW
MOV R3 R3 # ------------------------------
# update loop variables
ADD R3 @3[R0] # tmpAdd += N
INC R2
MOV R1 @3[R0]
SUB R1 R2
JNZ $OUTER_LOOP
#jmp $MUL_MAT_EPI
MOV PC $MUL_MAT_EPI
# expects R5 = Arow R6 = outrow
MUL_ROW:
MOV R4 0 # i=0 to P
MUL_ROW_LOOP:
# move values to registers
MOV R10 R5 # ARow
MOV R11 @6[R0] # MAT_B[i]
ADD R11 R4
MOV R12 R6 # OUT[i]
ADD R12 R4
CALL $MUL_CELL
# increment and test loop
INC R4
MOV R12 @4[R0]
SUB R12 R4
JNZ $MUL_ROW_LOOP
RET
# expects a_ind=R10, b_ind=R11, out=R12
MUL_CELL:
MOV @R12, 0 # out=0
MOV R9, 0 # i=0 to M
MUL_CELL_LOOP:
MOV R8 R10
ADD R8 R9
MOV R8 @R8
MUL R8, @R11
ADD @R12, R8
ADD R11, @4[R0]
INC R9
MOV R7, @4[R0]
SUB R7 R9
JNZ $MUL_CELL_LOOP
RET
MUL_MAT_EPI:
# epilog
POP SB
MOV SP SB
POP SB
RET
# end MUL_MAT
N_SIZE:
DW 2
M_SIZE:
DW 2
P_SIZE:
DW 2
MAT_A: # size N x M
DW 1 2
DW 3 4
MAT_B: # size M x P
DW 4 3
DW 2 1
MAT_RES:
DW 0 0
DW 0 0
LF:
DW 10 | 18.52518 | 50 | 0.471068 |
51b64992b639aa576e5d96f36eac78c172e36d5c | 497 | asm | Assembly | scripts/lavendermart.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 16 | 2018-08-28T21:47:01.000Z | 2022-02-20T20:29:59.000Z | scripts/lavendermart.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 5 | 2019-04-03T19:53:11.000Z | 2022-03-11T22:49:34.000Z | scripts/lavendermart.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 2 | 2019-12-09T19:46:02.000Z | 2020-12-05T21:36:30.000Z | LavenderMartScript:
jp EnableAutoTextBoxDrawing
LavenderMartTextPointers:
dw LavenderCashierText
dw LavenderMartText2
dw LavenderMartText3
LavenderMartText2:
TX_FAR _LavenderMartText2
db "@"
LavenderMartText3:
TX_ASM
CheckEvent EVENT_RESCUED_MR_FUJI
jr nz, .Nugget
ld hl, .ReviveText
call PrintText
jr .done
.Nugget
ld hl, .NuggetText
call PrintText
.done
jp TextScriptEnd
.ReviveText
TX_FAR _LavenderMartReviveText
db "@"
.NuggetText
TX_FAR _LavenderMartNuggetText
db "@"
| 15.060606 | 33 | 0.806841 |
4abedd9b84feb771839014700a50867daa7f3309 | 269 | asm | Assembly | Arithmetic operations/Division/division_float.asm | berkcetinsaya/MIPSLanguageExamples | e1ec7ae15a38621e09fcf211f033497c495ee06b | [
"Apache-2.0"
] | null | null | null | Arithmetic operations/Division/division_float.asm | berkcetinsaya/MIPSLanguageExamples | e1ec7ae15a38621e09fcf211f033497c495ee06b | [
"Apache-2.0"
] | null | null | null | Arithmetic operations/Division/division_float.asm | berkcetinsaya/MIPSLanguageExamples | e1ec7ae15a38621e09fcf211f033497c495ee06b | [
"Apache-2.0"
] | null | null | null | .data
number1: .float 5.0 # float variable number1 created
number2: .float 2.0 # float variable number2 created
.text
lwc1 $f2, number1 # number1 loaded into register $f2
lwc1 $f3, number2 # number2 loaded into register $f3
div.s $f0, $f2, $f3 # $f0 = $f2 / $f3
| 29.888889 | 53 | 0.69145 |
ad3be1c8e44d0163fdeffcc7ec69df46548671a0 | 379 | asm | Assembly | libsrc/games/enterprise/joystick.asm | grancier/z180 | e83f35e36c9b4d1457e40585019430e901c86ed9 | [
"ClArtistic"
] | null | null | null | libsrc/games/enterprise/joystick.asm | grancier/z180 | e83f35e36c9b4d1457e40585019430e901c86ed9 | [
"ClArtistic"
] | null | null | null | libsrc/games/enterprise/joystick.asm | grancier/z180 | e83f35e36c9b4d1457e40585019430e901c86ed9 | [
"ClArtistic"
] | 1 | 2019-12-03T23:57:48.000Z | 2019-12-03T23:57:48.000Z | ;
; Game device library for the Enterprise 64/128
; Stefano Bodrato - Mar 2011
;
; $Id: joystick.asm,v 1.4 2016/06/16 20:23:51 dom Exp $
;
SECTION code_clib
PUBLIC joystick
PUBLIC _joystick
INCLUDE "enterprise.def"
.joystick
._joystick
;__FASTALL__ : joystick no. in HL
ld c,l
ld b,FN_JOY
rst 30h
defb 11
ld h,0
ld l,c
ret
| 14.576923 | 55 | 0.627968 |
9919533765951cd5fb2aeb89c814efd04090a990 | 2,057 | asm | Assembly | programs/oeis/164/A164303.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/164/A164303.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/164/A164303.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A164303: a(n) = 2*a(n-1) + a(n-2) for n > 1; a(0) = 3, a(1) = 11.
; 3,11,25,61,147,355,857,2069,4995,12059,29113,70285,169683,409651,988985,2387621,5764227,13916075,33596377,81108829,195814035,472736899,1141287833,2755312565,6651912963,16059138491,38770189945,93599518381,225969226707,545537971795,1317045170297,3179628312389,7676301795075,18532231902539,44740765600153,108013763102845,260768291805843,629550346714531,1519868985234905,3669288317184341,8858445619603587,21386179556391515,51630804732386617,124647789021164749,300926382774716115,726500554570596979,1753927491915910073,4234355538402417125,10222638568720744323,24679632675843905771,59581903920408555865,143843440516661017501,347268784953730590867,838381010424122199235,2024030805801974989337,4886442622028072177909,11796916049858119345155,28480274721744310868219,68757465493346741081593,165995205708437793031405,400747876910222327144403,967490959528882447320211,2335729795967987221784825,5638950551464856890889861,13613630898897701003564547,32866212349260258898018955,79346055597418218799602457,191558323544096696497223869,462462702685611611794050195,1116483728915319920085324259,2695430160516251451964698713,6507344049947822824014721685,15710118260411897099994142083,37927580570771617024003005851,91565279401955131148000153785,221058139374681879320003313421,533681558151318889788006780627,1288421255677319658896016874675,3110524069505958207580040529977,7509469394689236074056097934629,18129462858884430355692236399235,43768395112458096785440570733099,105666253083800623926573377865433,255100901280059344638587326463965,615868055643919313203748030793363,1486837012567897971046083388050691,3589542080779715255295914806894745,8665921174127328481637913001840181,20921384429034372218571740810575107,50508690032196072918781394622990395,121938764493426518056134530056555897,294386219019049109031050454736102189,710711202531524736118235439528760275
mov $2,7
mov $3,3
mov $4,1
lpb $0
sub $0,1
sub $2,3
add $3,3
add $4,$2
mov $2,$3
sub $2,3
add $3,$4
mov $4,$3
lpe
add $1,$3
mov $0,$1
| 108.263158 | 1,837 | 0.895965 |
368add7a636d2646d787e25b1b3fd13cbbefd5dd | 1,191 | asm | Assembly | programs/oeis/214/A214489.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/214/A214489.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/214/A214489.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A214489: Numbers m such that A070939(m) = A070939(m + A070939(m)), A070939 = length of binary representation.
; 0,4,8,9,10,11,16,17,18,19,20,21,22,23,24,25,26,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,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,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,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
lpb $0,1
add $3,4
mov $2,$3
sub $2,1
add $0,$2
sub $0,1
mov $1,$0
add $1,5
mul $3,2
sub $3,1
add $4,$2
trn $0,$4
sub $3,3
lpe
trn $1,4
| 62.684211 | 918 | 0.690176 |
3c542601c5cc294933255f35600a17e219881413 | 2,787 | asm | Assembly | uti/exfilter.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | uti/exfilter.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | uti/exfilter.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ; Start up a filter job 1998 Jochen Merz
include dev8_keys_jcb
include dev8_keys_qdos_sms
include dev8_keys_qdos_io
include dev8_keys_qdos_ioa
include dev8_keys_err
include dev8_keys_hdr
include dev8_mac_xref
section utility
xdef ut_exfilter
;+++
; Start up a filter job which may be any executable file or, with SMSQ/E,
; any _bas, .bas, _sav or .sav file. In case of any error, an error window
; is displayed and the error "not complete" is returned.
; The job is created but not activated!
; This routine requires a lot of stack space!!!
;
; Entry Exit
; d1 job-ID or -1
; d5 input channel ID
; d6 output channel ID
; d7 colourway
; a0 filter filename
; a4 error if filter fails
; a5 printer driver job name
;
; Error codes:
; nc filterfile or SBASIC not found
;---
stk.buff equ 16 ; use some stack as buffer
par.buff equ 24
exf.regs reg d2-d3/a1-a3
ut_exfilter
movem.l exf.regs,-(sp) ; save some regs
sub.w #stk.buff,sp
move.l a0,a1
lea bas_exts,a3
xjsr fu_chkext
move.l d1,d4 ; BASIC flag
move.l a0,a2
moveq #ioa.kshr,d3 ; shared access (read)
xjsr gu_fopen
bne.s file_error ; open error
tst.b d4 ; BASIC?
bne ex_basic
move.l sp,a1 ; buffer for header
moveq #16,d2 ; length of file-header
moveq #iof.rhdr,d0 ; read header
xjsr gu_iow
bne.s file_error_close ; read header error
move.l sp,a1 ; start of header
cmp.b #hdrt.exe,hdr_type(a1) ; executable?
bne.s file_error_close ; no, error, but close file first
xjsr gu_fclos ; close file again
sub.w #par.buff,sp
move.l sp,a1 ; parameter string
move.w #12,(a1)+ ; word + 2 ID's + word
move.w #2,(a1)+ ; three ID's
move.l d5,(a1)+ ; input ID
move.l d6,(a1)+ ; output ID
clr.w (a1) ; no parameter string
move.l sp,a1 ; parameter string
move.l a2,a0 ; filename
moveq #-1,d1 ; owner
moveq #0,d2 ; don't start and don't wait
move.l a5,a2 ; driver name
sub.l a3,a3
xjsr gu_fexnm
add.w #par.buff,sp
bra.s return
file_error_close
xjsr gu_fclos ; close file first
file_error
move.l a4,d0
bset #31,d0 ; the error text
moveq #-1,d1 ; origin
move.b d7,d2 ; colourway
xjsr mu_rperr ; report error
moveq #err.nc,d0 ; and return error
return
add.w #stk.buff,sp
movem.l (sp)+,exf.regs
rts
bas_exts
dc.b 0,'BAS'
dc.b 0,'SAV'
dc.l -1
met_sbasic
dc.w 6,'SBASIC'
ex_basic
sub.w #par.buff,sp
move.l sp,a1 ; parameter string
move.w #16,(a1)+ ; word + 3 ID's + word
move.w #3,(a1)+ ; three ID's
move.l a0,(a1)+ ; program ID
move.l d5,(a1)+ ; input ID
move.l d6,(a1)+ ; output ID
clr.w (a1) ; no parameter string
move.l sp,a1 ; parameter string
moveq #-1,d1 ; owner
moveq #0,d2 ; don't start and don't wait
lea met_sbasic,a0
move.l a5,a2 ; job name
xjsr gu_thexn
add.w #par.buff,sp
bra return
end
| 22.658537 | 74 | 0.682095 |
3c8878a7f9ddc81298b7db962a22dec187f3c5ec | 328 | asm | Assembly | libsrc/_DEVELOPMENT/compress/zx7/c/sccz80/dzx7_standard_back_callee.asm | ahjelm/z88dk | c4de367f39a76b41f6390ceeab77737e148178fa | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/compress/zx7/c/sccz80/dzx7_standard_back_callee.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/compress/zx7/c/sccz80/dzx7_standard_back_callee.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; void dzx7_standard_back_callee(void *src, void *dst)
SECTION code_clib
SECTION code_compress_zx7
PUBLIC dzx7_standard_back_callee
EXTERN asm_dzx7_standard_back
dzx7_standard_back_callee:
IF __CPU_GBZ80__
pop bc
pop de
pop hl
push bc
ELSE
pop hl
pop de
ex (sp),hl
ENDIF
jp asm_dzx7_standard_back
| 13.12 | 54 | 0.768293 |
846f275f75c3cf74b218cc894f41dc2ae285fcae | 578 | asm | Assembly | oeis/024/A024017.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/024/A024017.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/024/A024017.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A024017: 2^n-n^7.
; 1,1,-124,-2179,-16368,-78093,-279872,-823415,-2096896,-4782457,-9998976,-19485123,-35827712,-62740325,-105397120,-170826607,-268369920,-410207601,-611957888,-893347451,-1278951424,-1798991389,-2490163584,-3396436839,-4569694208,-6069961193,-7964701312,-10326135475,-13224493056,-16713005397,-20796258176,-25365130463,-30064771072,-34028508385,-35343480960,-29979558507,-9644687360,42507076339,160462324352,412524807209,935671627776,2004268981671,4167507177856,8524274411101,17272908234752
mov $1,2
pow $1,$0
pow $0,7
add $0,1
sub $1,$0
add $1,1
mov $0,$1
| 52.545455 | 490 | 0.787197 |
b15bb2b344d5eed17036dae547c8c16db2fcb0f0 | 462 | asm | Assembly | programs/oeis/272/A272708.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/272/A272708.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/272/A272708.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A272708: First differences of number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 515", based on the 5-celled von Neumann neighborhood.
; 4,8,12,24,20,40,28,56,36,72,44,88,52,104,60,120,68,136,76,152,84,168,92,184,100,200,108,216,116,232,124,248,132,264,140,280,148,296,156,312,164,328,172,344,180,360,188,376,196,392,204,408,212,424,220,440
sub $0,1
mov $1,$0
gcd $1,2
mul $1,$0
add $1,2
mul $1,4
| 46.2 | 205 | 0.725108 |
5bea95a30adde61e7f6a7d07cc26433b20412740 | 786 | asm | Assembly | EserciziMips/2.1-Prodotto.asm | AntoAndGar/MIPS | 776bbf3ca1d9a3184f469a11b5230d4d03622826 | [
"MIT"
] | null | null | null | EserciziMips/2.1-Prodotto.asm | AntoAndGar/MIPS | 776bbf3ca1d9a3184f469a11b5230d4d03622826 | [
"MIT"
] | null | null | null | EserciziMips/2.1-Prodotto.asm | AntoAndGar/MIPS | 776bbf3ca1d9a3184f469a11b5230d4d03622826 | [
"MIT"
] | null | null | null | # Implementare un programma in linguaggio assembly MIPS che:
# stampa a video “Primo numero: ” e prenda in input un numero a
# stampa a video “Secondo numero: ” e prenda in input un numero b
# stampa a video “Prodotto dei due numeri: ” e stampi a video axb
# Esempio
# OUTPUT: Primo Numero:
# INPUT:5
# OUTPUT:Secondo Numero:
# INPUT:6
# OUTPUT: Prodotto dei due numeri:30
.text
.globl main
main:
la $a0, s_uno
li $v0, 4
syscall
li $v0, 5
syscall
move $t0, $v0
la $a0, s_due
li $v0, 4
syscall
li $v0, 5
syscall
move $t1, $v0
mul $t2, $t1, $t0
la $a0, s_result
li $v0, 4
syscall
move $a0, $t2
li $v0, 1
syscall
li $v0, 10
syscall
.data
s_uno: .asciiz "Primo numero: "
s_due: .asciiz "Secondo numero: "
s_result: .asciiz "Prodotto dei due numeri: " | 16.040816 | 65 | 0.666667 |
511bf39331e70d57bdf3af12dbcd64f83359430a | 29,620 | asm | Assembly | base/mvdm/wow16/kernel31/ldheader.asm | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | base/mvdm/wow16/kernel31/ldheader.asm | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | base/mvdm/wow16/kernel31/ldheader.asm | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | TITLE LDHEADER - Load Exe Header procedure
.xlist
include gpfix.inc
include kernel.inc
include newexe.inc
.list
externA __AHINCR
externFP IGlobalAlloc
externFP IGlobalFree
externFP FarSetOwner
externFP Int21Handler
externFP FarMyUpper
externFP IsBadStringPtr
externFP _hread
DataBegin
externB fBooting
externB szBozo
externW winVer
externD pSErrProc
DataEnd
externFP IGlobalLock
externFP IGlobalUnLock
sBegin NRESCODE
assumes CS,NRESCODE
externNP NResGetPureName
;-----------------------------------------------------------------------;
; LoadExeHeader ;
; ;
; Routine to read an EXE header and check for a new format EXE file. ;
; Returns NULL if not a new format EXE. Otherwise reads the resident ;
; portion of the new EXE header into allocated storage and returns ;
; the segment address of the new EXE header. ;
; ;
; Arguments: ;
; parmW fh ;
; parmW isfh ;
; parmD pfilename ;
; ;
; Returns: ;
; AX = segment of exe header ;
; DL = ne_exetyp ;
; DH = ne_flagsothers ;
; ;
; Error Returns: ;
;LME_MEM = 0 ; Out of memory ;
;LME_VERS = 10 ; Wrong windows version ;
;LME_INVEXE = 11 ; Invalid exe ;
;LME_OS2 = 12 ; OS/2 app ;
;LME_DOS4 = 13 ; DOS 4 app ;
;LME_EXETYPE = 14 ; unknown exe type ;
;LME_COMP = 19 ; Compressed EXE file ;
;LME_PE = 21 ; Portable EXE ;
; ;
; Registers Preserved: ;
; DI,SI ;
; ;
; Registers Destroyed: ;
; AX,BX,CX,DS,ES ;
; Calls: ;
; ;
; History: ;
; ;
; Thu Mar 19, 1987 08:35:32p -by- David N. Weise [davidw] ;
; Added this nifty comment block. ;
;-----------------------------------------------------------------------;
cProc LoadExeHeader,<PUBLIC,FAR>,<si,di>
parmW fh
parmW isfh
parmD pfilename
localW pnewexe
localW exetype
localW nchars
localW pseg
localW psegsrc
localW hBlock
localW pBlock
localW NEFileOffset
localD PreloadLen
localW NEBase
localW exeflags
localW expver
localW saveSP
localB fast_fail ; 1 if we can't use fastload block
localV hdrbuf,<SIZE EXE_HDR>
.errnz SIZE EXE_HDR - SIZE NEW_EXE
cBegin
xor ax,ax
mov pseg,ax
mov hBlock, ax
mov fast_fail, al
cmp SEG_pfilename,ax
je re0
IF KDEBUG ; LoadExeHeader is internal
cCall IsBadStringPtr, <pfilename, 128> ; so we assume file pointer is OK
or ax, ax
jnz refailj
ENDIF
lds si,pfilename
mov al,ds:[si].opLen
inc ax ; include null byte
re0:
mov nchars,ax
mov bx,fh ; No, seek backwards over what
cmp isfh,bx
je refile
mov ds,bx
xor si,si
jmp remem
refile: ; Here to load from a file
push ss ; DS:SI points to I/O buffer
pop ds
lea si,hdrbuf ; Read beginning of file
mov dx,si
mov cx,SIZE EXE_HDR
mov bx,fh
mov ah,3Fh
DOSFCALL
jnc @F
refailj:
jmps refail
@@:
cmp ax,cx ; Old EXE file, look for offset
jb refailj ; to new exe header
cmp ds:[si].e_magic,EMAGIC ; Check for old exe file
je @F
cmp ds:[si], 'ZS' ; Is it compressed?
jne refail
cmp ds:[si][2],'DD'
jne refail
cmp ds:[si][4],0F088h
jne refail
cmp ds:[si][6],03327h
jne refail
mov ax, LME_COMP ; Compressed EXE
jmp reexit
@@:
mov ax,ds:[si].e_lfanew.hi
mov dx,ds:[si].e_lfanew.lo
mov pnewexe,dx ; To check for bound OS/2 apps.
or ax,dx
jz refail ; Fail if not there.
mov cx,ds:[si].e_lfanew.hi
mov dx,ds:[si].e_lfanew.lo
mov bx, fh
mov ax,4200h
DOSFCALL
jc refail
mov cx,SIZE NEW_EXE
mov dx,si
mov ah,3Fh
DOSFCALL
jc refail
cmp ax,cx
jne refail
cmp ds:[si].ne_magic,NEMAGIC ; Did we get a valid new EXE header?
je remem
cmp ds:[si].ne_magic,PEMAGIC ; Did we find a Portable EXE (WIN32)
jne refail
mov ax, LME_PE
jmps rej
refail:
mov ax, LME_INVEXE ; invalid NEW EXE file format
rej: jmp reexit
remem:
mov psegsrc,bx ; bx has either fh or seg address
mov di,ds:[si].ne_enttab ; Compute size of resident new header
add di,ds:[si].ne_cbenttab
add di, 6 ; null entry space (bug #8414)
mov cx, ds:[si].ne_cbenttab
mov bx, ds:[si].ne_cmovent
shl bx, 1
sub cx, bx
shl bx, 1
sub cx, bx ; Number of bytes not moveable entries
shl cx, 1 ; Allow triple these bytes
add di, cx
mov cx,ds:[si].ne_cseg ; + 3 * #segments
; Reserve space for ns_handle field in segment table
shl cx,1
add di,cx
.errnz 10 - SIZE NEW_SEG1
; Reserve space for file info block at end
add di,nchars ; + size of file info block
xor ax,ax ; Allocate a fixed block for header
mov bx,GA_ZEROINIT or GA_MOVEABLE
cCall IGlobalAlloc,<bx,ax,di> ; that isn't code or data.
or ax,ax
jnz @F
jmps badformat
@@:
push ax
cCall IGlobalLock,<ax>
pop ax
push dx
cCall IGlobalUnlock,<ax>
pop ax
sub di,nchars
mov pseg,ax
mov es,ax ; ES:0 -> new header location
cld ; DS:SI -> old header
mov bx,psegsrc
cmp isfh,bx ; Is header in memory?
jne remem1 ; Yes, continue
mov ax,ds:[si].ne_enttab ; No, read into high end
add ax,ds:[si].ne_cbenttab ; of allocated block
sub di,ax
mov cx,SIZE NEW_EXE ; Copy part read so far
sub ax,cx
rep movsb
mov cx,ax
smov ds,es ; Read rest of header from file
mov dx,di
mov ah,3fh
DOSFCALL
mov bx,ax
jc refail1
lea si,[di-SIZE NEW_EXE] ; DS:SI -> old header
cmp bx,cx
je remem1
badformat:
mov ax, LME_INVEXE ; don't change flags
refail1: ; Here if error reading header
push ax
SetKernelDSNRes ; DS may be = pseg, prevent
cCall IGlobalFree,<pseg> ; GP faults in pmode.
pop ax
jmp reexit
remem1:
UnsetKernelDS
test ds:[si].ne_flags,NEIERR ; Errors in EXE image?
jnz badformat ; Yes, fail
cmp ds:[si].ne_ver,4 ; No, built by LINK4 or above?
jl badformat ; No, error
mov bx,ds:[si].ne_flags ; Make local copies of ne_flags &
and bl,NOT NEPROT ; ne_expver which can be modified
mov exeflags,bx ; (can't change ROM exe headers).
mov bx,ds:[si].ne_expver
mov expver,bx
mov bx,word ptr ds:[si].ne_exetyp ; get exetyp and flagsothers
mov exetype,bx
cmp bl,NE_UNKNOWN
jz windows_exe
cmp bl,NE_WINDOWS ; is it a Windows exe?
jz windows_exe
mov ax,LME_OS2
cmp bl,NE_OS2 ; is it an OS|2 exe?
jnz not_os2
test bh,NEINPROT ; can it be run under Windows?
jz @F
and exeflags,NOT NEAPPLOADER
or exeflags,NEPROT
mov expver,0300h
jmps windows_exe
@@:
cmp pnewexe,0800h ; is it a bound
jb refail1
jmp badformat
not_os2:
inc ax ; AX = 13 - LME_DOS4
cmp bl,NE_DOS4 ; is it a DOS 4 exe?
jz refail1
inc ax ; AX = 14 - LME_EXETYPE
jmp refail1
mgxlib DB 'MGXLIB'
windows_exe:
mov NEBase, si ; Offset of Source header
xor di,di ; ES:DI -> new header location
mov cx,SIZE NEW_EXE ; Copy fixed portion of header
cld
rep movsb
mov ax,exeflags
mov es:[ne_flags],ax
mov ax,expver
mov es:[ne_expver],ax
mov si, NEBase
add si, es:[ne_segtab] ; Real location of segment table
mov cx,es:[ne_cseg] ; Copy segment table, adding
mov es:[ne_segtab],di
jcxz recopysegx
recopyseg:
movsw ; ns_sector
movsw ; ns_cbseg
lodsw ; ns_flags
.errnz 4 - ns_flags
and ax,not (NS286DOS XOR NSGETHIGH) ; Clear 286DOS bits
; record in the segment flags if this module is a process, this is for EMS
test ax,NSTYPE ; NSCODE
jnz not_code
or ax,NSWINCODE
not_code:
or ax,NSNOTP
test es:[ne_flags],NSNOTP
jnz not_a_process
xor ax,NSNOTP
or ax,NSMOVE
not_a_process:
stosw ; ns_flags
movsw ; ns_minalloc
.errnz 8 - SIZE NEW_SEG
xor ax,ax
stosw ; one word for ns_handle field
.errnz 10 - SIZE NEW_SEG1
loop recopyseg
recopysegx:
test es:[ne_flagsothers], NEGANGLOAD
jz no_gang_loadj
mov bx, fh
cmp bx, isfh
jne no_gang_loadj
mov ax, es:[ne_gang_start]
or ax, ax
jz no_gang_loadj
mov NEFileOffset, ax ; file offset of gang load area
mov ax, es:[ne_gang_length]
or ax, ax
jz no_gang_loadj
mov cx, es:[ne_align]
xor dx, dx
gl_len: ; find length of Gang Load area
shl ax, 1
adc dx, dx
loop gl_len
cmp dx, 10h ; Greater than 1Mb, forget it!!
jb alloc_it ; PS: NEVER go bigger than 1Mb
no_gang_loadj:
jmp no_gang_load ; since LongPtrAdd is limited...
alloc_it:
mov word ptr PreloadLen[0], ax
mov word ptr PreloadLen[2], dx
mov ch, GA_DISCARDABLE
mov cl, GA_MOVEABLE+GA_NODISCARD+GA_NOCOMPACT
push es
cCall IGlobalAlloc,<cx,dx,ax> ; Allocate this much memory
pop es
or ax, ax
jz no_gang_loadj
mov hBlock, ax ; Have memory to read file into
push es
cCall IGlobalLock,<ax>
pop es
mov pBlock, dx
mov dx, NEFileOffset
mov cx, es:[ne_align]
xor bx, bx
gl_pos: ; find pos of Gang Load start
shl dx, 1
adc bx, bx
loop gl_pos
mov cx, bx
mov bx, fh
mov ax,4200h
DOSFCALL ; Seek to new exe header
jc refailgang
mov ax, pBlock
xor bx, bx
farptr memadr,ax,bx
cCall _hread, <fh, memadr, PreloadLen>
cmp dx, word ptr PreloadLen[2]
jnz refailgang
cmp ax, word ptr PreloadLen[0]
jz no_gang_load ; We're OK now
; push ds
; xor dx, dx
; mov ax, pBlock
; push si
; push di
; mov si, word ptr PreloadLen[2]
; mov di, word ptr PreloadLen[0]
;read_file:
; mov cx, 08000h ; Must be factor 64k DON'T CHANGE THIS
; or si, si
; jnz big_read
; cmp cx, di
; jbe big_read
; mov cx, di ; all that's left
; jcxz done_read ; Nothing left, quit.
;big_read:
; mov ds, ax
; mov ah, 3Fh
; DOSFCALL ; Read chunk from file
; jc refailgang
; cmp ax, cx ; All we asked for?
; jne refailgang ; no, file corrupted
; sub di, cx
; sbb si, 0
; mov ax, ds
; add dx, cx ; On to next block
; jnc read_file
; add ax, __AHINCR
; jmps read_file
;
refailgang:
; pop di
; pop si
; pop ds
cCall IGlobalUnlock,<hBlock>
cCall IGlobalFree,<hBlock>
mov hBlock, 0
jmps no_gang_load
BadExeHeader: ; GP fault handler!!!
mov sp, saveSP
; fix_fault_stack
jmp refail1 ; corrupt exe header (or our bug)
;done_read:
; pop di
; pop si
; pop ds
no_gang_load:
mov saveSP, sp
beg_fault_trap BadExeHeader
mov cx,es:[ne_restab] ; Copy resource table
sub cx,es:[ne_rsrctab]
mov si, NEBase ; Get correct source address
add si, es:[ne_rsrctab]
mov es:[ne_rsrctab],di
rep movsb
rerestab:
mov cx,es:[ne_modtab] ; Copy resident name table
sub cx,es:[ne_restab]
mov es:[ne_restab],di
rep movsb
push di
mov di, es:[ne_restab] ; Make the module name Upper Case
xor ch, ch
mov cl, es:[di]
inc di
uppercaseit:
mov al, es:[di]
call farMyUpper
stosb
loop uppercaseit
pop di
mov cx,es:[ne_imptab] ; Copy module xref table
sub cx,es:[ne_modtab]
mov es:[ne_modtab],di
rep movsb
mov es:[ne_psegrefbytes],di ; Insert segment reference byte table
mov es:[ne_pretthunks],di ; Setup return thunks
mov cx,es:[ne_enttab] ; Copy imported name table
sub cx,es:[ne_imptab]
mov es:[ne_imptab],di
jcxz reenttab
rep movsb
reenttab:
mov es:[ne_enttab],di
; Scan current entry table
xor ax, ax ; First entry in block
mov bx, di ; Pointer to info for this block
stosw ; Starts at 0
stosw ; Ends at 0
stosw ; And is not even here!
copy_next_block:
lodsw ; Get # entries and type
xor cx, cx
mov cl, al
jcxz copy_ent_done
mov al, ah
cmp al, ENT_UNUSED
jne copy_used_block
mov ax, es:[bx+2] ; Last entry in current block
cmp ax, es:[bx] ; No current block?
jne end_used_block
add es:[bx], cx
add es:[bx+2], cx
jmps copy_next_block
end_used_block:
mov es:[bx+4], di ; Pointer to next block
mov bx, di
add ax, cx ; Skip unused entries
stosw ; First in new block
stosw ; Last in new block
xor ax, ax
stosw ; End of list
jmps copy_next_block
copy_used_block:
add es:[bx+2], cx ; Add entries in this block
cmp al, ENT_MOVEABLE
je copy_moveable_block
; absolutes end up here as well
copy_fixed_block:
stosb ; Segno
movsb ; Flag byte
stosb ; segno again to match structure
movsw ; Offset
loop copy_fixed_block
jmps copy_next_block
copy_moveable_block:
stosb ; ENT_MOVEABLE
movsb ; Flag byte
add si, 2 ; Toss int 3Fh
movsb ; Copy segment #
movsw ; and offset
loop copy_moveable_block
jmps copy_next_block
copy_ent_done:
xor bx,bx
cmp es:[bx].ne_ver,5 ; Produced by version 5.0 LINK4
jae remem2a ; or above?
mov es:[bx].ne_expver,bx ; No, clear uninitialized fields
mov es:[bx].ne_swaparea,bx
; TEMPORARY BEGIN
push ax
push cx
push di
push si
mov si,es:[bx].ne_rsrctab
cmp si,es:[bx].ne_restab
jz prdone
mov di,es:[si].rs_align
add si,SIZE new_rsrc
prtype:
cmp es:[si].rt_id,0
je prdone
mov cx,es:[si].rt_nres
add si,SIZE rsrc_typeinfo
prname:
push cx
mov ax,es:[si].rn_flags
test ah,0F0h ; Is old discard field set?
jz @F
or ax,RNDISCARD ; Yes, convert to bit
@@:
and ax,not RNUNUSED ; Clear unused bits in 4.0 LINK files
mov es:[si].rn_flags,ax
pop cx
add si,SIZE rsrc_nameinfo
loop prname
jmp prtype
prdone: pop si
pop di
pop cx
pop ax
; TEMPORARY END
FixFlags: ; label for debugging
public FixFlags, leh_slow
public leh_code, leh_patchnext, leh_code_fixed, leh_patchdone, leh_data
remem2a: ; (bx == 0)
mov es:[bx].ne_usage,bx
mov es:[bx].ne_pnextexe,bx
mov es:[bx].ne_pfileinfo,bx
cmp es:[bx].ne_align,bx
jne @F
mov es:[bx].ne_align,NSALIGN
@@:
mov cx,nchars
jcxz @F
mov es:[bx].ne_pfileinfo,di
lds si,pfilename
rep movsb
@@: ; Save pointer to seginfo record
mov bx,es:[bx].ne_autodata ; of automatic data segment
or bx,bx
jz @F
dec bx
shl bx,1
mov cx,bx
shl bx,1
shl bx,1
add bx,cx
.errnz 10 - SIZE NEW_SEG1
add bx,es:[ne_segtab]
@@:
mov es:[ne_pautodata],bx
SetKernelDSNRes
; Scan seg table, marking nonautomatic DATA segments fixed, preload
mov ax,es:[ne_expver] ; Default expected version to
or ax,ax
jnz @F
mov ax,201h
mov es:[ne_expver],ax ; 2.01
@@:
cmp ax,winVer
jbe @F
cCall IGlobalFree,<pseg>
mov ax, LME_VERS
jmp reexit
@@:
mov bx,es:[ne_segtab]
xor cx,cx
sub bx,SIZE NEW_SEG1
jmps leh_patchnext
leh_test_preload:
test byte ptr es:[bx].ns_flags, NSPRELOAD
jnz leh_patchnext
or byte ptr es:[bx].ns_flags, NSPRELOAD
cmp es:[bx].ns_sector, 0 ; don't whine about empty segments
je leh_patchnext
krDebugOut DEB_WARN, "Segment #CX of %ES0 must be preload"
mov fast_fail, 1
leh_patchnext:
add bx,SIZE NEW_SEG1
inc cx
cmp cx,es:[ne_cseg]
ja leh_patchdone
test byte ptr es:[bx].ns_flags,NSDATA ; Is it a code segment?
jz leh_code ; Yes, next segment
.errnz NSCODE
leh_data: ; Data must be non-discardable, preload
if KDEBUG
test es:[bx].ns_flags, NSDISCARD
jz @F
krDebugOut DEB_WARN, "Data Segment #CX of %ES0 can't be discardable"
@@:
endif
and es:[bx].ns_flags,not NSDISCARD ; Data segments not discardable
jmps leh_test_preload
leh_code:
test byte ptr es:[bx].ns_flags,NSMOVE; Moveable code?
jz leh_code_fixed
; moveable code must be discardable, or must be preload
if KDEBUG
test es:[ne_flags],NENOTP ; for 3.0 libraries can't have
jz @F ; moveable only code
cmp fBooting,0 ; If not booting
jne @F
test es:[bx].ns_flags,NSDISCARD
jnz @F
krDebugOut DEB_WARN, "Segment #CX of %ES0 was discardable under Win 3.0"
@@:
endif
test es:[bx].ns_flags,NSDISCARD ; Is it discardable?
jnz leh_patchnext
jmp leh_test_preload
leh_code_fixed: ; fixed code must be preload
cmp fBooting,0 ; If not booting
jne leh_patchnext
jmp leh_test_preload
leh_patchdone:
mov bx,word ptr es:[ne_csip+2] ; Is there a start segment?
or bx,bx
jz @F ; No, continue
dec bx
shl bx,1
mov si,bx
shl si,1
shl si,1
add si,bx
.errnz 10 - SIZE NEW_SEG1
add si,es:[ne_segtab] ; Mark start segment as preload
if kdebug
test byte ptr es:[si].ns_flags,NSPRELOAD
jnz scs_pre
krDebugOut DEB_WARN, "Starting Code Segment of %ES0 must be preload"
mov fast_fail, 1
scs_pre:
endif
or byte ptr es:[si].ns_flags,NSPRELOAD
cmp es:[ne_autodata],0 ; Is there a data segment?
je @F
or es:[si].ns_flags,NSUSESDATA ; Yes, then it needs it
mov si,es:[ne_pautodata]
if kdebug
test byte ptr es:[si].ns_flags,NSPRELOAD
jnz sds_pre
cmp es:[bx].ns_sector, 0 ; don't whine about empty segments
je sds_pre
krDebugOut DEB_WARN, "Default Data Segment of %ES0 must be preload"
mov fast_fail, 1
sds_pre:
endif
or byte ptr es:[si].ns_flags,NSPRELOAD ; Mark DS as preload
@@:
test es:[ne_flags],NENOTP ; No stack if not a process
jnz @F
cmp es:[ne_stack],4096+1024
jae @F
mov es:[ne_stack],4096+1024 ; 4k stack is not enough (raor)
@@:
mov cx, es:[ne_heap] ; If the module wants a heap
jcxz leh_heapadjdone ; make sure it's big enough
mov ax, 800h ; ; Environment variables have
cmp cx, ax ; grown, so we need more heap
jae leh_heapadjdone ; space for apps so we use 800h
mov dx, ax
test es:[ne_flags],NENOTP
jnz @F
add dx, es:[ne_stack]
jc leh_heapadjmin
@@:
mov bx,es:[ne_autodata] ; set if no autodata segment
or bx,bx ; we have to do this here
jz leh_heapadjset ; because for certain dlls
dec bx ; pautodata is not initialized
shl bx,1
mov cx,bx
shl bx,1
shl bx,1
add bx,cx
add bx,es:[ne_segtab]
add dx, es:[bx].ns_minalloc
jnc leh_heapadjset
leh_heapadjmin:
; if 800h is too big fallback to
if KDEBUG ; what win9x code used as minimum
mov ax, 100h + SIZE LocalStats ; heap size 100h
else
mov ax, 100h
endif
mov cx, es:[ne_heap]
cmp cx, ax
jae leh_heapadjdone
leh_heapadjset:
mov es:[ne_heap], ax
leh_heapadjdone:
mov ax,es ; Set owner to be itself
cCall FarSetOwner,<ax,ax>
mov dx,exetype
test dh,NEINFONT ; save the font bit in exehdr
jz reexit ; somewhere
or es:[ne_flags],NEWINPROT
end_fault_trap
reexit:
; cmp ax, 20h ; translate error messages for ret
; jae @F
; mov bx, ax
; xor ax, ax
; cmp bl, 1 ; bx is 0, 1, 2, 19, other
; jz @F ; 1 -> 0 (out of memory)
; mov al, 11
; jb @F ; 0 -> 11 (invalid format)
; cmp bl, 3 ;
; mov al, 10
; jb @F ; 2 -> 10 (windows version)
; mov al, 19 ; 3 -> 19 (compressed EXE)
; jz @F ; others left alone
; mov al, bl
;@@:
push dx
mov bx, hBlock
or bx, bx
je noUnlock ; No block to unlock
push ax
cCall IGlobalUnlock,<bx>
push ss
pop ds ; might be freeing DS
cmp fast_fail, 1 ; is fastload area invalid?
jne @F
leh_slow:
krDebugOut DEB_WARN, "FastLoad area ignored due to incorrect segment flags"
cCall IGlobalFree,<hBlock> ; yes - free it, force slow-load
mov hBlock, 0
@@:
pop ax
cmp ax, LME_MAXERR
jae noFree ; Success, return memory block in bx
push ax
cCall IGlobalFree,<hBlock>
pop ax
noFree:
mov cx, NEFileOffset ; Return offset of header in CX
mov bx, hBlock
noUnlock:
pop dx
UnSetKernelDS
cEnd
sEnd NRESCODE
end
| 35.01182 | 189 | 0.426165 |
590192e46cb294106a474cc72216bf2939dd5c5c | 7,748 | asm | Assembly | Transynther/x86/_processed/NONE/_ht_st_zr_un_/i7-7700_9_0xca.log_21829_819.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_ht_st_zr_un_/i7-7700_9_0xca.log_21829_819.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_ht_st_zr_un_/i7-7700_9_0xca.log_21829_819.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x18780, %rcx
nop
and %rbp, %rbp
vmovups (%rcx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r11
nop
nop
nop
nop
nop
add %r12, %r12
lea addresses_normal_ht+0x17d7e, %r13
nop
nop
dec %r8
vmovups (%r13), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rbp
nop
nop
nop
nop
nop
add $6312, %rcx
lea addresses_A_ht+0x1e43e, %rbp
dec %rdx
mov (%rbp), %r12d
nop
and %r8, %r8
lea addresses_WT_ht+0x5e7e, %rcx
nop
nop
and %r11, %r11
mov (%rcx), %bp
nop
and $7754, %rbp
lea addresses_A_ht+0xf6c6, %rsi
lea addresses_D_ht+0x14df2, %rdi
nop
nop
nop
xor $56377, %rdx
mov $44, %rcx
rep movsb
add %rbp, %rbp
lea addresses_WT_ht+0x1dfce, %rcx
nop
nop
nop
inc %r11
movups (%rcx), %xmm5
vpextrq $1, %xmm5, %rdi
nop
add %r8, %r8
lea addresses_A_ht+0xd08c, %rsi
and $32796, %rcx
movw $0x6162, (%rsi)
nop
nop
nop
nop
inc %rdx
lea addresses_normal_ht+0x106ce, %rsi
lea addresses_WT_ht+0x197e, %rdi
and %r8, %r8
mov $118, %rcx
rep movsq
nop
nop
nop
nop
xor $883, %r11
lea addresses_WC_ht+0x181c6, %rsi
lea addresses_UC_ht+0x11ec3, %rdi
nop
dec %r11
mov $21, %rcx
rep movsw
nop
nop
dec %rsi
lea addresses_D_ht+0x1cabe, %r8
nop
nop
nop
add %rbp, %rbp
movb (%r8), %dl
nop
nop
nop
nop
dec %r13
lea addresses_normal_ht+0x317e, %r11
nop
nop
nop
nop
nop
xor $28543, %r8
movl $0x61626364, (%r11)
nop
and $44125, %r11
lea addresses_D_ht+0x227e, %rsi
lea addresses_UC_ht+0x1497e, %rdi
nop
nop
nop
nop
cmp $56688, %rdx
mov $3, %rcx
rep movsl
add %rsi, %rsi
lea addresses_WT_ht+0x1517e, %r12
nop
nop
nop
nop
nop
and $4661, %r8
movb (%r12), %dl
nop
nop
nop
cmp %r11, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r15
push %r8
push %rbp
push %rdx
push %rsi
// Store
lea addresses_WC+0x15c6e, %r15
nop
nop
nop
cmp %r8, %r8
movl $0x51525354, (%r15)
nop
nop
nop
xor $19712, %r15
// Store
lea addresses_RW+0x15cbe, %r13
nop
nop
nop
nop
sub %rsi, %rsi
movw $0x5152, (%r13)
cmp %r11, %r11
// Faulty Load
lea addresses_A+0xb57e, %r8
nop
nop
nop
nop
nop
sub $50829, %rdx
mov (%r8), %ebp
lea oracles, %r13
and $0xff, %rbp
shlq $12, %rbp
mov (%r13,%rbp,1), %rbp
pop %rsi
pop %rdx
pop %rbp
pop %r8
pop %r15
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC'}}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_RW'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'44': 5215, '46': 56, '48': 183, '00': 1109, 'ff': 14760, '53': 502, '45': 1, '49': 2, 'e0': 1}
ff ff ff 44 ff ff ff ff ff ff 44 ff ff ff 00 ff ff 44 ff ff ff ff ff ff ff ff 44 ff ff 44 ff 44 ff 44 ff 44 ff 44 44 ff ff ff 48 ff ff ff 44 ff 44 ff 44 ff ff 44 ff 44 ff ff ff ff ff 44 ff ff ff ff ff ff 44 ff ff ff 00 00 ff ff ff ff ff ff ff ff ff 48 ff ff ff ff 00 44 44 ff ff ff ff ff 44 ff 44 ff ff ff 00 ff ff ff ff 44 ff ff 44 44 ff 44 ff ff ff ff 44 ff ff ff 44 ff 44 ff 44 ff 00 44 ff ff 53 00 ff ff ff ff ff 44 ff 00 ff ff 44 44 ff ff ff ff ff ff ff ff 44 ff 44 ff ff ff ff ff ff 44 53 ff ff ff 44 44 44 ff 44 ff ff 44 ff ff ff ff ff ff 44 44 ff 44 ff ff 00 ff ff ff ff 44 ff ff ff ff 44 ff ff 44 ff ff 44 ff 44 ff 53 00 ff 44 ff 44 ff ff ff ff 44 ff 44 ff ff ff ff ff 44 53 00 44 ff ff ff ff ff ff 00 ff 44 ff 44 ff ff ff 44 44 44 ff ff ff ff 46 ff ff 44 ff ff 44 ff ff ff ff ff 44 ff 00 ff ff ff ff ff ff 44 ff 44 44 ff 44 44 ff ff ff 00 ff ff ff ff ff ff ff 44 44 ff ff 48 00 ff ff 44 44 44 ff ff 00 ff ff ff ff ff ff 44 44 ff 48 ff ff 44 ff ff ff 48 46 ff 44 ff ff ff ff ff 44 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 53 00 44 ff ff ff 00 ff ff 44 ff 44 ff ff 53 00 ff ff ff ff 48 ff 44 ff ff 44 ff ff ff ff ff ff ff ff ff 44 ff ff 44 ff 00 44 44 ff ff 44 ff ff ff ff 44 53 00 ff 00 ff ff 44 44 ff ff 44 00 ff 00 44 53 00 ff ff ff ff ff ff ff 44 ff ff ff 44 ff ff ff 00 ff ff ff ff ff ff ff ff 44 53 00 ff ff ff 44 ff 44 44 ff ff 00 ff 44 ff 44 ff ff ff ff ff ff ff 00 ff ff ff ff 44 ff 44 53 00 44 44 ff ff ff 44 ff 44 ff ff ff ff 44 ff ff ff ff ff 44 ff 48 ff ff ff ff ff 44 ff ff ff 44 44 44 44 44 ff ff ff 44 44 ff ff ff ff 44 44 ff ff 00 44 ff ff 00 ff ff ff ff ff ff ff 44 ff 44 44 ff 44 ff ff ff ff 44 ff 44 ff ff ff ff 44 ff 44 ff 44 ff ff ff ff ff ff ff ff 53 ff ff 44 44 ff ff 53 ff ff 44 44 44 ff ff 44 ff ff 44 ff ff ff ff ff 44 ff ff 44 ff 44 ff 44 ff 44 ff ff ff ff ff ff ff 44 ff 44 ff 53 00 ff ff 53 00 00 53 00 44 ff ff ff 44 44 44 ff ff ff ff ff ff 53 ff ff 44 ff ff 00 ff ff 44 ff ff ff ff ff 44 44 ff 44 ff ff 00 44 ff ff 44 ff ff ff ff 44 ff 44 ff ff ff 00 ff ff ff ff ff ff ff ff ff ff 44 ff ff 44 44 ff ff ff ff ff ff ff ff ff ff ff ff 44 ff 44 44 ff ff 44 ff ff ff ff 53 00 ff ff ff 44 ff ff ff 44 ff 44 ff ff ff ff 44 ff ff 00 ff 44 ff 44 ff ff 44 ff ff ff 00 ff ff 44 ff ff ff ff ff 44 ff ff 44 53 ff ff ff 44 44 ff ff ff ff ff 48 53 00 ff ff ff ff ff ff 44 ff ff ff 48 ff ff 53 00 ff ff 44 ff ff ff 44 ff ff ff 44 ff ff ff 44 44 ff ff ff 44 44 44 ff ff ff 00 ff 00 ff ff ff ff 44 44 44 ff ff ff ff ff ff 44 53 44 44 44 53 ff 00 ff 44 44 ff 44 ff ff ff ff 44 ff ff ff ff ff ff ff ff ff ff 44 44 00 44 ff ff 44 ff 44 ff ff ff ff 44 ff ff 53 00 44 53 00 44 ff 44 44 44 ff 44 44 ff ff 00 ff ff ff ff ff ff ff ff ff ff ff 44 ff ff 00 ff ff ff ff ff 44 44 ff ff ff ff ff ff 44 ff ff ff ff ff ff 44 44 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 44 ff ff ff ff ff 44 ff ff ff ff ff ff 44 ff 00 ff 44 ff 44 44 44 44 ff ff ff 00 ff ff ff ff ff 44 44 ff ff 00 ff 44 ff ff 44 44 ff ff ff ff ff ff ff ff ff ff 44 44 ff ff ff ff 44 44 ff ff ff ff
*/
| 34.132159 | 2,999 | 0.651781 |
64ae6d3ba1254e2e6c37f268e6a02358b92d3d26 | 300 | asm | Assembly | programs/oeis/173/A173960.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/173/A173960.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/173/A173960.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A173960: Averages of four consecutive odd squares.
; 21,41,69,105,149,201,261,329,405,489,581,681,789,905,1029,1161,1301,1449,1605,1769,1941,2121,2309,2505,2709,2921,3141,3369,3605,3849,4101,4361,4629,4905,5189,5481,5781,6089,6405,6729,7061,7401,7749,8105,8469
mul $0,2
add $0,4
pow $0,2
add $0,5
| 37.5 | 209 | 0.75 |
15e7bd7e51c410ef0fae1b630e91167d21abdf03 | 551 | asm | Assembly | data/baseStats/rapidash.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 16 | 2018-08-28T21:47:01.000Z | 2022-02-20T20:29:59.000Z | data/baseStats/rapidash.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 5 | 2019-04-03T19:53:11.000Z | 2022-03-11T22:49:34.000Z | data/baseStats/rapidash.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 2 | 2019-12-09T19:46:02.000Z | 2020-12-05T21:36:30.000Z | db DEX_RAPIDASH ; pokedex id
db 65 ; base hp
db 100 ; base attack
db 70 ; base defense
db 105 ; base speed
db 80 ; base special
db FIRE ; species type 1
db FIRE ; species type 2
db FULL_HEAL ; catch rate
db 192 ; base exp yield
INCBIN "pic/ymon/rapidash.pic",0,1 ; 77, sprite dimensions
dw RapidashPicFront
dw RapidashPicBack
; attacks known at lvl 0
db EMBER
db TAIL_WHIP
db STOMP
db GROWL
db 0 ; growth rate
; learnset
tmlearn 6,7,8
tmlearn 9,10,15,16
tmlearn 20
tmlearn 31,32
tmlearn 33,38,39
tmlearn 44
tmlearn 50
db BANK(RapidashPicFront)
| 19 | 58 | 0.747731 |
8e496063533a371c1db0cf8ea687f77c202a1e5a | 7,491 | asm | Assembly | src/pop-nedry.asm | zznop/pop-nedry | 7a1b334612a6e86cb1032670f6b4a19ad797267b | [
"MIT"
] | 81 | 2017-12-09T16:54:49.000Z | 2021-09-30T18:26:06.000Z | src/pop-nedry.asm | zznop/pop-nedry | 7a1b334612a6e86cb1032670f6b4a19ad797267b | [
"MIT"
] | null | null | null | src/pop-nedry.asm | zznop/pop-nedry | 7a1b334612a6e86cb1032670f6b4a19ad797267b | [
"MIT"
] | 13 | 2017-12-09T19:36:28.000Z | 2021-01-21T06:35:03.000Z | [bits 64]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Win x86-64 shellcode to recreate the Jurassic Park hacking scene on the victim's machine. This
;;; payload is position independent and can be used with most memory corruption exploits or for
;;; code injection. It does contain null bytes (can't get around that because of the embedded WAV).
;;; If you require no nulls, you'll have to encode it.
;;;
;;; - Plays the 'Ah, ah, ah... you didn't say the magic word' audio
;;; - Opens up a command prompt and floods "YOU DIDN'T SAY THE MAGIC WORD" output
;;; - Opens the victims default browser to a web page meant to host the Nedry GIF
;;; - Sleeps for 30 seconds for extra torment factor
;;;
;;; Tested on Windows 10 x64 Fall Creators Update. Should run on any Windows x64 OS.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Clear the direction flag and call/pop to load the address for api_call into rbp
start:
cld ; clear direction flag
and rsp, 0xfffffffffffffff0 ; Ensure RSP is 16 byte aligned
call setup_console ; call/pop to get addr of api_call in rbp
;;; Stub debo'd from Metasploit that iterates the kernel32 EAT until it finds a function name
;;; matching the supplied hash. It then tail calls into the procedure address.
%include "./api.asm"
;;; Open a console window (if not already running inside of a console app) and get a console handle
setup_console:
pop rbp ; address of api_call
mov r10d, 0xd975e69d ; hash for kernel32!AllocConsole
call rbp ; lookup hash and call AllocConsole
mov rcx, -11 ; STD_OUTPUT_HANDLE
mov r10d, 0x53cabb18 ; hash for kernel32!GetStdHandle
call rbp ; lookup hash and call GetStdHandle
call flood_message ; call/pop to get addr of output
command:
db "YOU DIDN'T SAY THE MAGIC WORD!", 0x0a
;;; Pop off the address of the message above and output the message to the console 50 times
flood_message:
mov r12, rax ; preserve handle to console
pop r13 ; pointer to message text
mov rdi, 0x32 ; loop fitty times
message_loop:
mov rcx, r12 ; HANDLE hConsoleOutput
mov rdx, r13 ; VOID lpBuffer
mov r8, 0x1f ; DWORD nNumberOfCharsToWrite
xor r9, r9 ; NumberOfCharsWritten
sub rsp, 0x8 ; call_api allocs for 4 params - alloc another 8 for 5th param
mov qword [rsp+0x20], rax ; LPVOID lpReserved
mov r10d, 0x5dcb5d71 ; hash for kernel32!WriteConsoleA
call rbp ; lookup hash and call WriteConsoleA
add rsp, 0x8 ; re-align
dec rdi ; decrement loop counter (also sets ZF)
jnz message_loop ; if rdi != 0 do it again
;;; Load winmm.dll using LoadLibrary API
load_winmm:
mov rcx, 0x000000000000006c ; push winmm.dll to stack
push rcx ; ..
mov rcx, 0x6c642e6d6d6e6977 ; ..
push rcx ; ..
mov rcx, rsp ; LPCTSTR lpFileName
mov r10d, 0x0726774C ; hash for kernel32!LoadLibraryA
call rbp ; lookup hash and call LoadLibraryA
;;; Get address for PlaySound procedure using GetProcAddress
get_playsound_addr:
mov rcx, rax ; HMODULE hModule
mov rdx, 0x0000000000000064 ; push 'PlaySound' to the stack
push rdx ; ..
mov rdx, 0x6e756f5379616c50 ; ..
push rdx ; ..
mov rdx, rsp ; LPCSTR lpProcName
mov r10d, 0x7802f749 ; hash for kernel32!GetProcAddress
call rbp ; lookup hash and call GetProcAddress
mov r14, rax ; preserve addr of PlaySound in r14
jmp call_load_wav ; jmp/call/pop to get addr of WAV buffer
;;; Load the WAV file from memory and play it asynchronously
load_wav:
pop rcx ; LPCTSTR pszSound - pointer to WAV buffer
sub rsp, 0x20 ; shadow space
xor rdx, rdx ; HMODULE hmod
mov r8, 0x000000000000000d ; DWORD fdwSound - SND_MEMORY (4) | SND_ASYNC (1) | SND_LOOP (8)
call rax ; call PlaySound
add rsp, 0x20 ; re-align
;;; Load shell32.dll
load_shell32:
mov rcx, 0x00000000006c6c64 ; push 'shell32.dll' to stack
push rcx ; ..
mov rcx, 0x2e32336c6c656873 ; ..
push rcx ; ..
mov rcx, rsp ; LPCTSTR lpFileName
mov r10d, 0x0726774C ; hash for kernel32!LoadLibraryA
call rbp ; lookup hash and call LoadLibraryA
;;; Get address for ShellExecuteA procedure using GetProcAddress
get_shellexecutea_addr:
mov rcx, rax ; HMODULE hModule
mov rdx, 0x0000004165747563 ; push 'ShellExecuteA' to the stack
push rdx ; ..
mov rdx, 0x6578456c6c656853 ; ..
push rdx ; ..
mov rdx, rsp ; LPCSTR lpProcName
mov r10d, 0x7802f749 ; hash for kernel32!GetProcAddress
call rbp ; lookup hash and call GetProcAddress
call pop_nedry ; call/pop to get addr for nedry URL
;;; Placeholder for up-to 64 character URL for Nedry GIF page
nedry_url:
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
;;; Open the target's default browser and point it to the URL hosting Nedry HTML
pop_nedry:
xor rcx, rcx ; HWND hwnd
pop r8 ; LPCTSTR lpFile
mov rdx, 0x000000006e65706f ; push 'open' to the stack
push rdx ; ..
mov rdx, rsp ; LPCTSTR lpOperation
xor r9, r9 ; lpParameters
sub rsp, 0x38 ; f*cking shadow space
xor r11, r11 ; LPCTSTR lpParameters
mov qword [rsp+32], r11 ; LPCTSTR lpDirectory
mov qword [rsp+40], 0x1 ; INT nShowCmd (SW_SHOWNORMAL)
call rax ; call ShellExecuteA
add rsp, 0x38 ; re-align
;;; Sleep for 30 seconds while the audio plays
sleep_while_tormenting_target:
mov rcx, 0x7530 ; DWORD dwMilliseconds
mov r10d, 0xe035f044 ; hash for kernel32!Sleep
call rbp ; lookup hash and call Sleep
;;; Unload the WAV file and terminate the audio
stop_wav:
sub rsp, 0x20 ; shadow space
xor rcx, rcx ; LPCTSTR pszSound - pointer to WAV buffer
xor rdx, rdx ; HMODULE hmod
xor r8, r8 ; DWORD fdwSound
call r14 ; call PlaySound
add rsp, 0x20 ; re-align
;;; Reset stack and return (thrown off by shadow alignment by api_call and string pushes)
cleanup:
add rsp, 0x770 ; restore the stack
ret ; return
;;; Call/pop to get address of the WAV buffer for load_wav
call_load_wav:
call load_wav ; call/pop to get addr of WAV buffer
;;; From here on down is the WAV file data
incbin "../resources/magicwrd.wav" | 47.411392 | 99 | 0.572153 |
04cc16e45d90d461abb31ec9057afd6f9c0e5fb2 | 1,676 | asm | Assembly | programs/oeis/245/A245425.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/245/A245425.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/245/A245425.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A245425: Number of nonnegative integers with the property that their base 9/4 expansion (see A024652) has n digits.
; 9,18,36,81,180,405,918,2061,4635,10431,23472,52812,118827,267363,601560,1353510,3045402,6852150,15417342,34689015,78050286,175613148,395129583,889041555,2000343501,4500772875,10126738971,22785162687,51266616048,115349886108
mov $20,$0
mov $22,$0
add $22,1
lpb $22
clr $0,20
mov $0,$20
sub $22,1
sub $0,$22
mov $17,$0
mov $19,$0
add $19,1
lpb $19
mov $0,$17
sub $19,1
sub $0,$19
mov $13,$0
mov $15,2
lpb $15
mov $0,$13
sub $15,1
add $0,$15
sub $0,1
mov $9,$0
mov $11,2
lpb $11
mov $0,$9
sub $11,1
add $0,$11
sub $0,1
mov $5,$0
mov $7,2
lpb $7
mov $0,$5
sub $7,1
add $0,$7
sub $0,1
mov $2,1
lpb $0
sub $0,1
mul $2,9
sub $2,1
div $2,4
add $2,1
lpe
mov $3,1
mul $3,$2
mov $1,$3
mov $8,$7
lpb $8
mov $6,$1
sub $8,1
lpe
lpe
lpb $5
mov $5,0
sub $6,$1
lpe
mov $1,$6
mov $12,$11
lpb $12
mov $10,$1
sub $12,1
lpe
lpe
lpb $9
mov $9,0
sub $10,$1
lpe
mov $1,$10
mov $16,$15
lpb $16
mov $14,$1
sub $16,1
lpe
lpe
lpb $13
mov $13,0
sub $14,$1
lpe
mov $1,$14
mul $1,9
add $18,$1
lpe
add $21,$18
lpe
mov $1,$21
| 18.622222 | 225 | 0.433174 |
f604dec077ffcc046d0bd94585de32107b475f9e | 3,065 | asm | Assembly | pin-3.22-98547-g7a303a835-gcc-linux/source/tools/AttachDetach/check_xmms_asm.asm | ArthasZhang007/15418FinalProject | a71f698ea48ebbc446111734c198f16a55633669 | [
"MIT"
] | null | null | null | pin-3.22-98547-g7a303a835-gcc-linux/source/tools/AttachDetach/check_xmms_asm.asm | ArthasZhang007/15418FinalProject | a71f698ea48ebbc446111734c198f16a55633669 | [
"MIT"
] | null | null | null | pin-3.22-98547-g7a303a835-gcc-linux/source/tools/AttachDetach/check_xmms_asm.asm | ArthasZhang007/15418FinalProject | a71f698ea48ebbc446111734c198f16a55633669 | [
"MIT"
] | null | null | null | ;
; Copyright (C) 2018-2018 Intel Corporation.
; SPDX-License-Identifier: MIT
;
include asm_macros.inc
PROLOGUE
PUBLIC CleanXmms
PUBLIC SaveXmms
PUBLIC ScrambleXmms
PUBLIC DoNothing
.code
; Set XMM0-7 to 0
CleanXmms PROC
BEGIN_STACK_FRAME
xorpd xmm0, xmm0
xorpd xmm1, xmm1
xorpd xmm2, xmm2
xorpd xmm3, xmm3
xorpd xmm4, xmm4
xorpd xmm5, xmm5
xorpd xmm6, xmm6
xorpd xmm7, xmm7
END_STACK_FRAME
ret
CleanXmms ENDP
; Store XMM0-7 into buffer pointer by first function argument
SaveXmms PROC
BEGIN_STACK_FRAME
mov SCRATCH_REG1, PARAM1
movdqu xmmword ptr [SCRATCH_REG1], xmm0
movdqu xmmword ptr [SCRATCH_REG1]+16, xmm1
movdqu xmmword ptr [SCRATCH_REG1]+32, xmm2
movdqu xmmword ptr [SCRATCH_REG1]+48, xmm3
movdqu xmmword ptr [SCRATCH_REG1]+64, xmm4
movdqu xmmword ptr [SCRATCH_REG1]+80, xmm5
movdqu xmmword ptr [SCRATCH_REG1]+96, xmm6
movdqu xmmword ptr [SCRATCH_REG1]+112, xmm7
END_STACK_FRAME
ret
SaveXmms ENDP
; Scramble XMM0-7 registers
ScrambleXmms PROC
BEGIN_STACK_FRAME
IFDEF TARGET_IA32E
mov SCRATCH_REG1, 0001020304050607h
mov SCRATCH_REG2, 08090a0b0c0d0e0fh
pinsrq xmm0, SCRATCH_REG1, 0
pinsrq xmm0, SCRATCH_REG2, 1
pinsrq xmm1, SCRATCH_REG1, 0
pinsrq xmm1, SCRATCH_REG2, 1
pinsrq xmm2, SCRATCH_REG1, 0
pinsrq xmm2, SCRATCH_REG2, 1
pinsrq xmm3, SCRATCH_REG1, 0
pinsrq xmm3, SCRATCH_REG2, 1
pinsrq xmm4, SCRATCH_REG1, 0
pinsrq xmm4, SCRATCH_REG2, 1
pinsrq xmm5, SCRATCH_REG1, 0
pinsrq xmm5, SCRATCH_REG2, 1
pinsrq xmm6, SCRATCH_REG1, 0
pinsrq xmm6, SCRATCH_REG2, 1
pinsrq xmm7, SCRATCH_REG1, 0
pinsrq xmm7, SCRATCH_REG2, 1
ELSE
mov SCRATCH_REG1, 00010203h
mov SCRATCH_REG2, 04050607h
mov SCRATCH_REG3, 08090a0bh
push CALLEE_SAVE_REG1
mov CALLEE_SAVE_REG1, 0c0d0e0fh
movd xmm0, SCRATCH_REG1
pinsrd xmm0, SCRATCH_REG2, 1
pinsrd xmm0, SCRATCH_REG3, 2
pinsrd xmm0, CALLEE_SAVE_REG1, 3
movd xmm1, SCRATCH_REG1
pinsrd xmm1, SCRATCH_REG2, 1
pinsrd xmm1, SCRATCH_REG3, 2
pinsrd xmm1, CALLEE_SAVE_REG1, 3
movd xmm2, SCRATCH_REG1
pinsrd xmm2, SCRATCH_REG2, 1
pinsrd xmm2, SCRATCH_REG3, 2
pinsrd xmm2, CALLEE_SAVE_REG1, 3
movd xmm3, SCRATCH_REG1
pinsrd xmm3, SCRATCH_REG2, 1
pinsrd xmm3, SCRATCH_REG3, 2
pinsrd xmm3, CALLEE_SAVE_REG1, 3
movd xmm4, SCRATCH_REG1
pinsrd xmm4, SCRATCH_REG2, 1
pinsrd xmm4, SCRATCH_REG3, 2
pinsrd xmm4, CALLEE_SAVE_REG1, 3
movd xmm5, SCRATCH_REG1
pinsrd xmm5, SCRATCH_REG2, 1
pinsrd xmm5, SCRATCH_REG3, 2
pinsrd xmm5, CALLEE_SAVE_REG1, 3
movd xmm6, SCRATCH_REG1
pinsrd xmm6, SCRATCH_REG2, 1
pinsrd xmm6, SCRATCH_REG3, 2
pinsrd xmm6, CALLEE_SAVE_REG1, 3
movd xmm7, SCRATCH_REG1
pinsrd xmm7, SCRATCH_REG2, 1
pinsrd xmm7, SCRATCH_REG3, 2
pinsrd xmm7, CALLEE_SAVE_REG1, 3
pop CALLEE_SAVE_REG1
ENDIF
END_STACK_FRAME
ret
ScrambleXmms ENDP
; Do nothing
DoNothing PROC
BEGIN_STACK_FRAME
nop
END_STACK_FRAME
ret
DoNothing ENDP
end
| 19.902597 | 61 | 0.729201 |
be60f9ebc4600a81627d0cd959f32f2ddb012ced | 6,603 | asm | Assembly | Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_401.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_401.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0_notsx.log_21829_401.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1a96, %rsi
lea addresses_D_ht+0x9072, %rdi
nop
nop
nop
nop
nop
add %rax, %rax
mov $50, %rcx
rep movsq
sub $63732, %rax
lea addresses_normal_ht+0x1bb8a, %r15
nop
nop
nop
nop
cmp $56295, %r11
movups (%r15), %xmm5
vpextrq $0, %xmm5, %rbp
nop
nop
and %r11, %r11
lea addresses_A_ht+0x10812, %rsi
lea addresses_A_ht+0x169f2, %rdi
nop
nop
nop
sub %r12, %r12
mov $91, %rcx
rep movsb
nop
nop
and %rax, %rax
lea addresses_normal_ht+0x1b2, %rcx
nop
nop
nop
nop
sub $4065, %rbp
movl $0x61626364, (%rcx)
nop
nop
inc %rcx
lea addresses_WT_ht+0x188e, %rsi
nop
nop
nop
nop
nop
and $13498, %r11
and $0xffffffffffffffc0, %rsi
movntdqa (%rsi), %xmm0
vpextrq $0, %xmm0, %rbp
sub $60413, %r15
lea addresses_A_ht+0x1ebb2, %rdi
lfence
vmovups (%rdi), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %rbp
nop
nop
nop
nop
sub $56487, %rdi
lea addresses_normal_ht+0xb2b2, %rsi
lea addresses_D_ht+0x705e, %rdi
nop
sub $26476, %rbp
mov $120, %rcx
rep movsl
nop
nop
nop
nop
nop
inc %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r9
push %rax
push %rbp
push %rdi
push %rsi
// Load
lea addresses_PSE+0xfecc, %r11
cmp $21565, %r13
mov (%r11), %si
nop
nop
add %rbp, %rbp
// Load
lea addresses_WC+0x1b80, %rdi
nop
nop
nop
inc %r9
vmovups (%rdi), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rbp
add $42913, %rbp
// Store
lea addresses_D+0x3632, %rsi
nop
nop
nop
nop
nop
add $31308, %rdi
mov $0x5152535455565758, %r13
movq %r13, %xmm0
vmovups %ymm0, (%rsi)
nop
xor $34779, %r9
// Faulty Load
mov $0x6ad6a50000000bb2, %r13
nop
and %rdi, %rdi
movups (%r13), %xmm3
vpextrq $0, %xmm3, %r9
lea oracles, %rbp
and $0xff, %r9
shlq $12, %r9
mov (%rbp,%r9,1), %r9
pop %rsi
pop %rdi
pop %rbp
pop %rax
pop %r9
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 4, 'NT': True, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 36.888268 | 2,999 | 0.658186 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.