Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 May 1999 11:51:57 -0400 (EDT)
From:      Luoqi Chen <luoqi@watermarkgroup.com>
To:        current@FreeBSD.ORG, darius@dons.net.au
Subject:   Re:  SMP & APM
Message-ID:  <199905051551.LAA10321@lor.watermarkgroup.com>

next in thread | raw e-mail | index | archive | help
> Hi,
> Has anyone tried having APM and SMP in the same kernel? It panic()'s mine :)
> 
> Basically the machine panics a few seconds after I do 'apmconf -e'. apm seems
> to return normal values though.
> 
> I've attached a sample output from APM, dmesg and my kernel config.
> 
> I get a trap 12: page fault in kernel mode
> mp_lock = 01000009; cpuid = 1; lapic.id = 01000000
> fault virtual address = 0x75f0
> fault code = supervisor read, page not present
> interrupt pointer =     0x8:0xc0208a4c
> stack pointer =         0x10:0xff80dd78
> frame pointer =         0x10:0xff80dd7c
> code segment =          base 0x0, limit 0xfffff, type 0x1b
>                         DPL 0, pres 1, def32 1, gran 1
> processor eflags =      interrupt enabled, resume, IOPL = 0
> current process =       Idle
> interrupt mask =        <- SMP: XXX
> 
> Also, nm kernel.debug | sort shows that 0xc0208a4c is in Xbpt
> 
> ---
> Daniel O'Connor software and network engineer
> for Genesis Software - http://www.gsoft.com.au
> "The nice thing about standards is that there
> are so many of them to choose from."
>   -- Andrew Tanenbaum
> 
My SMP vm sharing commit broke APM. Please try out this patch,

Index: apm.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/apm/apm.c,v
retrieving revision 1.80
diff -u -r1.80 apm.c
--- apm.c	1999/04/21 07:57:55	1.80
+++ apm.c	1999/05/05 15:44:48
@@ -20,6 +20,7 @@
 
 #include "opt_devfs.h"
 #include "opt_vm86.h"
+#include "opt_smp.h"
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -45,6 +46,10 @@
 #include <machine/vm86.h>
 #endif
 
+#ifdef SMP
+#include <machine/smp.h>
+#endif
+
 static int apm_display __P((int newstate));
 static int apm_int __P((u_long *eax, u_long *ebx, u_long *ecx, u_long *edx));
 static void apm_resume __P((void));
@@ -92,6 +97,10 @@
 static void
 setup_apm_gdt(u_int code32_base, u_int code16_base, u_int data_base, u_int code32_limit, u_int code16_limit, u_int data_limit)
 {
+#ifdef SMP
+	int x;
+#endif
+
 	/* setup 32bit code segment */
 	gdt_segs[GAPMCODE32_SEL].ssd_base  = code32_base;
 	gdt_segs[GAPMCODE32_SEL].ssd_limit = code32_limit;
@@ -108,6 +117,14 @@
 	ssdtosd(gdt_segs + GAPMCODE32_SEL, &gdt[GAPMCODE32_SEL].sd);
 	ssdtosd(gdt_segs + GAPMCODE16_SEL, &gdt[GAPMCODE16_SEL].sd);
 	ssdtosd(gdt_segs + GAPMDATA_SEL  , &gdt[GAPMDATA_SEL  ].sd);
+
+#ifdef SMP
+	for (x = 1; x < mp_ncpus; x++) {
+		gdt[x * NGDT + GAPMCODE32_SEL].sd = gdt[GAPMCODE32_SEL].sd;
+		gdt[x * NGDT + GAPMCODE16_SEL].sd = gdt[GAPMCODE16_SEL].sd;
+		gdt[x * NGDT + GAPMDATA_SEL  ].sd = gdt[GAPMDATA_SEL  ].sd;
+	}
+#endif
 }
 
 /* 48bit far pointer. Do not staticize - used from apm_setup.s */

-lq


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905051551.LAA10321>