Final commit? (not entirely sure what all this is now..)

This commit is contained in:
2025-07-05 11:44:43 +01:00
parent 8e3094f644
commit 20cc8788d8
198 changed files with 56377 additions and 2 deletions

BIN
_argtest Normal file

Binary file not shown.

BIN
_cat Normal file

Binary file not shown.

BIN
_cls Normal file

Binary file not shown.

BIN
_count Normal file

Binary file not shown.

BIN
_echo Normal file

Binary file not shown.

BIN
_forktest Normal file

Binary file not shown.

BIN
_grep Normal file

Binary file not shown.

BIN
_hello Normal file

Binary file not shown.

BIN
_init Normal file

Binary file not shown.

BIN
_kill Normal file

Binary file not shown.

BIN
_ln Normal file

Binary file not shown.

BIN
_ls Normal file

Binary file not shown.

BIN
_maze Normal file

Binary file not shown.

BIN
_mkdir Normal file

Binary file not shown.

BIN
_rm Normal file

Binary file not shown.

BIN
_screen Normal file

Binary file not shown.

BIN
_sh Normal file

Binary file not shown.

BIN
_shutdown Normal file

Binary file not shown.

BIN
_stressfs Normal file

Binary file not shown.

BIN
_usertests Normal file

Binary file not shown.

BIN
_wc Normal file

Binary file not shown.

BIN
_zombie Normal file

Binary file not shown.

1174
argtest.asm Normal file

File diff suppressed because it is too large Load Diff

1
argtest.d Normal file
View File

@ -0,0 +1 @@
argtest.o: argtest.c /usr/include/stdc-predef.h types.h user.h

BIN
argtest.o Normal file

Binary file not shown.

50
argtest.sym Normal file
View File

@ -0,0 +1,50 @@
00000000 argtest.c
00000000 ulib.c
00000000 printf.c
00000370 printint
000007b4 digits.0
00000000 umalloc.c
00000a68 freep
00000a6c base
00000050 strcpy
00000420 printf
0000034b greeting
00000270 memmove
0000031b mknod
00000170 gets
000002eb getpid
0000035b screen
00000650 malloc
000002fb sleep
000002b3 pipe
00000343 getch
00000313 write
000002d3 fstat
000002c3 kill
000002db chdir
000002cb exec
000002ab wait
000002bb read
00000323 unlink
0000029b fork
000002f3 sbrk
00000303 uptime
00000a68 __bss_start
00000110 memset
00000000 main
00000080 strcmp
00000353 shutdown
000002e3 dup
000001e0 stat
00000a68 _edata
00000a74 _end
0000032b link
000002a3 exit
00000230 atoi
00000363 cls
000000e0 strlen
0000030b open
00000130 strchr
00000333 mkdir
0000033b close
000005c0 free

2
bio.d Normal file
View File

@ -0,0 +1,2 @@
bio.o: bio.c /usr/include/stdc-predef.h types.h defs.h param.h spinlock.h \
sleeplock.h fs.h buf.h

BIN
bio.o Normal file

Binary file not shown.

1
bootasm.d Normal file
View File

@ -0,0 +1 @@
bootasm.o: bootasm.S asm.h memlayout.h mmu.h

BIN
bootasm.o Normal file

Binary file not shown.

BIN
bootblock Normal file

Binary file not shown.

341
bootblock.asm Normal file
View File

