Final commit? (not entirely sure what all this is now..)
This commit is contained in:
685
forktest.asm
Normal file
685
forktest.asm
Normal 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
|
Reference in New Issue
Block a user