PERFORCE change 52672 for review
Andrew Reisse
areisse at FreeBSD.org
Tue May 11 15:49:48 GMT 2004
http://perforce.freebsd.org/chv.cgi?CH=52672
Change 52672 by areisse at areisse_ibook on 2004/05/11 08:49:22
Use a different allocator if the linker is called before tasks
are initialized.
Affected files ...
.. //depot/projects/trustedbsd/sedarwin73/apsl/cctools/ld/ld.h#3 edit
Differences ...
==== //depot/projects/trustedbsd/sedarwin73/apsl/cctools/ld/ld.h#3 (text+ko) ====
@@ -361,3 +361,47 @@
#ifdef DEBUG
__private_extern__ unsigned long debug; /* link-editor debugging */
#endif /* DEBUG */
+
+#if (defined (KLD) && defined (RLD) && defined (__STATIC__))
+
+#include <mach/mach.h>
+#include <mach/kern_return.h>
+#include <mach/vm_map.h>
+
+extern int kth_started;
+
+static inline kern_return_t rkld_alloc (mach_port_t kport, size_t size, void **addr, int flags)
+{
+ if (kth_started)
+ return vm_allocate (kport, addr, size, flags);
+ else
+ {
+ *addr = kalloc (size);
+ return (*addr == 0);
+ }
+}
+
+static inline kern_return_t rkld_free (mach_port_t kport, size_t size, void *addr)
+{
+ if (kth_started)
+ return vm_deallocate (kport, addr, size);
+ else
+ {
+ kfree (addr, size);
+ return 0;
+ }
+}
+
+static inline kern_return_t rkld_protect (mach_port_t kport, void *addr, size_t size, int a, int b)
+{
+ if (kth_started)
+ return vm_protect (kport, addr, size, a, b);
+ else
+ return 0;
+}
+
+#define vm_allocate(kport,addr,size,flags) rkld_alloc (kport, size, addr, flags)
+#define vm_deallocate(kport,addr,size) rkld_free (kport, size, addr)
+#define vm_protect(kport,addr,size,f1,f2) rkld_protect (kport, addr, size, f1, f2)
+
+#endif
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list