2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
24 #include <kern/page_decrypt.h>
25 #include <kern/task.h>
26 #include <machine/commpage.h>
28 /*#include <sys/kernel.h> */
29 extern int hz
; /* system clock's frequency */
30 extern void* dsmos_blobs
[];
31 extern int dsmos_blob_count
;
33 /* #include <sys/proc.h> */
34 extern int tsleep(void *chan
, int pri
, const char *wmesg
, int timo
);
36 /* #include <sys/param.h> */
37 #define PZERO 22 /* No longer magic, shouldn't be here. XXX */
39 static int _dsmos_wait_for_callback(const void*,void*);
41 static dsmos_page_transform_hook_t dsmos_hook
= _dsmos_wait_for_callback
;
44 _dsmos_wait_for_callback(const void* from
, void *to
)
46 /* printf("%s\n", __FUNCTION__); */
47 while (dsmos_hook
== NULL
)
48 tsleep(&dsmos_hook
, PZERO
, "dsmos", hz
/ 10);
50 return (*dsmos_hook
) (from
, to
);
54 dsmos_page_transform_hook(dsmos_page_transform_hook_t hook
,
55 void (*commpage_setup_dsmos_blob
)(void**, int))
58 /* finish initializing the commpage here */
59 (*commpage_setup_dsmos_blob
)(dsmos_blobs
, dsmos_blob_count
);
62 /* set the hook now - new callers will run with it */
67 dsmos_page_transform(const void* from
, void* to
)
69 /* printf("%s\n", __FUNCTION__); */
70 if (dsmos_hook
== NULL
)
72 return (*dsmos_hook
) (from
, to
);