提交 41f6fab5 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

make sbrktest work again

上级 cde83c25
...@@ -1249,7 +1249,7 @@ forktest(void) ...@@ -1249,7 +1249,7 @@ forktest(void)
void void
sbrktest(void) sbrktest(void)
{ {
int fds[2], pid, pids[32], ppid; int fds[2], pid, pids[32];
char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch; char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch;
uptr amt; uptr amt;
...@@ -1292,15 +1292,17 @@ sbrktest(void) ...@@ -1292,15 +1292,17 @@ sbrktest(void)
fprintf(stdout, "sbrk test failed 632K test, p %x a %x\n", p, a); fprintf(stdout, "sbrk test failed 632K test, p %x a %x\n", p, a);
exit(); exit();
} }
lastaddr = (char*)(632 * 1024 - 1); lastaddr = p - 1;
*lastaddr = 99; *lastaddr = 99;
#if 0
// is one forbidden from allocating more than 632K? // is one forbidden from allocating more than 632K?
c = sbrk(4096); c = sbrk(4096);
if(c != (char*)0xffffffff){ if(c != (char*)0xffffffff){
fprintf(stdout, "sbrk allocated more than 632K, c %x\n", c); fprintf(stdout, "sbrk allocated more than 632K, c %x\n", c);
exit(); exit();
} }
#endif
// can one de-allocate? // can one de-allocate?
a = sbrk(0); a = sbrk(0);
...@@ -1330,12 +1332,15 @@ sbrktest(void) ...@@ -1330,12 +1332,15 @@ sbrktest(void)
} }
#endif #endif
#if 0
c = sbrk(4096); c = sbrk(4096);
if(c != (char*)0xffffffff){ if(c != (char*)0xffffffff){
fprintf(stdout, "sbrk was able to re-allocate beyond 632K, c %x\n", c); fprintf(stdout, "sbrk was able to re-allocate beyond 632K, c %x\n", c);
exit(); exit();
} }
#endif
#if 0
// can we read the kernel's memory? // can we read the kernel's memory?
for(a = (char*)(640*1024); a < (char*)2000000; a += 50000){ for(a = (char*)(640*1024); a < (char*)2000000; a += 50000){
ppid = getpid(); ppid = getpid();
...@@ -1351,6 +1356,7 @@ sbrktest(void) ...@@ -1351,6 +1356,7 @@ sbrktest(void)
} }
wait(); wait();
} }
#endif
// if we run the system out of memory, does it clean up the last // if we run the system out of memory, does it clean up the last
// failed allocation? // failed allocation?
...@@ -1602,7 +1608,7 @@ main(int argc, char *argv[]) ...@@ -1602,7 +1608,7 @@ main(int argc, char *argv[])
unopentest(); unopentest();
bigargtest(); bigargtest();
bsstest(); bsstest();
// sbrktest(); // XXX memory layout has changed. tests needs to be changed sbrktest();
// we should be able to grow a user process to consume all phys mem // we should be able to grow a user process to consume all phys mem
validatetest(); validatetest();
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论