Browse Source

Plan 9 from Bell Labs 2013-02-16

David du Colombier 11 years ago
parent
commit
6439459492
3 changed files with 59 additions and 54 deletions
  1. 1 1
      sys/lib/tmac/tmac.s
  2. 2 2
      sys/man/8/boot
  3. 56 51
      sys/src/cmd/ql/asm.c

+ 1 - 1
sys/lib/tmac/tmac.s

@@ -106,7 +106,7 @@
 .if !\\n(IM .if !\\n(MN .pn 0
 .so \\*(sd/tmac.scover
 .if !\\n(IM .if !\\n(MN .rm IM MF MR
-.if n .if !\\n(.T .pi /usr/bin/col
+.if n .if !\\n(.T .pi /bin/col
 .nr ST 1
 .ds QF TECHNICAL MEMORANDUM
 .br

+ 2 - 2
sys/man/8/boot

@@ -171,7 +171,7 @@ for subsequent processes to
 .I Boot
 completes by
 .IR exec (2)'ing
-.B /$objtype/init
+.B /$cputype/init
 .BR -t .
 If the
 .B -m
@@ -224,7 +224,7 @@ Once connected,
 .I boot
 behaves as on the terminal except for
 .IR exec (2)'ing
-.B /$objtype/init
+.B /$cputype/init
 .BR -c .
 .SS Booting Methods
 The methods available to any system depend on what was

+ 56 - 51
sys/src/cmd/ql/asm.c

@@ -45,6 +45,55 @@ entryvalue(void)
 	return s->value;
 }
 
+static void
+endelfsectab(void)
+{
+	seek(cout, HEADR+textsize+datsize+symsize, 0);
+	lput(1);			/* Section name (string tbl index) */
+	lput(1);			/* Section type */
+	lput(2|4);			/* Section flags */
+	lput(INITTEXT & ~KMASK);	/* Section virtual addr at execution */
+	lput(HEADR);			/* Section file offset */
+	lput(textsize);			/* Section size in bytes */
+	lput(0);			/* Link to another section */
+	lput(0);			/* Additional section information */
+	lput(0x10000L);			/* Section alignment */
+	lput(0);			/* Entry size if section holds table */
+
+	lput(7);			/* Section name (string tbl index) */
+	lput(1);			/* Section type */
+	lput(2|1);			/* Section flags */
+	lput(INITDAT & ~KMASK);		/* Section virtual addr at execution */
+	lput(HEADR+textsize);		/* Section file offset */
+	lput(datsize);			/* Section size in bytes */
+	lput(0);			/* Link to another section */
+	lput(0);			/* Additional section information */
+	lput(0x10000L);			/* Section alignment */
+	lput(0);			/* Entry size if section holds table */
+
+	/* string section header */
+	lput(12);			/* Section name (string tbl index) */
+	lput(3);			/* Section type */
+	lput(1 << 5);			/* Section flags */
+	lput(0);			/* Section virtual addr at execution */
+	lput(HEADR+textsize+datsize+symsize+3*40);	/* Section file offset */
+	lput(14);			/* Section size in bytes */
+	lput(0);			/* Link to another section */
+	lput(0);			/* Additional section information */
+	lput(1);			/* Section alignment */
+	lput(0);			/* Entry size if section holds table */
+
+	/* string table */
+	cput(0);
+	strnput(".text", 5);
+	cput(0);
+	strnput(".data", 5);
+	cput(0);
+	strnput(".strtab", 7);
+	cput(0);
+	cput(0);
+}
+
 void
 asmb(void)
 {
@@ -371,54 +420,8 @@ asmb(void)
 		lput(0x04L);			/* alignment code?? */
 		cflush();
 
-		if(!debug['S'])
-			break;
-
-		seek(cout, HEADR+textsize+datsize+symsize, 0);
-		lput(1);			/* Section name (string tbl index) */
-		lput(1);			/* Section type */
-		lput(2|4);			/* Section flags */
-		lput(INITTEXT & ~KMASK);	/* Section virtual addr at execution */
-		lput(HEADR);			/* Section file offset */
-		lput(textsize);			/* Section size in bytes */
-		lput(0);			/* Link to another section */
-		lput(0);			/* Additional section information */
-		lput(0x10000L);			/* Section alignment */
-		lput(0);			/* Entry size if section holds table */
-
-		lput(7);			/* Section name (string tbl index) */
-		lput(1);			/* Section type */
-		lput(2|1);			/* Section flags */
-		lput(INITDAT & ~KMASK);		/* Section virtual addr at execution */
-		lput(HEADR+textsize);		/* Section file offset */
-		lput(datsize);			/* Section size in bytes */
-		lput(0);			/* Link to another section */
-		lput(0);			/* Additional section information */
-		lput(0x10000L);			/* Section alignment */
-		lput(0);			/* Entry size if section holds table */
-
-		/* string section header */
-		lput(12);			/* Section name (string tbl index) */
-		lput(3);			/* Section type */
-		lput(1 << 5);			/* Section flags */
-		lput(0);			/* Section virtual addr at execution */
-		lput(HEADR+textsize+datsize+symsize+3*40);	/* Section file offset */
-		lput(14);			/* Section size in bytes */
-		lput(0);			/* Link to another section */
-		lput(0);			/* Additional section information */
-		lput(1);			/* Section alignment */
-		lput(0);			/* Entry size if section holds table */
-
-		/* string table */
-		cput(0);
-		strnput(".text", 5);
-		cput(0);
-		strnput(".data", 5);
-		cput(0);
-		strnput(".strtab", 7);
-		cput(0);
-		cput(0);
-
+		if(debug['S'])
+			endelfsectab();
 		break;
 	case 6:
 		/*
@@ -441,14 +444,14 @@ asmb(void)
 			lput(0L);		/* flags = PPC */
 			lput((52L<<16)|32L);	/* Ehdr & Phdr sizes*/
 			lput((4L<<16)|40L);	/* # Phdrs & Shdr size */
-			lput((4L<<16)|2L);	/* # Shdrs & shdr string size */
+			lput((3L<<16)|2L);	/* # Shdrs & shdr string size */
 		}
 		else{
 			lput(0L);
 			lput(0L);		/* flags = PPC */
 			lput((52L<<16)|32L);	/* Ehdr & Phdr sizes*/
 			lput((4L<<16)|0L);	/* # Phdrs & Shdr size */
-			lput((4L<<16)|0L);	/* # Shdrs & shdr string size */
+			lput((3L<<16)|0L);	/* # Shdrs & shdr string size */
 		}
 
 		lput(1L);			/* text - type = PT_LOAD */
@@ -487,8 +490,10 @@ asmb(void)
 		lput(JMPSZ);			/* memory size */
 		lput(0x05L);			/* protections = RX */
 		lput(0);			/* disable alignment */
-
 		cflush();
+
+		if(debug['S'])
+			endelfsectab();
 		break;
 	}
 	cflush();