VirtualBox

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

最後變更 在這個檔案從75337是 75337,由 vboxsync 提交於 6 年 前

Add/os2/VBoxSF: Early shared folders for OS/2. Not perfect yet, but was able to build all the disassembler libraries on a shared folder mount.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id Revision
檔案大小: 61.2 KB
 
1; $Id: VBoxSFA.asm 75337 2018-11-09 01:39:01Z 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
511segment CODE16
512extern FSH_FORCENOSWAP
513extern FSH_GETVOLPARM
514extern DOS16WRITE
515
516segment CODE32
517extern NAME(FS32_ALLOCATEPAGESPACE)
518extern NAME(FS32_ATTACH)
519extern NAME(FS32_CANCELLOCKREQUEST)
520extern NAME(FS32_CANCELLOCKREQUESTL)
521extern NAME(FS32_CHDIR)
522extern FS32_CHGFILEPTRL
523extern NAME(FS32_CLOSE)
524extern NAME(FS32_COMMIT)
525extern NAME(FS32_COPY)
526extern NAME(FS32_DELETE)
527extern NAME(FS32_DOPAGEIO)
528extern NAME(FS32_EXIT)
529extern NAME(FS32_FILEATTRIBUTE)
530extern NAME(FS32_FILEINFO)
531extern NAME(FS32_FILEIO)
532extern NAME(FS32_FILELOCKS)
533extern NAME(FS32_FILELOCKSL)
534extern NAME(FS32_FINDCLOSE)
535extern NAME(FS32_FINDFIRST)
536extern NAME(FS32_FINDFROMNAME)
537extern NAME(FS32_FINDNEXT)
538extern NAME(FS32_FINDNOTIFYCLOSE)
539extern NAME(FS32_FINDNOTIFYFIRST)
540extern NAME(FS32_FINDNOTIFYNEXT)
541extern NAME(FS32_FLUSHBUF)
542extern NAME(FS32_FSCTL)
543extern NAME(FS32_FSINFO)
544extern NAME(FS32_IOCTL)
545extern NAME(FS32_MKDIR)
546extern NAME(FS32_MOUNT)
547extern NAME(FS32_MOVE)
548extern NAME(FS32_NEWSIZEL)
549extern NAME(FS32_NMPIPE)
550extern NAME(FS32_OPENCREATE)
551extern NAME(FS32_OPENPAGEFILE)
552extern NAME(FS32_PATHINFO)
553extern NAME(FS32_PROCESSNAME)
554extern FS32_READ
555extern NAME(FS32_RMDIR)
556extern NAME(FS32_SETSWAP)
557extern NAME(FS32_SHUTDOWN)
558extern NAME(FS32_VERIFYUNCNAME)
559extern FS32_WRITE
560
561extern NAME(VBoxSFR0Init)
562
563
564
565;*******************************************************************************
566;* Global Variables *
567;*******************************************************************************
568segment DATA16
569
570;;
571; The file system name.
572global FS_NAME
573FS_NAME:
574 db 'VBOXSF',0
575
576;;
577; File system attributes
578; The 32-bit version is only used to indicate that this is a 32-bit file system.
579;
580%define FSA_REMOTE 0001h ; remote file system.
581%define FSA_UNC 0002h ; implements UNC.
582%define FSA_LOCK 0004h ; needs lock notification.
583%define FSA_LVL7 0008h ; accept level 7 (case preserving path request).
584%define FSA_PSVR 0010h ; (named) pipe server.
585%define FSA_LARGEFILE 0020h ; large file support.
586align 16
587global FS_ATTRIBUTE
588global FS32_ATTRIBUTE
589FS_ATTRIBUTE:
590FS32_ATTRIBUTE:
591 dd FSA_REMOTE + FSA_LARGEFILE + FSA_UNC + FSA_LVL7 ;+ FSA_LOCK
592
593;; 64-bit mask.
594; bit 0 - don't get the ring-0 spinlock.
595; bit 6 - don't get the subsystem ring-0 spinlock.
596global FS_MPSAFEFLAGS2
597FS_MPSAFEFLAGS2:
598 dd 1 | (1<<6)
599 dd 0
600
601;;
602; Set after VBoxSFR0Init16Bit has been called.
603GLOBALNAME g_fDoneRing0
604 db 0
605
606align 4
607;;
608; The device helper (IPRT expects this name).
609; (This is set by FS_INIT.)
610GLOBALNAME g_fpfnDevHlp
611 dd 0
612
613;;
614; Whether initialization should be verbose or quiet.
615GLOBALNAME g_fVerbose
616 db 1
617
618;; DEBUGGING DEBUGGING
619GLOBALNAME g_u32Info
620 dd 0
621
622;; Far pointer to DOS16WRITE (corrected set before called).
623; Just a 'temporary' hack to work around a wlink/nasm issue.
624GLOBALNAME g_fpfnDos16Write
625 dw DOS16WRITE
626 dw seg DOS16WRITE
627
628;;
629; The attach dd data.
630GLOBALNAME g_VBoxGuestAttachDD
631 dd 0
632 dw 0
633 dd 0
634 dw 0
635;;
636; The AttachDD name of the VBoxGuest.sys driver.
637GLOBALNAME g_szVBoxGuestName
638 db VBOXGUEST_DEVICE_NAME_SHORT, 0
639;;
640; The VBoxGuest IDC connection data.
641GLOBALNAME g_VBoxGuestIDC
642 times VBGLOS2ATTACHDD_size db 0
643
644;;
645; This must be present, we've got fixups against it.
646segment DATA32
647g_pfnDos16Write:
648 dd DOS16WRITE ; flat
649
650
651
652
653
654
655
656;
657;
658; 16-bit entry point thunking.
659; 16-bit entry point thunking.
660; 16-bit entry point thunking.
661;
662;
663segment CODE16
664
665
666;;
667; @cproto int FS_ALLOCATEPAGESPACE(PSFFSI psffsi, PVBOXSFFSD psffsd, ULONG cb, USHORT cbWantContig)
668VBOXSF_EP16_BEGIN FS_ALLOCATEPAGESPACE, 'FS_ALLOCATEPAGESPACE'
669VBOXSF_TO_32 FS_ALLOCATEPAGESPACE, 4*4
670 movzx ecx, word [ebp + 08h] ; cbWantContig
671 mov [esp + 3*4], ecx
672 mov edx, [ebp + 0ah] ; cb
673 mov [esp + 2*4], edx
674 VBOXSF_PSFFSD_2_FLAT 0eh, 1*4 ; psffsd
675 VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; psffsi
676 call NAME(FS32_ALLOCATEPAGESPACE)
677VBOXSF_TO_16 FS_ALLOCATEPAGESPACE
678 retf 0eh
679VBOXSF_EP16_END FS_ALLOCATEPAGESPACE
680
681;;
682; @cproto int FS_ATTACH(USHORT flag, PCSZ pszDev, PVPFSD pvpfsd, PCDFSD pcdfsd, PBYTE pszParm, PUSHORT pcbParm)
683;
684VBOXSF_EP16_BEGIN FS_ATTACH, 'FS_ATTACH'
685 ;
686 ; Initialized ring-0 yet? (this is a likely first entry point)
687 ;
688 push ds
689 mov ax, DATA16
690 mov ds, ax
691 test byte [NAME(g_fDoneRing0)], 1
692 jnz .DoneRing0
693 call NAME(VBoxSFR0Init16Bit)
694.DoneRing0:
695 pop ds
696
697VBOXSF_TO_32 FS_ATTACH, 6*4
698 VBOXSF_FARPTR_2_FLAT 08h, 5*4 ; pcbParm
699 VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pszParm
700 VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pcdfsd
701 VBOXSF_FARPTR_2_FLAT 14h, 2*4 ; pvpfsd
702 VBOXSF_FARPTR_2_FLAT 18h, 1*4 ; pszDev
703 movzx ecx, word [ebp + 1ch] ; fFlag
704 mov [esp], ecx
705 call NAME(FS32_ATTACH)
706VBOXSF_TO_16 FS_ATTACH
707 retf 16h
708VBOXSF_EP16_END FS_ATTACH
709
710
711;;
712; @cproto int FS_CANCELLOCKREQUEST(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelock far *pLockRange)
713VBOXSF_EP16_BEGIN FS_CANCELLOCKREQUEST, 'FS_CANCELLOCKREQUEST'
714VBOXSF_TO_32 FS_CANCELLOCKREQUEST, 3*4
715 VBOXSF_FARPTR_2_FLAT 08h, 2*4 ; pLockRange
716 VBOXSF_PSFFSD_2_FLAT 0ch, 1*4 ; psffsd
717 VBOXSF_FARPTR_2_FLAT 10h, 0*4 ; psffsi
718 call NAME(FS32_CANCELLOCKREQUEST)
719VBOXSF_TO_16 FS_CANCELLOCKREQUEST
720 retf 0ch
721VBOXSF_EP16_END FS_CANCELLOCKREQUEST
722
723
724;;
725; @cproto int FS_CANCELLOCKREQUESTL(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelockl far *pLockRange)
726VBOXSF_EP16_BEGIN FS_CANCELLOCKREQUESTL, 'FS_CANCELLOCKREQUESTL'
727VBOXSF_TO_32 FS_CANCELLOCKREQUESTL, 3*4
728 VBOXSF_FARPTR_2_FLAT 08h, 2*4 ; pLockRange
729 VBOXSF_PSFFSD_2_FLAT 0ch, 1*4 ; psffsd
730 VBOXSF_FARPTR_2_FLAT 10h, 0*4 ; psffsi
731 call NAME(FS32_CANCELLOCKREQUESTL)
732VBOXSF_TO_16 FS_CANCELLOCKREQUESTL
733 retf 0ch
734VBOXSF_EP16_END FS_CANCELLOCKREQUESTL
735
736
737;;
738; @cproto int FS_CHDIR(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszDir, USHORT iCurDirEnd)
739VBOXSF_EP16_BEGIN FS_CHDIR, 'FS_CHDIR'
740VBOXSF_TO_32 FS_CHDIR, 5*4
741 movsx ecx, word [ebp + 08h] ; iCurDirEnd
742 mov [esp + 4*4], ecx
743 VBOXSF_FARPTR_2_FLAT 0ah, 3*4 ; pszDir
744 VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pcdfsd (use slow thunk here, see flag)
745 VBOXSF_FARPTR_2_FLAT 12h, 1*4 ; pcdfsi
746 movzx eax, word [ebp + 16h] ; flag
747 mov [esp], eax
748 call NAME(FS32_CHDIR)
749VBOXSF_TO_16 FS_CHDIR
750 retf 10h
751VBOXSF_EP16_END FS_CHDIR
752
753
754; @cproto int FS_CHGFILEPTR(PSFFSI psffsi, PVBOXSFFSD psffsd, LONG off, USHORT usMethod, USHORT IOflag)
755VBOXSF_EP16_BEGIN FS_CHGFILEPTR, 'FS_CHGFILEPTR'
756VBOXSF_TO_32 FS_CHGFILEPTR, 6*4
757 movzx ecx, word [ebp + 08h] ; IOflag
758 mov [esp + 5*4], ecx
759 movzx edx, word [ebp + 0ah] ; usMethod
760 mov [esp + 4*4], edx
761 mov eax, [ebp + 0ch] ; off
762 mov [esp + 2*4], eax
763 rol eax, 1 ; high dword - is there a better way than this?
764 and eax, 1
765 mov edx, 0ffffffffh
766 mul edx
767 mov [esp + 3*4], eax
768 VBOXSF_PSFFSD_2_FLAT 10h, 1*4 ; psffsd
769 VBOXSF_FARPTR_2_FLAT 14h, 0*4 ; psffsi
770 call FS32_CHGFILEPTRL
771VBOXSF_TO_16 FS_CHGFILEPTR
772 retf 10h
773VBOXSF_EP16_END FS_CHGFILEPTR
774
775
776;;
777; @cproto int FS_CLOSE(USHORT type, USHORT IOflag, PSFFSI psffsi, PVBOXSFFSD psffsd)
778;
779VBOXSF_EP16_BEGIN FS_CLOSE, 'FS_CLOSE'
780VBOXSF_TO_32 FS_CLOSE, 4*4
781 VBOXSF_PSFFSD_2_FLAT 08h, 3*4 ; psffsd
782 VBOXSF_FARPTR_2_FLAT 0ch, 2*4 ; psffsi
783 movzx ecx, word [ebp + 10h] ; IOflag
784 mov [esp + 1*4], ecx
785 movzx edx, word [ebp + 12h] ; type
786 mov [esp], edx
787 call NAME(FS32_CLOSE)
788VBOXSF_TO_16 FS_CLOSE
789 retf 0ch
790VBOXSF_EP16_END FS_CLOSE
791
792
793;;
794; @cproto int FS_COMMIT(USHORT type, USHORT IOflag, PSFFSI psffsi, PVBOXSFFSD psffsd)
795;
796VBOXSF_EP16_BEGIN FS_COMMIT, 'FS_COMMIT'
797VBOXSF_TO_32 FS_COMMIT, 4*4
798 VBOXSF_PSFFSD_2_FLAT 08h, 3*4 ; psffsd
799 VBOXSF_FARPTR_2_FLAT 0ch, 2*4 ; psffsi
800 movzx ecx, word [ebp + 10h] ; IOflag
801 mov [esp + 1*4], ecx
802 movzx edx, word [ebp + 12h] ; type
803 mov [esp], edx
804 call NAME(FS32_COMMIT)
805VBOXSF_TO_16 FS_COMMIT
806 retf 0ch
807VBOXSF_EP16_END FS_COMMIT
808
809;;
810; @cproto int FS_COPY(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszSrc, USHORT iSrcCurDirEnd
811; PCSZ pszDst, USHORT iDstCurDirEnd, USHORT nameType);
812VBOXSF_EP16_BEGIN FS_COPY, 'FS_COPY'
813VBOXSF_TO_32 FS_COPY, 8*4
814 movzx ecx, word [ebp + 08h] ; flag
815 mov [esp + 7*4], ecx
816 movsx edx, word [ebp + 0ah] ; iDstCurDirEnd
817 mov [esp + 6*4], edx
818 VBOXSF_FARPTR_2_FLAT 0ch, 5*4 ; pszDst
819 movsx eax, word [ebp + 10h] ; iSrcCurDirEnd
820 mov [esp + 4*4], eax
821 VBOXSF_FARPTR_2_FLAT 12h, 3*4 ; pszSrc
822 VBOXSF_PCDFSD_2_FLAT 16h, 2*4 ; psffsd
823 VBOXSF_FARPTR_2_FLAT 1ah, 1*4 ; psffsi
824 movzx ecx, word [ebp + 1eh] ; flag
825 mov [esp], ecx
826 call NAME(FS32_COPY)
827VBOXSF_TO_16 FS_COPY
828 retf 18h
829VBOXSF_EP16_END FS_COPY
830
831
832;;
833; @cproto int FS_DELETE(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszFile, USHORT iCurDirEnd);
834VBOXSF_EP16_BEGIN FS_DELETE, 'FS_DELETE'
835VBOXSF_TO_32 FS_DELETE, 4*4
836 movsx ecx, word [ebp + 08h] ; iCurDirEnd
837 mov [esp + 3*4], ecx
838 VBOXSF_FARPTR_2_FLAT 0ah, 2*4 ; pszFile
839 VBOXSF_PCDFSD_2_FLAT 0eh, 1*4 ; pcdfsd
840 VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; pcdfsi
841 call NAME(FS32_DELETE)
842VBOXSF_TO_16 FS_DELETE
843 retf 0eh
844VBOXSF_EP16_END FS_DELETE
845
846
847;;
848; @cproto int FS_DOPAGEIO(PSFFSI psffsi, PVBOXSFFSD psffsd, struct PageCmdHeader far *pList)
849VBOXSF_EP16_BEGIN FS_DOPAGEIO, 'FS_DOPAGEIO'
850VBOXSF_TO_32 FS_DOPAGEIO, 3*4
851 VBOXSF_FARPTR_2_FLAT 08h, 2*4 ; pList
852 VBOXSF_PSFFSD_2_FLAT 0ch, 1*4 ; psffsd
853 VBOXSF_FARPTR_2_FLAT 10h, 0*4 ; psffsi
854 call NAME(FS32_DOPAGEIO)
855VBOXSF_TO_16 FS_DOPAGEIO
856 retf 0ch
857VBOXSF_EP16_END FS_DOPAGEIO
858
859;;
860; @cproto void FS_EXIT(USHORT uid, USHORT pid, USHORT pdb)
861VBOXSF_EP16_BEGIN FS_EXIT, 'FS_EXIT'
862 ;
863 ; Initialized ring-0 yet? (this is a likely first entry point)
864 ;
865 push ds
866 mov ax, DATA16
867 mov ds, ax
868 test byte [NAME(g_fDoneRing0)], 1
869 jnz .DoneRing0
870 call NAME(VBoxSFR0Init16Bit)
871.DoneRing0:
872 pop ds
873
874VBOXSF_TO_32 FS_EXIT, 3*4
875 movzx ecx, word [ebp + 08h] ; pdb
876 mov [esp + 2*4], ecx
877 movzx edx, word [ebp + 0ah] ; pib
878 mov [esp + 1*4], edx
879 movzx eax, word [ebp + 0ch] ; uid
880 mov [esp], eax
881 call NAME(FS32_EXIT)
882VBOXSF_TO_16 FS_EXIT
883 retf 6h
884VBOXSF_EP16_END FS_EXIT
885
886
887;;
888; @cproto int FS_FILEATTRIBUTE(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd, PUSHORT pAttr);
889;
890VBOXSF_EP16_BEGIN FS_FILEATTRIBUTE, 'FS_FILEATTRIBUTE'
891VBOXSF_TO_32 FS_FILEATTRIBUTE, 6*4
892 VBOXSF_FARPTR_2_FLAT 08h, 5*4 ; pAttr
893 movsx ecx, word [ebp + 0ch] ; iCurDirEnd - caller may pass 0xffff, so sign extend.
894 mov [esp + 4*4], ecx
895 VBOXSF_FARPTR_2_FLAT 0eh, 3*4 ; pszName
896 VBOXSF_PCDFSD_2_FLAT 12h, 2*4 ; pcdfsd
897 VBOXSF_FARPTR_2_FLAT 16h, 1*4 ; pcdfsi
898 movzx edx, word [ebp + 1ah] ; flag
899 mov [esp], edx
900 call NAME(FS32_FILEATTRIBUTE)
901VBOXSF_TO_16 FS_FILEATTRIBUTE
902 retf 14h
903VBOXSF_EP16_END FS_FILEATTRIBUTE
904
905
906;;
907; @cproto int FS_FILEINFO(USHORT flag, PSFFSI psffsi, PVBOXSFFSD psffsd, USHORT level,
908; PBYTE pData, USHORT cbData, USHORT IOflag);
909VBOXSF_EP16_BEGIN FS_FILEINFO, 'FS_FILEINFO'
910VBOXSF_TO_32 FS_FILEINFO, 7*4
911 movzx ecx, word [ebp + 08h] ; IOflag
912 mov [esp + 6*4], ecx
913 movzx edx, word [ebp + 0ah] ; cbData
914 mov [esp + 5*4], edx
915 VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pData
916 movzx eax, word [ebp + 10h] ; level
917 mov [esp + 3*4], eax
918 VBOXSF_PSFFSD_2_FLAT 12h, 2*4 ; psffsd
919 VBOXSF_FARPTR_2_FLAT 16h, 1*4 ; psffsi
920 movzx ecx, word [ebp + 1ah] ; flag
921 mov [esp], ecx
922 call NAME(FS32_FILEINFO)
923VBOXSF_TO_16 FS_FILEINFO
924 retf 14h
925VBOXSF_EP16_END FS_FILEINFO
926
927
928;;
929; @cproto int FS_FILEIO(PSFFSI psffsi, PVBOXSFFSD psffsd, PBYTE pCmdList, USHORT cbCmdList,
930; PUSHORT poError, USHORT IOflag);
931VBOXSF_EP16_BEGIN FS_FILEIO, 'FS_FILEIO'
932VBOXSF_TO_32 FS_FILEIO, 6*4
933 movzx ecx, word [ebp + 08h] ; IOFlag
934 mov [esp + 5*4], ecx
935 VBOXSF_FARPTR_2_FLAT 0ah, 4*4 ; poError
936 movzx edx, word [ebp + 0eh] ; cbCmdList
937 mov [esp + 3*4], edx
938 VBOXSF_FARPTR_2_FLAT 10h, 2*4 ; pCmdList
939 VBOXSF_PSFFSD_2_FLAT 14h, 1*4 ; psffsd
940 VBOXSF_FARPTR_2_FLAT 18h, 0*4 ; psffsi
941 call NAME(FS32_FILEIO)
942VBOXSF_TO_16 FS_FILEIO
943 retf 14h
944VBOXSF_EP16_END FS_FILEIO
945
946
947;;
948; @cproto int FS_FILELOCKS(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelock far *pUnLockRange
949; struct filelock far *pLockRange, ULONG timeout, ULONG flags)
950VBOXSF_EP16_BEGIN FS_FILELOCKS, 'FS_FILELOCKS'
951VBOXSF_TO_32 FS_FILELOCKS, 6*4
952 mov ecx, [ebp + 08h] ; flags
953 mov [esp + 5*4], ecx
954 mov edx, [ebp + 0ch] ; timeout
955 mov [esp + 4*4], edx
956 VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pLockRange
957 VBOXSF_FARPTR_2_FLAT 14h, 2*4 ; pUnLockRange
958 VBOXSF_PSFFSD_2_FLAT 18h, 1*4 ; psffsd
959 VBOXSF_FARPTR_2_FLAT 1ch, 0*4 ; psffsi
960 call NAME(FS32_FILELOCKS)
961VBOXSF_TO_16 FS_FILELOCKS
962 retf 18h
963VBOXSF_EP16_END FS_FILELOCKS
964
965
966;;
967; @cproto int FS_FILELOCKSL(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelockl far *pUnLockRange
968; struct filelockl far *pLockRange, ULONG timeout, ULONG flags)
969VBOXSF_EP16_BEGIN FS_FILELOCKSL, 'FS_FILELOCKSL'
970VBOXSF_TO_32 FS_FILELOCKSL, 6*4
971 mov ecx, [ebp + 08h] ; flags
972 mov [esp + 5*4], ecx
973 mov edx, [ebp + 0ch] ; timeout
974 mov [esp + 4*4], edx
975 VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pLockRange
976 VBOXSF_FARPTR_2_FLAT 14h, 2*4 ; pUnLockRange
977 VBOXSF_PSFFSD_2_FLAT 18h, 1*4 ; psffsd
978 VBOXSF_FARPTR_2_FLAT 1ch, 0*4 ; psffsi
979 call NAME(FS32_FILELOCKS)
980VBOXSF_TO_16 FS_FILELOCKSL
981 retf 18h
982VBOXSF_EP16_END FS_FILELOCKSL
983
984
985;;
986; @cproto int FS_FINDCLOSE(PFSFSI pfsfsi, PVBOXSFFS pfsfsd);
987;
988VBOXSF_EP16_BEGIN FS_FINDCLOSE, 'FS_FINDCLOSE'
989VBOXSF_TO_32 FS_FINDCLOSE, 2*4
990 VBOXSF_PFSFSD_2_FLAT 08h, 1*4 ; pfsfsd
991 VBOXSF_FARPTR_2_FLAT 0ch, 0*4 ; pfsfsi
992 call NAME(FS32_FINDCLOSE)
993VBOXSF_TO_16 FS_FINDCLOSE
994 retf 8h
995VBOXSF_EP16_END FS_FINDCLOSE
996
997
998;;
999; @cproto int FS_FINDFIRST(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd, USHORT attr,
1000; PFSFSI pfsfsi, PVBOXSFFS pfsfsd, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
1001; USHORT level, USHORT flags);
1002;
1003VBOXSF_EP16_BEGIN FS_FINDFIRST, 'FS_FINDFIRST'
1004VBOXSF_TO_32 FS_FINDFIRST, 12*4
1005 movzx ecx, word [ebp + 08h] ; flags
1006 mov [esp + 11*4], ecx
1007 movzx edx, word [ebp + 0ah] ; level
1008 mov [esp + 10*4], edx
1009 VBOXSF_FARPTR_2_FLAT 0ch, 9*4 ; pcMatch
1010 movzx eax, word [ebp + 10h] ; cbData
1011 mov [esp + 8*4], eax
1012 VBOXSF_FARPTR_2_FLAT 12h, 7*4 ; pbData
1013 VBOXSF_FARPTR_2_FLAT 16h, 6*4 ; pfsfsd
1014 VBOXSF_FARPTR_2_FLAT 1ah, 5*4 ; pfsfsi
1015 movzx ecx, word [ebp + 1eh] ; attr
1016 mov [esp + 4*4], ecx
1017 movsx edx, word [ebp + 20h] ; iCurDirEnd
1018 mov [esp + 3*4], edx
1019 VBOXSF_FARPTR_2_FLAT 22h, 2*4 ; pszName
1020 VBOXSF_PCDFSD_2_FLAT 26h, 1*4 ; pcdfsd
1021 VBOXSF_FARPTR_2_FLAT 2ah, 0*4 ; pcdfsi
1022 call NAME(FS32_FINDFIRST)
1023VBOXSF_TO_16 FS_FINDFIRST
1024 retf 26h
1025VBOXSF_EP16_END FS_FINDFIRST
1026
1027
1028;;
1029; @cproto int FS_FINDFROMNAME(PFSFSI pfsfsi, PVBOXSFFS pfsfsd, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
1030; USHORT level, ULONG position, PCSZ pszName, USHORT flag)
1031;
1032VBOXSF_EP16_BEGIN FS_FINDFROMNAME, 'FS_FINDFROMNAME'
1033VBOXSF_TO_32 FS_FINDFROMNAME, 9*4
1034 movzx ecx, word [ebp + 08h] ; flags
1035 mov [esp + 8*4], ecx
1036 VBOXSF_FARPTR_2_FLAT 0ah, 7*4 ; pszName
1037 mov edx, [ebp + 0eh] ; position
1038 mov [esp + 6*4], edx
1039 movzx eax, word [ebp + 12h] ; level
1040 mov [esp + 5*4], eax
1041 VBOXSF_FARPTR_2_FLAT 14h, 4*4 ; pcMatch
1042 movzx eax, word [ebp + 18h] ; cbData
1043 mov [esp + 3*4], eax
1044 VBOXSF_FARPTR_2_FLAT 1ah, 2*4 ; pbData
1045 VBOXSF_PFSFSD_2_FLAT 1eh, 1*4 ; pfsfsd
1046 VBOXSF_FARPTR_2_FLAT 22h, 0*4 ; pfsfsi
1047 call NAME(FS32_FINDFROMNAME)
1048VBOXSF_TO_16 FS_FINDFROMNAME
1049 retf 1eh
1050VBOXSF_EP16_END FS_FINDFROMNAME
1051
1052
1053;;
1054; @cproto int FS_FINDNEXT(PFSFSI pfsfsi, PVBOXSFFS pfsfsd, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
1055; USHORT level, USHORT flag)
1056;
1057VBOXSF_EP16_BEGIN FS_FINDNEXT, 'FS_FINDNEXT'
1058VBOXSF_TO_32 FS_FINDNEXT, 7*4
1059 movzx ecx, word [ebp + 08h] ; flags
1060 mov [esp + 6*4], ecx
1061 movzx eax, word [ebp + 0ah] ; level
1062 mov [esp + 5*4], eax
1063 VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pcMatch
1064 movzx eax, word [ebp + 10h] ; cbData
1065 mov [esp + 3*4], eax
1066 VBOXSF_FARPTR_2_FLAT 12h, 2*4 ; pbData
1067 VBOXSF_PFSFSD_2_FLAT 16h, 1*4 ; pfsfsd
1068 VBOXSF_FARPTR_2_FLAT 1ah, 0*4 ; pfsfsi
1069 call NAME(FS32_FINDNEXT)
1070VBOXSF_TO_16 FS_FINDNEXT
1071 retf 16h
1072VBOXSF_EP16_END FS_FINDNEXT
1073
1074
1075;;
1076; @cproto int FS_FINDNOTIFYCLOSE(USHORT handle);
1077;
1078VBOXSF_EP16_BEGIN FS_FINDNOTIFYCLOSE, 'FS_FINDNOTIFYCLOSE'
1079VBOXSF_TO_32 FS_FINDNOTIFYCLOSE, 1*4
1080 movzx ecx, word [ebp + 08h] ; handle
1081 mov [esp], ecx
1082 call NAME(FS32_FINDNOTIFYCLOSE)
1083VBOXSF_TO_16 FS_FINDNOTIFYCLOSE
1084 retf 2h
1085VBOXSF_EP16_END FS_FINDNOTIFYCLOSE
1086
1087
1088;;
1089; @cproto int FS_FINDNOTIFYFIRST(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd, USHORT attr,
1090; PUSHORT pHandle, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
1091; USHORT level, USHORT flags);
1092;
1093VBOXSF_EP16_BEGIN FS_FINDNOTIFYFIRST, 'FS_FINDNOTIFYFIRST'
1094VBOXSF_TO_32 FS_FINDNOTIFYFIRST, 11*4
1095 movzx ecx, word [ebp + 08h] ; flags
1096 mov [esp + 10*4], ecx
1097 movzx edx, word [ebp + 0ah] ; level
1098 mov [esp + 9*4], edx
1099 VBOXSF_FARPTR_2_FLAT 0ch, 8*4 ; pcMatch
1100 movzx eax, word [ebp + 10h] ; cbData
1101 mov [esp + 7*4], eax
1102 VBOXSF_FARPTR_2_FLAT 12h, 6*4 ; pbData
1103 VBOXSF_FARPTR_2_FLAT 16h, 5*4 ; pHandle
1104 movzx ecx, word [ebp + 1ah] ; attr
1105 mov [esp + 4*4], ecx
1106 movsx edx, word [ebp + 1ch] ; iCurDirEnd
1107 mov [esp + 3*4], edx
1108 VBOXSF_FARPTR_2_FLAT 1eh, 2*4 ; pszName
1109 VBOXSF_PCDFSD_2_FLAT 22h, 1*4 ; pcdfsd
1110 VBOXSF_FARPTR_2_FLAT 26h, 0*4 ; pcdfsi
1111 call NAME(FS32_FINDNOTIFYFIRST)
1112VBOXSF_TO_16 FS_FINDNOTIFYFIRST
1113 retf 22h
1114VBOXSF_EP16_END FS_FINDNOTIFYFIRST
1115
1116
1117;;
1118; @cproto int FS_FINDNOTIFYNEXT(USHORT handle, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
1119; USHORT level, ULONG timeout)
1120;
1121VBOXSF_EP16_BEGIN FS_FINDNOTIFYNEXT, 'FS_FINDNOTIFYNEXT'
1122VBOXSF_TO_32 FS_FINDNOTIFYNEXT, 6*4
1123 mov ecx, [ebp + 08h] ; timeout
1124 mov [esp + 5*4], ecx
1125 movzx edx, word [ebp + 0ch] ; level
1126 mov [esp + 4*4], edx
1127 VBOXSF_FARPTR_2_FLAT 0eh, 3*4 ; pcMatch
1128 movzx eax, word [ebp + 12h] ; cbData
1129 mov [esp + 2*4], eax
1130 VBOXSF_FARPTR_2_FLAT 14h, 1*4 ; pbData
1131 movzx ecx, word [ebp + 18h] ; handle
1132 mov [esp], ecx
1133 call NAME(FS32_FINDNOTIFYNEXT)
1134VBOXSF_TO_16 FS_FINDNOTIFYNEXT
1135 retf 12h
1136VBOXSF_EP16_END FS_FINDNOTIFYNEXT
1137
1138
1139;; @cproto int FS_FLUSHBUF(USHORT hVPB, USHORT flag);
1140VBOXSF_EP16_BEGIN FS_FLUSHBUF, 'FS_FLUSHBUF'
1141VBOXSF_TO_32 FS_FLUSHBUF, 2*4
1142 movzx edx, word [ebp + 08h] ; flag
1143 mov [esp + 1*4], edx
1144 movzx eax, word [ebp + 0ch] ; hVPB
1145 mov [esp + 0*4], eax
1146 call NAME(FS32_FLUSHBUF)
1147VBOXSF_TO_16 FS_FLUSHBUF
1148 retf 4h
1149VBOXSF_EP16_END FS_FLUSHBUF
1150
1151
1152;; @cproto int FS_FSCTL(union argdat far *pArgdat, USHORT iArgType, USHORT func,
1153; PVOID pParm, USHORT lenParm, PUSHORT plenParmIO,
1154; PVOID pData, USHORT lenData, PUSHORT plenDataIO);
1155VBOXSF_EP16_BEGIN FS_FSCTL, 'FS_FSCTL'
1156 ;
1157 ; Initialized ring-0 yet? (this is a likely first entry point)
1158 ;
1159 push ds
1160 mov ax, DATA16
1161 mov ds, ax
1162 test byte [NAME(g_fDoneRing0)], 1
1163 jnz .DoneRing0
1164 call NAME(VBoxSFR0Init16Bit)
1165.DoneRing0:
1166 pop ds
1167
1168VBOXSF_TO_32 FS_FSCTL, 9*4
1169 VBOXSF_FARPTR_2_FLAT 08h, 8*4 ; plenDataIO
1170 movzx ecx, word [ebp + 0ch] ; lenData
1171 mov [esp + 7*4], ecx
1172 VBOXSF_FARPTR_2_FLAT 0eh, 6*4 ; pData
1173 VBOXSF_FARPTR_2_FLAT 12h, 5*4 ; plenDataIO
1174 movzx ecx, word [ebp + 16h] ; lenData
1175 mov [esp + 4*4], ecx
1176 VBOXSF_FARPTR_2_FLAT 18h, 3*4 ; pData
1177 movzx edx, word [ebp + 1ch] ; func
1178 mov [esp + 2*4], edx
1179 movzx eax, word [ebp + 1eh] ; iArgType
1180 mov [esp + 1*4], eax
1181 VBOXSF_FARPTR_2_FLAT 20h, 0*4 ; pArgdat
1182 call NAME(FS32_FSCTL)
1183VBOXSF_TO_16 FS_FSCTL
1184 retf 1ch
1185VBOXSF_EP16_END FS_FSCTL
1186
1187
1188;; @cproto int FS_FSINFO(USHORT flag, USHORT hVPB, PBYTE pbData, USHORT cbData, USHORT level)
1189VBOXSF_EP16_BEGIN FS_FSINFO, 'FS_FSINFO'
1190VBOXSF_TO_32 FS_FSINFO, 5*4
1191 movzx ecx, word [ebp + 08h] ; level
1192 mov [esp + 10h], ecx
1193 movzx edx, word [ebp + 0ah] ; cbData
1194 mov [esp + 0ch], edx
1195 VBOXSF_FARPTR_2_FLAT 0ch, 2*4 ; pbData
1196 movzx edx, word [ebp + 10h] ; hVPB
1197 mov [esp + 4], edx
1198 movzx eax, word [ebp + 12h] ; flag
1199 mov [esp], eax
1200 call NAME(FS32_FSINFO)
1201VBOXSF_TO_16 FS_FSINFO
1202 retf 14h
1203VBOXSF_EP16_END FS_FSINFO
1204
1205
1206;;
1207; @cproto int FS_IOCTL(PSFFSI psffsi, PVBOXSFFSD psffsd, USHORT cat, USHORT func,
1208; PVOID pParm, USHORT lenParm, PUSHORT plenParmIO,
1209; PVOID pData, USHORT lenData, PUSHORT plenDataIO);
1210VBOXSF_EP16_BEGIN FS_IOCTL, 'FS_IOCTL'
1211VBOXSF_TO_32 FS_IOCTL, 10*4
1212 VBOXSF_FARPTR_2_FLAT 08h, 9*4 ; plenDataIO
1213 movzx ecx, word [ebp + 0ch] ; lenData
1214 mov [esp + 8*4], ecx
1215 VBOXSF_FARPTR_2_FLAT 0eh, 7*4 ; pData
1216 VBOXSF_FARPTR_2_FLAT 12h, 6*4 ; plenDataIO
1217 movzx ecx, word [ebp + 16h] ; lenData
1218 mov [esp + 5*4], ecx
1219 VBOXSF_FARPTR_2_FLAT 18h, 4*4 ; pData
1220 movzx edx, word [ebp + 1ch] ; cat
1221 mov [esp + 3*4], edx
1222 movzx eax, word [ebp + 1eh] ; func
1223 mov [esp + 2*4], eax
1224 VBOXSF_PSFFSD_2_FLAT 20h, 1*4 ; psffsd
1225 VBOXSF_FARPTR_2_FLAT 24h, 0*4 ; pData
1226 call NAME(FS32_IOCTL)
1227VBOXSF_TO_16 FS_IOCTL
1228 retf 20h
1229VBOXSF_EP16_END FS_IOCTL
1230
1231
1232;;
1233; @cproto int FS_MKDIR(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd,
1234; PBYTE pEABuf, USHORT flag);
1235VBOXSF_EP16_BEGIN FS_MKDIR, 'FS_MKDIR'
1236VBOXSF_TO_32 FS_MKDIR, 6*4
1237 movzx ecx, word [ebp + 08h] ; flag
1238 mov [esp + 5*4], ecx
1239 VBOXSF_FARPTR_2_FLAT 0ah, 4*4 ; pEABuf
1240 movsx edx, word [ebp + 0eh] ; iCurDirEnd
1241 mov [esp + 3*4], edx
1242 VBOXSF_FARPTR_2_FLAT 10h, 2*4 ; pszName
1243 VBOXSF_PCDFSD_2_FLAT 14h, 1*4 ; pcdfsd
1244 VBOXSF_FARPTR_2_FLAT 18h, 0*4 ; pcdfsi
1245 call NAME(FS32_MKDIR)
1246VBOXSF_TO_16 FS_MKDIR
1247 retf 14h
1248VBOXSF_EP16_END FS_MKDIR
1249
1250
1251;;
1252; @cproto int FS_MOUNT(USHORT flag, PVPFSI pvpfsi, PVBOXSFVP pvpfsd, USHORT hVPB, PCSZ pszBoot)
1253VBOXSF_EP16_BEGIN FS_MOUNT, 'FS_MOUNT'
1254 ;
1255 ; Initialized ring-0 yet? (this is a likely first entry point)
1256 ;
1257 push ds
1258 mov ax, DATA16
1259 mov ds, ax
1260 test byte [NAME(g_fDoneRing0)], 1
1261 jnz .DoneRing0
1262 call NAME(VBoxSFR0Init16Bit)
1263.DoneRing0:
1264 pop ds
1265
1266VBOXSF_TO_32 FS_MOUNT, 5*4
1267 VBOXSF_FARPTR_2_FLAT 08h, 4*4 ; pszBoot
1268 movzx ecx, word [ebp + 0ch] ; hVPB
1269 mov [esp + 3*4], ecx
1270 VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pvpfsd
1271 VBOXSF_FARPTR_2_FLAT 12h, 1*4 ; pvpfsi
1272 movzx ecx, word [ebp + 16h] ; flag
1273 mov [esp], ecx
1274 call NAME(FS32_MOUNT)
1275VBOXSF_TO_16 FS_MOUNT
1276 retf 10h
1277VBOXSF_EP16_END FS_MOUNT
1278
1279
1280;;
1281; @cproto int FS_MOVE(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszSrc, USHORT iSrcCurDirEnd
1282; PCSZ pszDst, USHORT iDstCurDirEnd, USHORT type)
1283VBOXSF_EP16_BEGIN FS_MOVE, 'FS_MOVE'
1284VBOXSF_TO_32 FS_MOVE, 7*4
1285 movzx ecx, word [ebp + 08h] ; type
1286 mov [esp + 6*4], ecx
1287 movzx edx, word [ebp + 0ah] ; iDstCurDirEnd
1288 mov [esp + 5*4], edx
1289 VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pszDst
1290 movzx eax, word [ebp + 10h] ; iSrcCurDirEnd
1291 mov [esp + 3*4], eax
1292 VBOXSF_FARPTR_2_FLAT 12h, 2*4 ; pszSrc
1293 VBOXSF_PCDFSD_2_FLAT 16h, 1*4 ; psffsd
1294 VBOXSF_FARPTR_2_FLAT 1ah, 0*4 ; psffsi
1295 call NAME(FS32_MOVE)
1296VBOXSF_TO_16 FS_MOVE
1297 retf 16h
1298VBOXSF_EP16_END FS_MOVE
1299
1300
1301;;
1302; @cproto int FS_NEWSIZE(PSFFSI psffsi, PVBOXSFFSD psffsd, ULONG cbFile, USHORT IOflag);
1303VBOXSF_EP16_BEGIN FS_NEWSIZE, 'FS_NEWSIZE'
1304VBOXSF_TO_32 FS_NEWSIZE, 5*4 ; thunking to longlong edition.
1305 movzx ecx, word [ebp + 08h] ; IOflag
1306 mov [esp + 4*4], ecx
1307 mov eax, [ebp + 0ah] ; cbFile (ULONG -> LONGLONG)
1308 mov dword [esp + 3*4], 0
1309 mov [esp + 2*4], eax
1310 VBOXSF_PSFFSD_2_FLAT 0eh, 1*4 ; psffsd
1311 VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; psffsi
1312 call NAME(FS32_NEWSIZEL)
1313VBOXSF_TO_16 FS_NEWSIZE
1314 retf 0eh
1315VBOXSF_EP16_END FS_NEWSIZE
1316
1317
1318;;
1319; @cproto int FS_NEWSIZEL(PSFFSI psffsi, PVBOXSFFSD psffsd, LONGLONG cbFile, USHORT IOflag);
1320VBOXSF_EP16_BEGIN FS_NEWSIZEL, 'FS_NEWSIZEL'
1321VBOXSF_TO_32 FS_NEWSIZEL, 5*4
1322 movzx ecx, word [ebp + 08h] ; IOflag
1323 mov [esp + 4*4], ecx
1324 mov eax, [ebp + 0ah] ; cbFile
1325 mov edx, [ebp + 0eh]
1326 mov [esp + 3*4], edx
1327 mov [esp + 2*4], eax
1328 VBOXSF_PSFFSD_2_FLAT 12h, 1*4 ; psffsd
1329 VBOXSF_FARPTR_2_FLAT 16h, 0*4 ; psffsi
1330 call NAME(FS32_NEWSIZEL)
1331VBOXSF_TO_16 FS_NEWSIZEL
1332 retf 12h
1333VBOXSF_EP16_END FS_NEWSIZEL
1334
1335
1336;;
1337; @cproto int FS_NMPIPE(PSFFSI psffsi, PVBOXSFFSD psffsd, USHORT OpType, union npoper far *pOpRec,
1338; PBYTE pData, PCSZ pszName);
1339VBOXSF_EP16_BEGIN FS_NMPIPE, 'FS_NMPIPE'
1340VBOXSF_TO_32 FS_NMPIPE, 6*4
1341 VBOXSF_FARPTR_2_FLAT 08h, 5*4 ; pszName
1342 VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pData
1343 VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pOpRec
1344 movzx ecx, word [ebp + 14h] ; OpType
1345 mov [esp + 2*4], ecx
1346 VBOXSF_FARPTR_2_FLAT 16h, 1*4 ; psffsd (take care...)
1347 VBOXSF_FARPTR_2_FLAT 1ah, 0*4 ; psffsi
1348 call NAME(FS32_NMPIPE)
1349VBOXSF_TO_16 FS_NMPIPE
1350 retf 16h
1351VBOXSF_EP16_END FS_NMPIPE
1352
1353
1354;;
1355; @cproto int FS_OPENCREATE(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd,
1356; PSFFSI psffsi, PVBOXSFFSD psffsd, ULONG ulOpenMode, USHORT usOpenFlag,
1357; PUSHORT pusAction, USHORT usAttr, PBYTE pcEABuf, PUSHORT pfgenflag);
1358VBOXSF_EP16_BEGIN FS_OPENCREATE, 'FS_OPENCREATE'
1359VBOXSF_TO_32 FS_OPENCREATE, 12*4
1360 VBOXSF_FARPTR_2_FLAT 08h, 11*4 ; pfgenflag
1361 VBOXSF_FARPTR_2_FLAT 0ch, 10*4 ; pcEABuf
1362 movzx ecx, word [ebp + 10h] ; usAttr
1363 mov [esp + 9*4], ecx
1364 VBOXSF_FARPTR_2_FLAT 12h, 8*4 ; pusAction
1365 movzx edx, word [ebp + 16h] ; usOpenFlag
1366 mov [esp + 7*4], edx
1367 mov eax, [ebp + 18h] ; ulOpenMode
1368 mov [esp + 6*4], eax
1369 VBOXSF_FARPTR_2_FLAT 1ch, 5*4 ; psffsd (new, no short cuts)
1370 VBOXSF_FARPTR_2_FLAT 20h, 4*4 ; psffsi
1371 movsx ecx, word [ebp + 24h] ; iCurDirEnd
1372 mov [esp + 3*4], ecx
1373 VBOXSF_FARPTR_2_FLAT 26h, 2*4 ; pszName
1374 VBOXSF_PCDFSD_2_FLAT 2ah, 1*4 ; pcdfsd
1375 VBOXSF_FARPTR_2_FLAT 2eh, 0*4 ; pcdfsi
1376 call NAME(FS32_OPENCREATE)
1377VBOXSF_TO_16 FS_OPENCREATE
1378 retf 42
1379VBOXSF_EP16_END FS_OPENCREATE
1380
1381
1382;;
1383; @cproto int FS_OPENPAGEFILE(PULONG pFlag, PULONG pcMaxReq, PCSZ pszName, PSFFSI psffsi, PVBOXSFFSD psffsd,
1384; USHORT ulOpenMode, USHORT usOpenFlag, USHORT usAttr, ULONG Reserved)
1385VBOXSF_EP16_BEGIN FS_OPENPAGEFILE, 'FS_OPENPAGEFILE'
1386VBOXSF_TO_32 FS_OPENPAGEFILE, 9*4
1387 mov ecx, [ebp + 08h] ; Reserved
1388 mov [esp + 8*4], ecx
1389 movzx edx, word [ebp + 0ch] ; usAttr
1390 mov [esp + 7*4], edx
1391 movzx eax, word [ebp + 0eh] ; usOpenFlag
1392 mov [esp + 6*4], eax
1393 movzx ecx, word [ebp + 10h] ; usOpenMode
1394 mov [esp + 5*4], ecx
1395 VBOXSF_FARPTR_2_FLAT 12h, 4*4 ; psffsd (new, no short cuts)
1396 VBOXSF_FARPTR_2_FLAT 16h, 3*4 ; psffsi
1397 VBOXSF_FARPTR_2_FLAT 1ah, 2*4 ; pszName
1398 VBOXSF_FARPTR_2_FLAT 1eh, 1*4 ; pcMaxReq
1399 VBOXSF_FARPTR_2_FLAT 22h, 0*4 ; pFlag
1400 call NAME(FS32_OPENPAGEFILE)
1401VBOXSF_TO_16 FS_OPENPAGEFILE
1402 retf 1eh
1403VBOXSF_EP16_END FS_OPENPAGEFILE
1404
1405
1406;;
1407; @cproto int FS_PATHINFO(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnt,
1408; USHORT level, PBYTE pData, USHORT cbData);
1409VBOXSF_EP16_BEGIN FS_PATHINFO, 'FS_PATHINFO'
1410VBOXSF_TO_32 FS_PATHINFO, 8*4
1411 movzx ecx, word [ebp + 08h] ; cbData
1412 mov [esp + 7*4], ecx
1413 VBOXSF_FARPTR_2_FLAT 0ah, 6*4 ; pData
1414 movzx edx, word [ebp + 0eh] ; level
1415 mov [esp + 5*4], edx
1416 movsx eax, word [ebp + 10h] ; iCurDirEnd
1417 mov [esp + 4*4], eax
1418 VBOXSF_FARPTR_2_FLAT 12h, 3*4 ; pszName
1419 VBOXSF_PCDFSD_2_FLAT 16h, 2*4 ; pcdfsd
1420 VBOXSF_FARPTR_2_FLAT 1ah, 1*4 ; pcdfsi
1421 movzx edx, word [ebp + 1eh] ; flag
1422 mov [esp], edx
1423 call NAME(FS32_PATHINFO)
1424VBOXSF_TO_16 FS_PATHINFO
1425 retf 18h
1426VBOXSF_EP16_END FS_PATHINFO
1427
1428
1429;; @cproto int FS_PROCESSNAME(PSZ pszName);
1430VBOXSF_EP16_BEGIN FS_PROCESSNAME, 'FS_PROCESSNAME'
1431VBOXSF_TO_32 FS_PROCESSNAME, 1*4
1432 VBOXSF_FARPTR_2_FLAT 08h, 0*4 ; pszName
1433 call NAME(FS32_PROCESSNAME)
1434VBOXSF_TO_16 FS_PROCESSNAME
1435 retf 4h
1436VBOXSF_EP16_END FS_PROCESSNAME
1437
1438
1439;;
1440; @cproto int FS_READ(PSFFSI psffsi, PVBOXSFFSD psffsd, PBYTE pbData, PUSHORT pcbData, USHORT IOflag)
1441VBOXSF_EP16_BEGIN FS_READ, 'FS_READ'
1442VBOXSF_TO_32 FS_READ, 6*4 ; extra local for ULONG cbDataTmp.
1443 movzx ecx, word [ebp + 08h] ; IOflag
1444 mov [esp + 4*4], ecx
1445 les dx, [ebp + 0ah] ; cbDataTmp = *pcbData;
1446 movzx edx, dx
1447 lea ecx, [esp + 5*4] ; pcbData = &cbDataTmp
1448 movzx eax, word [es:edx]
1449 mov [ecx], eax
1450 mov [esp + 3*4], ecx
1451 mov edx, DATA32
1452 mov es, edx
1453 VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pbData
1454 VBOXSF_PSFFSD_2_FLAT 12h, 1*4 ; psffsd
1455 VBOXSF_FARPTR_2_FLAT 16h, 0*4 ; psffsi
1456 call FS32_READ
1457
1458 les dx, [ebp + 0ah] ; *pcbData = cbDataTmp;
1459 movzx edx, dx
1460 mov cx, [esp + 5*4]
1461 mov [es:edx], cx
1462 mov edx, DATA32
1463 mov es, edx
1464
1465VBOXSF_TO_16 FS_READ
1466 retf 12h
1467VBOXSF_EP16_END FS_READ
1468
1469
1470;;
1471; @cproto int FS_RMDIR(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd);
1472;
1473VBOXSF_EP16_BEGIN FS_RMDIR, 'FS_RMDIR'
1474VBOXSF_TO_32 FS_RMDIR, 4*4
1475 movsx edx, word [ebp + 08h] ; iCurDirEnd
1476 mov [esp + 3*4], edx
1477 VBOXSF_FARPTR_2_FLAT 0ah, 2*4 ; pszName
1478 VBOXSF_PCDFSD_2_FLAT 0eh, 1*4 ; pcdfsd
1479 VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; pcdfsi
1480 call NAME(FS32_RMDIR)
1481VBOXSF_TO_16 FS_RMDIR
1482 retf 0eh
1483VBOXSF_EP16_END FS_RMDIR
1484
1485
1486;;
1487; @cproto int FS_SETSWAP(PSFFSI psffsi, PVBOXSFFSD psffsd);
1488;
1489VBOXSF_EP16_BEGIN FS_SETSWAP, 'FS_SETSWAP'
1490VBOXSF_TO_32 FS_SETSWAP, 2*4
1491 VBOXSF_PSFFSD_2_FLAT 08h, 1*4 ; psffsd
1492 VBOXSF_FARPTR_2_FLAT 0ch, 0*4 ; psffsi
1493 call NAME(FS32_SETSWAP)
1494VBOXSF_TO_16 FS_SETSWAP
1495 retf 8h
1496VBOXSF_EP16_END FS_SETSWAP
1497
1498
1499;;
1500; @cproto int FS_SHUTDOWN(USHORT type, ULONG reserved);
1501;
1502VBOXSF_EP16_BEGIN FS_SHUTDOWN, 'FS_SHUTDOWN'
1503VBOXSF_TO_32 FS_SHUTDOWN, 3*4
1504 mov ecx, [ebp + 0ch] ; type
1505 mov [esp + 1*4], edx
1506 movzx edx, word [ebp + 08h] ; reserved
1507 mov [esp], eax
1508 call NAME(FS32_SHUTDOWN)
1509VBOXSF_TO_16 FS_SHUTDOWN
1510 retf 6h
1511VBOXSF_EP16_END FS_SHUTDOWN
1512
1513
1514;;
1515; @cproto int FS_VERIFYUNCNAME(USHORT type, PCSZ pszName);
1516;
1517VBOXSF_EP16_BEGIN FS_VERIFYUNCNAME, 'FS_VERIFYUNCNAME'
1518VBOXSF_TO_32 FS_VERIFYUNCNAME, 3*4
1519 VBOXSF_FARPTR_2_FLAT 08h, 1*4 ; pszDev
1520 movzx ecx, word [ebp + 0ch] ; fFlag
1521 mov [esp], ecx
1522 call NAME(FS32_VERIFYUNCNAME)
1523VBOXSF_TO_16 FS_VERIFYUNCNAME
1524 retf 6h
1525VBOXSF_EP16_END FS_VERIFYUNCNAME
1526
1527
1528;;
1529; @cproto int FS_WRITE(PSFFSI psffsi, PVBOXSFFSD psffsd, PBYTE pbData, PUSHORT pcbData, USHORT IOflag)
1530VBOXSF_EP16_BEGIN FS_WRITE, 'FS_WRITE'
1531VBOXSF_TO_32 FS_WRITE, 6*4 ; extra local for ULONG cbDataTmp.
1532 movzx ecx, word [ebp + 08h] ; IOflag
1533 mov [esp + 4*4], ecx
1534 les dx, [ebp + 0ah] ; cbDataTmp = *pcbData;
1535 movzx edx, dx
1536 lea ecx, [esp + 5*4] ; pcbData = &cbDataTmp
1537 movzx eax, word [es:edx]
1538 mov [ecx], eax
1539 mov [esp + 3*4], ecx
1540 mov edx, DATA32
1541 mov es, edx
1542 VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pbData
1543 VBOXSF_PSFFSD_2_FLAT 12h, 1*4 ; psffsd
1544 VBOXSF_FARPTR_2_FLAT 16h, 0*4 ; psffsi
1545 call FS32_WRITE
1546
1547 les dx, [ebp + 0ah] ; *pcbData = cbDataTmp;
1548 movzx edx, dx
1549 mov cx, [esp + 5*4]
1550 mov [es:edx], cx
1551 mov edx, DATA32
1552 mov es, edx
1553
1554VBOXSF_TO_16 FS_WRITE
1555 retf 12h
1556VBOXSF_EP16_END FS_WRITE
1557
1558
1559;
1560;
1561; Calling 16-bit kernel code.
1562;
1563;
1564
1565BEGINCODE
1566
1567;;
1568; Wrapper around FSH_GETVOLPARM.
1569;
1570; @returns VPBFSD.
1571; @param hVbp The volume handle to resolve.
1572; @param ppVbpFsi
1573;
1574BEGINPROC Fsh32GetVolParams
1575VBOXSF_FROM_32 Fsh32GetVolParams, 2*4
1576 mov di, sp ; make the top of the stack addressable via di
1577
1578 mov [ss:di], eax ; clear the return variables
1579 mov [ss:di + 4], eax
1580
1581 mov ax, [bp + 8] ; hVbp
1582 push ax
1583
1584 lea ax, [ss:di] ; &hvfsi
1585 push ss
1586 push ax
1587
1588 lea ax, [ss:di + 4] ; &hvfsd
1589 push ss
1590 push ax
1591
1592 call far FSH_GETVOLPARM
1593
1594 mov sp, di ; paranoia (pascal pops params)
1595
1596VBOXSF_FROM_16_SWITCH Fsh32GetVolParams
1597
1598 ; Convert vpfsi to flat and store it in return location.
1599 mov ebx, [ebp + 0ch]
1600 test ebx, ebx
1601 jz .no_vpfsi
1602 call KernSelToFlat
1603 mov [ebx], eax
1604.no_vpfsi:
1605 add esp, 4
1606
1607 ; Convert vpfsd to flat and return it.
1608 call KernSelToFlat
1609
1610VBOXSF_FROM_16_EPILOGUE
1611 ret
1612ENDPROC Fsh32GetVolParams
1613
1614
1615
1616
1617
1618;
1619;
1620; Init code starts here
1621; Init code starts here
1622; Init code starts here
1623;
1624;
1625
1626
1627;;
1628; Ring-3 Init (16-bit).
1629;
1630; @param pMiniFS [bp + 08h] The mini-FSD. (NULL)
1631; @param fpfnDevHlp [bp + 0ch] The address of the DevHlp router.
1632; @param pszCmdLine [bp + 10h] The config.sys command line.
1633;
1634VBOXSF_EP16_BEGIN FS_INIT, 'FS_INIT'
1635; DEBUG_STR16 'VBoxSF: FS_INIT - enter'
1636 push ebp
1637 mov ebp, esp
1638 push ds ; bp - 02h
1639 push es ; bp - 04h
1640 push esi ; bp - 08h
1641 push edi ; bp - 0ch
1642
1643 mov ax, DATA16
1644 mov ds, ax
1645 mov es, ax
1646
1647 ;
1648 ; Save the device help entry point.
1649 ;
1650 mov eax, [bp + 0ch]
1651 mov [NAME(g_fpfnDevHlp)], eax
1652
1653 ;
1654 ; Parse the command line.
1655 ; Doing this in assembly is kind of ugly...
1656 ;
1657 cmp word [bp + 10h + 2], 3
1658 jbe near .no_command_line
1659 lds si, [bp + 10h] ; ds:si -> command line iterator.
1660.parse_next:
1661
1662 ; skip leading blanks.
1663.parse_next_char:
1664 mov di, si ; DI = start of argument.
1665 lodsb
1666 cmp al, ' '
1667 je .parse_next_char
1668 cmp al, 9 ; tab
1669 je .parse_next_char
1670 cmp al, 0
1671 je near .parse_done
1672
1673 ; check for '/' or '-'
1674 cmp al, '/'
1675 je .parse_switch
1676 cmp al, '-'
1677 je .parse_switch
1678 jmp .parse_error
1679
1680 ; parse switches.
1681.parse_switch:
1682 lodsb
1683 cmp al, 0
1684 je .parse_error
1685 and al, ~20h ; uppercase
1686
1687 cmp al, 'V' ; /V - verbose
1688 je .parse_verbose
1689 cmp al, 'Q' ; /Q - quiet.
1690 je .parse_quiet
1691 jmp .parse_error
1692
1693.parse_verbose:
1694 mov byte [es:NAME(g_fVerbose)], 1
1695 jmp .parse_next
1696
1697.parse_quiet:
1698 mov byte [es:NAME(g_fVerbose)], 0
1699 jmp .parse_next
1700
1701.parse_error:
1702segment DATA16
1703.szSyntaxError:
1704 db 0dh, 0ah, 'VBoxSF.ifs: command line parse error at: ', 0
1705.szNewLine:
1706 db 0dh, 0ah, 0dh, 0ah, 0
1707segment CODE16
1708 mov bx, .szSyntaxError
1709 call NAME(FS_INIT_FPUTS)
1710
1711 push es
1712 push ds
1713 pop es
1714 mov bx, di
1715 call NAME(FS_INIT_FPUTS)
1716 pop es
1717
1718 mov bx, .szNewLine
1719 call NAME(FS_INIT_FPUTS)
1720
1721 mov ax, ERROR_INVALID_PARAMETER
1722 jmp .done
1723
1724.parse_done:
1725 mov ax, DATA16
1726 mov ds, ax
1727.no_command_line:
1728
1729 ;
1730 ; Write our greeting to STDOUT.
1731 ; APIRET _Pascal DosWrite(HFILE hf, PVOID pvBuf, USHORT cbBuf, PUSHORT pcbBytesWritten);
1732 ;
1733 cmp byte [NAME(g_fVerbose)], 0
1734 je near .quiet
1735segment DATA16
1736.szMessage:
1737 db 'VirtualBox Guest Additions IFS for OS/2', 0dh, 0ah, 0
1738segment CODE16
1739 mov bx, .szMessage
1740 call NAME(FS_INIT_FPUTS)
1741.quiet:
1742
1743 ; return success.
1744 xor eax, eax
1745.done:
1746 lea sp, [bp - 0ch]
1747 pop edi
1748 pop esi
1749 pop es
1750 pop ds
1751 mov esp, ebp
1752 pop ebp
1753 DEBUG_STR16 'VBoxSF: FS_INIT - leave'
1754 retf 0ch
1755VBOXSF_EP16_END FS_INIT
1756
1757
1758;;
1759; Dos16Write wrapper.
1760;
1761; @param es:bx String to print. (zero terminated)
1762; @uses nothing.
1763GLOBALNAME FS_INIT_FPUTS
1764 push bp
1765 mov bp, sp
1766 push es ; bp - 02h
1767 push ds ; bp - 04h
1768 push ax ; bp - 06h
1769 push bx ; bp - 08h
1770 push cx ; bp - 0ah
1771 push dx ; bp - 0ch
1772 push si ; bp - 0eh
1773 push di ; bp - 10h
1774
1775 ; cx = strlen(es:bx)
1776 xor al, al
1777 mov di, bx
1778 mov cx, 0ffffh
1779 cld
1780 repne scasb
1781 not cx
1782 dec cx
1783
1784 ; APIRET _Pascal DosWrite(HFILE hf, PVOID pvBuf, USHORT cbBuf, PUSHORT pcbBytesWritten);
1785 push cx
1786 mov ax, sp ; cbBytesWritten
1787 push 1 ; STDOUT
1788 push es ; pvBuf
1789 push bx
1790 push cx ; cbBuf
1791 push ss ; pcbBytesWritten
1792 push ax
1793%if 0 ; wlink/nasm generates a non-aliased fixup here which results in 16-bit offset with the flat 32-bit selector.
1794 call far DOS16WRITE
1795%else
1796 ; convert flat pointer to a far pointer using the tiled algorithm.
1797 mov ax, DATA32 wrt FLAT
1798 mov ds, ax
1799 mov eax, g_pfnDos16Write wrt FLAT
1800 movzx eax, word [eax + 2] ; High word of the flat address (in DATA32).
1801 shl ax, 3
1802 or ax, 0007h
1803 mov dx, DATA16
1804 mov ds, dx
1805 mov [NAME(g_fpfnDos16Write) + 2], ax ; Update the selector (in DATA16).
1806 ; do the call
1807 call far [NAME(g_fpfnDos16Write)]
1808%endif
1809
1810 lea sp, [bp - 10h]
1811 pop di
1812 pop si
1813 pop dx
1814 pop cx
1815 pop bx
1816 pop ax
1817 pop ds
1818 pop es
1819 pop bp
1820 ret
1821ENDPROC FS_INIT_FPUTS
1822
1823
1824
1825;;
1826; 16-bit ring-0 init routine.
1827;
1828; Called from various entrypoints likely to be the first to be invoked.
1829;
1830GLOBALNAME VBoxSFR0Init16Bit
1831 DEBUG_STR16 'VBoxSF: VBoxSFR0Init16Bit - enter'
1832 push ds
1833 push es
1834 push fs
1835 push gs
1836 push esi
1837 push edi
1838 push ebp
1839 mov ebp, esp
1840 and sp, 0fffch
1841
1842 ;
1843 ; Only try once.
1844 ;
1845 mov ax, DATA16
1846 mov ds, ax
1847 mov byte [NAME(g_fDoneRing0)], 1
1848
1849 ;
1850 ; Try attach to the VBoxGuest driver.
1851 ;
1852 mov bx, NAME(g_szVBoxGuestName)
1853 mov di, NAME(g_VBoxGuestAttachDD)
1854 mov dl, DevHlp_AttachDD
1855 call far [NAME(g_fpfnDevHlp)]
1856 jc .attach_attempt_done
1857
1858 push seg NAME(g_VBoxGuestIDC)
1859 push NAME(g_VBoxGuestIDC)
1860 call far [NAME(g_VBoxGuestAttachDD) + 6]
1861.attach_attempt_done:
1862
1863%ifndef DONT_LOCK_SEGMENTS
1864 ;
1865 ; Lock the two 16-bit segments.
1866 ;
1867 push DATA16
1868 call far FSH_FORCENOSWAP
1869 push CODE16
1870 call far FSH_FORCENOSWAP
1871 ; Wonder if this'll work if wlink could mark the two segments as ALIASed...
1872 ;push DATA32
1873 ;call far FSH_FORCENOSWAP
1874 ;push TEXT32
1875 ;call far FSH_FORCENOSWAP
1876%endif
1877
1878 ;
1879 ; Do 32-bit ring-0 init.
1880 ;
1881 ;jmp far dword NAME(VBoxSFR0Init16Bit_32) wrt FLAT
1882 db 066h
1883 db 0eah
1884 dd NAME(VBoxSFR0Init16Bit_32) ;wrt FLAT
1885 dw TEXT32 wrt FLAT
1886segment TEXT32
1887GLOBALNAME VBoxSFR0Init16Bit_32
1888 mov ax, DATA32 wrt FLAT
1889 mov ds, ax
1890 mov es, ax
1891
1892 call KernThunkStackTo32
1893 call NAME(VBoxSFR0Init)
1894 call KernThunkStackTo16
1895
1896 ;jmp far dword NAME(VBoxSFR0Init16Bit_16) wrt CODE16
1897 db 066h
1898 db 0eah
1899 dw NAME(VBoxSFR0Init16Bit_16) wrt CODE16
1900 dw CODE16
1901segment CODE16
1902GLOBALNAME VBoxSFR0Init16Bit_16
1903
1904 mov esp, ebp
1905 pop ebp
1906 pop edi
1907 pop esi
1908 pop gs
1909 pop fs
1910 pop es
1911 pop ds
1912 DEBUG_STR16 'VBoxSF: VBoxSFR0Init16Bit - leave'
1913 ret
1914ENDPROC VBoxSFR0Init16Bit
1915
1916
1917%ifdef DEBUG
1918;;
1919; print the string which offset is in AX (it's in the data segment).
1920; @uses AX
1921;
1922GLOBALNAME dbgstr16
1923 push ds
1924 push ebx
1925 push edx
1926
1927 mov bx, ax
1928 mov dx, 0504h ; RTLOG_DEBUG_PORT
1929 mov ax, DATA16
1930 mov ds, ax
1931
1932.next:
1933 mov al, [bx]
1934 or al, al
1935 jz .done
1936 inc bx
1937 out dx, al
1938 jmp .next
1939
1940.done:
1941 pop edx
1942 pop ebx
1943 pop ds
1944 ret
1945ENDPROC dbgstr16
1946%endif
1947
1948
1949%ifdef WITH_DWARF
1950;
1951; Close debug info
1952;
1953segment _debug_info
1954 db 0
1955g_dwarf_compile_unit_end:
1956%endif
1957
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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