Rev 4419 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4419 | Rev 4453 | ||
---|---|---|---|
1 | include 'kglobals.inc' |
1 | include 'kglobals.inc' |
2 | 2 | ||
3 | PG_UNMAP equ 0x000 |
3 | PG_UNMAP equ 0x000 |
4 | PG_MAP equ 0x001 |
4 | PG_MAP equ 0x001 |
5 | PG_WRITE equ 0x002 |
5 | PG_WRITE equ 0x002 |
6 | PG_SW equ 0x003 |
6 | PG_SW equ 0x003 |
7 | PG_USER equ 0x005 |
7 | PG_USER equ 0x005 |
8 | PG_UW equ 0x007 |
8 | PG_UW equ 0x007 |
9 | PG_NOCACHE equ 0x018 |
9 | PG_NOCACHE equ 0x018 |
10 | PG_LARGE equ 0x080 |
10 | PG_LARGE equ 0x080 |
11 | PG_GLOBAL equ 0x100 |
11 | PG_GLOBAL equ 0x100 |
12 | 12 | ||
13 | DRV_ENTRY equ 1 |
13 | DRV_ENTRY equ 1 |
14 | DRV_EXIT equ -1 |
14 | DRV_EXIT equ -1 |
15 | 15 | ||
16 | struct LHEAD |
16 | struct LHEAD |
17 | next dd ? ;next object in list |
17 | next dd ? ;next object in list |
18 | prev dd ? ;prev object in list |
18 | prev dd ? ;prev object in list |
19 | ends |
19 | ends |
20 | 20 | ||
21 | struct MUTEX |
21 | struct MUTEX |
22 | lhead LHEAD |
22 | lhead LHEAD |
23 | count dd ? |
23 | count dd ? |
24 | ends |
24 | ends |
25 | 25 | ||
26 | struct PCIDEV |
26 | struct PCIDEV |
27 | bk dd ? |
27 | bk dd ? |
28 | fd dd ? |
28 | fd dd ? |
29 | vendor_device_id dd ? |
29 | vendor_device_id dd ? |
30 | class dd ? |
30 | class dd ? |
31 | devfn db ? |
31 | devfn db ? |
32 | bus db ? |
32 | bus db ? |
33 | rb 2 |
33 | rb 2 |
34 | owner dd ? ; pointer to SRV or 0 |
34 | owner dd ? ; pointer to SRV or 0 |
35 | ends |
35 | ends |
- | 36 | ||
- | 37 | struct IOCTL |
|
- | 38 | handle dd ? |
|
- | 39 | io_code dd ? |
|
- | 40 | input dd ? |
|
- | 41 | inp_size dd ? |
|
- | 42 | output dd ? |
|
- | 43 | out_size dd ? |
|
- | 44 | ends |
|
36 | 45 | ||
37 | ; The following macro assume that we are on uniprocessor machine. |
46 | ; The following macro assume that we are on uniprocessor machine. |
38 | ; Serious work is needed for multiprocessor machines. |
47 | ; Serious work is needed for multiprocessor machines. |
39 | macro spin_lock_irqsave spinlock |
48 | macro spin_lock_irqsave spinlock |
40 | { |
49 | { |
41 | pushf |
50 | pushf |
42 | cli |
51 | cli |
43 | } |
52 | } |
44 | macro spin_unlock_irqrestore spinlock |
53 | macro spin_unlock_irqrestore spinlock |
45 | { |
54 | { |
46 | popf |
55 | popf |
47 | } |
56 | } |
48 | macro spin_lock_irq spinlock |
57 | macro spin_lock_irq spinlock |
49 | { |
58 | { |
50 | cli |
59 | cli |
51 | } |
60 | } |
52 | macro spin_unlock_irq spinlock |
61 | macro spin_unlock_irq spinlock |
53 | { |
62 | { |
54 | sti |
63 | sti |
55 | } |
64 | } |
56 | 65 | ||
57 | ; \begin{diamond}[29.09.2006] |
66 | ; \begin{diamond}[29.09.2006] |
58 | ; may be useful for kernel debugging |
67 | ; may be useful for kernel debugging |
59 | ; example 1: |
68 | ; example 1: |
60 | ; dbgstr 'Hello, World!' |
69 | ; dbgstr 'Hello, World!' |
61 | ; example 2: |
70 | ; example 2: |
62 | ; dbgstr 'Hello, World!', save_flags |
71 | ; dbgstr 'Hello, World!', save_flags |
63 | macro dbgstr string*, f |
72 | macro dbgstr string*, f |
64 | { |
73 | { |
65 | local a |
74 | local a |
66 | iglobal_nested |
75 | iglobal_nested |
67 | a db 'K : ',string,13,10,0 |
76 | a db 'K : ',string,13,10,0 |
68 | endg_nested |
77 | endg_nested |
69 | if ~ f eq |
78 | if ~ f eq |
70 | pushfd |
79 | pushfd |
71 | end if |
80 | end if |
72 | push esi |
81 | push esi |
73 | mov esi, a |
82 | mov esi, a |
74 | if defined SysMsgBoardStr._pe_import |
83 | if defined SysMsgBoardStr._pe_import |
75 | invoke SysMsgBoardStr |
84 | invoke SysMsgBoardStr |
76 | else |
85 | else |
77 | call SysMsgBoardStr |
86 | call SysMsgBoardStr |
78 | end if |
87 | end if |
79 | pop esi |
88 | pop esi |
80 | if ~ f eq |
89 | if ~ f eq |
81 | popfd |
90 | popfd |
82 | end if |
91 | end if |
83 | } |
92 | } |
84 | ; \end{diamond}[29.09.2006] |
93 | ; \end{diamond}[29.09.2006] |
85 | 94 | ||
86 | ; MOV Immediate. |
95 | ; MOV Immediate. |
87 | ; Useful for things like movi eax,10: |
96 | ; Useful for things like movi eax,10: |
88 | ; shorter than regular mov, but slightly slower, |
97 | ; shorter than regular mov, but slightly slower, |
89 | ; do not use it in performance-critical places. |
98 | ; do not use it in performance-critical places. |
90 | macro movi dst, imm |
99 | macro movi dst, imm |
91 | { |
100 | { |
92 | if imm >= -0x80 & imm <= 0x7F |
101 | if imm >= -0x80 & imm <= 0x7F |
93 | push imm |
102 | push imm |
94 | pop dst |
103 | pop dst |
95 | else |
104 | else |
96 | mov dst, imm |
105 | mov dst, imm |
97 | end if |
106 | end if |
98 | } |
107 | } |
99 | 108 | ||
100 | macro call name |
109 | macro call name |
101 | { |
110 | { |
102 | if name eqtype func & defined name#._pe_import |
111 | if name eqtype func & defined name#._pe_import |
103 | err Use invoke, not call/stdcall for PE imports! |
112 | err Use invoke, not call/stdcall for PE imports! |
104 | end if |
113 | end if |
105 | call name |
114 | call name |
106 | }=> |
115 | }=> |