From owner-freebsd-smp Wed Jul 16 13:44:23 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id NAA06321 for smp-outgoing; Wed, 16 Jul 1997 13:44:23 -0700 (PDT) Received: from Ilsa.StevesCafe.com (Ilsa.StevesCafe.com [205.168.119.129]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id NAA06268; Wed, 16 Jul 1997 13:44:11 -0700 (PDT) Received: from Ilsa.StevesCafe.com (localhost [127.0.0.1]) by Ilsa.StevesCafe.com (8.8.6/8.8.5) with ESMTP id OAA09705; Wed, 16 Jul 1997 14:42:55 -0600 (MDT) Message-Id: <199707162042.OAA09705@Ilsa.StevesCafe.com> X-Mailer: exmh version 2.0gamma 1/27/96 From: Steve Passe To: smp@freebsd.org cc: current@freebsd.org Subject: self modifying kernel code Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 16 Jul 1997 14:42:55 -0600 Sender: owner-smp@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi, I see the possible usefullness for "self-modifying-code" in several places in the SMP kernel. I currently am doing some "redirected calls" for INT resumption routines because we don't know till run time where several of the vectors will be. Peter pointed out a technique where another SMP kernel puts calls in the kernel to a pseudo-lock routine. This routine then determines whether it is running on a UP or SMP motherboard. If UP it replaces the call with a near jump to the return address. If SMP it replaces the call TARGET address with the address of the real lock routine. Note that this means a modification the 1st time EACH call to a lock/unlock routine is encountered, NOT "just once". This is a win for both UP and SMP, while allowing one kernel to support both. So what is the policy/reality of self-modifying code in the -current source? The 1st example above can be handled during boot, so I suspect that the modifications should be easy enough. The second involves modification of the kernel code space after going multi-user (probaly dozens of times b4 its finished), I'm not so sure about modifying kernel code-space at that point... Comments? -- Steve Passe | powered by smp@csn.net | Symmetric MultiProcessor FreeBSD