Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Arnaud Installe <gmeb@ace.ulyssis.student.kuleuven.ac.be>
To: Jay.Estabrook@digital.com
Cc: axp-list@redhat.com
Subject: milo patches: read, memory fault
Date: Mon, 1 Jun 1998 22:56:58 +0200	[thread overview]
Message-ID: <19980601225658.A7314@ace.ulyssis.student.kuleuven.ac.be> (raw)

[-- Attachment #1: Type: text/plain, Size: 967 bytes --]

Hello Jay,

 I noticed `read dev: block' didn't work properly: it just hangs doing
nothing.  Apparently this is caused by a NULL pointer.  I've fixed that
problem, and meanwhile extended the function of read somewhat.  (Instead of
just showing 256 bytes it shows what's on the disk one screenful at a time.)
 Since it's also nice to have an indication as to why milo crashes I also
added `wrent (entMM, 2)' somewhere.  But perhaps that should be called even
earlier.  Now milo will reboot if a memory fault occurs after having
displayed an explanation message.
 Another few lines fixed a few `unresolved symbols' when linking to the free
x86 emulation library.  Though the free library won't work anyway on my
machine.  *Sigh*
 Oh yes, this is against milo-2.0.30-0.4 I think.

					Arnaud

-- 
Arnaud Installe                                 arnaud.installe@advalvas.be 

3rd Law of Computing:
	Anything that can go wr
fortune: Segmentation violation -- Core dumped

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 6244 bytes --]

diff -ur milo-2.0.30-0.4/boot_main.c milo-2.0.30-0.4.new/boot_main.c
--- milo-2.0.30-0.4/boot_main.c	Mon Nov 24 19:16:09 1997
+++ milo-2.0.30-0.4.new/boot_main.c	Mon Jun  1 17:22:54 1998
@@ -245,6 +245,8 @@
 #define HLT	0x02			/* 4 mS                          */
 #define ND	0x00			/* Use DMA                       */
 
+extern void entMM (void);
+
 static void fdasleep(int nmsec)
 {
     int i;
@@ -1106,6 +1108,9 @@
 /*****************************************************************************
  *  Do any CPU specific initialisation required                              *
  *****************************************************************************/
+
+    /* enable memory fault handler */
+    wrent (entMM, 2);
 
     /* we need the hwrpb set up before we can do this */
     /* This gets us keyboard and VGA (I hope) */
diff -ur milo-2.0.30-0.4/entry.S milo-2.0.30-0.4.new/entry.S
--- milo-2.0.30-0.4/entry.S	Wed Sep 24 06:03:19 1997
+++ milo-2.0.30-0.4.new/entry.S	Mon Jun  1 20:49:11 1998
@@ -88,18 +88,14 @@
 
 	.globl	entMM
 	.ent	entMM
-entMM:	br	zero,entMM
-	br	gp,1f
+entMM:	br	gp,1f
 1:	ldgp	gp,0(gp)
-	lda	sp,-8(sp)
-	stq	ra,0(sp)
-	ldq	a3,8(sp)
-	ldq	a4,16(sp)
-	ldq	a5,24(sp)
+	ldq	a3,0(sp)
+	ldq	a4,8(sp)
+	ldq	a5,16(sp)
+	bis	zero,ra,a0
 	jsr	ra,do_entMM
-	ldq	ra,0(sp)
-	lda	sp,8(sp)
-	ret	zero,(ra)
+	call_pal	PAL_halt
 	.end	entMM
 
 	.globl	entIF
diff -ur milo-2.0.30-0.4/memory.c milo-2.0.30-0.4.new/memory.c
--- milo-2.0.30-0.4/memory.c	Thu Sep 18 16:04:25 1997
+++ milo-2.0.30-0.4.new/memory.c	Mon Jun  1 21:07:06 1998
@@ -580,10 +580,14 @@
 void
 do_entMM(u64 a0, u64 a1, u64 a2, u64 ps, u64 pc, u64 gp)
 {
-    printk("MM fault: ps = 0x%lx, pc = 0x%lx, gp = 0x%lx\n",
-	   ps, pc, gp);
-    printk("  a0 = 0x%lx, a1 = 0x%lx, a2 = 0x%lx\n", a0, a1, a2);
-    for(;;) ; /* wait forever */
+	/* inform user of memory fault and regs */
+	printk ("\nMemory fault:\n");
+	printk("    ps = 0x%016lx, pc = 0x%016lx, gp = 0x%016lx\n", ps, pc, gp);
+	printk("    a0 = 0x%016lx, a1 = 0x%016lx, a2 = 0x%016lx\n", a0, a1, a2);
+
+	/* wait for keypress */
+ 	printk("\nPress any key to reboot... ");
+	kbd_getc();
 }
 
 
diff -ur milo-2.0.30-0.4/milo.c milo-2.0.30-0.4.new/milo.c
--- milo-2.0.30-0.4/milo.c	Mon Nov 24 22:54:17 1997
+++ milo-2.0.30-0.4.new/milo.c	Mon Jun  1 21:07:47 1998
@@ -155,7 +155,7 @@
       &boot_parse}, 
     {"read", 
       "dev: blknum", 
-      "Read a block (256 bytes) from given dev at given block", 
+      "Read from given dev starting at given block", 
       &read_parse}, 
     {"run", 
       "[-t fs] dev:file", 
@@ -797,8 +797,9 @@
 #ifndef MINI_EMBED_LINUX
 static void read_cmd(char *lsdev, int blknum)
 {
-    unsigned char buf[256];
+    unsigned char buf[24*16];		/* One screenful at a time */
     int rc, i, n;
+    long offset = blknum*512;		/* For partitions up to 512 GB... */
     int dummyfd = -1;
 
     dummyfd = device_open(lsdev);
@@ -806,26 +807,33 @@
 	printk("read: Could not open device: %s\n", lsdev);
 	return;
     }
-    rc = device_read(dummyfd, buf, sizeof(buf), blknum * 512);
-    device_close(dummyfd);
 
-    if (rc < 0) {
-	printk("Read of block from %s:[%d] failed\n", lsdev, blknum);
-	return;
-    }
-    printk("\n");
-    for (n = 0; n < rc; n += 16) {
-	printk(" %3x:", n);
-	for (i = 0; i < 16; ++i)
-	    printk(" %02X", buf[n + i]);
-	printk("  |");
-	for (i = 0; i < 16; ++i) {
-	    int c = buf[n + i];
+    do {
+	rc = device_read(dummyfd, buf, sizeof(buf), offset);
 
-	    printk("%c", (c <= ' ' || c > 126) ? '.' : c);
-	}
-	printk("|\n");
+    	if (rc < 0) {
+	    printk("\nRead of block from %s:[%d] failed\n", lsdev, blknum);
+	    return;
+    	}
+    	printk("\n");
+    	for (n = 0; n < rc; n += 16) {
+	    printk("%010lx:", offset+n);
+	    for (i = 0; i < 16; ++i)
+	    	printk(" %02x", buf[n + i]);
+	    printk("  |");
+	    for (i = 0; i < 16; ++i) {
+		int c = buf[n + i];
+
+	    	printk("%c", (c <= ' ' || c > 126) ? '.' : c);
+	    }
+	    printk("|\n");
+        }
+	printk ("                  -- q to quit - any other key to continue --");
+	offset += sizeof(buf);
     }
+    while (kbd_getc () != 'q');
+
+    printk ("\n"); device_close (dummyfd);
 }
 #endif
 
@@ -1088,7 +1096,7 @@
     token = __PULL();
 
     if (token != NULL) {
-	int len = strlen(readdev);
+	int len = strlen(token);
 
 	readdev = token;
 	if (len > 0 && readdev[len - 1] == ':')
@@ -1098,7 +1106,7 @@
     if ((token != NULL && (readblk = atoi(token)) < 0) || 
       (readdev == NULL) || (token == NULL)) {
 	printk("MILO: 'read' command requires a device name and block number\n");
-	printk("      MILO> run fd0: blknum\n");
+	printk("      MILO> read fd0: blknum\n");
     } else {
 	read_cmd(readdev, readblk);
     }
diff -ur milo-2.0.30-0.4/x86_sysenv.c milo-2.0.30-0.4.new/x86_sysenv.c
--- milo-2.0.30-0.4/x86_sysenv.c	Mon Nov 24 19:45:22 1997
+++ milo-2.0.30-0.4.new/x86_sysenv.c	Fri Apr 10 21:14:15 1998
@@ -41,6 +41,16 @@
 #include "sysenv.h"
 #include "host.h"
 
+/* this will be accurate for machines rated at 200 BogoMIPS */
+/* it will be too long for slow machines, and too fast for others, but... */
+/* this will be used by the <asm-alpha/delay.h> "udelay" macro whenever */
+/* the "calibrate_delay" routine has *NOT* been called beforehand. */
+unsigned long loops_per_sec = 100000000UL;
+
+void *malloc(int size)
+{   return vmalloc(size);
+}
+
 #ifdef MINI_DIGITAL_BIOSEMU
 /*
  *  Use Digital's BIOS emulation technology to set up the video device.
@@ -100,10 +110,6 @@
     return pci_root.subordinate;
 }
 
-void *malloc(int size)
-{   return vmalloc(size);
-}
-
 #ifdef NOT_NOW
 unsigned char InPciCfgB(unsigned int bus, unsigned int dev, unsigned int func, 
   unsigned int reg)
@@ -153,12 +159,6 @@
     pcibios_write_config_dword(bus, PCI_DEVFN(dev, func), reg, data);
 }
 #endif /* NOT_NOW */
-
-/* this will be accurate for machines rated at 200 BogoMIPS */
-/* it will be too long for slow machines, and too fast for others, but... */
-/* this will be used by the <asm-alpha/delay.h> "udelay" macro whenever */
-/* the "calibrate_delay" routine has *NOT* been called beforehand. */
-unsigned long loops_per_sec = 100000000UL;
 
 /* used only by the BIOS emulator for delaying before its banner message */
 

                 reply	other threads:[~1998-06-01 20:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox