VirtualBox

source: vbox/trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFA.asm

最後變更 在這個檔案是 79113,由 vboxsync 提交於 5 年 前

os2/VBoxSF: Display version info during boot and log it on the host.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id Revision
檔案大小: 62.8 KB
 
1; $Id: VBoxSFA.asm 79113 2019-06-13 03:56:18Z vboxsync $
2;; @file
3; VBoxSF - OS/2 Shared Folders, all assembly code (16 -> 32 thunking mostly).
4;
5
6;
7; Copyright (c) 2007 knut st. osmundsen <[email protected]>
8;
9; Permission is hereby granted, free of charge, to any person
10; obtaining a copy of this software and associated documentation
11; files (the "Software"), to deal in the Software without
12; restriction, including without limitation the rights to use,
13; copy, modify, merge, publish, distribute, sublicense, and/or sell
14; copies of the Software, and to permit persons to whom the
15; Software is furnished to do so, subject to the following
16; conditions:
17;
18; The above copyright notice and this permission notice shall be
19; included in all copies or substantial portions of the Software.
20;
21; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28; OTHER DEALINGS IN THE SOFTWARE.
29;
30
31
32;*********************************************************************************************************************************
33;* Header Files *
34;*********************************************************************************************************************************
35%define RT_INCL_16BIT_SEGMENTS
36%include "iprt/asmdefs.mac"
37%include "iprt/err.mac"
38%include "iprt/x86.mac"
39%include "iprt/formats/dwarf.mac"
40%include "VBox/VBoxGuest.mac"
41
42
43;*********************************************************************************************************************************
44;* Dwarf constants and macros *
45;*********************************************************************************************************************************
46;; enable dwarf debug info
47%define WITH_DWARF 1
48
49;; Emits a LEB128 (signed) constant (%1) - limited range.
50%macro DWARF_LEB128 1
51%if %1 >= 0
52 %if %1 < 64
53 db %1
54 %else
55 db (%1 & 0x7f) | 0x80
56 db (%1 >> 7) & 0x7f
57 %endif
58%else
59 %if %1 > -64
60 db (%1 & 0x3f) | 0x40
61 %else
62 db (%1 & 0x7f) | 0x80
63 db ((%1 >> 7) & 0x7f) | 0x40
64 %endif
65%endif
66%endmacro
67
68;; Emits a ULEB128 (unsigned) constant (%1) - limited range.
69%macro DWARF_ULEB128 1
70%if %1 < 0x80
71 db %1
72%elif %1 < 0x4000
73 db (%1 & 0x7f) | 0x80
74 db (%1 >> 7)
75%elif %1 < 0x200000
76 db ((%1) & 0x7f) | 0x80
77 db ((%1 >> 7) & 0x7f) | 0x80
78 db ((%1 >> 14))
79%else
80 %error out of range: %1
81%endif
82%endmacro
83
84;; Emits a pair of ULEB128 constants. Useful for .debug_abbrev.
85%macro DWARF_ULEB128_PAIR 2
86 DWARF_ULEB128 %1
87 DWARF_ULEB128 %2
88%endmacro
89
90
91;; defines a CFA offset by register (%1) + unsigned offset (%2).
92%macro CFA_DEF_CFA 2
93 db DW_CFA_def_cfa
94 DWARF_ULEB128 %1
95 DWARF_ULEB128 %2
96%endmacro
97
98;; defines the register (%1) value as CFA + unsigned offset (%2) * data_alignment_factor.
99%macro CFA_VAL_OFFSET 2
100 db DW_CFA_val_offset
101 DWARF_ULEB128 %1
102 DWARF_ULEB128 %2
103%endmacro
104
105;; defines the register (%1) save location as CFA + unsigned offset (%2) * data_alignment_factor.
106%macro CFA_OFFSET 2
107%if %1 < 0x40
108 db DW_CFA_offset | %1
109%else
110 db DW_CFA_offset_extended
111 DWARF_ULEB128 %1
112%endif
113 DWARF_ULEB128 %2
114%endmacro
115
116%define MY_ABBREV_CODE_CU 2
117%define MY_ABBREV_CODE_LABEL 3
118
119
120;; Emits a debug info for a label in CODE16.
121;; @param %1 symbol
122%macro DWARF_LABEL_CODE16 1
123%ifdef WITH_DWARF
124segment _debug_info
125 DWARF_ULEB128 MY_ABBREV_CODE_LABEL
126 dd %1 wrt CODE16
127 db 2 ; Hardcoded CODE16 number.
128%defstr tmp_str_conversion %1
129 db tmp_str_conversion, 0
130%endif
131segment CODE16
132%endmacro
133
134
135;; Emits a debug info for a label in CODE32.
136;; @param %1 symbol
137%macro DWARF_LABEL_TEXT32 1
138%ifdef WITH_DWARF
139segment _debug_info
140 DWARF_ULEB128 MY_ABBREV_CODE_LABEL
141 dd %1 wrt TEXT32
142 db 3 ; Hardcoded TEXT32 number.
143%defstr tmp_str_conversion %1
144 db tmp_str_conversion, 0
145%endif
146segment TEXT32
147%endmacro
148
149
150
151;*********************************************************************************************************************************
152;* Additional Segment definitions. *
153;*********************************************************************************************************************************
154%ifdef WITH_DWARF ; We need to use '_debug_xxx' + dotseg.exe here rather than '.debug_xxx' because some nasm crap.
155segment _debug_frame public CLASS=DWARF align=4 use32
156g_cie_thunk_back:
157 dd (g_cie_thunk_end - g_cie_thunk_back - 4) ; Length
158 dd 0xffffffff ; I'm a CIE.
159 db 4 ; DwARF v4
160 db 0 ; Augmentation.
161 db 4 ; Address size.
162 db 4 ; Segment size.
163 DWARF_LEB128 1 ; Code alignment factor.
164 DWARF_LEB128 -1 ; Data alignment factor.
165 DWARF_ULEB128 DWREG_X86_RA ; Return register column.
166 CFA_DEF_CFA DWREG_X86_EBP, 8 ; cfa = EBP + 8
167 CFA_OFFSET DWREG_X86_EBP, 8 ; EBP = [CFA - 8]
168 CFA_OFFSET DWREG_X86_ESP, 8+10 ; SS = [CFA - 8 - 10]
169 CFA_OFFSET DWREG_X86_SS, 8+6 ; SS = [CFA - 8 - 6]
170 CFA_OFFSET DWREG_X86_ES, 8+4 ; ES = [CFA - 8 - 4]
171 CFA_OFFSET DWREG_X86_DS, 8+2 ; DS = [CFA - 8 - 2]
172 CFA_OFFSET DWREG_X86_CS, 2 ; CS = [CFA - 2]
173; CFA_OFFSET DWREG_X86_RA, 4 ; RetAddr = [CFA - 4]
174 align 4, db DW_CFA_nop
175g_cie_thunk_end:
176
177
178segment _debug_abbrev public CLASS=DWARF align=1 use32
179g_abbrev_compile_unit:
180 DWARF_ULEB128 MY_ABBREV_CODE_CU
181 DWARF_ULEB128_PAIR DW_TAG_compile_unit, DW_CHILDREN_yes
182 DWARF_ULEB128_PAIR DW_AT_name, DW_FORM_string
183 db 0, 0 ; the end.
184g_abbrev_label:
185 db MY_ABBREV_CODE_LABEL
186 DWARF_ULEB128_PAIR DW_TAG_label, DW_CHILDREN_no
187 DWARF_ULEB128_PAIR DW_AT_low_pc, DW_FORM_addr
188 DWARF_ULEB128_PAIR DW_AT_segment, DW_FORM_data1
189 DWARF_ULEB128_PAIR DW_AT_name, DW_FORM_string
190 db 0, 0 ; the end.
191
192
193segment _debug_info public CLASS=DWARF align=1 use32
194g_dwarf_compile_unit_header:
195 dd g_dwarf_compile_unit_end - g_dwarf_compile_unit_header - 4
196 dw 2 ; DWARF v2
197 dd g_abbrev_compile_unit wrt _debug_abbrev
198 db 4 ; address_size
199.compile_unit_die:
200 db MY_ABBREV_CODE_CU
201 db __FILE__, 0
202
203segment TEXT32
204%endif ; WITH_DWARF
205
206
207
208;*********************************************************************************************************************************
209;* Defined Constants And Macros *
210;*********************************************************************************************************************************
211%define ERROR_NOT_SUPPORTED 50
212%define ERROR_INVALID_PARAMETER 87
213%define DevHlp_AttachDD 2ah
214
215
216;;
217; Prints a string to the VBox log port.
218%macro DEBUG_STR16 1
219%ifdef DEBUG
220segment DATA16
221%%my_dbg_str: db %1, 0ah, 0
222segment CODE16
223 push ax
224 mov ax, %%my_dbg_str
225 call NAME(dbgstr16)
226 pop ax
227%endif
228%endmacro
229
230;%define RT_STR_QUOTE "
231;%define RT_STR(a_Label) RT_STR_QUOTE a_Label RT_STR_QUOTE
232
233%macro VBOXSF_EP16_BEGIN 2
234DWARF_LABEL_CODE16 %1
235global %1
236%1:
237 ;DEBUG_STR16 {'VBoxSF: ', %2}
238
239%endmacro
240
241%macro VBOXSF_EP16_END 1
242global %1_EndProc
243%1_EndProc:
244%endmacro
245
246;;
247; Used in a 16-bit entrypoint for taking us to 32-bit and reserving a parameter frame.
248;
249; @param %1 The function name
250; @param %2 The number of bytes to reserve
251;
252%macro VBOXSF_TO_32 2
253 ; prologue
254%ifdef DEBUG
255 %ifndef WITH_DWARF
256 inc ebp
257 %endif
258%endif
259 push ebp
260 mov ebp, esp ; bp
261 push ds ; bp - 2
262 push es ; bp - 4
263%ifdef WITH_DWARF
264 push ss ; bp - 6
265 lea eax, [esp + 3*2 + 4 + 4] ; bp - 10: return esp (16-bit)
266 push eax
267%endif
268
269 ; Reserve the 32-bit parameter and align the stack on a 16 byte
270 ; boundary to make GCC really happy.
271 sub sp, %2
272 and sp, 0fff0h
273
274 ;jmp far dword NAME(%i %+ _32) wrt FLAT
275 db 066h
276 db 0eah
277 dd NAME(%1 %+ _32) ;wrt FLAT
278 dw TEXT32 wrt FLAT
279segment TEXT32
280GLOBALNAME %1 %+ _32
281DWARF_LABEL_TEXT32 NAME(%1 %+ _32)
282 mov ax, DATA32 wrt FLAT
283 mov ds, ax
284 mov es, ax
285
286 call KernThunkStackTo32
287.vboxsf_to_32_end:
288
289%endmacro ; VBOXSF_TO_32
290
291;;
292; The counter part to VBOXSF_TO_32
293;
294; @param %1 The function name
295;
296%macro VBOXSF_TO_16 1
297.vboxsf_to_16_start:
298 push eax
299 call KernThunkStackTo16
300 pop eax
301
302 ;jmp far dword NAME(%1 %+ _16) wrt CODE16
303 db 066h
304 db 0eah
305 dw NAME(%1 %+ _16) wrt CODE16
306 dw CODE16
307.vboxsf_to_16_done_32:
308%ifdef WITH_DWARF
309segment _debug_frame
310.fde_start:
311 dd (.fde_end - .fde_start) - 4
312 dd g_cie_thunk_back wrt _debug_frame
313 dd 2 ; TEXT32 idx
314 dd NAME(%1 %+ _32) wrt TEXT32
315 dd .vboxsf_to_16_done_32 - NAME(%1 %+ _32)
316 db DW_CFA_advance_loc | 4
317 db DW_CFA_advance_loc | 2
318 db DW_CFA_advance_loc | 2
319 db DW_CFA_advance_loc | 5
320 db DW_CFA_advance_loc2 ; Hack to easily cover the parameter conversion code.
321 dw .vboxsf_to_16_start - .vboxsf_to_32_end
322 db DW_CFA_advance_loc | 1
323 db DW_CFA_advance_loc | 5
324 db DW_CFA_advance_loc | 1
325 db DW_CFA_advance_loc | 6
326 align 4, db DW_CFA_nop
327.fde_end:
328 %endif ; WITH_DWARF
329segment CODE16
330GLOBALNAME %1 %+ _16
331DWARF_LABEL_CODE16 NAME(%1 %+ _16)
332
333 ; Epilogue
334 lea sp, [bp - 4h]
335 pop es
336 pop ds
337 mov esp, ebp
338 pop ebp
339%ifdef DEBUG
340 %ifndef WITH_DWARF
341 dec ebp
342 %endif
343%endif
344%endmacro
345
346;;
347; Thunks the given 16:16 pointer to a flat pointer, NULL is returned as NULL.
348;
349; @param %1 The ebp offset of the input.
350; @param %2 The esp offset of the output.
351; @users eax, edx, ecx
352;
353%macro VBOXSF_FARPTR_2_FLAT 2
354 push dword [ebp + (%1)]
355 call KernSelToFlat
356 add esp, 4h
357 mov [esp + (%2)], eax
358%endmacro
359
360;;
361; Thunks the given 16:16 struct sffsd pointer to a flat pointer.
362;
363; @param %1 The ebp offset of the input.
364; @param %2 The esp offset of the output.
365; @users eax, ecx
366;
367%macro VBOXSF_PSFFSD_2_FLAT 2
368%if 1 ; optimize later if we can.
369 VBOXSF_FARPTR_2_FLAT %1, %2
370%else
371 lds cx, [ebp + (%1)]
372 and ecx, 0ffffh
373 mov eax, dword [ecx]
374 mov cx, DATA32 wrt FLAT
375 mov [esp + (%2)], eax
376 mov ds, cx
377%endif
378%endmacro
379
380
381;;
382; Thunks the given 16:16 struct cdfsd pointer to a flat pointer.
383;
384; @param %1 The ebp offset of the input.
385; @param %2 The esp offset of the output.
386; @users eax, ecx
387;
388%macro VBOXSF_PCDFSD_2_FLAT 2
389%if 1 ; optimize later if possible.
390 VBOXSF_FARPTR_2_FLAT %1, %2
391%else
392 lds cx, [ebp + (%1)]
393 and ecx, 0ffffh
394 mov eax, dword [ecx]
395 mov cx, DATA32 wrt FLAT
396 mov [esp + (%2)], eax
397 mov ds, cx
398%endif
399%endmacro
400
401;;
402; Thunks the given 16:16 struct fsfsd pointer to a flat pointer.
403;
404; @param %1 The ebp offset of the input.
405; @param %2 The esp offset of the output.
406; @users eax, ecx
407;
408%macro VBOXSF_PFSFSD_2_FLAT 2
409%if 1 ; optimize later if possible.
410 VBOXSF_FARPTR_2_FLAT %1, %2
411%else
412 lds cx, [ebp + (%1)]
413 and ecx, 0ffffh
414 mov eax, dword [ecx]
415 mov cx, DATA32 wrt FLAT
416 mov [esp + (%2)], eax
417 mov ds, cx
418%endif
419%endmacro
420
421
422;;
423; Used for taking us from 32-bit and reserving a parameter frame.
424;
425; @param %1 The function name
426; @param %2 The number of bytes to reserve
427;
428%macro VBOXSF_FROM_32 2
429 ; prologue
430 push ebp
431 mov ebp, esp ; ebp
432 push ds ; ebp - 4
433 push es ; ebp - 8
434 push ebx ; ebp - 0ch
435 push esi ; ebp - 10h
436 push edi ; ebp - 14h
437
438 ; Reserve the 32-bit parameter
439 sub esp, %2
440
441 call KernThunkStackTo16
442
443 ;jmp far dword NAME(%1 %+ _16) wrt CODE16
444 db 066h
445 db 0eah
446 dw NAME(%1 %+ _16) wrt CODE16
447 dw CODE16
448.vboxsf_from_32_end:
449
450segment CODE16
451GLOBALNAME %1 %+ _16
452DWARF_LABEL_CODE16 NAME(%1 %+ _16)
453
454%endmacro
455
456
457;;
458; Partially countering VBOXSF_FROM_32:
459; Take us back to 32-bit mode, but don't do the epilogue stuff.
460;
461; @param %1 The function name
462;
463%macro VBOXSF_FROM_16_SWITCH 1
464.vboxsf_from_16_start:
465 ;jmp far dword NAME(%i %+ _32) wrt FLAT
466 db 066h
467 db 0eah
468 dd NAME(%1 %+ _32) ;wrt FLAT
469 dw TEXT32 wrt FLAT
470.vboxsf_from_16_done_16:
471
472segment TEXT32
473GLOBALNAME %1 %+ _32
474DWARF_LABEL_TEXT32 NAME(%1 %+ _32)
475
476 push eax
477 call KernThunkStackTo32
478 mov ax, DATA32 wrt FLAT
479 mov ds, eax
480 mov es, eax
481 pop eax
482%endmacro
483
484
485;;
486; Does the remaining recovery after VBOXSF_FROM_32.
487;
488%macro VBOXSF_FROM_16_EPILOGUE 0
489 ; Epilogue
490 lea esp, [ebp - 14h]
491 pop edi
492 pop esi
493 pop ebx
494 pop es
495 pop ds
496 cld
497 mov esp, ebp
498 pop ebp
499%endmacro
500
501
502
503
504;*********************************************************************************************************************************
505;* External Symbols *
506;*********************************************************************************************************************************
507segment CODE32
508extern KernThunkStackTo32
509extern KernThunkStackTo16
510extern KernSelToFlat
511extern KernStrToUcs
512extern KernStrFromUcs
513segment CODE16
514extern FSH_FORCENOSWAP
515extern FSH_GETVOLPARM
516extern DOS16WRITE
517
518segment CODE32
519extern NAME(FS32_ALLOCATEPAGESPACE)
520extern NAME(FS32_ATTACH)
521extern NAME(FS32_CANCELLOCKREQUEST)
522extern NAME(FS32_CANCELLOCKREQUESTL)
523extern NAME(FS32_CHDIR)
524extern FS32_CHGFILEPTRL
525extern NAME(FS32_CLOSE)
526extern NAME(FS32_COMMIT)
527extern NAME(FS32_COPY)
528extern NAME(FS32_DELETE)
529extern NAME(FS32_DOPAGEIO)
530extern NAME(FS32_EXIT)
531extern NAME(FS32_FILEATTRIBUTE)
532extern NAME(FS32_FILEINFO)
533extern NAME(FS32_FILEIO)
534extern NAME(FS32_FILELOCKS)
535extern NAME(FS32_FILELOCKSL)
536extern NAME(FS32_FINDCLOSE)
537extern NAME(FS32_FINDFIRST)
538extern NAME(FS32_FINDFROMNAME)
539extern NAME(FS32_FINDNEXT)
540extern NAME(FS32_FINDNOTIFYCLOSE)
541extern NAME(FS32_FINDNOTIFYFIRST)
542extern NAME(FS32_FINDNOTIFYNEXT)
543extern NAME(FS32_FLUSHBUF)
544extern NAME(FS32_FSCTL)
545extern NAME(FS32_FSINFO)
546extern NAME(FS32_IOCTL)
547extern NAME(FS32_MKDIR)
548extern NAME(FS32_MOUNT)
549extern NAME(FS32_MOVE)
550extern NAME(FS32_NEWSIZEL)
551extern NAME(FS32_NMPIPE)
552extern NAME(FS32_OPENCREATE)
553extern NAME(FS32_OPENPAGEFILE)
554extern NAME(FS32_PATHINFO)
555extern NAME(FS32_PROCESSNAME)
556extern FS32_READ
557extern NAME(FS32_RMDIR)
558extern NAME(FS32_SETSWAP)
559extern NAME(FS32_SHUTDOWN)
560extern NAME(FS32_VERIFYUNCNAME)
561extern FS32_WRITE
562
563extern NAME(VBoxSFR0Init)
564
565
566
567;*******************************************************************************
568;* Global Variables *
569;*******************************************************************************
570segment DATA16
571
572;;
573; The file system name.
574global FS_NAME
575FS_NAME:
576 db 'VBOXSF',0
577
578;;
579; File system attributes
580; The 32-bit version is only used to indicate that this is a 32-bit file system.
581;
582%define FSA_REMOTE 0001h ; remote file system.
583%define FSA_UNC 0002h ; implements UNC.
584%define FSA_LOCK 0004h ; needs lock notification.
585%define FSA_LVL7 0008h ; accept level 7 (case preserving path request).
586%define FSA_PSVR 0010h ; (named) pipe server.
587%define FSA_LARGEFILE 0020h ; large file support.
588align 16
589global FS_ATTRIBUTE
590global FS32_ATTRIBUTE
591FS_ATTRIBUTE:
592FS32_ATTRIBUTE:
593 dd FSA_REMOTE + FSA_LARGEFILE + FSA_UNC + FSA_LVL7 ;+ FSA_LOCK
594
595;; 64-bit mask.
596; bit 0 - don't get the ring-0 spinlock.
597; bit 6 - don't get the subsystem ring-0 spinlock.
598global FS_MPSAFEFLAGS2
599FS_MPSAFEFLAGS2:
600 dd 0 ;1 | (1<<6) - not getting the ring-0 spinlock causes trouble, so dropping both for now.
601 dd 0
602
603;;
604; Set after VBoxSFR0Init16Bit has been called.
605GLOBALNAME g_fDoneRing0
606 db 0
607
608align 4
609;;
610; The device helper (IPRT expects this name).
611; (This is set by FS_INIT.)
612GLOBALNAME g_fpfnDevHlp
613 dd 0
614
615;;
616; Whether initialization should be verbose or quiet.
617GLOBALNAME g_fVerbose
618 db 1
619
620;; DEBUGGING DEBUGGING
621GLOBALNAME g_u32Info
622 dd 0
623
624;; Far pointer to DOS16WRITE (corrected set before called).
625; Just a 'temporary' hack to work around a wlink/nasm issue.
626GLOBALNAME g_fpfnDos16Write
627 dw DOS16WRITE
628 dw seg DOS16WRITE
629
630;;
631; The attach dd data.
632GLOBALNAME g_VBoxGuestAttachDD
633 dd 0
634 dw 0
635 dd 0
636 dw 0
637;;
638; The AttachDD name of the VBoxGuest.sys driver.
639GLOBALNAME g_szVBoxGuestName
640 db VBOXGUEST_DEVICE_NAME_SHORT, 0
641;;
642; The VBoxGuest IDC connection data.
643GLOBALNAME g_VBoxGuestIDC
644 times VBGLOS2ATTACHDD_size db 0
645
646;;
647; This must be present, we've got fixups against it.
648segment DATA32
649g_pfnDos16Write:
650 dd DOS16WRITE ; flat
651
652
653
654
655
656
657
658;
659;
660; 16-bit entry point thunking.
661; 16-bit entry point thunking.
662; 16-bit entry point thunking.
663;
664;
665segment CODE16
666
667
668;;
669; @cproto int FS_ALLOCATEPAGESPACE(PSFFSI psffsi, PVBOXSFFSD psffsd, ULONG cb, USHORT cbWantContig)
670VBOXSF_EP16_BEGIN FS_ALLOCATEPAGESPACE, 'FS_ALLOCATEPAGESPACE'
671VBOXSF_TO_32 FS_ALLOCATEPAGESPACE, 4*4
672 movzx ecx, word [ebp + 08h] ; cbWantContig
673 mov [esp + 3*4], ecx
674 mov edx, [ebp + 0ah] ; cb
675 mov [esp + 2*4], edx
676 VBOXSF_PSFFSD_2_FLAT 0eh, 1*4 ; psffsd
677 VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; psffsi
678 call NAME(FS32_ALLOCATEPAGESPACE)
679VBOXSF_TO_16 FS_ALLOCATEPAGESPACE
680 retf 0eh
681VBOXSF_EP16_END FS_ALLOCATEPAGESPACE
682
683;;
684; @cproto int FS_ATTACH(USHORT flag, PCSZ pszDev, PVPFSD pvpfsd, PCDFSD pcdfsd, PBYTE pszParm, PUSHORT pcbParm)
685;
686VBOXSF_EP16_BEGIN FS_ATTACH, 'FS_ATTACH'
687 ;
688 ; Initialized ring-0 yet? (this is a likely first entry point)
689 ;
690 push ds
691 mov ax, DATA16
692 mov ds, ax
693 test byte [NAME(g_fDoneRing0)], 1
694 jnz .DoneRing0
695 call NAME(VBoxSFR0Init16Bit)
696.DoneRing0:
697 pop ds
698
699VBOXSF_TO_32 FS_ATTACH, 6*4
700 VBOXSF_FARPTR_2_FLAT 08h, 5*4 ; pcbParm
701 VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pszParm
702 VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pcdfsd
703 VBOXSF_FARPTR_2_FLAT 14h, 2*4 ; pvpfsd
704 VBOXSF_FARPTR_2_FLAT 18h, 1*4 ; pszDev
705 movzx ecx, word [ebp + 1ch] ; fFlag
706 mov [esp], ecx
707 call NAME(FS32_ATTACH)
708VBOXSF_TO_16 FS_ATTACH
709 retf 16h
710VBOXSF_EP16_END FS_ATTACH
711
712
713;;
714; @cproto int FS_CANCELLOCKREQUEST(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelock far *pLockRange)
715VBOXSF_EP16_BEGIN FS_CANCELLOCKREQUEST, 'FS_CANCELLOCKREQUEST'
716VBOXSF_TO_32 FS_CANCELLOCKREQUEST, 3*4
717 VBOXSF_FARPTR_2_FLAT 08h, 2*4 ; pLockRange
718 VBOXSF_PSFFSD_2_FLAT 0ch, 1*4 ; psffsd
719 VBOXSF_FARPTR_2_FLAT 10h, 0*4 ; psffsi
720 call NAME(FS32_CANCELLOCKREQUEST)
721VBOXSF_TO_16 FS_CANCELLOCKREQUEST
722 retf 0ch
723VBOXSF_EP16_END FS_CANCELLOCKREQUEST
724
725
726;;
727; @cproto int FS_CANCELLOCKREQUESTL(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelockl far *pLockRange)
728VBOXSF_EP16_BEGIN FS_CANCELLOCKREQUESTL, 'FS_CANCELLOCKREQUESTL'
729VBOXSF_TO_32 FS_CANCELLOCKREQUESTL, 3*4
730 VBOXSF_FARPTR_2_FLAT 08h, 2*4 ; pLockRange
731 VBOXSF_PSFFSD_2_FLAT 0ch, 1*4 ; psffsd
732 VBOXSF_FARPTR_2_FLAT 10h, 0*4 ; psffsi
733 call NAME(FS32_CANCELLOCKREQUESTL)
734VBOXSF_TO_16 FS_CANCELLOCKREQUESTL
735 retf 0ch
736VBOXSF_EP16_END FS_CANCELLOCKREQUESTL
737
738
739;;
740; @cproto int FS_CHDIR(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszDir, USHORT iCurDirEnd)
741VBOXSF_EP16_BEGIN FS_CHDIR, 'FS_CHDIR'
742VBOXSF_TO_32 FS_CHDIR, 5*4
743 movsx ecx, word [ebp + 08h] ; iCurDirEnd
744 mov [esp + 4*4], ecx
745 VBOXSF_FARPTR_2_FLAT 0ah, 3*4 ; pszDir
746 VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pcdfsd (use slow thunk here, see flag)
747 VBOXSF_FARPTR_2_FLAT 12h, 1*4 ; pcdfsi
748 movzx eax, word [ebp + 16h] ; flag
749 mov [esp], eax
750 call NAME(FS32_CHDIR)
751VBOXSF_TO_16 FS_CHDIR
752 retf 10h
753VBOXSF_EP16_END FS_CHDIR
754
755
756; @cproto int FS_CHGFILEPTR(PSFFSI psffsi, PVBOXSFFSD psffsd, LONG off, USHORT usMethod, USHORT IOflag)
757VBOXSF_EP16_BEGIN FS_CHGFILEPTR, 'FS_CHGFILEPTR'
758VBOXSF_TO_32 FS_CHGFILEPTR, 6*4
759 movzx ecx, word [ebp + 08h] ; IOflag
760 mov [esp + 5*4], ecx
761 movzx edx, word [ebp + 0ah] ; usMethod
762 mov [esp + 4*4], edx
763 mov eax, [ebp + 0ch] ; off
764 mov [esp + 2*4], eax
765 rol eax, 1 ; high dword - is there a better way than this?
766 and eax, 1
767 mov edx, 0ffffffffh
768 mul edx
769 mov [esp + 3*4], eax
770 VBOXSF_PSFFSD_2_FLAT 10h, 1*4 ; psffsd
771 VBOXSF_FARPTR_2_FLAT 14h, 0*4 ; psffsi
772 call FS32_CHGFILEPTRL
773VBOXSF_TO_16 FS_CHGFILEPTR
774 retf 10h
775VBOXSF_EP16_END FS_CHGFILEPTR
776
777
778;;
779; @cproto int FS_CLOSE(USHORT type, USHORT IOflag, PSFFSI psffsi, PVBOXSFFSD psffsd)
780;
781VBOXSF_EP16_BEGIN FS_CLOSE, 'FS_CLOSE'
782VBOXSF_TO_32 FS_CLOSE, 4*4
783 VBOXSF_PSFFSD_2_FLAT 08h, 3*4 ; psffsd
784 VBOXSF_FARPTR_2_FLAT 0ch, 2*4 ; psffsi
785 movzx ecx, word [ebp + 10h] ; IOflag
786 mov [esp + 1*4], ecx
787 movzx edx, word [ebp + 12h] ; type
788 mov [esp], edx
789 call NAME(FS32_CLOSE)
790VBOXSF_TO_16 FS_CLOSE
791 retf 0ch
792VBOXSF_EP16_END FS_CLOSE
793
794
795;;
796; @cproto int FS_COMMIT(USHORT type, USHORT IOflag, PSFFSI psffsi, PVBOXSFFSD psffsd)
797;
798VBOXSF_EP16_BEGIN FS_COMMIT, 'FS_COMMIT'
799VBOXSF_TO_32 FS_COMMIT, 4*4
800 VBOXSF_PSFFSD_2_FLAT 08h, 3*4 ; psffsd
801 VBOXSF_FARPTR_2_FLAT 0ch, 2*4 ; psffsi
802 movzx ecx, word [ebp + 10h] ; IOflag
803 mov [esp + 1*4], ecx
804 movzx edx, word [ebp + 12h] ; type
805 mov [esp], edx
806 call NAME(FS32_COMMIT)
807VBOXSF_TO_16 FS_COMMIT
808 retf 0ch
809VBOXSF_EP16_END FS_COMMIT
810
811;;
812; @cproto int FS_COPY(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszSrc, USHORT iSrcCurDirEnd
813; PCSZ pszDst, USHORT iDstCurDirEnd, USHORT nameType);
814VBOXSF_EP16_BEGIN FS_COPY, 'FS_COPY'
815VBOXSF_TO_32 FS_COPY, 8*4
816 movzx ecx, word [ebp + 08h] ; flag
817 mov [esp + 7*4], ecx
818 movsx edx, word [ebp + 0ah] ; iDstCurDirEnd
819 mov [esp + 6*4], edx
820 VBOXSF_FARPTR_2_FLAT 0ch, 5*4 ; pszDst
821 movsx eax, word [ebp + 10h] ; iSrcCurDirEnd
822 mov [esp + 4*4], eax
823 VBOXSF_FARPTR_2_FLAT 12h, 3*4 ; pszSrc
824 VBOXSF_PCDFSD_2_FLAT 16h, 2*4 ; psffsd
825 VBOXSF_FARPTR_2_FLAT 1ah, 1*4 ; psffsi
826 movzx ecx, word [ebp + 1eh] ; flag
827 mov [esp], ecx
828 call NAME(FS32_COPY)
829VBOXSF_TO_16 FS_COPY
830 retf 18h
831VBOXSF_EP16_END FS_COPY
832
833
834;;
835; @cproto int FS_DELETE(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszFile, USHORT iCurDirEnd);
836VBOXSF_EP16_BEGIN FS_DELETE, 'FS_DELETE'
837VBOXSF_TO_32 FS_DELETE, 4*4
838 movsx ecx, word [ebp + 08h] ; iCurDirEnd
839 mov [esp + 3*4], ecx
840 VBOXSF_FARPTR_2_FLAT 0ah, 2*4 ; pszFile
841 VBOXSF_PCDFSD_2_FLAT 0eh, 1*4 ; pcdfsd
842 VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; pcdfsi
843 call NAME(FS32_DELETE)
844VBOXSF_TO_16 FS_DELETE
845 retf 0eh
846VBOXSF_EP16_END FS_DELETE
847
848
849;;
850; @cproto int FS_DOPAGEIO(PSFFSI psffsi, PVBOXSFFSD psffsd, struct PageCmdHeader far *pList)
851VBOXSF_EP16_BEGIN FS_DOPAGEIO, 'FS_DOPAGEIO'
852VBOXSF_TO_32 FS_DOPAGEIO, 3*4
853 VBOXSF_FARPTR_2_FLAT 08h, 2*4 ; pList
854 VBOXSF_PSFFSD_2_FLAT 0ch, 1*4 ; psffsd
855 VBOXSF_FARPTR_2_FLAT 10h, 0*4 ; psffsi
856 call NAME(FS32_DOPAGEIO)
857VBOXSF_TO_16 FS_DOPAGEIO
858 retf 0ch
859VBOXSF_EP16_END FS_DOPAGEIO
860
861;;
862; @cproto void FS_EXIT(USHORT uid, USHORT pid, USHORT pdb)
863VBOXSF_EP16_BEGIN FS_EXIT, 'FS_EXIT'
864 ;
865 ; Initialized ring-0 yet? (this is a likely first entry point)
866 ;
867 push ds
868 mov ax, DATA16
869 mov ds, ax
870 test byte [NAME(g_fDoneRing0)], 1
871 jnz .DoneRing0
872 call NAME(VBoxSFR0Init16Bit)
873.DoneRing0:
874 pop ds
875
876VBOXSF_TO_32 FS_EXIT, 3*4
877 movzx ecx, word [ebp + 08h] ; pdb
878 mov [esp + 2*4], ecx
879 movzx edx, word [ebp + 0ah] ; pib
880 mov [esp + 1*4], edx
881 movzx eax, word [ebp + 0ch] ; uid
882 mov [esp], eax
883 call NAME(FS32_EXIT)
884VBOXSF_TO_16 FS_EXIT
885 retf 6h
886VBOXSF_EP16_END FS_EXIT
887
888
889;;
890; @cproto int FS_FILEATTRIBUTE(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd, PUSHORT pAttr);
891;
892VBOXSF_EP16_BEGIN FS_FILEATTRIBUTE, 'FS_FILEATTRIBUTE'
893VBOXSF_TO_32 FS_FILEATTRIBUTE, 6*4
894 VBOXSF_FARPTR_2_FLAT 08h, 5*4 ; pAttr
895 movsx ecx, word [ebp + 0ch] ; iCurDirEnd - caller may pass 0xffff, so sign extend.
896 mov [esp + 4*4], ecx
897 VBOXSF_FARPTR_2_FLAT 0eh, 3*4 ; pszName
898 VBOXSF_PCDFSD_2_FLAT 12h, 2*4 ; pcdfsd
899 VBOXSF_FARPTR_2_FLAT 16h, 1*4 ; pcdfsi
900 movzx edx, word [ebp + 1ah] ; flag
901 mov [esp], edx
902 call NAME(FS32_FILEATTRIBUTE)
903VBOXSF_TO_16 FS_FILEATTRIBUTE
904 retf 14h
905VBOXSF_EP16_END FS_FILEATTRIBUTE
906
907
908;;
909; @cproto int FS_FILEINFO(USHORT flag, PSFFSI psffsi, PVBOXSFFSD psffsd, USHORT level,
910; PBYTE pData, USHORT cbData, USHORT IOflag);
911VBOXSF_EP16_BEGIN FS_FILEINFO, 'FS_FILEINFO'
912VBOXSF_TO_32 FS_FILEINFO, 7*4
913 movzx ecx, word [ebp + 08h] ; IOflag
914 mov [esp + 6*4], ecx
915 movzx edx, word [ebp + 0ah] ; cbData
916 mov [esp + 5*4], edx
917 VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pData
918 movzx eax, word [ebp + 10h] ; level
919 mov [esp + 3*4], eax
920 VBOXSF_PSFFSD_2_FLAT 12h, 2*4 ; psffsd
921 VBOXSF_FARPTR_2_FLAT 16h, 1*4 ; psffsi
922 movzx ecx, word [ebp + 1ah] ; flag
923 mov [esp], ecx
924 call NAME(FS32_FILEINFO)
925VBOXSF_TO_16 FS_FILEINFO
926 retf 14h
927VBOXSF_EP16_END FS_FILEINFO
928
929
930;;
931; @cproto int FS_FILEIO(PSFFSI psffsi, PVBOXSFFSD psffsd, PBYTE pCmdList, USHORT cbCmdList,
932; PUSHORT poError, USHORT IOflag);
933VBOXSF_EP16_BEGIN FS_FILEIO, 'FS_FILEIO'
934VBOXSF_TO_32 FS_FILEIO, 6*4
935 movzx ecx, word [ebp + 08h] ; IOFlag
936 mov [esp + 5*4], ecx
937 VBOXSF_FARPTR_2_FLAT 0ah, 4*4 ; poError
938 movzx edx, word [ebp + 0eh] ; cbCmdList
939 mov [esp + 3*4], edx
940 VBOXSF_FARPTR_2_FLAT 10h, 2*4 ; pCmdList
941 VBOXSF_PSFFSD_2_FLAT 14h, 1*4 ; psffsd
942 VBOXSF_FARPTR_2_FLAT 18h, 0*4 ; psffsi
943 call NAME(FS32_FILEIO)
944VBOXSF_TO_16 FS_FILEIO
945 retf 14h
946VBOXSF_EP16_END FS_FILEIO
947
948
949;;
950; @cproto int FS_FILELOCKS(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelock far *pUnLockRange
951; struct filelock far *pLockRange, ULONG timeout, ULONG flags)
952VBOXSF_EP16_BEGIN FS_FILELOCKS, 'FS_FILELOCKS'
953VBOXSF_TO_32 FS_FILELOCKS, 6*4
954 mov ecx, [ebp + 08h] ; flags
955 mov [esp + 5*4], ecx
956 mov edx, [ebp + 0ch] ; timeout
957 mov [esp + 4*4], edx
958 VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pLockRange
959 VBOXSF_FARPTR_2_FLAT 14h, 2*4 ; pUnLockRange
960 VBOXSF_PSFFSD_2_FLAT 18h, 1*4 ; psffsd
961 VBOXSF_FARPTR_2_FLAT 1ch, 0*4 ; psffsi
962 call NAME(FS32_FILELOCKS)
963VBOXSF_TO_16 FS_FILELOCKS
964 retf 18h
965VBOXSF_EP16_END FS_FILELOCKS
966
967
968;;
969; @cproto int FS_FILELOCKSL(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelockl far *pUnLockRange
970; struct filelockl far *pLockRange, ULONG timeout, ULONG flags)
971VBOXSF_EP16_BEGIN FS_FILELOCKSL, 'FS_FILELOCKSL'
972VBOXSF_TO_32 FS_FILELOCKSL, 6*4
973 mov ecx, [ebp + 08h] ; flags
974 mov [esp + 5*4], ecx
975 mov edx, [ebp + 0ch] ; timeout
976 mov [esp + 4*4], edx
977 VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pLockRange
978 VBOXSF_FARPTR_2_FLAT 14h, 2*4 ; pUnLockRange
979 VBOXSF_PSFFSD_2_FLAT 18h, 1*4 ; psffsd
980 VBOXSF_FARPTR_2_FLAT 1ch, 0*4 ; psffsi
981 call NAME(FS32_FILELOCKS)
982VBOXSF_TO_16 FS_FILELOCKSL
983 retf 18h
984VBOXSF_EP16_END FS_FILELOCKSL
985
986
987;;
988; @cproto int FS_FINDCLOSE(PFSFSI pfsfsi, PVBOXSFFS pfsfsd);
989;
990VBOXSF_EP16_BEGIN FS_FINDCLOSE, 'FS_FINDCLOSE'
991VBOXSF_TO_32 FS_FINDCLOSE, 2*4
992 VBOXSF_PFSFSD_2_FLAT 08h, 1*4 ; pfsfsd
993 VBOXSF_FARPTR_2_FLAT 0ch, 0*4 ; pfsfsi
994 call NAME(FS32_FINDCLOSE)
995VBOXSF_TO_16 FS_FINDCLOSE
996 retf 8h
997VBOXSF_EP16_END FS_FINDCLOSE
998
999
1000;;
1001; @cproto int FS_FINDFIRST(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd, USHORT attr,
1002; PFSFSI pfsfsi, PVBOXSFFS pfsfsd, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
1003; USHORT level, USHORT flags);
1004;
1005VBOXSF_EP16_BEGIN FS_FINDFIRST, 'FS_FINDFIRST'
1006VBOXSF_TO_32 FS_FINDFIRST, 12*4
1007 movzx ecx, word [ebp + 08h] ; flags
1008 mov [esp + 11*4], ecx
1009 movzx edx, word [ebp + 0ah] ; level
1010 mov [esp + 10*4], edx
1011 VBOXSF_FARPTR_2_FLAT 0ch, 9*4 ; pcMatch
1012 movzx eax, word [ebp + 10h] ; cbData
1013 mov [esp + 8*4], eax
1014 VBOXSF_FARPTR_2_FLAT 12h, 7*4 ; pbData
1015 VBOXSF_FARPTR_2_FLAT 16h, 6*4 ; pfsfsd
1016 VBOXSF_FARPTR_2_FLAT 1ah, 5*4 ; pfsfsi
1017 movzx ecx, word [ebp + 1eh] ; attr
1018 mov [esp + 4*4], ecx
1019 movsx edx, word [ebp + 20h] ; iCurDirEnd
1020 mov [esp + 3*4], edx
1021 VBOXSF_FARPTR_2_FLAT 22h, 2*4 ; pszName
1022 VBOXSF_PCDFSD_2_FLAT 26h, 1*4 ; pcdfsd
1023 VBOXSF_FARPTR_2_FLAT 2ah, 0*4 ; pcdfsi
1024 call NAME(FS32_FINDFIRST)
1025VBOXSF_TO_16 FS_FINDFIRST
1026 retf 26h
1027VBOXSF_EP16_END FS_FINDFIRST
1028
1029
1030;;
1031; @cproto int FS_FINDFROMNAME(PFSFSI pfsfsi, PVBOXSFFS pfsfsd, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
1032; USHORT level, ULONG position, PCSZ pszName, USHORT flag)
1033;
1034VBOXSF_EP16_BEGIN FS_FINDFROMNAME, 'FS_FINDFROMNAME'
1035VBOXSF_TO_32 FS_FINDFROMNAME, 9*4
1036 movzx ecx, word [ebp + 08h] ; flags
1037 mov [esp + 8*4], ecx
1038 VBOXSF_FARPTR_2_FLAT 0ah, 7*4 ; pszName
1039 mov edx, [ebp + 0eh] ; position
1040 mov [esp + 6*4], edx
1041 movzx eax, word [ebp + 12h] ; level
1042 mov [esp + 5*4], eax
1043 VBOXSF_FARPTR_2_FLAT 14h, 4*4 ; pcMatch
1044 movzx eax, word [ebp + 18h] ; cbData
1045 mov [esp + 3*4], eax
1046 VBOXSF_FARPTR_2_FLAT 1ah, 2*4 ; pbData
1047 VBOXSF_PFSFSD_2_FLAT 1eh, 1*4 ; pfsfsd
1048 VBOXSF_FARPTR_2_FLAT 22h, 0*4 ; pfsfsi
1049 call NAME(FS32_FINDFROMNAME)
1050VBOXSF_TO_16 FS_FINDFROMNAME
1051 retf 1eh
1052VBOXSF_EP16_END FS_FINDFROMNAME
1053
1054
1055;;
1056; @cproto int FS_FINDNEXT(PFSFSI pfsfsi, PVBOXSFFS pfsfsd, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
1057; USHORT level, USHORT flag)
1058;
1059VBOXSF_EP16_BEGIN FS_FINDNEXT, 'FS_FINDNEXT'
1060VBOXSF_TO_32 FS_FINDNEXT, 7*4
1061 movzx ecx, word [ebp + 08h] ; flags
1062 mov [esp + 6*4], ecx
1063 movzx eax, word [ebp + 0ah] ; level
1064 mov [esp + 5*4], eax
1065 VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pcMatch
1066 movzx eax, word [ebp + 10h] ; cbData
1067 mov [esp + 3*4], eax
1068 VBOXSF_FARPTR_2_FLAT 12h, 2*4 ; pbData
1069 VBOXSF_PFSFSD_2_FLAT 16h, 1*4 ; pfsfsd
1070 VBOXSF_FARPTR_2_FLAT 1ah, 0*4 ; pfsfsi
1071 call NAME(FS32_FINDNEXT)
1072VBOXSF_TO_16 FS_FINDNEXT
1073 retf 16h
1074VBOXSF_EP16_END FS_FINDNEXT
1075
1076
1077;;
1078; @cproto int FS_FINDNOTIFYCLOSE(USHORT handle);
1079;
1080VBOXSF_EP16_BEGIN FS_FINDNOTIFYCLOSE, 'FS_FINDNOTIFYCLOSE'
1081VBOXSF_TO_32 FS_FINDNOTIFYCLOSE, 1*4
1082 movzx ecx, word [ebp + 08h] ; handle
1083 mov [esp], ecx
1084 call NAME(FS32_FINDNOTIFYCLOSE)
1085VBOXSF_TO_16 FS_FINDNOTIFYCLOSE
1086 retf 2h
1087VBOXSF_EP16_END FS_FINDNOTIFYCLOSE
1088
1089
1090;;
1091; @cproto int FS_FINDNOTIFYFIRST(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd, USHORT attr,
1092; PUSHORT pHandle, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
1093; USHORT level, USHORT flags);
1094;
1095VBOXSF_EP16_BEGIN FS_FINDNOTIFYFIRST, 'FS_FINDNOTIFYFIRST'
1096VBOXSF_TO_32 FS_FINDNOTIFYFIRST, 11*4
1097 movzx ecx, word [ebp + 08h] ; flags
1098 mov [esp + 10*4], ecx
1099 movzx edx, word [ebp + 0ah] ; level
1100 mov [esp + 9*4], edx
1101 VBOXSF_FARPTR_2_FLAT 0ch, 8*4 ; pcMatch
1102 movzx eax, word [ebp + 10h] ; cbData
1103 mov [esp + 7*4], eax
1104 VBOXSF_FARPTR_2_FLAT 12h, 6*4 ; pbData
1105 VBOXSF_FARPTR_2_FLAT 16h, 5*4 ; pHandle
1106 movzx ecx, word [ebp + 1ah] ; attr
1107 mov [esp + 4*4], ecx
1108 movsx edx, word [ebp + 1ch] ; iCurDirEnd
1109 mov [esp + 3*4], edx
1110 VBOXSF_FARPTR_2_FLAT 1eh, 2*4 ; pszName
1111 VBOXSF_PCDFSD_2_FLAT 22h, 1*4 ; pcdfsd
1112 VBOXSF_FARPTR_2_FLAT 26h, 0*4 ; pcdfsi
1113 call NAME(FS32_FINDNOTIFYFIRST)
1114VBOXSF_TO_16 FS_FINDNOTIFYFIRST
1115 retf 22h
1116VBOXSF_EP16_END FS_FINDNOTIFYFIRST
1117
1118
1119;;
1120; @cproto int FS_FINDNOTIFYNEXT(USHORT handle, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
1121; USHORT level, ULONG timeout)
1122;
1123VBOXSF_EP16_BEGIN FS_FINDNOTIFYNEXT, 'FS_FINDNOTIFYNEXT'
1124VBOXSF_TO_32 FS_FINDNOTIFYNEXT, 6*4
1125 mov ecx, [ebp + 08h] ; timeout
1126 mov [esp + 5*4], ecx
1127 movzx edx, word [ebp + 0ch] ; level
1128 mov [esp + 4*4], edx
1129 VBOXSF_FARPTR_2_FLAT 0eh, 3*4 ; pcMatch
1130 movzx eax, word [ebp + 12h] ; cbData
1131 mov [esp + 2*4], eax
1132 VBOXSF_FARPTR_2_FLAT 14h, 1*4 ; pbData
1133 movzx ecx, word [ebp + 18h] ; handle
1134 mov [esp], ecx
1135 call NAME(FS32_FINDNOTIFYNEXT)
1136VBOXSF_TO_16 FS_FINDNOTIFYNEXT
1137 retf 12h
1138VBOXSF_EP16_END FS_FINDNOTIFYNEXT
1139
1140
1141;; @cproto int FS_FLUSHBUF(USHORT hVPB, USHORT flag);
1142VBOXSF_EP16_BEGIN FS_FLUSHBUF, 'FS_FLUSHBUF'
1143VBOXSF_TO_32 FS_FLUSHBUF, 2*4
1144 movzx edx, word [ebp + 08h] ; flag
1145 mov [esp + 1*4], edx
1146 movzx eax, word [ebp + 0ch] ; hVPB
1147 mov [esp + 0*4], eax
1148 call NAME(FS32_FLUSHBUF)
1149VBOXSF_TO_16 FS_FLUSHBUF
1150 retf 4h
1151VBOXSF_EP16_END FS_FLUSHBUF
1152
1153
1154;; @cproto int FS_FSCTL(union argdat far *pArgdat, USHORT iArgType, USHORT func,
1155; PVOID pParm, USHORT lenParm, PUSHORT plenParmIO,
1156; PVOID pData, USHORT lenData, PUSHORT plenDataIO);
1157VBOXSF_EP16_BEGIN FS_FSCTL, 'FS_FSCTL'
1158 ;
1159 ; Initialized ring-0 yet? (this is a likely first entry point)
1160 ;
1161 push ds
1162 mov ax, DATA16
1163 mov ds, ax
1164 test byte [NAME(g_fDoneRing0)], 1
1165 jnz .DoneRing0
1166 call NAME(VBoxSFR0Init16Bit)
1167.DoneRing0:
1168 pop ds
1169
1170VBOXSF_TO_32 FS_FSCTL, 9*4
1171 VBOXSF_FARPTR_2_FLAT 08h, 8*4 ; plenDataIO
1172 movzx ecx, word [ebp + 0ch] ; lenData
1173 mov [esp + 7*4], ecx
1174 VBOXSF_FARPTR_2_FLAT 0eh, 6*4 ; pData
1175 VBOXSF_FARPTR_2_FLAT 12h, 5*4 ; plenDataIO
1176 movzx ecx, word [ebp + 16h] ; lenData
1177 mov [esp + 4*4], ecx
1178 VBOXSF_FARPTR_2_FLAT 18h, 3*4 ; pData
1179 movzx edx, word [ebp + 1ch] ; func
1180 mov [esp + 2*4], edx
1181 movzx eax, word [ebp + 1eh] ; iArgType
1182 mov [esp + 1*4], eax
1183 VBOXSF_FARPTR_2_FLAT 20h, 0*4 ; pArgdat
1184 call NAME(FS32_FSCTL)
1185VBOXSF_TO_16 FS_FSCTL
1186 retf 1ch
1187VBOXSF_EP16_END FS_FSCTL
1188
1189
1190;; @cproto int FS_FSINFO(USHORT flag, USHORT hVPB, PBYTE pbData, USHORT cbData, USHORT level)
1191VBOXSF_EP16_BEGIN FS_FSINFO, 'FS_FSINFO'
1192VBOXSF_TO_32 FS_FSINFO, 5*4
1193 movzx ecx, word [ebp + 08h] ; level
1194 mov [esp + 10h], ecx
1195 movzx edx, word [ebp + 0ah] ; cbData
1196 mov [esp + 0ch], edx
1197 VBOXSF_FARPTR_2_FLAT 0ch, 2*4 ; pbData
1198 movzx edx, word [ebp + 10h] ; hVPB
1199 mov [esp + 4], edx
1200 movzx eax, word [ebp + 12h] ; flag
1201 mov [esp], eax
1202 call NAME(FS32_FSINFO)
1203VBOXSF_TO_16 FS_FSINFO
1204 retf 14h
1205VBOXSF_EP16_END FS_FSINFO
1206
1207
1208;;
1209; @cproto int FS_IOCTL(PSFFSI psffsi, PVBOXSFFSD psffsd, USHORT cat, USHORT func,
1210; PVOID pParm, USHORT lenParm, PUSHORT plenParmIO,
1211; PVOID pData, USHORT lenData, PUSHORT plenDataIO);
1212VBOXSF_EP16_BEGIN FS_IOCTL, 'FS_IOCTL'
1213VBOXSF_TO_32 FS_IOCTL, 10*4
1214 VBOXSF_FARPTR_2_FLAT 08h, 9*4 ; plenDataIO
1215 movzx ecx, word [ebp + 0ch] ; lenData
1216 mov [esp + 8*4], ecx
1217 VBOXSF_FARPTR_2_FLAT 0eh, 7*4 ; pData
1218 VBOXSF_FARPTR_2_FLAT 12h, 6*4 ; plenDataIO
1219 movzx ecx, word [ebp + 16h] ; lenData
1220 mov [esp + 5*4], ecx
1221 VBOXSF_FARPTR_2_FLAT 18h, 4*4 ; pData
1222 movzx edx, word [ebp + 1ch] ; cat
1223 mov [esp + 3*4], edx
1224 movzx eax, word [ebp + 1eh] ; func
1225 mov [esp + 2*4], eax
1226 VBOXSF_PSFFSD_2_FLAT 20h, 1*4 ; psffsd
1227 VBOXSF_FARPTR_2_FLAT 24h, 0*4 ; pData
1228 call NAME(FS32_IOCTL)
1229VBOXSF_TO_16 FS_IOCTL
1230 retf 20h
1231VBOXSF_EP16_END FS_IOCTL
1232
1233
1234;;
1235; @cproto int FS_MKDIR(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd,
1236; PBYTE pEABuf, USHORT flag);
1237VBOXSF_EP16_BEGIN FS_MKDIR, 'FS_MKDIR'
1238VBOXSF_TO_32 FS_MKDIR, 6*4
1239 movzx ecx, word [ebp + 08h] ; flag
1240 mov [esp + 5*4], ecx
1241 VBOXSF_FARPTR_2_FLAT 0ah, 4*4 ; pEABuf
1242 movsx edx, word [ebp + 0eh] ; iCurDirEnd
1243 mov [esp + 3*4], edx
1244 VBOXSF_FARPTR_2_FLAT 10h, 2*4 ; pszName
1245 VBOXSF_PCDFSD_2_FLAT 14h, 1*4 ; pcdfsd
1246 VBOXSF_FARPTR_2_FLAT 18h, 0*4 ; pcdfsi
1247 call NAME(FS32_MKDIR)
1248VBOXSF_TO_16 FS_MKDIR
1249 retf 14h
1250VBOXSF_EP16_END FS_MKDIR
1251
1252
1253;;
1254; @cproto int FS_MOUNT(USHORT flag, PVPFSI pvpfsi, PVBOXSFVP pvpfsd, USHORT hVPB, PCSZ pszBoot)
1255VBOXSF_EP16_BEGIN FS_MOUNT, 'FS_MOUNT'
1256 ;
1257 ; Initialized ring-0 yet? (this is a likely first entry point)
1258 ;
1259 push ds
1260 mov ax, DATA16
1261 mov ds, ax
1262 test byte [NAME(g_fDoneRing0)], 1
1263 jnz .DoneRing0
1264 call NAME(VBoxSFR0Init16Bit)
1265.DoneRing0:
1266 pop ds
1267
1268VBOXSF_TO_32 FS_MOUNT, 5*4
1269 VBOXSF_FARPTR_2_FLAT 08h, 4*4 ; pszBoot
1270 movzx ecx, word [ebp + 0ch] ; hVPB
1271 mov [esp + 3*4], ecx
1272 VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pvpfsd
1273 VBOXSF_FARPTR_2_FLAT 12h, 1*4 ; pvpfsi
1274 movzx ecx, word [ebp + 16h] ; flag
1275 mov [esp], ecx
1276 call NAME(FS32_MOUNT)
1277VBOXSF_TO_16 FS_MOUNT
1278 retf 10h
1279VBOXSF_EP16_END FS_MOUNT
1280
1281
1282;;
1283; @cproto int FS_MOVE(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszSrc, USHORT iSrcCurDirEnd
1284; PCSZ pszDst, USHORT iDstCurDirEnd, USHORT type)
1285VBOXSF_EP16_BEGIN FS_MOVE, 'FS_MOVE'
1286VBOXSF_TO_32 FS_MOVE, 7*4
1287 movzx ecx, word [ebp + 08h] ; type
1288 mov [esp + 6*4], ecx
1289 movzx edx, word [ebp + 0ah] ; iDstCurDirEnd
1290 mov [esp + 5*4], edx
1291 VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pszDst
1292 movzx eax, word [ebp + 10h] ; iSrcCurDirEnd
1293 mov [esp + 3*4], eax
1294 VBOXSF_FARPTR_2_FLAT 12h, 2*4 ; pszSrc
1295 VBOXSF_PCDFSD_2_FLAT 16h, 1*4 ; psffsd
1296 VBOXSF_FARPTR_2_FLAT 1ah, 0*4 ; psffsi
1297 call NAME(FS32_MOVE)
1298VBOXSF_TO_16 FS_MOVE
1299 retf 16h
1300VBOXSF_EP16_END FS_MOVE
1301
1302
1303;;
1304; @cproto int FS_NEWSIZE(PSFFSI psffsi, PVBOXSFFSD psffsd, ULONG cbFile, USHORT IOflag);
1305VBOXSF_EP16_BEGIN FS_NEWSIZE, 'FS_NEWSIZE'
1306VBOXSF_TO_32 FS_NEWSIZE, 5*4 ; thunking to longlong edition.
1307 movzx ecx, word [ebp + 08h] ; IOflag
1308 mov [esp + 4*4], ecx
1309 mov eax, [ebp + 0ah] ; cbFile (ULONG -> LONGLONG)
1310 mov dword [esp + 3*4], 0
1311 mov [esp + 2*4], eax
1312 VBOXSF_PSFFSD_2_FLAT 0eh, 1*4 ; psffsd
1313 VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; psffsi
1314 call NAME(FS32_NEWSIZEL)
1315VBOXSF_TO_16 FS_NEWSIZE
1316 retf 0eh
1317VBOXSF_EP16_END FS_NEWSIZE
1318
1319
1320;;
1321; @cproto int FS_NEWSIZEL(PSFFSI psffsi, PVBOXSFFSD psffsd, LONGLONG cbFile, USHORT IOflag);
1322VBOXSF_EP16_BEGIN FS_NEWSIZEL, 'FS_NEWSIZEL'
1323VBOXSF_TO_32 FS_NEWSIZEL, 5*4
1324 movzx ecx, word [ebp + 08h] ; IOflag
1325 mov [esp + 4*4], ecx
1326 mov eax, [ebp + 0ah] ; cbFile
1327 mov edx, [ebp + 0eh]
1328 mov [esp + 3*4], edx
1329 mov [esp + 2*4], eax
1330 VBOXSF_PSFFSD_2_FLAT 12h, 1*4 ; psffsd
1331 VBOXSF_FARPTR_2_FLAT 16h, 0*4 ; psffsi
1332 call NAME(FS32_NEWSIZEL)
1333VBOXSF_TO_16 FS_NEWSIZEL
1334 retf 12h
1335VBOXSF_EP16_END FS_NEWSIZEL
1336
1337
1338;;
1339; @cproto int FS_NMPIPE(PSFFSI psffsi, PVBOXSFFSD psffsd, USHORT OpType, union npoper far *pOpRec,
1340; PBYTE pData, PCSZ pszName);
1341VBOXSF_EP16_BEGIN FS_NMPIPE, 'FS_NMPIPE'
1342VBOXSF_TO_32 FS_NMPIPE, 6*4
1343 VBOXSF_FARPTR_2_FLAT 08h, 5*4 ; pszName
1344 VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pData
1345 VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pOpRec
1346 movzx ecx, word [ebp + 14h] ; OpType
1347 mov [esp + 2*4], ecx
1348 VBOXSF_FARPTR_2_FLAT 16h, 1*4 ; psffsd (take care...)
1349 VBOXSF_FARPTR_2_FLAT 1ah, 0*4 ; psffsi
1350 call NAME(FS32_NMPIPE)
1351VBOXSF_TO_16 FS_NMPIPE
1352 retf 16h
1353VBOXSF_EP16_END FS_NMPIPE
1354
1355
1356;;
1357; @cproto int FS_OPENCREATE(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd,
1358; PSFFSI psffsi, PVBOXSFFSD psffsd, ULONG ulOpenMode, USHORT usOpenFlag,
1359; PUSHORT pusAction, USHORT usAttr, PBYTE pcEABuf, PUSHORT pfgenflag);
1360VBOXSF_EP16_BEGIN FS_OPENCREATE, 'FS_OPENCREATE'
1361VBOXSF_TO_32 FS_OPENCREATE, 12*4
1362 VBOXSF_FARPTR_2_FLAT 08h, 11*4 ; pfgenflag
1363 VBOXSF_FARPTR_2_FLAT 0ch, 10*4 ; pcEABuf
1364 movzx ecx, word [ebp + 10h] ; usAttr
1365 mov [esp + 9*4], ecx
1366 VBOXSF_FARPTR_2_FLAT 12h, 8*4 ; pusAction
1367 movzx edx, word [ebp + 16h] ; usOpenFlag
1368 mov [esp + 7*4], edx
1369 mov eax, [ebp + 18h] ; ulOpenMode
1370 mov [esp + 6*4], eax
1371 VBOXSF_FARPTR_2_FLAT 1ch, 5*4 ; psffsd (new, no short cuts)
1372 VBOXSF_FARPTR_2_FLAT 20h, 4*4 ; psffsi
1373 movsx ecx, word [ebp + 24h] ; iCurDirEnd
1374 mov [esp + 3*4], ecx
1375 VBOXSF_FARPTR_2_FLAT 26h, 2*4 ; pszName
1376 VBOXSF_PCDFSD_2_FLAT 2ah, 1*4 ; pcdfsd
1377 VBOXSF_FARPTR_2_FLAT 2eh, 0*4 ; pcdfsi
1378 call NAME(FS32_OPENCREATE)
1379VBOXSF_TO_16 FS_OPENCREATE
1380 retf 42
1381VBOXSF_EP16_END FS_OPENCREATE
1382
1383
1384;;
1385; @cproto int FS_OPENPAGEFILE(PULONG pFlag, PULONG pcMaxReq, PCSZ pszName, PSFFSI psffsi, PVBOXSFFSD psffsd,
1386; USHORT ulOpenMode, USHORT usOpenFlag, USHORT usAttr, ULONG Reserved)
1387VBOXSF_EP16_BEGIN FS_OPENPAGEFILE, 'FS_OPENPAGEFILE'
1388VBOXSF_TO_32 FS_OPENPAGEFILE, 9*4
1389 mov ecx, [ebp + 08h] ; Reserved
1390 mov [esp + 8*4], ecx
1391 movzx edx, word [ebp + 0ch] ; usAttr
1392 mov [esp + 7*4], edx
1393 movzx eax, word [ebp + 0eh] ; usOpenFlag
1394 mov [esp + 6*4], eax
1395 movzx ecx, word [ebp + 10h] ; usOpenMode
1396 mov [esp + 5*4], ecx
1397 VBOXSF_FARPTR_2_FLAT 12h, 4*4 ; psffsd (new, no short cuts)
1398 VBOXSF_FARPTR_2_FLAT 16h, 3*4 ; psffsi
1399 VBOXSF_FARPTR_2_FLAT 1ah, 2*4 ; pszName
1400 VBOXSF_FARPTR_2_FLAT 1eh, 1*4 ; pcMaxReq
1401 VBOXSF_FARPTR_2_FLAT 22h, 0*4 ; pFlag
1402 call NAME(FS32_OPENPAGEFILE)
1403VBOXSF_TO_16 FS_OPENPAGEFILE
1404 retf 1eh
1405VBOXSF_EP16_END FS_OPENPAGEFILE
1406
1407
1408;;
1409; @cproto int FS_PATHINFO(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnt,
1410; USHORT level, PBYTE pData, USHORT cbData);
1411VBOXSF_EP16_BEGIN FS_PATHINFO, 'FS_PATHINFO'
1412VBOXSF_TO_32 FS_PATHINFO, 8*4
1413 movzx ecx, word [ebp + 08h] ; cbData
1414 mov [esp + 7*4], ecx
1415 VBOXSF_FARPTR_2_FLAT 0ah, 6*4 ; pData
1416 movzx edx, word [ebp + 0eh] ; level
1417 mov [esp + 5*4], edx
1418 movsx eax, word [ebp + 10h] ; iCurDirEnd
1419 mov [esp + 4*4], eax
1420 VBOXSF_FARPTR_2_FLAT 12h, 3*4 ; pszName
1421 VBOXSF_PCDFSD_2_FLAT 16h, 2*4 ; pcdfsd
1422 VBOXSF_FARPTR_2_FLAT 1ah, 1*4 ; pcdfsi
1423 movzx edx, word [ebp + 1eh] ; flag
1424 mov [esp], edx
1425 call NAME(FS32_PATHINFO)
1426VBOXSF_TO_16 FS_PATHINFO
1427 retf 18h
1428VBOXSF_EP16_END FS_PATHINFO
1429
1430
1431;; @cproto int FS_PROCESSNAME(PSZ pszName);
1432VBOXSF_EP16_BEGIN FS_PROCESSNAME, 'FS_PROCESSNAME'
1433VBOXSF_TO_32 FS_PROCESSNAME, 1*4
1434 VBOXSF_FARPTR_2_FLAT 08h, 0*4 ; pszName
1435 call NAME(FS32_PROCESSNAME)
1436VBOXSF_TO_16 FS_PROCESSNAME
1437 retf 4h
1438VBOXSF_EP16_END FS_PROCESSNAME
1439
1440
1441;;
1442; @cproto int FS_READ(PSFFSI psffsi, PVBOXSFFSD psffsd, PBYTE pbData, PUSHORT pcbData, USHORT IOflag)
1443VBOXSF_EP16_BEGIN FS_READ, 'FS_READ'
1444VBOXSF_TO_32 FS_READ, 6*4 ; extra local for ULONG cbDataTmp.
1445 movzx ecx, word [ebp + 08h] ; IOflag
1446 mov [esp + 4*4], ecx
1447 les dx, [ebp + 0ah] ; cbDataTmp = *pcbData;
1448 movzx edx, dx
1449 lea ecx, [esp + 5*4] ; pcbData = &cbDataTmp
1450 movzx eax, word [es:edx]
1451 mov [ecx], eax
1452 mov [esp + 3*4], ecx
1453 mov edx, DATA32
1454 mov es, edx
1455 VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pbData
1456 VBOXSF_PSFFSD_2_FLAT 12h, 1*4 ; psffsd
1457 VBOXSF_FARPTR_2_FLAT 16h, 0*4 ; psffsi
1458 call FS32_READ
1459
1460 les dx, [ebp + 0ah] ; *pcbData = cbDataTmp;
1461 movzx edx, dx
1462 mov cx, [esp + 5*4]
1463 mov [es:edx], cx
1464 mov edx, DATA32
1465 mov es, edx
1466
1467VBOXSF_TO_16 FS_READ
1468 retf 12h
1469VBOXSF_EP16_END FS_READ
1470
1471
1472;;
1473; @cproto int FS_RMDIR(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd);
1474;
1475VBOXSF_EP16_BEGIN FS_RMDIR, 'FS_RMDIR'
1476VBOXSF_TO_32 FS_RMDIR, 4*4
1477 movsx edx, word [ebp + 08h] ; iCurDirEnd
1478 mov [esp + 3*4], edx
1479 VBOXSF_FARPTR_2_FLAT 0ah, 2*4 ; pszName
1480 VBOXSF_PCDFSD_2_FLAT 0eh, 1*4 ; pcdfsd
1481 VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; pcdfsi
1482 call NAME(FS32_RMDIR)
1483VBOXSF_TO_16 FS_RMDIR
1484 retf 0eh
1485VBOXSF_EP16_END FS_RMDIR
1486
1487
1488;;
1489; @cproto int FS_SETSWAP(PSFFSI psffsi, PVBOXSFFSD psffsd);
1490;
1491VBOXSF_EP16_BEGIN FS_SETSWAP, 'FS_SETSWAP'
1492VBOXSF_TO_32 FS_SETSWAP, 2*4
1493 VBOXSF_PSFFSD_2_FLAT 08h, 1*4 ; psffsd
1494 VBOXSF_FARPTR_2_FLAT 0ch, 0*4 ; psffsi
1495 call NAME(FS32_SETSWAP)
1496VBOXSF_TO_16 FS_SETSWAP
1497 retf 8h
1498VBOXSF_EP16_END FS_SETSWAP
1499
1500
1501;;
1502; @cproto int FS_SHUTDOWN(USHORT type, ULONG reserved);
1503;
1504VBOXSF_EP16_BEGIN FS_SHUTDOWN, 'FS_SHUTDOWN'
1505VBOXSF_TO_32 FS_SHUTDOWN, 3*4
1506 mov ecx, [ebp + 0ch] ; type
1507 mov [esp + 1*4], edx
1508 movzx edx, word [ebp + 08h] ; reserved
1509 mov [esp], eax
1510 call NAME(FS32_SHUTDOWN)
1511VBOXSF_TO_16 FS_SHUTDOWN
1512 retf 6h
1513VBOXSF_EP16_END FS_SHUTDOWN
1514
1515
1516;;
1517; @cproto int FS_VERIFYUNCNAME(USHORT type, PCSZ pszName);
1518;
1519VBOXSF_EP16_BEGIN FS_VERIFYUNCNAME, 'FS_VERIFYUNCNAME'
1520VBOXSF_TO_32 FS_VERIFYUNCNAME, 3*4
1521 VBOXSF_FARPTR_2_FLAT 08h, 1*4 ; pszDev
1522 movzx ecx, word [ebp + 0ch] ; fFlag
1523 mov [esp], ecx
1524 call NAME(FS32_VERIFYUNCNAME)
1525VBOXSF_TO_16 FS_VERIFYUNCNAME
1526 retf 6h
1527VBOXSF_EP16_END FS_VERIFYUNCNAME
1528
1529
1530;;
1531; @cproto int FS_WRITE(PSFFSI psffsi, PVBOXSFFSD psffsd, PBYTE pbData, PUSHORT pcbData, USHORT IOflag)
1532VBOXSF_EP16_BEGIN FS_WRITE, 'FS_WRITE'
1533VBOXSF_TO_32 FS_WRITE, 6*4 ; extra local for ULONG cbDataTmp.
1534 movzx ecx, word [ebp + 08h] ; IOflag
1535 mov [esp + 4*4], ecx
1536 les dx, [ebp + 0ah] ; cbDataTmp = *pcbData;
1537 movzx edx, dx
1538 lea ecx, [esp + 5*4] ; pcbData = &cbDataTmp
1539 movzx eax, word [es:edx]
1540 mov [ecx], eax
1541 mov [esp + 3*4], ecx
1542 mov edx, DATA32
1543 mov es, edx
1544 VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pbData
1545 VBOXSF_PSFFSD_2_FLAT 12h, 1*4 ; psffsd
1546 VBOXSF_FARPTR_2_FLAT 16h, 0*4 ; psffsi
1547 call FS32_WRITE
1548
1549 les dx, [ebp + 0ah] ; *pcbData = cbDataTmp;
1550 movzx edx, dx
1551 mov cx, [esp + 5*4]
1552 mov [es:edx], cx
1553 mov edx, DATA32
1554 mov es, edx
1555
1556VBOXSF_TO_16 FS_WRITE
1557 retf 12h
1558VBOXSF_EP16_END FS_WRITE
1559
1560
1561;
1562;
1563; Calling 16-bit kernel code.
1564;
1565;
1566
1567BEGINCODE
1568
1569;;
1570; Wrapper around FSH_GETVOLPARM.
1571;
1572; @returns VPBFSD.
1573; @param hVbp The volume handle to resolve.
1574; @param ppVbpFsi
1575;
1576BEGINPROC Fsh32GetVolParams
1577VBOXSF_FROM_32 Fsh32GetVolParams, 2*4
1578 mov di, sp ; make the top of the stack addressable via di
1579
1580 mov [ss:di], eax ; clear the return variables
1581 mov [ss:di + 4], eax
1582
1583 mov ax, [bp + 8] ; hVbp
1584 push ax
1585
1586 lea ax, [ss:di] ; &hvfsi
1587 push ss
1588 push ax
1589
1590 lea ax, [ss:di + 4] ; &hvfsd
1591 push ss
1592 push ax
1593
1594 call far FSH_GETVOLPARM
1595
1596 mov sp, di ; paranoia (pascal pops params)
1597
1598VBOXSF_FROM_16_SWITCH Fsh32GetVolParams
1599
1600 ; Convert vpfsi to flat and store it in return location.
1601 mov ebx, [ebp + 0ch]
1602 test ebx, ebx
1603 jz .no_vpfsi
1604 call KernSelToFlat
1605 mov [ebx], eax
1606.no_vpfsi:
1607 add esp, 4
1608
1609 ; Convert vpfsd to flat and return it.
1610 call KernSelToFlat
1611
1612VBOXSF_FROM_16_EPILOGUE
1613 ret
1614ENDPROC Fsh32GetVolParams
1615
1616
1617
1618;
1619;
1620; Calling 32-bit kernel code.
1621;
1622;
1623
1624BEGINCODE
1625
1626;;
1627; Wraps APIRET APIENTRY KernStrToUcs(PUconvObj, UniChar *, char *, LONG, LONG),
1628; to preserve ES. ES get trashed in some cases (probably conversion table init).
1629;
1630BEGINPROC SafeKernStrToUcs
1631DWARF_LABEL_TEXT32 NAME(SafeKernStrToUcs)
1632 push ebp
1633 mov ebp, esp
1634 push es
1635 push ds
1636
1637 push dword [ebp + 18h]
1638 push dword [ebp + 14h]
1639 push dword [ebp + 10h]
1640 push dword [ebp + 0ch]
1641 push dword [ebp + 08h]
1642 call KernStrToUcs
1643
1644 lea esp, [ebp - 8]
1645 pop ds
1646 pop es
1647 cld ; just to be on the safe side
1648 leave
1649 ret
1650ENDPROC SafeKernStrToUcs
1651
1652
1653;;
1654; Wraps APIRET APIENTRY KernStrFromUcs(PUconvObj, char *, UniChar *, LONG, LONG),
1655; to preserve ES. ES get trashed in some cases (probably conversion table init).
1656;
1657BEGINPROC SafeKernStrFromUcs
1658DWARF_LABEL_TEXT32 NAME(SafeKernStrFromUcs)
1659 push ebp
1660 mov ebp, esp
1661 push es
1662 push ds
1663
1664 push dword [ebp + 18h]
1665 push dword [ebp + 14h]
1666 push dword [ebp + 10h]
1667 push dword [ebp + 0ch]
1668 push dword [ebp + 08h]
1669 call KernStrFromUcs
1670
1671 lea esp, [ebp - 8]
1672 pop ds
1673 pop es
1674 cld ; just to be on the safe side
1675 leave
1676 ret
1677ENDPROC SafeKernStrFromUcs
1678
1679
1680
1681;
1682;
1683; Init code starts here
1684; Init code starts here
1685; Init code starts here
1686;
1687;
1688
1689
1690;;
1691; Ring-3 Init (16-bit).
1692;
1693; @param pMiniFS [bp + 08h] The mini-FSD. (NULL)
1694; @param fpfnDevHlp [bp + 0ch] The address of the DevHlp router.
1695; @param pszCmdLine [bp + 10h] The config.sys command line.
1696;
1697VBOXSF_EP16_BEGIN FS_INIT, 'FS_INIT'
1698; DEBUG_STR16 'VBoxSF: FS_INIT - enter'
1699 push ebp
1700 mov ebp, esp
1701 push ds ; bp - 02h
1702 push es ; bp - 04h
1703 push esi ; bp - 08h
1704 push edi ; bp - 0ch
1705
1706 mov ax, DATA16
1707 mov ds, ax
1708 mov es, ax
1709
1710 ;
1711 ; Save the device help entry point.
1712 ;
1713 mov eax, [bp + 0ch]
1714 mov [NAME(g_fpfnDevHlp)], eax
1715
1716 ;
1717 ; Parse the command line.
1718 ; Doing this in assembly is kind of ugly...
1719 ;
1720 cmp word [bp + 10h + 2], 3
1721 jbe near .no_command_line
1722 lds si, [bp + 10h] ; ds:si -> command line iterator.
1723.parse_next:
1724
1725 ; skip leading blanks.
1726.parse_next_char:
1727 mov di, si ; DI = start of argument.
1728 lodsb
1729 cmp al, ' '
1730 je .parse_next_char
1731 cmp al, 9 ; tab
1732 je .parse_next_char
1733 cmp al, 0
1734 je near .parse_done
1735
1736 ; check for '/' or '-'
1737 cmp al, '/'
1738 je .parse_switch
1739 cmp al, '-'
1740 je .parse_switch
1741 jmp .parse_error
1742
1743 ; parse switches.
1744.parse_switch:
1745 lodsb
1746 cmp al, 0
1747 je .parse_error
1748 and al, ~20h ; uppercase
1749
1750 cmp al, 'V' ; /V - verbose
1751 je .parse_verbose
1752 cmp al, 'Q' ; /Q - quiet.
1753 je .parse_quiet
1754 jmp .parse_error
1755
1756.parse_verbose:
1757 mov byte [es:NAME(g_fVerbose)], 1
1758 jmp .parse_next
1759
1760.parse_quiet:
1761 mov byte [es:NAME(g_fVerbose)], 0
1762 jmp .parse_next
1763
1764.parse_error:
1765segment DATA16
1766.szSyntaxError:
1767 db 0dh, 0ah, 'VBoxSF.ifs: command line parse error at: ', 0
1768.szNewLine:
1769 db 0dh, 0ah, 0dh, 0ah, 0
1770segment CODE16
1771 mov bx, .szSyntaxError
1772 call NAME(FS_INIT_FPUTS)
1773
1774 push es
1775 push ds
1776 pop es
1777 mov bx, di
1778 call NAME(FS_INIT_FPUTS)
1779 pop es
1780
1781 mov bx, .szNewLine
1782 call NAME(FS_INIT_FPUTS)
1783
1784 mov ax, ERROR_INVALID_PARAMETER
1785 jmp .done
1786
1787.parse_done:
1788 mov ax, DATA16
1789 mov ds, ax
1790.no_command_line:
1791
1792 ;
1793 ; Write our greeting to STDOUT.
1794 ; APIRET _Pascal DosWrite(HFILE hf, PVOID pvBuf, USHORT cbBuf, PUSHORT pcbBytesWritten);
1795 ;
1796 cmp byte [NAME(g_fVerbose)], 0
1797 je near .quiet
1798segment DATA16
1799.szMessage:
1800 db 'VirtualBox Guest Additions IFS for OS/2 version ', VBOX_VERSION_STRING, ' r', VBOX_SVN_REV_STR, 0dh, 0ah, 0
1801segment CODE16
1802 mov bx, .szMessage
1803 call NAME(FS_INIT_FPUTS)
1804.quiet:
1805
1806 ; return success.
1807 xor eax, eax
1808.done:
1809 lea sp, [bp - 0ch]
1810 pop edi
1811 pop esi
1812 pop es
1813 pop ds
1814 mov esp, ebp
1815 pop ebp
1816 DEBUG_STR16 'VBoxSF: FS_INIT - leave'
1817 retf 0ch
1818VBOXSF_EP16_END FS_INIT
1819
1820
1821;;
1822; Dos16Write wrapper.
1823;
1824; @param es:bx String to print. (zero terminated)
1825; @uses nothing.
1826GLOBALNAME FS_INIT_FPUTS
1827 push bp
1828 mov bp, sp
1829 push es ; bp - 02h
1830 push ds ; bp - 04h
1831 push ax ; bp - 06h
1832 push bx ; bp - 08h
1833 push cx ; bp - 0ah
1834 push dx ; bp - 0ch
1835 push si ; bp - 0eh
1836 push di ; bp - 10h
1837
1838 ; cx = strlen(es:bx)
1839 xor al, al
1840 mov di, bx
1841 mov cx, 0ffffh
1842 cld
1843 repne scasb
1844 not cx
1845 dec cx
1846
1847 ; APIRET _Pascal DosWrite(HFILE hf, PVOID pvBuf, USHORT cbBuf, PUSHORT pcbBytesWritten);
1848 push cx
1849 mov ax, sp ; cbBytesWritten
1850 push 1 ; STDOUT
1851 push es ; pvBuf
1852 push bx
1853 push cx ; cbBuf
1854 push ss ; pcbBytesWritten
1855 push ax
1856%if 0 ; wlink/nasm generates a non-aliased fixup here which results in 16-bit offset with the flat 32-bit selector.
1857 call far DOS16WRITE
1858%else
1859 ; convert flat pointer to a far pointer using the tiled algorithm.
1860 mov ax, DATA32 wrt FLAT
1861 mov ds, ax
1862 mov eax, g_pfnDos16Write wrt FLAT
1863 movzx eax, word [eax + 2] ; High word of the flat address (in DATA32).
1864 shl ax, 3
1865 or ax, 0007h
1866 mov dx, DATA16
1867 mov ds, dx
1868 mov [NAME(g_fpfnDos16Write) + 2], ax ; Update the selector (in DATA16).
1869 ; do the call
1870 call far [NAME(g_fpfnDos16Write)]
1871%endif
1872
1873 lea sp, [bp - 10h]
1874 pop di
1875 pop si
1876 pop dx
1877 pop cx
1878 pop bx
1879 pop ax
1880 pop ds
1881 pop es
1882 pop bp
1883 ret
1884ENDPROC FS_INIT_FPUTS
1885
1886
1887
1888;;
1889; 16-bit ring-0 init routine.
1890;
1891; Called from various entrypoints likely to be the first to be invoked.
1892;
1893GLOBALNAME VBoxSFR0Init16Bit
1894 DEBUG_STR16 'VBoxSF: VBoxSFR0Init16Bit - enter'
1895 push ds
1896 push es
1897 push fs
1898 push gs
1899 push esi
1900 push edi
1901 push ebp
1902 mov ebp, esp
1903 and sp, 0fffch
1904
1905 ;
1906 ; Only try once.
1907 ;
1908 mov ax, DATA16
1909 mov ds, ax
1910 mov byte [NAME(g_fDoneRing0)], 1
1911
1912 ;
1913 ; Try attach to the VBoxGuest driver.
1914 ;
1915 mov bx, NAME(g_szVBoxGuestName)
1916 mov di, NAME(g_VBoxGuestAttachDD)
1917 mov dl, DevHlp_AttachDD
1918 call far [NAME(g_fpfnDevHlp)]
1919 jc .attach_attempt_done
1920
1921 push seg NAME(g_VBoxGuestIDC)
1922 push NAME(g_VBoxGuestIDC)
1923 call far [NAME(g_VBoxGuestAttachDD) + 6]
1924.attach_attempt_done:
1925
1926%ifndef DONT_LOCK_SEGMENTS
1927 ;
1928 ; Lock the two 16-bit segments.
1929 ;
1930 push DATA16
1931 call far FSH_FORCENOSWAP
1932 push CODE16
1933 call far FSH_FORCENOSWAP
1934 ; Wonder if this'll work if wlink could mark the two segments as ALIASed...
1935 ;push DATA32
1936 ;call far FSH_FORCENOSWAP
1937 ;push TEXT32
1938 ;call far FSH_FORCENOSWAP
1939%endif
1940
1941 ;
1942 ; Do 32-bit ring-0 init.
1943 ;
1944 ;jmp far dword NAME(VBoxSFR0Init16Bit_32) wrt FLAT
1945 db 066h
1946 db 0eah
1947 dd NAME(VBoxSFR0Init16Bit_32) ;wrt FLAT
1948 dw TEXT32 wrt FLAT
1949segment TEXT32
1950GLOBALNAME VBoxSFR0Init16Bit_32
1951 mov ax, DATA32 wrt FLAT
1952 mov ds, ax
1953 mov es, ax
1954
1955 call KernThunkStackTo32
1956 call NAME(VBoxSFR0Init)
1957 call KernThunkStackTo16
1958
1959 ;jmp far dword NAME(VBoxSFR0Init16Bit_16) wrt CODE16
1960 db 066h
1961 db 0eah
1962 dw NAME(VBoxSFR0Init16Bit_16) wrt CODE16
1963 dw CODE16
1964segment CODE16
1965GLOBALNAME VBoxSFR0Init16Bit_16
1966
1967 mov esp, ebp
1968 pop ebp
1969 pop edi
1970 pop esi
1971 pop gs
1972 pop fs
1973 pop es
1974 pop ds
1975 DEBUG_STR16 'VBoxSF: VBoxSFR0Init16Bit - leave'
1976 ret
1977ENDPROC VBoxSFR0Init16Bit
1978
1979
1980%ifdef DEBUG
1981;;
1982; print the string which offset is in AX (it's in the data segment).
1983; @uses AX
1984;
1985GLOBALNAME dbgstr16
1986 push ds
1987 push ebx
1988 push edx
1989
1990 mov bx, ax
1991 mov dx, 0504h ; RTLOG_DEBUG_PORT
1992 mov ax, DATA16
1993 mov ds, ax
1994
1995.next:
1996 mov al, [bx]
1997 or al, al
1998 jz .done
1999 inc bx
2000 out dx, al
2001 jmp .next
2002
2003.done:
2004 pop edx
2005 pop ebx
2006 pop ds
2007 ret
2008ENDPROC dbgstr16
2009%endif
2010
2011
2012%ifdef WITH_DWARF
2013;
2014; Close debug info
2015;
2016segment _debug_info
2017 db 0
2018g_dwarf_compile_unit_end:
2019%endif
2020
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette