Non-gcc compilers
Matthew Dillon
dillon at apollo.backplane.com
Sun Nov 16 14:45:53 PST 2003
:I think on -current we have another possibility to do what my ntp patch
:does. I think I remember a commit log which allows to add clock drivers
:with a make.conf variable, but I was lazy at that time and forgot to
:investigate if my patch is still needed instead of adding it to
:make.conf. The code for this clock driver wasn't added, as there where
:some issues with the in kernel code, I don't remember which issues, as I
:haven't encountered any problems, but the discussion should be available
:in -current.
I don't consider it a big deal. As long as it doesn't break anything
there is no particular reason not to compile it in.
:This patch is from a mail from bde, see
:http://www.leidinger.net/FreeBSD/misc-patches/kern_exec.c.patch for more
:(it's the mail itself).
:
:> Also, newer gcc's use a masking operation on %esp instead of a subtract
:> and do not actually need an aligned stack pointer to be optimal. But
:> it doesn't hurt so I will commit it anyway :-)
:
:Feel free to send me a diff of your version.
:
:Bye,
:Alexander.
I committed it. Patch (again DFly) attached. I will email BDE to make
sure that the '- 4' is not needed. Basically I just used the patch you
had listed and cleaned it up a bit and removed the - 4.
-Matt
Matthew Dillon
<dillon at xxxxxxxxxxxxx>
Index: kern_exec.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- kern_exec.c 16 Nov 2003 02:37:39 -0000 1.15
+++ kern_exec.c 16 Nov 2003 19:32:31 -0000 1.16
@@ -24,7 +24,7 @@
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/kern_exec.c,v 1.107.2.15 2002/07/30 15:40:46 nectar Exp $
- * $DragonFly: src/sys/kern/kern_exec.c,v 1.15 2003/11/16 02:37:39 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_exec.c,v 1.16 2003/11/16 19:32:31 dillon Exp $
*/
#include <sys/param.h>
@@ -753,23 +753,26 @@
/*
* If we have a valid auxargs ptr, prepare some room
* on the stack.
- */
- if (imgp->auxargs)
- /*
+ *
* The '+ 2' is for the null pointers at the end of each of the
* arg and env vector sets, and 'AT_COUNT*2' is room for the
* ELF Auxargs data.
*/
+ if (imgp->auxargs) {
+ vectp = (char **)(destp - (imgp->args->argc +
+ imgp->args->envc + 2 + AT_COUNT * 2) * sizeof(char*));
+ } else {
vectp = (char **)(destp - (imgp->args->argc +
- imgp->args->envc + 2 + AT_COUNT*2) * sizeof(char*));
- else
+ imgp->args->envc + 2) * sizeof(char*));
+ }
+
/*
- * The '+ 2' is for the null pointers at the end of each of the
- * arg and env vector sets
+ * Align the stack to a multiple of 0x20 to be friendly to high-end
+ * cpus. This is not strictly necessary since newer gcc's now use
+ * a masking operation on the stack pointer instead of assuming
+ * alignment, but it doesn't hurt either.
*/
- vectp = (char **)
- (destp - (imgp->args->argc + imgp->args->envc + 2) *
- sizeof(char*));
+ vectp = (char **)((vm_offset_t)vectp & ~(vm_offset_t)0x1F);
/*
* vectp also becomes our initial stack base
More information about the Kernel
mailing list