@ -0,0 +1,341 @@
bootblock.o: file format elf32-i386
Disassembly of section .text:
00007c00 <start>:
# with %cs=0 %ip=7c00.
.code16 # Assemble for 16-bit mode
.globl start
start:
cli # BIOS enabled interrupts; disable
7c00: fa cli
# Zero data segment registers DS, ES, and SS.
xorw %ax,%ax # Set %ax to zero
7c01: 31 c0 xor %eax,%eax
movw %ax,%ds # -> Data Segment
7c03: 8e d8 mov %eax,%ds
movw %ax,%es # -> Extra Segment
7c05: 8e c0 mov %eax,%es
movw %ax,%ss # -> Stack Segment
7c07: 8e d0 mov %eax,%ss
00007c09 <seta20.1>:
# Physical address line A20 is tied to zero so that the first PCs
# with 2 MB would run software that assumed 1 MB. Undo that.
seta20.1:
inb $0x64,%al # Wait for not busy
7c09: e4 64 in $0x64,%al
testb $0x2,%al
7c0b: a8 02 test $0x2,%al
jnz seta20.1
7c0d: 75 fa jne 7c09 <seta20.1>
movb $0xd1,%al # 0xd1 -> port 0x64
7c0f: b0 d1 mov $0xd1,%al
outb %al,$0x64
7c11: e6 64 out %al,$0x64
00007c13 <seta20.2>:
seta20.2:
inb $0x64,%al # Wait for not busy
7c13: e4 64 in $0x64,%al
testb $0x2,%al
7c15: a8 02 test $0x2,%al
jnz seta20.2
7c17: 75 fa jne 7c13 <seta20.2>
movb $0xdf,%al # 0xdf -> port 0x60
7c19: b0 df mov $0xdf,%al
outb %al,$0x60
7c1b: e6 60 out %al,$0x60
# Switch from real to protected mode. Use a bootstrap GDT that makes
# virtual addresses map directly to physical addresses so that the
# effective memory map doesn't change during the transition.
lgdt gdtdesc
7c1d: 0f 01 16 lgdtl (%esi)
7c20: 68 7c 0f 20 c0 push $0xc0200f7c
movl %cr0, %eax
orl $CR0_PE, %eax
7c25: 66 83 c8 01 or $0x1,%ax
movl %eax, %cr0
7c29: 0f 22 c0 mov %eax,%cr0
# Complete the transition to 32-bit protected mode by using a long jmp
# to reload %cs and %eip. The segment descriptors are set up with no
# translation, so that the mapping is still the identity mapping.
ljmp $(SEG_KCODE<<3), $start32
7c2c: ea .byte 0xea
7c2d: 31 7c 08 00 xor %edi,0x0(%eax,%ecx,1)
00007c31 <start32>:
.code32 # Tell assembler to generate 32-bit code now.
start32:
# Set up the protected-mode data segment registers
movw $(SEG_KDATA<<3), %ax # Our data segment selector
7c31: 66 b8 10 00 mov $0x10,%ax
movw %ax, %ds # -> DS: Data Segment
7c35: 8e d8 mov %eax,%ds
movw %ax, %es # -> ES: Extra Segment
7c37: 8e c0 mov %eax,%es
movw %ax, %ss # -> SS: Stack Segment
7c39: 8e d0 mov %eax,%ss
movw $0, %ax # Zero segments not ready for use
7c3b: 66 b8 00 00 mov $0x0,%ax
movw %ax, %fs # -> FS
7c3f: 8e e0 mov %eax,%fs
movw %ax, %gs # -> GS
7c41: 8e e8 mov %eax,%gs
# Set up the stack pointer and call into C.
movl $start, %esp
7c43: bc 00 7c 00 00 mov $0x7c00,%esp
call bootmain
7c48: e8 e0 00 00 00 call 7d2d <bootmain>
00007c4d <spin>:
# If bootmain returns (it shouldn't), loop.
spin:
jmp spin
7c4d: eb fe jmp 7c4d <spin>
7c4f: 90 nop
00007c50 <gdt>:
...
7c58: ff (bad)
7c59: ff 00 incl (%eax)
7c5b: 00 00 add %al,(%eax)
7c5d: 9a cf 00 ff ff 00 00 lcall $0x0,$0xffff00cf
7c64: 00 .byte 0x0
7c65: 92 xchg %eax,%edx
7c66: cf iret
...
00007c68 <gdtdesc>:
7c68: 17 pop %ss
7c69: 00 50 7c add %dl,0x7c(%eax)
...
00007c6e <waitdisk>:
// Routines to let C code use special x86 instructions.
static inline uchar inb(ushort port) {
uchar data;
asm volatile ("in %1,%0" : "=a" (data) : "d" (port));
7c6e: ba f7 01 00 00 mov $0x1f7,%edx
7c73: ec in (%dx),%al
entry();
}
void waitdisk(void) {
// Wait for disk ready.
while ((inb(0x1F7) & 0xC0) != 0x40) {
7c74: 83 e0 c0 and $0xffffffc0,%eax
7c77: 3c 40 cmp $0x40,%al
7c79: 75 f8 jne 7c73 <waitdisk+0x5>
;
}
}
7c7b: c3 ret
00007c7c <readsect>:
// Read a single sector at offset into dst.
void readsect(void *dst, uint offset) {
7c7c: 55 push %ebp
7c7d: 89 e5 mov %esp,%ebp
7c7f: 57 push %edi
7c80: 53 push %ebx
7c81: 8b 5d 0c mov 0xc(%ebp),%ebx
// Issue command.
waitdisk();
7c84: e8 e5 ff ff ff call 7c6e <waitdisk>
"d" (port), "0" (addr), "1" (cnt) :
"memory", "cc");
}
static inline void outb(ushort port, uchar data) {
asm volatile ("out %0,%1" : : "a" (data), "d" (port));
7c89: b8 01 00 00 00 mov $0x1,%eax
7c8e: ba f2 01 00 00 mov $0x1f2,%edx
7c93: ee out %al,(%dx)
7c94: ba f3 01 00 00 mov $0x1f3,%edx
7c99: 89 d8 mov %ebx,%eax
7c9b: ee out %al,(%dx)
outb(0x1F2, 1); // count = 1
outb(0x1F3, offset);
outb(0x1F4, offset >> 8);
7c9c: 89 d8 mov %ebx,%eax
7c9e: c1 e8 08 shr $0x8,%eax
7ca1: ba f4 01 00 00 mov $0x1f4,%edx
7ca6: ee out %al,(%dx)
outb(0x1F5, offset >> 16);
7ca7: 89 d8 mov %ebx,%eax
7ca9: c1 e8 10 shr $0x10,%eax
7cac: ba f5 01 00 00 mov $0x1f5,%edx
7cb1: ee out %al,(%dx)
outb(0x1F6, (offset >> 24) | 0xE0);
7cb2: 89 d8 mov %ebx,%eax
7cb4: c1 e8 18 shr $0x18,%eax
7cb7: 83 c8 e0 or $0xffffffe0,%eax
7cba: ba f6 01 00 00 mov $0x1f6,%edx
7cbf: ee out %al,(%dx)
7cc0: b8 20 00 00 00 mov $0x20,%eax
7cc5: ba f7 01 00 00 mov $0x1f7,%edx
7cca: ee out %al,(%dx)
outb(0x1F7, 0x20); // cmd 0x20 - read sectors
// Read data.
waitdisk();
7ccb: e8 9e ff ff ff call 7c6e <waitdisk>
asm volatile ("cld; rep insl" :
7cd0: 8b 7d 08 mov 0x8(%ebp),%edi
7cd3: b9 80 00 00 00 mov $0x80,%ecx
7cd8: ba f0 01 00 00 mov $0x1f0,%edx
7cdd: fc cld
7cde: f3 6d rep insl (%dx),%es:(%edi)
insl(0x1F0, dst, SECTSIZE / 4);
}
7ce0: 5b pop %ebx
7ce1: 5f pop %edi
7ce2: 5d pop %ebp
7ce3: c3 ret
00007ce4 <readseg>:
// Read 'count' bytes at 'offset' from kernel into physical address 'pa'.
// Might copy more than asked.
void readseg(uchar* pa, uint count, uint offset) {
7ce4: 55 push %ebp
7ce5: 89 e5 mov %esp,%ebp
7ce7: 57 push %edi
7ce8: 56 push %esi
7ce9: 53 push %ebx
7cea: 83 ec 0c sub $0xc,%esp
7ced: 8b 5d 08 mov 0x8(%ebp),%ebx
7cf0: 8b 75 10 mov 0x10(%ebp),%esi
uchar* epa;
epa = pa + count;
7cf3: 89 df mov %ebx,%edi
7cf5: 03 7d 0c add 0xc(%ebp),%edi
// Round down to sector boundary.
pa -= offset % SECTSIZE;
7cf8: 89 f0 mov %esi,%eax
7cfa: 25 ff 01 00 00 and $0x1ff,%eax
7cff: 29 c3 sub %eax,%ebx
// Translate from bytes to sectors; kernel starts at sector 1.
offset = (offset / SECTSIZE) + 1;
7d01: c1 ee 09 shr $0x9,%esi
7d04: 83 c6 01 add $0x1,%esi
// If this is too slow, we could read lots of sectors at a time.
// We'd write more to memory than asked, but it doesn't matter --
// we load in increasing order.
for (; pa < epa; pa += SECTSIZE, offset++) {
7d07: 39 df cmp %ebx,%edi
7d09: 76 1a jbe 7d25 <readseg+0x41>
readsect(pa, offset);
7d0b: 83 ec 08 sub $0x8,%esp
7d0e: 56 push %esi
7d0f: 53 push %ebx
7d10: e8 67 ff ff ff call 7c7c <readsect>
for (; pa < epa; pa += SECTSIZE, offset++) {
7d15: 81 c3 00 02 00 00 add $0x200,%ebx
7d1b: 83 c6 01 add $0x1,%esi
7d1e: 83 c4 10 add $0x10,%esp
7d21: 39 df cmp %ebx,%edi
7d23: 77 e6 ja 7d0b <readseg+0x27>
}
}
7d25: 8d 65 f4 lea -0xc(%ebp),%esp
7d28: 5b pop %ebx
7d29: 5e pop %esi
7d2a: 5f pop %edi
7d2b: 5d pop %ebp
7d2c: c3 ret
00007d2d <bootmain>:
void bootmain(void) {
7d2d: 55 push %ebp
7d2e: 89 e5 mov %esp,%ebp
7d30: 57 push %edi
7d31: 56 push %esi
7d32: 53 push %ebx
7d33: 83 ec 10 sub $0x10,%esp
readseg((uchar*)elf, 4096, 0);
7d36: 6a 00 push $0x0
7d38: 68 00 10 00 00 push $0x1000
7d3d: 68 00 00 01 00 push $0x10000
7d42: e8 9d ff ff ff call 7ce4 <readseg>
if (elf->magic != ELF_MAGIC) {
7d47: 83 c4 10 add $0x10,%esp
7d4a: 81 3d 00 00 01 00 7f cmpl $0x464c457f,0x10000
7d51: 45 4c 46
7d54: 75 21 jne 7d77 <bootmain+0x4a>
ph = (struct proghdr*)((uchar*)elf + elf->phoff);
7d56: a1 1c 00 01 00 mov 0x1001c,%eax
7d5b: 8d 98 00 00 01 00 lea 0x10000(%eax),%ebx
eph = ph + elf->phnum;
7d61: 0f b7 35 2c 00 01 00 movzwl 0x1002c,%esi
7d68: c1 e6 05 shl $0x5,%esi
7d6b: 01 de add %ebx,%esi
for (; ph < eph; ph++) {
7d6d: 39 f3 cmp %esi,%ebx
7d6f: 72 15 jb 7d86 <bootmain+0x59>
entry();
7d71: ff 15 18 00 01 00 call *0x10018
}
7d77: 8d 65 f4 lea -0xc(%ebp),%esp
7d7a: 5b pop %ebx
7d7b: 5e pop %esi
7d7c: 5f pop %edi
7d7d: 5d pop %ebp
7d7e: c3 ret
for (; ph < eph; ph++) {
7d7f: 83 c3 20 add $0x20,%ebx
7d82: 39 de cmp %ebx,%esi
7d84: 76 eb jbe 7d71 <bootmain+0x44>
pa = (uchar*)ph->paddr;
7d86: 8b 7b 0c mov 0xc(%ebx),%edi
readseg(pa, ph->filesz, ph->off);
7d89: 83 ec 04 sub $0x4,%esp
7d8c: ff 73 04 push 0x4(%ebx)
7d8f: ff 73 10 push 0x10(%ebx)
7d92: 57 push %edi
7d93: e8 4c ff ff ff call 7ce4 <readseg>
if (ph->memsz > ph->filesz) {
7d98: 8b 4b 14 mov 0x14(%ebx),%ecx
7d9b: 8b 43 10 mov 0x10(%ebx),%eax
7d9e: 83 c4 10 add $0x10,%esp
7da1: 39 c1 cmp %eax,%ecx
7da3: 76 da jbe 7d7f <bootmain+0x52>
stosb(pa + ph->filesz, 0, ph->memsz - ph->filesz);
7da5: 01 c7 add %eax,%edi
7da7: 29 c1 sub %eax,%ecx
"d" (port), "0" (addr), "1" (cnt) :
"cc");
}
static inline void stosb(void *addr, int data, int cnt) {
asm volatile ("cld; rep stosb" :
7da9: b8 00 00 00 00 mov $0x0,%eax
7dae: fc cld
7daf: f3 aa rep stos %al,%es:(%edi)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
7db1: eb cc jmp 7d7f <bootmain+0x52>

BIN
bootblock.o Normal file

Binary file not shown.

BIN
bootblockother.o Normal file

Binary file not shown.

1
bootmain.d Normal file
View File

@ -0,0 +1 @@
bootmain.o: bootmain.c types.h elf.h x86.h memlayout.h

BIN
bootmain.o Normal file

Binary file not shown.

1268
cat.asm Normal file

File diff suppressed because it is too large Load Diff

1
cat.d Normal file
View File

@ -0,0 +1 @@
cat.o: cat.c /usr/include/stdc-predef.h types.h stat.h user.h

BIN
cat.o Normal file

Binary file not shown.

52
cat.sym Normal file
View File

@ -0,0 +1,52 @@
00000000 cat.c
00000000 ulib.c
00000000 printf.c
00000430 printint
000008a0 digits.0
00000000 umalloc.c
00000da0 freep
00000da4 base
00000110 strcpy
000004e0 printf
0000040b greeting
00000330 memmove
000003db mknod
00000230 gets
000003ab getpid
00000090 cat
0000041b screen
00000710 malloc
000003bb sleep
00000373 pipe
00000403 getch
000003d3 write
00000393 fstat
00000383 kill
0000039b chdir
0000038b exec
0000036b wait
0000037b read
000003e3 unlink
0000035b fork
000003b3 sbrk
000003c3 uptime
00000b84 __bss_start
000001d0 memset
00000000 main
00000140 strcmp
00000413 shutdown
000003a3 dup
00000ba0 buf
000002a0 stat
00000b84 _edata
00000dac _end
000003eb link
00000363 exit
000002f0 atoi
00000423 cls
000001a0 strlen
000003cb open
000001f0 strchr
000003f3 mkdir
000003fb close
00000680 free

1142
cls.asm Normal file

File diff suppressed because it is too large Load Diff

1
cls.d Normal file
View File

@ -0,0 +1 @@
cls.o: cls.c /usr/include/stdc-predef.h types.h user.h

BIN
cls.o Normal file

Binary file not shown.

50
cls.sym Normal file
View File

@ -0,0 +1,50 @@
00000000 cls.c
00000000 ulib.c
00000000 printf.c
00000330 printint
00000768 digits.0
00000000 umalloc.c
00000a08 freep
00000a0c base
00000010 strcpy
000003e0 printf
0000030b greeting
00000230 memmove
000002db mknod
00000130 gets
000002ab getpid
0000031b screen
00000610 malloc
000002bb sleep
00000273 pipe
00000303 getch
000002d3 write
00000293 fstat
00000283 kill
0000029b chdir
0000028b exec
0000026b wait
0000027b read
000002e3 unlink
0000025b fork
000002b3 sbrk
000002c3 uptime
00000a08 __bss_start
000000d0 memset
00000000 main
00000040 strcmp
00000313 shutdown
000002a3 dup
000001a0 stat
00000a08 _edata
00000a14 _end
000002eb link
00000263 exit
000001f0 atoi
00000323 cls
000000a0 strlen
000002cb open
000000f0 strchr
000002f3 mkdir
000002fb close
00000580 free

3
console.d Normal file
View File

@ -0,0 +1,3 @@
console.o: console.c /usr/include/stdc-predef.h types.h defs.h param.h \
traps.h spinlock.h sleeplock.h fs.h file.h memlayout.h mmu.h proc.h \
x86.h

BIN
console.o Normal file

Binary file not shown.

1275
count.asm Normal file

File diff suppressed because it is too large Load Diff

1
count.d Normal file
View File

@ -0,0 +1 @@
count.o: count.c /usr/include/stdc-predef.h types.h user.h

BIN
count.o Normal file

Binary file not shown.

50
count.sym Normal file
View File

@ -0,0 +1,50 @@
00000000 count.c
00000000 ulib.c
00000000 printf.c
00000460 printint
00000928 digits.0
00000000 umalloc.c
00000bdc freep
00000be0 base
00000140 strcpy
00000510 printf
0000043b greeting
00000360 memmove
0000040b mknod
00000260 gets
000003db getpid
0000044b screen
00000740 malloc
000003eb sleep
000003a3 pipe
00000433 getch
00000403 write
000003c3 fstat
000003b3 kill
000003cb chdir
000003bb exec
0000039b wait
000003ab read
00000413 unlink
0000038b fork
000003e3 sbrk
000003f3 uptime
00000bdc __bss_start
00000200 memset
00000000 main
00000170 strcmp
00000443 shutdown
000003d3 dup
000002d0 stat
00000bdc _edata
00000be8 _end
0000041b link
00000393 exit
00000320 atoi
00000453 cls
000001d0 strlen
000003fb open
00000220 strchr
00000423 mkdir
0000042b close
000006b0 free

1181
echo.asm Normal file

File diff suppressed because it is too large Load Diff

1
echo.d Normal file
View File

@ -0,0 +1 @@
echo.o: echo.c /usr/include/stdc-predef.h types.h stat.h user.h

BIN
echo.o Normal file

Binary file not shown.

50
echo.sym Normal file
View File

@ -0,0 +1,50 @@
00000000 echo.c
00000000 ulib.c
00000000 printf.c
00000390 printint
000007d0 digits.0
00000000 umalloc.c
00000a84 freep
00000a88 base
00000070 strcpy
00000440 printf
0000036b greeting
00000290 memmove
0000033b mknod
00000190 gets
0000030b getpid
0000037b screen
00000670 malloc
0000031b sleep
000002d3 pipe
00000363 getch
00000333 write
000002f3 fstat
000002e3 kill
000002fb chdir
000002eb exec
000002cb wait
000002db read
00000343 unlink
000002bb fork
00000313 sbrk
00000323 uptime
00000a84 __bss_start
00000130 memset
00000000 main
000000a0 strcmp
00000373 shutdown
00000303 dup
00000200 stat
00000a84 _edata
00000a90 _end
0000034b link
000002c3 exit
00000250 atoi
00000383 cls
00000100 strlen
0000032b open
00000150 strchr
00000353 mkdir
0000035b close
000005e0 free

BIN
entry.o Normal file

Binary file not shown.

BIN
entryother Normal file

Binary file not shown.

115
entryother.asm Normal file
View File

@ -0,0 +1,115 @@
bootblockother.o: file format elf32-i386
Disassembly of section .text:
00007000 <start>:
# This code combines elements of bootasm.S and entry.S.
.code16
.globl start
start:
cli
7000: fa cli
# Zero data segment registers DS, ES, and SS.
xorw %ax,%ax
7001: 31 c0 xor %eax,%eax
movw %ax,%ds
7003: 8e d8 mov %eax,%ds
movw %ax,%es
7005: 8e c0 mov %eax,%es
movw %ax,%ss
7007: 8e d0 mov %eax,%ss
# Switch from real to protected mode. Use a bootstrap GDT that makes
# virtual addresses map directly to physical addresses so that the
# effective memory map doesn't change during the transition.
lgdt gdtdesc
7009: 0f 01 16 lgdtl (%esi)
700c: 74 70 je 707e <_end+0x2>
movl %cr0, %eax
700e: 0f 20 c0 mov %cr0,%eax
orl $CR0_PE, %eax
7011: 66 83 c8 01 or $0x1,%ax
movl %eax, %cr0
7015: 0f 22 c0 mov %eax,%cr0
# Complete the transition to 32-bit protected mode by using a long jmp
# to reload %cs and %eip. The segment descriptors are set up with no
# translation, so that the mapping is still the identity mapping.
ljmpl $(SEG_KCODE<<3), $(start32)
7018: 66 ea 20 70 00 00 ljmpw $0x0,$0x7020
701e: 08 00 or %al,(%eax)
00007020 <start32>:
.code32 # Tell assembler to generate 32-bit code now.
start32:
# Set up the protected-mode data segment registers
movw $(SEG_KDATA<<3), %ax # Our data segment selector
7020: 66 b8 10 00 mov $0x10,%ax
movw %ax, %ds # -> DS: Data Segment
7024: 8e d8 mov %eax,%ds
movw %ax, %es # -> ES: Extra Segment
7026: 8e c0 mov %eax,%es
movw %ax, %ss # -> SS: Stack Segment
7028: 8e d0 mov %eax,%ss
movw $0, %ax # Zero segments not ready for use
702a: 66 b8 00 00 mov $0x0,%ax
movw %ax, %fs # -> FS
702e: 8e e0 mov %eax,%fs
movw %ax, %gs # -> GS
7030: 8e e8 mov %eax,%gs
# Turn on page size extension for 4Mbyte pages
movl %cr4, %eax
7032: 0f 20 e0 mov %cr4,%eax
orl $(CR4_PSE), %eax
7035: 83 c8 10 or $0x10,%eax
movl %eax, %cr4
7038: 0f 22 e0 mov %eax,%cr4
# Use entrypgdir as our initial page table
movl (start-12), %eax
703b: a1 f4 6f 00 00 mov 0x6ff4,%eax
movl %eax, %cr3
7040: 0f 22 d8 mov %eax,%cr3
# Turn on paging.
movl %cr0, %eax
7043: 0f 20 c0 mov %cr0,%eax
orl $(CR0_PE|CR0_PG|CR0_WP), %eax
7046: 0d 01 00 01 80 or $0x80010001,%eax
movl %eax, %cr0
704b: 0f 22 c0 mov %eax,%cr0
# Switch to the stack allocated by startothers()
movl (start-4), %esp
704e: 8b 25 fc 6f 00 00 mov 0x6ffc,%esp
# Call mpenter()
call *(start-8)
7054: ff 15 f8 6f 00 00 call *0x6ff8
0000705a <spin>:
# We should never return.
spin:
jmp spin
705a: eb fe jmp 705a <spin>
0000705c <gdt>:
...
7064: ff (bad)
7065: ff 00 incl (%eax)
7067: 00 00 add %al,(%eax)
7069: 9a cf 00 ff ff 00 00 lcall $0x0,$0xffff00cf
7070: 00 .byte 0x0
7071: 92 xchg %eax,%edx
7072: cf iret
...
00007074 <gdtdesc>:
7074: 17 pop %ss
7075: 00 5c 70 00 add %bl,0x0(%eax,%esi,2)
...

1
entryother.d Normal file
View File

@ -0,0 +1 @@
entryother.o: entryother.S asm.h memlayout.h mmu.h

BIN
entryother.o Normal file

Binary file not shown.

2
exec.d Normal file
View File

@ -0,0 +1,2 @@
exec.o: exec.c /usr/include/stdc-predef.h types.h param.h memlayout.h \
mmu.h proc.h defs.h x86.h elf.h

BIN
exec.o Normal file

Binary file not shown.

2
file.d Normal file
View File

@ -0,0 +1,2 @@
file.o: file.c /usr/include/stdc-predef.h types.h defs.h param.h fs.h \
spinlock.h sleeplock.h file.h

BIN
file.o Normal file

Binary file not shown.

685
forktest.asm Normal file
View File

@ -0,0 +1,685 @@
_forktest: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
}
printf(1, "fork test OK\n");
}
int main(void) {
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
forktest();
6: e8 35 00 00 00 call 40 <forktest>
exit();
b: e8 63 03 00 00 call 373 <exit>
00000010 <printf>:
void printf(int fd, const char *s, ...) {
10: 55 push %ebp
11: 89 e5 mov %esp,%ebp
13: 53 push %ebx
14: 83 ec 10 sub $0x10,%esp
17: 8b 5d 0c mov 0xc(%ebp),%ebx
write(fd, s, strlen(s));
1a: 53 push %ebx
1b: e8 90 01 00 00 call 1b0 <strlen>
20: 83 c4 0c add $0xc,%esp
23: 50 push %eax
24: 53 push %ebx
25: ff 75 08 push 0x8(%ebp)
28: e8 b6 03 00 00 call 3e3 <write>
}
2d: 8b 5d fc mov -0x4(%ebp),%ebx
30: 83 c4 10 add $0x10,%esp
33: c9 leave
34: c3 ret
35: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000040 <forktest>:
void forktest(void) {
40: 55 push %ebp
41: 89 e5 mov %esp,%ebp
43: 53 push %ebx
for (n = 0; n < N; n++) {
44: 31 db xor %ebx,%ebx
void forktest(void) {
46: 83 ec 10 sub $0x10,%esp
write(fd, s, strlen(s));
49: 68 3c 04 00 00 push $0x43c
4e: e8 5d 01 00 00 call 1b0 <strlen>
53: 83 c4 0c add $0xc,%esp
56: 50 push %eax
57: 68 3c 04 00 00 push $0x43c
5c: 6a 01 push $0x1
5e: e8 80 03 00 00 call 3e3 <write>
63: 83 c4 10 add $0x10,%esp
66: eb 19 jmp 81 <forktest+0x41>
68: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
6f: 90 nop
if (pid == 0) {
70: 74 58 je ca <forktest+0x8a>
for (n = 0; n < N; n++) {
72: 83 c3 01 add $0x1,%ebx
75: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
7b: 0f 84 83 00 00 00 je 104 <forktest+0xc4>
pid = fork();
81: e8 e5 02 00 00 call 36b <fork>
if (pid < 0) {
86: 85 c0 test %eax,%eax
88: 79 e6 jns 70 <forktest+0x30>
for (; n > 0; n--) {
8a: 85 db test %ebx,%ebx
8c: 74 10 je 9e <forktest+0x5e>
8e: 66 90 xchg %ax,%ax
if (wait() < 0) {
90: e8 e6 02 00 00 call 37b <wait>
95: 85 c0 test %eax,%eax
97: 78 36 js cf <forktest+0x8f>
for (; n > 0; n--) {
99: 83 eb 01 sub $0x1,%ebx
9c: 75 f2 jne 90 <forktest+0x50>
if (wait() != -1) {
9e: e8 d8 02 00 00 call 37b <wait>
a3: 83 f8 ff cmp $0xffffffff,%eax
a6: 75 49 jne f1 <forktest+0xb1>
write(fd, s, strlen(s));
a8: 83 ec 0c sub $0xc,%esp
ab: 68 6e 04 00 00 push $0x46e
b0: e8 fb 00 00 00 call 1b0 <strlen>
b5: 83 c4 0c add $0xc,%esp
b8: 50 push %eax
b9: 68 6e 04 00 00 push $0x46e
be: 6a 01 push $0x1
c0: e8 1e 03 00 00 call 3e3 <write>
}
c5: 8b 5d fc mov -0x4(%ebp),%ebx
c8: c9 leave
c9: c3 ret
exit();
ca: e8 a4 02 00 00 call 373 <exit>
write(fd, s, strlen(s));
cf: 83 ec 0c sub $0xc,%esp
d2: 68 47 04 00 00 push $0x447
d7: e8 d4 00 00 00 call 1b0 <strlen>
dc: 83 c4 0c add $0xc,%esp
df: 50 push %eax
e0: 68 47 04 00 00 push $0x447
e5: 6a 01 push $0x1
e7: e8 f7 02 00 00 call 3e3 <write>
exit();
ec: e8 82 02 00 00 call 373 <exit>
printf(1, "wait got too many\n");
f1: 52 push %edx
f2: 52 push %edx
f3: 68 5b 04 00 00 push $0x45b
f8: 6a 01 push $0x1
fa: e8 11 ff ff ff call 10 <printf>
exit();
ff: e8 6f 02 00 00 call 373 <exit>
printf(1, "fork claimed to work N times!\n", N);
104: 50 push %eax
105: 68 e8 03 00 00 push $0x3e8
10a: 68 7c 04 00 00 push $0x47c
10f: 6a 01 push $0x1
111: e8 fa fe ff ff call 10 <printf>
exit();
116: e8 58 02 00 00 call 373 <exit>
11b: 66 90 xchg %ax,%ax
11d: 66 90 xchg %ax,%ax
11f: 90 nop
00000120 <strcpy>:
#include "stat.h"
#include "fcntl.h"
#include "user.h"
#include "x86.h"
char*strcpy(char *s, const char *t) {
120: 55 push %ebp
char *os;
os = s;
while ((*s++ = *t++) != 0) {
121: 31 c0 xor %eax,%eax
char*strcpy(char *s, const char *t) {
123: 89 e5 mov %esp,%ebp
125: 53 push %ebx
126: 8b 4d 08 mov 0x8(%ebp),%ecx
129: 8b 5d 0c mov 0xc(%ebp),%ebx
12c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while ((*s++ = *t++) != 0) {
130: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx
134: 88 14 01 mov %dl,(%ecx,%eax,1)
137: 83 c0 01 add $0x1,%eax
13a: 84 d2 test %dl,%dl
13c: 75 f2 jne 130 <strcpy+0x10>
;
}
return os;
}
13e: 8b 5d fc mov -0x4(%ebp),%ebx
141: 89 c8 mov %ecx,%eax
143: c9 leave
144: c3 ret
145: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
14c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000150 <strcmp>:
int strcmp(const char *p, const char *q) {
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 53 push %ebx
154: 8b 55 08 mov 0x8(%ebp),%edx
157: 8b 4d 0c mov 0xc(%ebp),%ecx
while (*p && *p == *q) {
15a: 0f b6 02 movzbl (%edx),%eax
15d: 84 c0 test %al,%al
15f: 75 17 jne 178 <strcmp+0x28>
161: eb 3a jmp 19d <strcmp+0x4d>
163: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
167: 90 nop
168: 0f b6 42 01 movzbl 0x1(%edx),%eax
p++, q++;
16c: 83 c2 01 add $0x1,%edx
16f: 8d 59 01 lea 0x1(%ecx),%ebx
while (*p && *p == *q) {
172: 84 c0 test %al,%al
174: 74 1a je 190 <strcmp+0x40>
p++, q++;
176: 89 d9 mov %ebx,%ecx
while (*p && *p == *q) {
178: 0f b6 19 movzbl (%ecx),%ebx
17b: 38 c3 cmp %al,%bl
17d: 74 e9 je 168 <strcmp+0x18>
}
return (uchar) * p - (uchar) * q;
17f: 29 d8 sub %ebx,%eax
}
181: 8b 5d fc mov -0x4(%ebp),%ebx
184: c9 leave
185: c3 ret
186: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
18d: 8d 76 00 lea 0x0(%esi),%esi
return (uchar) * p - (uchar) * q;
190: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
194: 31 c0 xor %eax,%eax
196: 29 d8 sub %ebx,%eax
}
198: 8b 5d fc mov -0x4(%ebp),%ebx
19b: c9 leave
19c: c3 ret
return (uchar) * p - (uchar) * q;
19d: 0f b6 19 movzbl (%ecx),%ebx
1a0: 31 c0 xor %eax,%eax
1a2: eb db jmp 17f <strcmp+0x2f>
1a4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1ab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1af: 90 nop
000001b0 <strlen>:
uint strlen(const char *s) {
1b0: 55 push %ebp
1b1: 89 e5 mov %esp,%ebp
1b3: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for (n = 0; s[n]; n++) {
1b6: 80 3a 00 cmpb $0x0,(%edx)
1b9: 74 15 je 1d0 <strlen+0x20>
1bb: 31 c0 xor %eax,%eax
1bd: 8d 76 00 lea 0x0(%esi),%esi
1c0: 83 c0 01 add $0x1,%eax
1c3: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
1c7: 89 c1 mov %eax,%ecx
1c9: 75 f5 jne 1c0 <strlen+0x10>
;
}
return n;
}
1cb: 89 c8 mov %ecx,%eax
1cd: 5d pop %ebp
1ce: c3 ret
1cf: 90 nop
for (n = 0; s[n]; n++) {
1d0: 31 c9 xor %ecx,%ecx
}
1d2: 5d pop %ebp
1d3: 89 c8 mov %ecx,%eax
1d5: c3 ret
1d6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
1dd: 8d 76 00 lea 0x0(%esi),%esi
000001e0 <memset>:
void* memset(void *dst, int c, uint n) {
1e0: 55 push %ebp
1e1: 89 e5 mov %esp,%ebp
1e3: 57 push %edi
1e4: 8b 55 08 mov 0x8(%ebp),%edx
"d" (port), "0" (addr), "1" (cnt) :
"cc");
}
static inline void stosb(void *addr, int data, int cnt) {
asm volatile ("cld; rep stosb" :
1e7: 8b 4d 10 mov 0x10(%ebp),%ecx
1ea: 8b 45 0c mov 0xc(%ebp),%eax
1ed: 89 d7 mov %edx,%edi
1ef: fc cld
1f0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
1f2: 8b 7d fc mov -0x4(%ebp),%edi
1f5: 89 d0 mov %edx,%eax
1f7: c9 leave
1f8: c3 ret
1f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000200 <strchr>:
char* strchr(const char *s, char c) {
200: 55 push %ebp
201: 89 e5 mov %esp,%ebp
203: 8b 45 08 mov 0x8(%ebp),%eax
206: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for (; *s; s++) {
20a: 0f b6 10 movzbl (%eax),%edx
20d: 84 d2 test %dl,%dl
20f: 75 12 jne 223 <strchr+0x23>
211: eb 1d jmp 230 <strchr+0x30>
213: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
217: 90 nop
218: 0f b6 50 01 movzbl 0x1(%eax),%edx
21c: 83 c0 01 add $0x1,%eax
21f: 84 d2 test %dl,%dl
221: 74 0d je 230 <strchr+0x30>
if (*s == c) {
223: 38 d1 cmp %dl,%cl
225: 75 f1 jne 218 <strchr+0x18>
return (char*)s;
}
}
return 0;
}
227: 5d pop %ebp
228: c3 ret
229: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return 0;
230: 31 c0 xor %eax,%eax
}
232: 5d pop %ebp
233: c3 ret
234: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
23b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
23f: 90 nop
00000240 <gets>:
char* gets(char *buf, int max) {
240: 55 push %ebp
241: 89 e5 mov %esp,%ebp
243: 57 push %edi
244: 56 push %esi
int i, cc;
char c;
for (i = 0; i + 1 < max;) {
cc = read(0, &c, 1);
245: 8d 7d e7 lea -0x19(%ebp),%edi
char* gets(char *buf, int max) {
248: 53 push %ebx
for (i = 0; i + 1 < max;) {
249: 31 db xor %ebx,%ebx
char* gets(char *buf, int max) {
24b: 83 ec 1c sub $0x1c,%esp
for (i = 0; i + 1 < max;) {
24e: eb 27 jmp 277 <gets+0x37>
cc = read(0, &c, 1);
250: 83 ec 04 sub $0x4,%esp
253: 6a 01 push $0x1
255: 57 push %edi
256: 6a 00 push $0x0
258: e8 2e 01 00 00 call 38b <read>
if (cc < 1) {
25d: 83 c4 10 add $0x10,%esp
260: 85 c0 test %eax,%eax
262: 7e 1d jle 281 <gets+0x41>
break;
}
buf[i++] = c;
264: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
268: 8b 55 08 mov 0x8(%ebp),%edx
26b: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if (c == '\n' || c == '\r') {
26f: 3c 0a cmp $0xa,%al
271: 74 1d je 290 <gets+0x50>
273: 3c 0d cmp $0xd,%al
275: 74 19 je 290 <gets+0x50>
for (i = 0; i + 1 < max;) {
277: 89 de mov %ebx,%esi
279: 83 c3 01 add $0x1,%ebx
27c: 3b 5d 0c cmp 0xc(%ebp),%ebx
27f: 7c cf jl 250 <gets+0x10>
break;
}
}
buf[i] = '\0';
281: 8b 45 08 mov 0x8(%ebp),%eax
284: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
288: 8d 65 f4 lea -0xc(%ebp),%esp
28b: 5b pop %ebx
28c: 5e pop %esi
28d: 5f pop %edi
28e: 5d pop %ebp
28f: c3 ret
buf[i] = '\0';
290: 8b 45 08 mov 0x8(%ebp),%eax
293: 89 de mov %ebx,%esi
295: c6 04 30 00 movb $0x0,(%eax,%esi,1)
}
299: 8d 65 f4 lea -0xc(%ebp),%esp
29c: 5b pop %ebx
29d: 5e pop %esi
29e: 5f pop %edi
29f: 5d pop %ebp
2a0: c3 ret
2a1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2a8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2af: 90 nop
000002b0 <stat>:
int stat(const char *n, struct stat *st) {
2b0: 55 push %ebp
2b1: 89 e5 mov %esp,%ebp
2b3: 56 push %esi
2b4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
2b5: 83 ec 08 sub $0x8,%esp
2b8: 6a 00 push $0x0
2ba: ff 75 08 push 0x8(%ebp)
2bd: e8 19 01 00 00 call 3db <open>
if (fd < 0) {
2c2: 83 c4 10 add $0x10,%esp
2c5: 85 c0 test %eax,%eax
2c7: 78 27 js 2f0 <stat+0x40>
return -1;
}
r = fstat(fd, st);
2c9: 83 ec 08 sub $0x8,%esp
2cc: ff 75 0c push 0xc(%ebp)
2cf: 89 c3 mov %eax,%ebx
2d1: 50 push %eax
2d2: e8 cc 00 00 00 call 3a3 <fstat>
close(fd);
2d7: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
2da: 89 c6 mov %eax,%esi
close(fd);
2dc: e8 2a 01 00 00 call 40b <close>
return r;
2e1: 83 c4 10 add $0x10,%esp
}
2e4: 8d 65 f8 lea -0x8(%ebp),%esp
2e7: 89 f0 mov %esi,%eax
2e9: 5b pop %ebx
2ea: 5e pop %esi
2eb: 5d pop %ebp
2ec: c3 ret
2ed: 8d 76 00 lea 0x0(%esi),%esi
return -1;
2f0: be ff ff ff ff mov $0xffffffff,%esi
2f5: eb ed jmp 2e4 <stat+0x34>
2f7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2fe: 66 90 xchg %ax,%ax
00000300 <atoi>:
int atoi(const char *s) {
300: 55 push %ebp
301: 89 e5 mov %esp,%ebp
303: 53 push %ebx
304: 8b 55 08 mov 0x8(%ebp),%edx
int n;
n = 0;
while ('0' <= *s && *s <= '9') {
307: 0f be 02 movsbl (%edx),%eax
30a: 8d 48 d0 lea -0x30(%eax),%ecx
30d: 80 f9 09 cmp $0x9,%cl
n = 0;
310: b9 00 00 00 00 mov $0x0,%ecx
while ('0' <= *s && *s <= '9') {
315: 77 1e ja 335 <atoi+0x35>
317: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
31e: 66 90 xchg %ax,%ax
n = n * 10 + *s++ - '0';
320: 83 c2 01 add $0x1,%edx
323: 8d 0c 89 lea (%ecx,%ecx,4),%ecx
326: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx
while ('0' <= *s && *s <= '9') {
32a: 0f be 02 movsbl (%edx),%eax
32d: 8d 58 d0 lea -0x30(%eax),%ebx
330: 80 fb 09 cmp $0x9,%bl
333: 76 eb jbe 320 <atoi+0x20>
}
return n;
}
335: 8b 5d fc mov -0x4(%ebp),%ebx
338: 89 c8 mov %ecx,%eax
33a: c9 leave
33b: c3 ret
33c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000340 <memmove>:
void* memmove(void *vdst, const void *vsrc, int n) {
340: 55 push %ebp
341: 89 e5 mov %esp,%ebp
343: 57 push %edi
344: 8b 45 10 mov 0x10(%ebp),%eax
347: 8b 55 08 mov 0x8(%ebp),%edx
34a: 56 push %esi
34b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while (n-- > 0) {
34e: 85 c0 test %eax,%eax
350: 7e 13 jle 365 <memmove+0x25>
352: 01 d0 add %edx,%eax
dst = vdst;
354: 89 d7 mov %edx,%edi
356: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
35d: 8d 76 00 lea 0x0(%esi),%esi
*dst++ = *src++;
360: a4 movsb %ds:(%esi),%es:(%edi)
while (n-- > 0) {
361: 39 f8 cmp %edi,%eax
363: 75 fb jne 360 <memmove+0x20>
}
return vdst;
}
365: 5e pop %esi
366: 89 d0 mov %edx,%eax
368: 5f pop %edi
369: 5d pop %ebp
36a: c3 ret
0000036b <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
36b: b8 01 00 00 00 mov $0x1,%eax
370: cd 40 int $0x40
372: c3 ret
00000373 <exit>:
SYSCALL(exit)
373: b8 02 00 00 00 mov $0x2,%eax
378: cd 40 int $0x40
37a: c3 ret
0000037b <wait>:
SYSCALL(wait)
37b: b8 03 00 00 00 mov $0x3,%eax
380: cd 40 int $0x40
382: c3 ret
00000383 <pipe>:
SYSCALL(pipe)
383: b8 04 00 00 00 mov $0x4,%eax
388: cd 40 int $0x40
38a: c3 ret
0000038b <read>:
SYSCALL(read)
38b: b8 05 00 00 00 mov $0x5,%eax
390: cd 40 int $0x40
392: c3 ret
00000393 <kill>:
SYSCALL(kill)
393: b8 06 00 00 00 mov $0x6,%eax
398: cd 40 int $0x40
39a: c3 ret
0000039b <exec>:
SYSCALL(exec)
39b: b8 07 00 00 00 mov $0x7,%eax
3a0: cd 40 int $0x40
3a2: c3 ret
000003a3 <fstat>:
SYSCALL(fstat)
3a3: b8 08 00 00 00 mov $0x8,%eax
3a8: cd 40 int $0x40
3aa: c3 ret
000003ab <chdir>:
SYSCALL(chdir)
3ab: b8 09 00 00 00 mov $0x9,%eax
3b0: cd 40 int $0x40
3b2: c3 ret
000003b3 <dup>:
SYSCALL(dup)
3b3: b8 0a 00 00 00 mov $0xa,%eax
3b8: cd 40 int $0x40
3ba: c3 ret
000003bb <getpid>:
SYSCALL(getpid)
3bb: b8 0b 00 00 00 mov $0xb,%eax
3c0: cd 40 int $0x40
3c2: c3 ret
000003c3 <sbrk>:
SYSCALL(sbrk)
3c3: b8 0c 00 00 00 mov $0xc,%eax
3c8: cd 40 int $0x40
3ca: c3 ret
000003cb <sleep>:
SYSCALL(sleep)
3cb: b8 0d 00 00 00 mov $0xd,%eax
3d0: cd 40 int $0x40
3d2: c3 ret
000003d3 <uptime>:
SYSCALL(uptime)
3d3: b8 0e 00 00 00 mov $0xe,%eax
3d8: cd 40 int $0x40
3da: c3 ret
000003db <open>:
SYSCALL(open)
3db: b8 0f 00 00 00 mov $0xf,%eax
3e0: cd 40 int $0x40
3e2: c3 ret
000003e3 <write>:
SYSCALL(write)
3e3: b8 10 00 00 00 mov $0x10,%eax
3e8: cd 40 int $0x40
3ea: c3 ret
000003eb <mknod>:
SYSCALL(mknod)
3eb: b8 11 00 00 00 mov $0x11,%eax
3f0: cd 40 int $0x40
3f2: c3 ret
000003f3 <unlink>:
SYSCALL(unlink)
3f3: b8 12 00 00 00 mov $0x12,%eax
3f8: cd 40 int $0x40
3fa: c3 ret
000003fb <link>:
SYSCALL(link)
3fb: b8 13 00 00 00 mov $0x13,%eax
400: cd 40 int $0x40
402: c3 ret
00000403 <mkdir>:
SYSCALL(mkdir)
403: b8 14 00 00 00 mov $0x14,%eax
408: cd 40 int $0x40
40a: c3 ret
0000040b <close>:
SYSCALL(close)
40b: b8 15 00 00 00 mov $0x15,%eax
410: cd 40 int $0x40
412: c3 ret
00000413 <getch>:
SYSCALL(getch)
413: b8 16 00 00 00 mov $0x16,%eax
418: cd 40 int $0x40
41a: c3 ret
0000041b <greeting>:
SYSCALL(greeting)
41b: b8 17 00 00 00 mov $0x17,%eax
420: cd 40 int $0x40
422: c3 ret
00000423 <shutdown>:
SYSCALL(shutdown)
423: b8 18 00 00 00 mov $0x18,%eax
428: cd 40 int $0x40
42a: c3 ret
0000042b <screen>:
SYSCALL(screen)
42b: b8 19 00 00 00 mov $0x19,%eax
430: cd 40 int $0x40
432: c3 ret
00000433 <cls>:
SYSCALL(cls)
433: b8 1a 00 00 00 mov $0x1a,%eax
438: cd 40 int $0x40
43a: c3 ret

1
forktest.d Normal file
View File

@ -0,0 +1 @@
forktest.o: forktest.c /usr/include/stdc-predef.h types.h stat.h user.h

BIN
forktest.o Normal file

Binary file not shown.

2
fs.d Normal file
View File

@ -0,0 +1,2 @@
fs.o: fs.c /usr/include/stdc-predef.h types.h defs.h param.h stat.h mmu.h \
proc.h spinlock.h sleeplock.h fs.h buf.h file.h

BIN
fs.img (Stored with Git LFS) Normal file

Binary file not shown.

BIN
fs.o Normal file

Binary file not shown.

1595
grep.asm Normal file

File diff suppressed because it is too large Load Diff

1
grep.d Normal file
View File

@ -0,0 +1 @@
grep.o: grep.c /usr/include/stdc-predef.h types.h stat.h user.h

BIN
grep.o Normal file

Binary file not shown.

55
grep.sym Normal file
View File

@ -0,0 +1,55 @@
00000000 grep.c
00000000 ulib.c
00000000 printf.c
00000690 printint
00000b00 digits.0
00000000 umalloc.c
000012a0 freep
000012a4 base
00000370 strcpy
00000740 printf
0000066b greeting
00000590 memmove
000000c0 matchhere
0000063b mknod
00000490 gets
0000060b getpid
0000067b screen
000001d0 grep
00000970 malloc
0000061b sleep
000005d3 pipe
00000663 getch
00000633 write
000005f3 fstat
000005e3 kill
000005fb chdir
000005eb exec
000005cb wait
000005db read
00000643 unlink
000005bb fork
00000613 sbrk
00000623 uptime
00000ea0 __bss_start
00000430 memset
00000000 main
00000310 matchstar
000003a0 strcmp
00000673 shutdown
00000603 dup
00000ea0 buf
00000500 stat
00000ea0 _edata
000012ac _end
00000170 match
0000064b link
000005c3 exit
00000550 atoi
00000683 cls
00000400 strlen
0000062b open
00000450 strchr
00000653 mkdir
0000065b close
000008e0 free

1189
hello.asm Normal file

File diff suppressed because it is too large Load Diff

1
hello.d Normal file
View File

@ -0,0 +1 @@
hello.o: hello.c /usr/include/stdc-predef.h types.h user.h

BIN
hello.o Normal file

Binary file not shown.

50
hello.sym Normal file
View File

@ -0,0 +1,50 @@
00000000 hello.c
00000000 ulib.c
00000000 printf.c
00000390 printint
00000834 digits.0
00000000 umalloc.c
00000ae8 freep
00000aec base
00000070 strcpy
00000440 printf
0000036b greeting
00000290 memmove
0000033b mknod
00000190 gets
0000030b getpid
0000037b screen
00000670 malloc
0000031b sleep
000002d3 pipe
00000363 getch
00000333 write
000002f3 fstat
000002e3 kill
000002fb chdir
000002eb exec
000002cb wait
000002db read
00000343 unlink
000002bb fork
00000313 sbrk
00000323 uptime
00000ae8 __bss_start
00000130 memset
00000000 main
000000a0 strcmp
00000373 shutdown
00000303 dup
00000200 stat
00000ae8 _edata
00000af4 _end
0000034b link
000002c3 exit
00000250 atoi
00000383 cls
00000100 strlen
0000032b open
00000150 strchr
00000353 mkdir
0000035b close
000005e0 free

2
ide.d Normal file
View File

@ -0,0 +1,2 @@
ide.o: ide.c /usr/include/stdc-predef.h types.h defs.h param.h \
memlayout.h mmu.h proc.h x86.h traps.h spinlock.h sleeplock.h fs.h buf.h

BIN
ide.o Normal file

Binary file not shown.

1238
init.asm Normal file

File diff suppressed because it is too large Load Diff

1
init.d Normal file
View File

@ -0,0 +1 @@
init.o: init.c /usr/include/stdc-predef.h types.h stat.h user.h fcntl.h

BIN
init.o Normal file

Binary file not shown.

51
init.sym Normal file
View File

@ -0,0 +1,51 @@
00000000 init.c
00000000 ulib.c
00000000 printf.c
00000400 printint
00000880 digits.0
00000000 umalloc.c
00000b34 freep
00000b38 base
000000e0 strcpy
000004b0 printf
000003db greeting
00000b2c argv
00000300 memmove
000003ab mknod
00000200 gets
0000037b getpid
000003eb screen
000006e0 malloc
0000038b sleep
00000343 pipe
000003d3 getch
000003a3 write
00000363 fstat
00000353 kill
0000036b chdir
0000035b exec
0000033b wait
0000034b read
000003b3 unlink
0000032b fork
00000383 sbrk
00000393 uptime
00000b34 __bss_start
000001a0 memset
00000000 main
00000110 strcmp
000003e3 shutdown
00000373 dup
00000270 stat
00000b34 _edata
00000b40 _end
000003bb link
00000333 exit
000002c0 atoi
000003f3 cls
00000170 strlen
0000039b open
000001c0 strchr
000003c3 mkdir
000003cb close
00000650 free

BIN
initcode Normal file

Binary file not shown.

43
initcode.asm Normal file
View File

@ -0,0 +1,43 @@
initcode.o: file format elf32-i386
Disassembly of section .text:
00000000 <start>:
# exec(init, argv)
.globl start
start:
pushl $argv
0: 68 24 00 00 00 push $0x24
pushl $init
5: 68 1c 00 00 00 push $0x1c
pushl $0 // where caller pc would be
a: 6a 00 push $0x0
movl $SYS_exec, %eax
c: b8 07 00 00 00 mov $0x7,%eax
int $T_SYSCALL
11: cd 40 int $0x40
00000013 <exit>:
# for(;;) exit();
exit:
movl $SYS_exit, %eax
13: b8 02 00 00 00 mov $0x2,%eax
int $T_SYSCALL
18: cd 40 int $0x40
jmp exit
1a: eb f7 jmp 13 <exit>
0000001c <init>:
1c: 2f das
1d: 69 6e 69 74 00 00 90 imul $0x90000074,0x69(%esi),%ebp
00000024 <argv>:
24: 1c 00 sbb $0x0,%al
26: 00 00 add %al,(%eax)
28: 00 00 add %al,(%eax)
...

1
initcode.d Normal file
View File

@ -0,0 +1 @@
initcode.o: initcode.S syscall.h traps.h

BIN
initcode.o Normal file

Binary file not shown.

BIN
initcode.out Normal file

Binary file not shown.

1
ioapic.d Normal file
View File

@ -0,0 +1 @@
ioapic.o: ioapic.c /usr/include/stdc-predef.h types.h defs.h traps.h

BIN
ioapic.o Normal file

Binary file not shown.

2
kalloc.d Normal file
View File

@ -0,0 +1,2 @@
kalloc.o: kalloc.c /usr/include/stdc-predef.h types.h defs.h param.h \
memlayout.h mmu.h spinlock.h

BIN
kalloc.o Normal file

Binary file not shown.

1
kbd.d Normal file
View File

@ -0,0 +1 @@
kbd.o: kbd.c /usr/include/stdc-predef.h types.h x86.h defs.h kbd.h

BIN
kbd.o Normal file

Binary file not shown.

BIN
kernel Normal file

Binary file not shown.

18368
kernel.asm Normal file

File diff suppressed because it is too large Load Diff

534
kernel.sym Normal file
View File

@ -0,0 +1,534 @@
00000000 bio.c
00000000 console.c
80100280 navigatemenu
8011b6c0 currentmenuitem
8011b680 cons
8011b6b8 panicked
80100500 cgaputc
8011b6bc menuactive
80108a90 digits.0
80100e90 drawtitle
8011b640 vcons
00000000 exec.c
00000000 file.c
00000000 fs.c
801026b0 bfree
80102730 balloc
80102840 iget
80102940 bmap
80103280 namex
00000000 ide.c
801035d0 idestart
8011dd80 idelock
8011dd60 havedisk1
8011dd64 idequeue
00000000 ioapic.c
00000000 kalloc.c
00000000 kbd.c
8011ddfc shift.1
80108dc0 shiftcode
80108cc0 togglecode
80108ca0 charcode.0
8010a200 normalmap
8010a100 shiftmap
8010a000 ctlmap
00000000 lapic.c
00000000 log.c
801040b0 install_trans
80104150 write_head
00000000 main.c
801044f0 mpmain
80104530 mpenter
00000000 mp.c
80104680 mpsearch1
00000000 picirq.c
00000000 pipe.c
00000000 proc.c
80104ce0 allocproc
8010c000 first.1
801209d4 initproc
801090d8 states.0
00000000 sleeplock.c
00000000 spinlock.c
00000000 string.c
00000000 syscall.c
80109160 syscalls
00000000 sysfile.c
801060b0 create
00000000 sysproc.c
00000000 trap.c
00000000 uart.c
80107340 uartgetc
80121240 uart
00000000 vm.c
80107f40 deallocuvm.part.0
80107ff0 mappages
8010c420 kmap
8010893a uva2ka.cold
80108941 copyout.cold
80100320 consoleread
80107e8f vector242
801078e6 vector119
8010000c entry
801077c6 vector87
801077bd vector86
80105e00 safestrcpy
801063d0 sys_close
80107efb vector251
801077ea vector91
801075e0 vector33
80107acf vector162
80105590 yield
8011de20 log
8011ddc0 kmem
80107d33 vector213
80107883 vector108
80107370 uartinit
8010763a vector43
80103e00 lapiceoi
80107af3 vector165
80107be3 vector185
801038c0 ioapicinit
801078c2 vector115
80102510 fileread
80107901 vector122
80106d30 sys_sbrk
8011df00 ioapicid
80107a87 vector156
80107eb3 vector245
8011ddb4 ioapic
80107c13 vector189
80107504 vector7
801076dc vector61
8010758f vector24
8010789e vector111
80107c97 vector200
80107712 vector67
801079af vector138
80107751 vector74
80105230 sched
80105ce0 memmove
801076b8 vector57
80106040 syscall
80107d3f vector214
80107832 vector99
80104e90 cpuid
80103080 writei
801079d3 vector141
80106cb0 sys_fork
80101ed0 cleanupexec
8010c520 bcache
80107b47 vector172
80107e83 vector241
801059d0 getcallerpcs
80106940 sys_mkdir
80107f13 vector253
801074e0 vector3
801074d7 vector2
801031b0 namecmp
80107ddb vector227
80107d0f vector210
80105fc0 argstr
80107db7 vector224
8011b5a0 inputBuffer
80107628 vector41
80100890 cprintf
80102390 filedup
80101d40 closeconsole
80103590 namei
80107574 vector21
80100040 binit
80107b83 vector177
80101e60 setconsoleproctitle
801078dd vector118
8010772d vector70
80107724 vector69
80107e53 vector237
801076f7 vector64
801075aa vector27
80107967 vector132
80107bef vector186
801062d0 sys_read
80107d63 vector217
80105e70 fetchint
801085e0 setupkvm
80105d40 memcpy
80108560 freevm
801074ce vector1
80107b8f vector178
8010760d vector38
801039b0 kfree
80107e5f vector238
80106e60 sys_greeting
80104e30 mycpu
80102da0 iput
80107973 vector133
80107748 vector73
801079f7 vector144
80107f1f vector254
80102a10 readsb
8010c004 nextpid
80107844 vector101
80107d1b vector211
80104700 mpinit
80107b5f vector174
80107e9b vector243
80102300 fileinit
801064a0 cleanupsyslink
801059b0 initlock
80107937 vector128
80108870 copyout
80107790 vector81
801055e0 sleep
80103e20 microdelay
80107532 vector13
80107682 vector51
80107549 vector16
8011b580 input
80107e77 vector240
8010769d vector54
80107562 vector19
801077f3 vector92
80107ea7 vector244
80102f50 stati
801079c7 vector140
80106ce0 sys_kill
8010764c vector45
8010777e vector79
80104a60 pipeclose
80107df3 vector229
80107a9f vector158
80106430 sys_fstat
801007e0 consolewrite
80107616 vector39
80107b17 vector168
801042c0 end_op
801075f2 vector35
801078b0 vector113
80103a50 freerange
8010791c vector125
801012f0 newconsole
80108400 allocuvm
80106fe9 trapret
80107d57 vector216
801076ee vector63
801075a1 vector26
80107c43 vector193
80103ce0 lapicinit
80107c67 vector196
80107d03 vector209
801074e9 vector4
80107b2f vector170
80121250 stack
80107997 vector136
8010751d vector10
80107cdf vector206
80102d50 iunlock
80106d80 sys_sleep
80107f2b vector255
80107bb3 vector181
801076ca vector59
801077b4 vector85
801077ab vector84
80107bcb vector183
80107aab vector159
80107d27 vector212
801064e0 sys_link
8010765e vector47
80107de7 vector228
80107631 vector42
801078b9 vector114
80108820 uva2ka
80107b6b vector175
801079eb vector143
80102320 filealloc
801056a0 wakeup
8010794f vector130
80107ebf vector246
80107514 vector9
801079df vector142
8010783b vector100
80107ca3 vector201
80108680 clearpteu
80104eb0 myproc
80107000 tvinit
801076d3 vector60
80107586 vector23
80102c40 idup
80107e47 vector236
80103cc0 kbdintr
80106800 sys_open
80107e0b vector231
80107709 vector66
801075bc vector29
80102f80 readi
8010798b vector135
80101530 consoleintr
80105700 kill
8010776c vector77
80102b00 ialloc
80107ba7 vector180
80121244 kpgdir
80101de0 getcurrentconsoleindex
80107cf7 vector208
80103ec0 cmostime
801074b0 uartintr
80107829 vector98
80107820 vector97
80107b77 vector176
80107c4f vector194
801075d7 vector32
80122250 end
80107c8b vector199
80100fb0 consoleget
8010795b vector131
80107f07 vector252
801025a0 filewrite
801074c5 vector0
80105f00 argint
80104920 cleanuppipealloc
80101f20 exec
80107a03 vector145
80106350 sys_write
80105b20 release
80105eb0 fetchstr
8010787a vector107
8010761f vector40
80105450 wait
8010784d vector102
8010b000 entrypgdir
0010000c _start
801076af vector56
8010771b vector68
801074fb vector6
8010c48c _binary_initcode_end
80100000 multiboot_header
80107943 vector129
80105190 scheduler
801031d0 dirlookup
80107c73 vector197
801023e0 fileclose
80104250 begin_op
80101080 loadscreenbuffer
80107a57 vector152
80108660 kvmalloc
80107dff vector230
80101000 testfillbuffer
80105d50 strncmp
80107604 vector37
80107cd3 vector205
80107ac3 vector161
80120a00 tickslock
80104b00 pipewrite
80105da0 strncpy
80107736 vector71
801086d0 copyuvm
8011b6e0 ftable
80107ab7 vector160
80105f50 argptr
80107d4b vector215
80107a93 vector157
80106250 sys_dup
801078a7 vector112
80100480 panic
80104dc0 forkret
80107bbf vector182
8010752b vector12
80105c90 memcmp
80103be0 kbdgetc
8010788c vector109
8010756b vector20
80105070 fork
80107694 vector53
80107559 vector18
0000007a _binary_entryother_size
8011df20 cpus
80105920 releasesleep
8010780e vector95
80106ca0 sys_getch
80105ae0 holding
8011dd34 sb
80105b80 acquire
80107dcf vector226
801035b0 nameiparent
80107670 vector49
80107643 vector44
8011de00 lapic
80107775 vector78
80106fd1 alltraps
80107b53 vector173
801078d4 vector117
801010c0 clearscreen
80107799 vector82
80107d9f vector222
8010750d vector8
80107a33 vector149
80102bc0 iupdate
8010a000 data
80105c40 memset
80107e17 vector232
80104550 main
80108170 switchkvm
80107871 vector106
80107d87 vector220
801077e1 vector90
80107adb vector163
80107e2f vector234
80106f20 sys_screen
80104430 log_write
801058c0 acquiresleep
80106630 sys_unlink
801076e5 vector62
80107598 vector25
80107c7f vector198
801078ef vector120
8010c48c _binary_entryother_start
80103b00 kinit1
80107679 vector50
80107540 vector15
80107a4b vector151
801077a2 vector83
801077d8 vector89
801077cf vector88
80106ed0 sys_shutdown
801070b0 trap
80106e30 sys_uptime
80107b9b vector179
801075e9 vector34
80107655 vector46
8010797f vector134
80107dab vector223
80120a40 idt
80107d6f vector218
80104e10 pinit
80100c00 sprintf
80108530 deallocuvm
801013e0 switchtoconsole
80107dc3 vector225
80103de0 lapicid
80107bfb vector187
80104ff0 growproc
80105960 holdingsleep
8011df04 ncpu
801075c5 vector30
80104ee0 userinit
80100470 getconsoleindex
801000d0 bread
8010792e vector127
80104c00 piperead
801209e0 ticks
80107c37 vector192
80107aff vector166
801011e0 consoleinit
80107763 vector76
8010775a vector75
80103730 ideintr
80107c5b vector195
80107a3f vector150
801076c1 vector58
80107ed7 vector248
8010790a vector123
80107817 vector96
80110ea0 consoles
801075ce vector31
80107cbb vector203
801079bb vector139
80107a63 vector153
80107ae7 vector164
80105780 procdump
801078f8 vector121
80107450 uartputc
801074f2 vector5
80107b0b vector167
80107a7b vector155
80107ee3 vector249
801001f0 brelse
801013c0 releaseallconsoles
80107eef vector250
80107913 vector124
80107895 vector110
80107cc7 vector204
80102c70 ilock
80106ae0 sys_exec
801079a3 vector137
8010c460 _binary_initcode_start
80105e5b swtch
80107ecb vector247
8010757d vector22
80107caf vector202
801080e0 seginit
80102f00 iunlockput
80110e80 currentconsole
8010773f vector72
801076a6 vector55
80107925 vector126
80107700 vector65
801075b3 vector28
8010c506 _binary_entryother_end
80107b23 vector169
801001b0 bwrite
80107e23 vector233
801010a0 savescreenbuffer
80107080 idtinit
80101050 getbaseconsoleptr
801052f0 exit
80106cd0 sys_wait
80106cc0 sys_exit
801034d0 dirlink
0000002c _binary_initcode_size
80107a1b vector147
80105880 initsleeplock
801036b0 ideinit
80108310 loaduvm
8010785f vector104
801078cb vector116
8011e4a0 ptable
80103970 ioapicenable
80105a80 popcli
8010c008 vectors
8010768b vector52
80107552 vector17
80107bd7 vector184
80105e40 strlen
80106bd0 sys_pipe
80102a50 iinit
80104900 picinit
80107ceb vector207
80108290 inituvm
80106fc0 sys_cls
80107c1f vector190
80107e6b vector239
80107805 vector94
801077fc vector93
801041b0 initlog
80107c07 vector188
80107667 vector48
801037d0 iderw
80100f80 getvalidprocessconsoleptr
80107d7b vector219
80107a27 vector148
80107d93 vector221
80103b70 kalloc
8011c080 devsw
80106d20 sys_getpid
80107787 vector80
80107b3b vector171
80107a6f vector154
80101060 clearconsole
801075fb vector36
80104970 pipealloc
80107e3b vector235
80107868 vector105
80106a30 sys_chdir
8011c0e0 icache
80107a0f vector146
80107c2b vector191
80107856 vector103
801069a0 sys_mknod
80103e30 lapicstartap
80108180 switchuvm
80105a30 pushcli
80103aa0 kinit2
80107524 vector11
80107539 vector14
801024c0 filestat

1185
kill.asm Normal file

File diff suppressed because it is too large Load Diff

1
kill.d Normal file
View File

@ -0,0 +1 @@
kill.o: kill.c /usr/include/stdc-predef.h types.h stat.h user.h

BIN
kill.o Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More