win-pvdrivers

view liblfds.6/src/single_dir_for_windows_kernel/slist_internal.h @ 766:6300617040e0

Big changes - not ready for production use.
Removed all the custom DMA handling code as it was completely incompatible with the Windows verifier.
Added liblfds (using the lock free stack) from liblfds.org so that grant's can be obtained at DIRQL.
Fixed xennet and xenvbd to support the changes.
xenusb and xenscsi almost certainly will not yet work after the changes.
author James Harper <james.harper@bendigoit.com.au>
date Sun Jan 31 21:28:42 2010 +1100 (2010-01-31)
parents
children
line source
1 /***** the library wide include file *****/
2 #include "liblfds_internal.h"
4 /***** defines *****/
5 #define SLIST_USER_DATA 0
6 #define SLIST_FLAGS 1
8 #define SLIST_NO_FLAGS 0x0
9 #define SLIST_FLAG_DELETED 0x1
11 /***** structures *****/
12 #pragma pack( push, ALIGN_SINGLE_POINTER )
14 struct slist_state
15 {
16 struct slist_element
17 *volatile head;
19 void
20 (*user_data_delete_function)( void *user_data, void *user_state ),
21 *user_state;
22 };
24 #pragma pack( pop )
26 #pragma pack( push, ALIGN_DOUBLE_POINTER )
28 /* TRD : this pragma pack doesn't seem to work under Windows
29 if the structure members are the correct way round
30 (next first), then user_data_and_flags ends up on
31 a single pointer boundary and DCAS crashes
33 accordingly, I've moved user_data_and_flags first
34 */
36 struct slist_element
37 {
38 void
39 *volatile user_data_and_flags[2];
41 // TRD : requires volatile as is target of CAS
42 struct slist_element
43 *volatile next;
44 };
46 #pragma pack( pop )
48 /***** private prototypes *****/
49 void slist_internal_init_slist( struct slist_state *ss, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state );
51 void slist_internal_link_element_to_head( struct slist_state *slist_state, struct slist_element *volatile se );
52 void slist_internal_link_element_after_element( struct slist_element *volatile slist_in_list_element, struct slist_element *volatile se );
54 void slist_internal_move_to_first_undeleted_element( struct slist_element **se );