Date: Wed, 16 Jul 1997 14:42:55 -0600 From: Steve Passe <smp@csn.net> To: smp@freebsd.org Cc: current@freebsd.org Subject: self modifying kernel code Message-ID: <199707162042.OAA09705@Ilsa.StevesCafe.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707162042.OAA09705>