]> Devi Nivas Git - cs3210-lab1.git/commitdiff
believe it or not, this was working
authorrsc <rsc>
Thu, 27 Sep 2007 05:13:10 +0000 (05:13 +0000)
committerrsc <rsc>
Thu, 27 Sep 2007 05:13:10 +0000 (05:13 +0000)
the macro expansion of "char *cp;" turned into
char *(curproc[cpu()]);  which declares a dynamically
sized array of char* called curproc.

so then &cp == &(curproc[cpu()]) was actually a
stack variable as "expected".  it was one past the
end of the array, but the implicit alloca allocated
more than was necessary.

do not tell me that making cp a #define was a bad idea.
there are worse problems to fix.  more on that later.

dot-bochsrc
sysfile.c
usertests.c

index bd249ce9f66eb30aedfa504ca5e3d679816f03e1..bef6558baac7102d2a0eb0ab0e6ecdbd8f8171fb 100755 (executable)
@@ -74,7 +74,8 @@
 # now supported, but we still recommend to use the BIOS distributed with
 # Bochs. Now the start address can be calculated from image size.
 #=======================================================================
-romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
+#romimage: file=$BXSHARE/BIOS-bochs-latest
+romimage: file=/home/rsc/pub/bochs/bios/BIOS-bochs-latest
 #romimage: file=mybios.bin, address=0xfff80000 # 512k at memory top
 #romimage: file=mybios.bin # calculate start address from image size
 
@@ -107,7 +108,7 @@ romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
 #  650Mhz Athlon K-7 with Linux 2.4.4/egcs-2.91.66  2 to  2.5 Mips
 #  400Mhz Pentium II with Linux 2.0.36/egcs-1.0.3   1 to  1.8 Mips
 #=======================================================================
-cpu: count=2, ips=10000000
+cpu: count=2, ips=10000000, quantum=1
 
 #=======================================================================
 # MEGS
@@ -403,7 +404,7 @@ debug: action=ignore
 #=======================================================================
 #debugger_log: /dev/null
 #debugger_log: debugger.out
-debugger_log: -
+debugger_log: bochsout.txt
 
 #=======================================================================
 # COM1, COM2, COM3, COM4:
@@ -675,6 +676,7 @@ keyboard_mapping: enabled=0, map=
 #   i440fxsupport: enabled=1, slot1=pcivga, slot2=ne2k
 #=======================================================================
 #i440fxsupport: enabled=1
+i440fxsupport: enabled=1
 
 #=======================================================================
 # USB1:
index 279847b21475a25c1d0dbadc72548831a43fef5e..a23b48acf9f412abdc05147868cfcdd6a8e67bd8 100644 (file)
--- a/sysfile.c
+++ b/sysfile.c
@@ -49,11 +49,11 @@ sys_read(void)
 {
   struct file *f;
   int n;
-  char *cp;
+  char *p;
 
-  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &cp, n) < 0)
+  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
     return -1;
-  return fileread(f, cp, n);
+  return fileread(f, p, n);
 }
 
 int
@@ -61,11 +61,11 @@ sys_write(void)
 {
   struct file *f;
   int n;
-  char *cp;
+  char *p;
 
-  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &cp, n) < 0)
+  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
     return -1;
-  return filewrite(f, cp, n);
+  return filewrite(f, p, n);
 }
 
 int
index 2b35b8f10230aca6f446e578f274f1fdf9bd3ad8..9be276490bc5911abcdfb8be0b7e3bb7429e360e 100644 (file)
@@ -1234,7 +1234,9 @@ int
 main(int argc, char *argv[])
 {
   printf(1, "usertests starting\n");
-  
+
+for(;;) concreate();
+
   if(open("usertests.ran", 0) >= 0){
     printf(1, "already ran user tests -- rebuild fs.img\n");
     exit();