+ if (!fn) {
+ /* unregistration is always allowed */
+ copyout_shim_fn = NULL;
+ return KERN_SUCCESS;
+ }
+
+ if (copyout_shim_fn) {
+ //need to unregister first before registering a new one.
+ return KERN_FAILURE;
+ }
+
+ if (!PE_parse_boot_argn("enable_copyout_shim", ©out_shim_enabled, sizeof(copyout_shim_enabled)) || !copyout_shim_enabled) {
+ return KERN_FAILURE;
+ }
+
+
+ co_src_flags = types;
+ copyout_shim_fn = fn;
+ return KERN_SUCCESS;