; Used to taking us to 32-bit and reserving a parameter frame.
; @param %1 The function name
; @param %2 The number of bytes to reserve
; Reserve the 32-bit parameter and align the stack on a 16 byte
; boundrary to make GCC really happy.
;jmp far dword NAME(%i %+ _32) wrt FLAT
dd NAME(%1 %+ _32) ;wrt FLAT
; The counter part to VBOXSF_TO_32
; @param %1 The function name
;jmp far dword NAME(%1 %+ _16) wrt CODE16
dw NAME(%1 %+ _16) wrt CODE16
; Thunks the given 16:16 pointer to a flat pointer.
; @param %1 The negated ebp offset of the input.
; @param %2 The esp offset of the output.
%macro VBOXSF_FARPTR_2_FLAT 2
movzx eax, word [ebp - (%1) + 2]
movzx edx, word [ebp - (%1)]
; Thunks the given 16:16 struct sffsd pointer to a flat pointer.
; @param %1 The negated ebp offset of the input.
; @param %2 The esp offset of the output.
%macro VBOXSF_PSFFSD_2_FLAT 2
; Thunks the given 16:16 struct cdfsd pointer to a flat pointer.
; @param %1 The negated ebp offset of the input.
; @param %2 The esp offset of the output.
%macro VBOXSF_PCDFSD_2_FLAT 2
; Thunks the given 16:16 struct fsfsd pointer to a flat pointer.
; @param %1 The negated ebp offset of the input.
; @param %2 The esp offset of the output.
%macro VBOXSF_PFSFSD_2_FLAT 2
;*******************************************************************************
;*******************************************************************************
extern KernThunkStackTo32
extern KernThunkStackTo16
extern NAME(FS32_ALLOCATEPAGESPACE)
extern NAME(FS32_CANCELLOCKREQUEST)
extern NAME(FS32_CANCELLOCKREQUESTL)
extern NAME(FS32_DOPAGEIO)
extern NAME(FS32_FILEATTRIBUTE)
extern NAME(FS32_FILEINFO)
extern NAME(FS32_FILELOCKS)
extern NAME(FS32_FILELOCKSL)
extern NAME(FS32_FINDCLOSE)
extern NAME(FS32_FINDFIRST)
extern NAME(FS32_FINDFROMNAME)
extern NAME(FS32_FINDNEXT)
extern NAME(FS32_FINDNOTIFYCLOSE)
extern NAME(FS32_FINDNOTIFYFIRST)
extern NAME(FS32_FINDNOTIFYNEXT)
extern NAME(FS32_FLUSHBUF)
extern NAME(FS32_NEWSIZEL)
extern NAME(FS32_OPENCREATE)
extern NAME(FS32_OPENPAGEFILE)
extern NAME(FS32_PATHINFO)
extern NAME(FS32_PROCESSNAME)
extern NAME(FS32_SETSWAP)
extern NAME(FS32_SHUTDOWN)
extern NAME(VBoxSFR0Init)
;*******************************************************************************
;*******************************************************************************
; The 32-bit version is only used to indicate that this is a 32-bit file system.
%define FSA_REMOTE 0001h ; remote file system.
%define FSA_UNC 0002h ; implements UNC.
%define FSA_LOCK 0004h ; needs lock notification.
%define FSA_LVL7 0008h ; accept level 7 (case perserving path request).
%define FSA_PSVR 0010h ; (named) pipe server.
%define FSA_LARGEFILE 0020h ; large file support.
dd FSA_REMOTE + FSA_LARGEFILE ;+ FSA_LVL7 + FSA_LOCK
; bit 0 - don't get the ring-0 spinlock.
; bit 6 - don't get the subsystem ring-0 spinlock.
; Set after VBoxSFR0Init16Bit has been called.
; The device helper (IPRT expects this name).
; (This is set by FS_INIT.)
; Whether initialization should be verbose or quiet.
;; Far pointer to DOS16WRITE (corrected set before called).
; Just a 'temporary' hack to work around a
wlink/nasm issue.
GLOBALNAME g_fpfnDos16Write
GLOBALNAME g_VBoxGuestAttachDD
GLOBALNAME g_szVBoxGuestName
db VBOXGUEST_DEVICE_NAME, 0
; The VBoxGuest IDC connection data.
GLOBALNAME g_VBoxGuestIDC
times VBGOS2IDC_size db 0
; This must be present, we've got fixups against it.
; 16-bit entry point thunking.
; 16-bit entry point thunking.
; 16-bit entry point thunking.
; @cproto int FS_ALLOCATEPAGESPACE(PSFFSI psffsi, PVBOXSFFSD psffsd, ULONG cb, USHORT cbWantContig)
VBOXSF_EP16_BEGIN FS_ALLOCATEPAGESPACE, 'FS_ALLOCATEPAGESPACE'
VBOXSF_TO_32 FS_ALLOCATEPAGESPACE, 4*4
movzx ecx, word [ebp + 08h] ; cbWantContig
mov edx, [ebp + 0ah] ; cb
VBOXSF_PSFFSD_2_FLAT 0eh, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; psffsi
call NAME(FS32_ALLOCATEPAGESPACE)
VBOXSF_TO_16 FS_ALLOCATEPAGESPACE
VBOXSF_EP16_END FS_ALLOCATEPAGESPACE
; @cproto int FS_ATTACH(USHORT flag, PCSZ pszDev, PVPFSD pvpfsd, PCDFSD pcdfsd, PBYTE pszParm, PUSHORT pcbParm)
VBOXSF_EP16_BEGIN FS_ATTACH, 'FS_ATTACH'
; Initialized ring-0 yet? (this is a likely first entry point)
test byte [NAME(g_fDoneRing0)], 1
call NAME(VBoxSFR0Init16Bit)
VBOXSF_TO_32 FS_ATTACH, 6*4
VBOXSF_FARPTR_2_FLAT 08h, 5*4 ; pcbParm
VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pszParm
VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pcdfsd
VBOXSF_FARPTR_2_FLAT 14h, 2*4 ; pvpfsd
VBOXSF_FARPTR_2_FLAT 18h, 1*4 ; pszDev
movzx ecx, word [ebp + 1ch] ; fFlag
VBOXSF_EP16_END FS_ATTACH
; @cproto int FS_CANCELLOCKREQUEST(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelock far *pLockRange)
VBOXSF_EP16_BEGIN FS_CANCELLOCKREQUEST, 'FS_CANCELLOCKREQUEST'
VBOXSF_TO_32 FS_CANCELLOCKREQUEST, 3*4
VBOXSF_FARPTR_2_FLAT 08h, 2*4 ; pLockRange
VBOXSF_PSFFSD_2_FLAT 0ch, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 10h, 0*4 ; psffsi
call NAME(FS32_CANCELLOCKREQUEST)
VBOXSF_TO_16 FS_CANCELLOCKREQUEST
VBOXSF_EP16_END FS_CANCELLOCKREQUEST
; @cproto int FS_CANCELLOCKREQUESTL(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelockl far *pLockRange)
VBOXSF_EP16_BEGIN FS_CANCELLOCKREQUESTL, 'FS_CANCELLOCKREQUESTL'
VBOXSF_TO_32 FS_CANCELLOCKREQUESTL, 3*4
VBOXSF_FARPTR_2_FLAT 08h, 2*4 ; pLockRange
VBOXSF_PSFFSD_2_FLAT 0ch, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 10h, 0*4 ; psffsi
call NAME(FS32_CANCELLOCKREQUESTL)
VBOXSF_TO_16 FS_CANCELLOCKREQUESTL
VBOXSF_EP16_END FS_CANCELLOCKREQUESTL
; @cproto int FS_CHDIR(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszDir, USHORT iCurDirEnd)
VBOXSF_EP16_BEGIN FS_CHDIR, 'FS_CHDIR'
VBOXSF_TO_32 FS_CHDIR, 5*4
movzx ecx, word [ebp + 08h] ; iCurDirEnd
VBOXSF_FARPTR_2_FLAT 0ah, 3*4 ; pszDir
VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pcdfsd (use slow thunk here, see flag)
VBOXSF_FARPTR_2_FLAT 12h, 1*4 ; pcdfsi
movzx eax, word [ebp + 16h] ; flag
; @cproto int FS_CHGFILEPTR(PSFFSI psffsi, PVBOXSFFSD psffsd, LONG off, USHORT usMethod, USHORT IOflag)
VBOXSF_EP16_BEGIN FS_CHGFILEPTR, 'FS_CHGFILEPTR'
VBOXSF_TO_32 FS_CHGFILEPTR, 6*4
movzx ecx, word [ebp + 08h] ; IOflag
movzx edx, word [ebp + 0ah] ; usMethod
mov eax, [ebp + 0ch] ; off
rol eax, 1 ; high dword - is there a better way than this?
VBOXSF_PSFFSD_2_FLAT 10h, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 14h, 0*4 ; psffsi
VBOXSF_TO_16 FS_CHGFILEPTR
VBOXSF_EP16_END FS_CHGFILEPTR
; @cproto int FS_CLOSE(USHORT type, USHORT IOflag, PSFFSI psffsi, PVBOXSFFSD psffsd)
VBOXSF_EP16_BEGIN FS_CLOSE, 'FS_CLOSE'
VBOXSF_TO_32 FS_CLOSE, 4*4
VBOXSF_PSFFSD_2_FLAT 08h, 3*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 0ch, 2*4 ; psffsi
movzx ecx, word [ebp + 10h] ; IOflag
movzx edx, word [ebp + 12h] ; type
; @cproto int FS_COMMIT(USHORT type, USHORT IOflag, PSFFSI psffsi, PVBOXSFFSD psffsd)
VBOXSF_EP16_BEGIN FS_COMMIT, 'FS_COMMIT'
VBOXSF_TO_32 FS_COMMIT, 4*4
VBOXSF_PSFFSD_2_FLAT 08h, 3*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 0ch, 2*4 ; psffsi
movzx ecx, word [ebp + 10h] ; IOflag
movzx edx, word [ebp + 12h] ; type
VBOXSF_EP16_END FS_COMMIT
; @cproto int FS_COPY(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszSrc, USHORT iSrcCurDirEnd
; PCSZ pszDst, USHORT iDstCurDirEnd, USHORT nameType);
VBOXSF_EP16_BEGIN FS_COPY, 'FS_COPY'
VBOXSF_TO_32 FS_COPY, 8*4
movzx ecx, word [ebp + 08h] ; flag
movzx edx, word [ebp + 0ah] ; iDstCurDirEnd
VBOXSF_FARPTR_2_FLAT 0ch, 5*4 ; pszDst
movzx eax, word [ebp + 10h] ; iSrcCurDirEnd
VBOXSF_FARPTR_2_FLAT 12h, 3*4 ; pszSrc
VBOXSF_PCDFSD_2_FLAT 16h, 2*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 1ah, 1*4 ; psffsi
movzx ecx, word [ebp + 1eh] ; flag
; @cproto int FS_DELETE(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszFile, USHORT iCurDirEnd);
VBOXSF_EP16_BEGIN FS_DELETE, 'FS_DELETE'
VBOXSF_TO_32 FS_DELETE, 4*4
movzx ecx, word [ebp + 08h] ; iCurDirEnd
VBOXSF_FARPTR_2_FLAT 0ah, 2*4 ; pszFile
VBOXSF_PCDFSD_2_FLAT 0eh, 1*4 ; pcdfsd
VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; pcdfsi
VBOXSF_EP16_END FS_DELETE
; @cproto int FS_DOPAGEIO(PSFFSI psffsi, PVBOXSFFSD psffsd, struct PageCmdHeader far *pList)
VBOXSF_EP16_BEGIN FS_DOPAGEIO, 'FS_DOPAGEIO'
VBOXSF_TO_32 FS_DOPAGEIO, 3*4
VBOXSF_FARPTR_2_FLAT 08h, 2*4 ; pList
VBOXSF_PSFFSD_2_FLAT 0ch, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 10h, 0*4 ; psffsi
VBOXSF_EP16_END FS_DOPAGEIO
; @cproto void FS_EXIT(USHORT uid, USHORT pid, USHORT pdb)
VBOXSF_EP16_BEGIN FS_EXIT, 'FS_EXIT'
; Initialized ring-0 yet? (this is a likely first entry point)
test byte [NAME(g_fDoneRing0)], 1
call NAME(VBoxSFR0Init16Bit)
VBOXSF_TO_32 FS_EXIT, 3*4
movzx ecx, word [ebp + 08h] ; pdb
movzx edx, word [ebp + 0ah] ; pib
movzx eax, word [ebp + 0ch] ; uid
; @cproto int FS_FILEATTRIBUTE(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd, PUSHORT pAttr);
VBOXSF_EP16_BEGIN FS_FILEATTRIBUTE, 'FS_FILEATTRIBUTE'
VBOXSF_TO_32 FS_FILEATTRIBUTE, 6*4
VBOXSF_FARPTR_2_FLAT 08h, 5*4 ; pAttr
movzx ecx, word [ebp + 0ch] ; iCurDirEnd
VBOXSF_FARPTR_2_FLAT 0eh, 3*4 ; pszName
VBOXSF_PCDFSD_2_FLAT 12h, 2*4 ; pcdfsd
VBOXSF_FARPTR_2_FLAT 16h, 1*4 ; pcdfsi
movzx edx, word [ebp + 1ah] ; flag
call NAME(FS32_FILEATTRIBUTE)
VBOXSF_TO_16 FS_FILEATTRIBUTE
VBOXSF_EP16_END FS_FILEATTRIBUTE
; @cproto int FS_FILEINFO(USHORT flag, PSFFSI psffsi, PVBOXSFFSD psffsd, USHORT level,
; PBYTE pData, USHORT cbData, USHORT IOflag);
VBOXSF_EP16_BEGIN FS_FILEINFO, 'FS_FILEINFO'
VBOXSF_TO_32 FS_FILEINFO, 7*4
movzx ecx, word [ebp + 08h] ; IOflag
movzx edx, word [ebp + 0ah] ; cbData
VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pData
movzx eax, word [ebp + 10h] ; level
VBOXSF_PSFFSD_2_FLAT 12h, 2*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 16h, 1*4 ; psffsi
movzx ecx, word [ebp + 1ah] ; flag
VBOXSF_EP16_END FS_FILEINFO
; @cproto int FS_FILEIO(PSFFSI psffsi, PVBOXSFFSD psffsd, PBYTE pCmdList, USHORT cbCmdList,
; PUSHORT poError, USHORT IOflag);
VBOXSF_EP16_BEGIN FS_FILEIO, 'FS_FILEIO'
VBOXSF_TO_32 FS_FILEIO, 6*4
movzx ecx, word [ebp + 08h] ; IOFlag
VBOXSF_FARPTR_2_FLAT 0ah, 4*4 ; poError
movzx edx, word [ebp + 0eh] ; cbCmdList
VBOXSF_FARPTR_2_FLAT 10h, 2*4 ; pCmdList
VBOXSF_PSFFSD_2_FLAT 14h, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 18h, 0*4 ; psffsi
VBOXSF_EP16_END FS_FILEIO
; @cproto int FS_FILELOCKS(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelock far *pUnLockRange
; struct filelock far *pLockRange, ULONG timeout, ULONG flags)
VBOXSF_EP16_BEGIN FS_FILELOCKS, 'FS_FILELOCKS'
VBOXSF_TO_32 FS_FILELOCKS, 6*4
mov ecx, [ebp + 08h] ; flags
mov edx, [ebp + 0ch] ; timeout
VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pLockRange
VBOXSF_FARPTR_2_FLAT 14h, 2*4 ; pUnLockRange
VBOXSF_PSFFSD_2_FLAT 18h, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 1ch, 0*4 ; psffsi
call NAME(FS32_FILELOCKS)
VBOXSF_TO_16 FS_FILELOCKS
VBOXSF_EP16_END FS_FILELOCKS
; @cproto int FS_FILELOCKSL(PSFFSI psffsi, PVBOXSFFSD psffsd, struct filelockl far *pUnLockRange
; struct filelockl far *pLockRange, ULONG timeout, ULONG flags)
VBOXSF_EP16_BEGIN FS_FILELOCKSL, 'FS_FILELOCKSL'
VBOXSF_TO_32 FS_FILELOCKSL, 6*4
mov ecx, [ebp + 08h] ; flags
mov edx, [ebp + 0ch] ; timeout
VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pLockRange
VBOXSF_FARPTR_2_FLAT 14h, 2*4 ; pUnLockRange
VBOXSF_PSFFSD_2_FLAT 18h, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 1ch, 0*4 ; psffsi
call NAME(FS32_FILELOCKS)
VBOXSF_TO_16 FS_FILELOCKSL
VBOXSF_EP16_END FS_FILELOCKSL
; @cproto int FS_FINDCLOSE(PFSFSI pfsfsi, PVBOXSFFS pfsfsd);
VBOXSF_EP16_BEGIN FS_FINDCLOSE, 'FS_FINDCLOSE'
VBOXSF_TO_32 FS_FINDCLOSE, 2*4
VBOXSF_PFSFSD_2_FLAT 08h, 1*4 ; pfsfsd
VBOXSF_FARPTR_2_FLAT 0ch, 0*4 ; pfsfsi
call NAME(FS32_FINDCLOSE)
VBOXSF_TO_16 FS_FINDCLOSE
VBOXSF_EP16_END FS_FINDCLOSE
; @cproto int FS_FINDFIRST(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd, USHORT attr,
; PFSFSI pfsfsi, PVBOXSFFS pfsfsd, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
; USHORT level, USHORT flags);
VBOXSF_EP16_BEGIN FS_FINDFIRST, 'FS_FINDFIRST'
VBOXSF_TO_32 FS_FINDFIRST, 12*4
movzx ecx, word [ebp + 08h] ; flags
movzx edx, word [ebp + 0ah] ; level
VBOXSF_FARPTR_2_FLAT 0ch, 9*4 ; pcMatch
movzx eax, word [ebp + 10h] ; cbData
VBOXSF_FARPTR_2_FLAT 12h, 7*4 ; pbData
VBOXSF_FARPTR_2_FLAT 16h, 6*4 ; pfsfsd
VBOXSF_FARPTR_2_FLAT 1ah, 5*4 ; pfsfsi
movzx ecx, word [ebp + 1eh] ; attr
movzx edx, word [ebp + 20h] ; iCurDirEnd
VBOXSF_FARPTR_2_FLAT 22h, 2*4 ; pszName
VBOXSF_PCDFSD_2_FLAT 26h, 1*4 ; pcdfsd
VBOXSF_FARPTR_2_FLAT 2ah, 0*4 ; pcdfsi
call NAME(FS32_FINDFIRST)
VBOXSF_TO_16 FS_FINDFIRST
VBOXSF_EP16_END FS_FINDFIRST
; @cproto int FS_FINDFROMNAME(PFSFSI pfsfsi, PVBOXSFFS pfsfsd, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
; USHORT level, ULONG position, PCSZ pszName, USHORT flag)
VBOXSF_EP16_BEGIN FS_FINDFROMNAME, 'FS_FINDFROMNAME'
VBOXSF_TO_32 FS_FINDFROMNAME, 9*4
movzx ecx, word [ebp + 08h] ; flags
VBOXSF_FARPTR_2_FLAT 0ah, 7*4 ; pszName
mov edx, [ebp + 0eh] ; position
movzx eax, word [ebp + 12h] ; level
VBOXSF_FARPTR_2_FLAT 14h, 4*4 ; pcMatch
movzx eax, word [ebp + 18h] ; cbData
VBOXSF_FARPTR_2_FLAT 1ah, 2*4 ; pbData
VBOXSF_PFSFSD_2_FLAT 1eh, 1*4 ; pfsfsd
VBOXSF_FARPTR_2_FLAT 22h, 0*4 ; pfsfsi
call NAME(FS32_FINDFROMNAME)
VBOXSF_TO_16 FS_FINDFROMNAME
VBOXSF_EP16_END FS_FINDFROMNAME
; @cproto int FS_FINDNEXT(PFSFSI pfsfsi, PVBOXSFFS pfsfsd, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
; USHORT level, USHORT flag)
VBOXSF_EP16_BEGIN FS_FINDNEXT, 'FS_FINDNEXT'
VBOXSF_TO_32 FS_FINDNEXT, 7*4
movzx ecx, word [ebp + 08h] ; flags
movzx eax, word [ebp + 0ah] ; level
VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pcMatch
movzx eax, word [ebp + 10h] ; cbData
VBOXSF_FARPTR_2_FLAT 12h, 2*4 ; pbData
VBOXSF_PFSFSD_2_FLAT 16h, 1*4 ; pfsfsd
VBOXSF_FARPTR_2_FLAT 1ah, 0*4 ; pfsfsi
VBOXSF_EP16_END FS_FINDNEXT
; @cproto int FS_FINDNOTIFYCLOSE(USHORT handle);
VBOXSF_EP16_BEGIN FS_FINDNOTIFYCLOSE, 'FS_FINDNOTIFYCLOSE'
VBOXSF_TO_32 FS_FINDNOTIFYCLOSE, 1*4
movzx ecx, word [ebp + 08h] ; handle
call NAME(FS32_FINDNOTIFYCLOSE)
VBOXSF_TO_16 FS_FINDNOTIFYCLOSE
VBOXSF_EP16_END FS_FINDNOTIFYCLOSE
; @cproto int FS_FINDNOTIFYFIRST(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd, USHORT attr,
; PUSHORT pHandle, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
; USHORT level, USHORT flags);
VBOXSF_EP16_BEGIN FS_FINDNOTIFYFIRST, 'FS_FINDNOTIFYFIRST'
VBOXSF_TO_32 FS_FINDNOTIFYFIRST, 11*4
movzx ecx, word [ebp + 08h] ; flags
movzx edx, word [ebp + 0ah] ; level
VBOXSF_FARPTR_2_FLAT 0ch, 8*4 ; pcMatch
movzx eax, word [ebp + 10h] ; cbData
VBOXSF_FARPTR_2_FLAT 12h, 6*4 ; pbData
VBOXSF_FARPTR_2_FLAT 16h, 5*4 ; pHandle
movzx ecx, word [ebp + 1ah] ; attr
movzx edx, word [ebp + 1ch] ; iCurDirEnd
VBOXSF_FARPTR_2_FLAT 1eh, 2*4 ; pszName
VBOXSF_PCDFSD_2_FLAT 22h, 1*4 ; pcdfsd
VBOXSF_FARPTR_2_FLAT 26h, 0*4 ; pcdfsi
call NAME(FS32_FINDNOTIFYFIRST)
VBOXSF_TO_16 FS_FINDNOTIFYFIRST
VBOXSF_EP16_END FS_FINDNOTIFYFIRST
; @cproto int FS_FINDNOTIFYNEXT(USHORT handle, PBYTE pbData, USHORT cbData, PUSHORT pcMatch,
; USHORT level, ULONG timeout)
VBOXSF_EP16_BEGIN FS_FINDNOTIFYNEXT, 'FS_FINDNOTIFYNEXT'
VBOXSF_TO_32 FS_FINDNOTIFYNEXT, 6*4
mov ecx, [ebp + 08h] ; timeout
movzx edx, word [ebp + 0ch] ; level
VBOXSF_FARPTR_2_FLAT 0eh, 3*4 ; pcMatch
movzx eax, word [ebp + 12h] ; cbData
VBOXSF_FARPTR_2_FLAT 14h, 1*4 ; pbData
movzx ecx, word [ebp + 18h] ; handle
call NAME(FS32_FINDNOTIFYNEXT)
VBOXSF_TO_16 FS_FINDNOTIFYNEXT
VBOXSF_EP16_END FS_FINDNOTIFYNEXT
;; @cproto int FS_FLUSHBUF(USHORT hVPB, USHORT flag);
VBOXSF_EP16_BEGIN FS_FLUSHBUF, 'FS_FLUSHBUF'
VBOXSF_TO_32 FS_FLUSHBUF, 2*4
movzx edx, word [ebp + 08h] ; flag
movzx eax, word [ebp + 0ch] ; hVPB
VBOXSF_EP16_END FS_FLUSHBUF
;; @cproto int FS_FSCTL(union argdat far *pArgdat, USHORT iArgType, USHORT func,
; PVOID pParm, USHORT lenParm, PUSHORT plenParmIO,
; PVOID pData, USHORT lenData, PUSHORT plenDataIO);
VBOXSF_EP16_BEGIN FS_FSCTL, 'FS_FSCTL'
; Initialized ring-0 yet? (this is a likely first entry point)
test byte [NAME(g_fDoneRing0)], 1
call NAME(VBoxSFR0Init16Bit)
VBOXSF_TO_32 FS_FSCTL, 9*4
VBOXSF_FARPTR_2_FLAT 08h, 8*4 ; plenDataIO
movzx ecx, word [ebp + 0ch] ; lenData
VBOXSF_FARPTR_2_FLAT 0eh, 6*4 ; pData
VBOXSF_FARPTR_2_FLAT 12h, 5*4 ; plenDataIO
movzx ecx, word [ebp + 16h] ; lenData
VBOXSF_FARPTR_2_FLAT 18h, 3*4 ; pData
movzx edx, word [ebp + 1ch] ; func
movzx eax, word [ebp + 1eh] ; iArgType
VBOXSF_FARPTR_2_FLAT 20h, 0*4 ; pArgdat
;; @cproto int FS_FSINFO(USHORT flag, USHORT hVPB, PBYTE pbData, USHORT cbData, USHORT level)
VBOXSF_EP16_BEGIN FS_FSINFO, 'FS_FSINFO'
VBOXSF_TO_32 FS_FSINFO, 5*4
movzx ecx, word [ebp + 08h] ; level
movzx edx, word [ebp + 0ah] ; cbData
VBOXSF_FARPTR_2_FLAT 0ch, 2*4 ; pbData
movzx edx, word [ebp + 10h] ; hVPB
movzx eax, word [ebp + 12h] ; flag
VBOXSF_EP16_END FS_FSINFO
; @cproto int FS_IOCTL(PSFFSI psffsi, PVBOXSFFSD psffsd, USHORT cat, USHORT func,
; PVOID pParm, USHORT lenParm, PUSHORT plenParmIO,
; PVOID pData, USHORT lenData, PUSHORT plenDataIO);
VBOXSF_EP16_BEGIN FS_IOCTL, 'FS_IOCTL'
VBOXSF_TO_32 FS_IOCTL, 10*4
VBOXSF_FARPTR_2_FLAT 08h, 9*4 ; plenDataIO
movzx ecx, word [ebp + 0ch] ; lenData
VBOXSF_FARPTR_2_FLAT 0eh, 7*4 ; pData
VBOXSF_FARPTR_2_FLAT 12h, 6*4 ; plenDataIO
movzx ecx, word [ebp + 16h] ; lenData
VBOXSF_FARPTR_2_FLAT 18h, 4*4 ; pData
movzx edx, word [ebp + 1ch] ; cat
movzx eax, word [ebp + 1eh] ; func
VBOXSF_PSFFSD_2_FLAT 20h, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 24h, 0*4 ; pData
; @cproto int FS_MKDIR(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd,
; PBYTE pEABuf, USHORT flag);
VBOXSF_EP16_BEGIN FS_MKDIR, 'FS_MKDIR'
VBOXSF_TO_32 FS_MKDIR, 6*4
movzx ecx, word [ebp + 08h] ; flag
VBOXSF_FARPTR_2_FLAT 0ah, 4*4 ; pEABuf
movzx edx, word [ebp + 0eh] ; iCurDirEnd
VBOXSF_FARPTR_2_FLAT 10h, 2*4 ; pszName
VBOXSF_PCDFSD_2_FLAT 14h, 1*4 ; pcdfsd
VBOXSF_FARPTR_2_FLAT 18h, 0*4 ; pcdfsi
; @cproto int FS_MOUNT(USHORT flag, PVPFSI pvpfsi, PVBOXSFVP pvpfsd, USHORT hVPB, PCSZ pszBoot)
VBOXSF_EP16_BEGIN FS_MOUNT, 'FS_MOUNT'
; Initialized ring-0 yet? (this is a likely first entry point)
test byte [NAME(g_fDoneRing0)], 1
call NAME(VBoxSFR0Init16Bit)
VBOXSF_TO_32 FS_MOUNT, 5*4
VBOXSF_FARPTR_2_FLAT 08h, 4*4 ; pszBoot
movzx ecx, word [ebp + 0ch] ; hVPB
VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pvpfsd
VBOXSF_FARPTR_2_FLAT 12h, 1*4 ; pvpfsi
movzx ecx, word [ebp + 16h] ; flag
; @cproto int FS_MOVE(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszSrc, USHORT iSrcCurDirEnd
; PCSZ pszDst, USHORT iDstCurDirEnd, USHORT type)
VBOXSF_EP16_BEGIN FS_MOVE, 'FS_MOVE'
VBOXSF_TO_32 FS_MOVE, 7*4
movzx ecx, word [ebp + 08h] ; type
movzx edx, word [ebp + 0ah] ; iDstCurDirEnd
VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pszDst
movzx eax, word [ebp + 10h] ; iSrcCurDirEnd
VBOXSF_FARPTR_2_FLAT 12h, 2*4 ; pszSrc
VBOXSF_PCDFSD_2_FLAT 16h, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 1ah, 0*4 ; psffsi
; @cproto int FS_NEWSIZE(PSFFSI psffsi, PVBOXSFFSD psffsd, ULONG cbFile, USHORT IOflag);
VBOXSF_EP16_BEGIN FS_NEWSIZE, 'FS_NEWSIZE'
VBOXSF_TO_32 FS_NEWSIZE, 5*4 ; thunking to longlong edition.
movzx ecx, word [ebp + 08h] ; IOflag
mov eax, [ebp + 0ah] ; cbFile (ULONG -> LONGLONG)
VBOXSF_PSFFSD_2_FLAT 0eh, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; psffsi
VBOXSF_EP16_END FS_NEWSIZE
; @cproto int FS_NEWSIZEL(PSFFSI psffsi, PVBOXSFFSD psffsd, LONGLONG cbFile, USHORT IOflag);
VBOXSF_EP16_BEGIN FS_NEWSIZEL, 'FS_NEWSIZEL'
VBOXSF_TO_32 FS_NEWSIZEL, 5*4
movzx ecx, word [ebp + 08h] ; IOflag
mov eax, [ebp + 0ah] ; cbFile
VBOXSF_PSFFSD_2_FLAT 12h, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 16h, 0*4 ; psffsi
VBOXSF_EP16_END FS_NEWSIZEL
; @cproto int FS_NMPIPE(PSFFSI psffsi, PVBOXSFFSD psffsd, USHORT OpType, union npoper far *pOpRec,
; PBYTE pData, PCSZ pszName);
VBOXSF_EP16_BEGIN FS_NMPIPE, 'FS_NMPIPE'
VBOXSF_TO_32 FS_NMPIPE, 6*4
VBOXSF_FARPTR_2_FLAT 08h, 5*4 ; pszName
VBOXSF_FARPTR_2_FLAT 0ch, 4*4 ; pData
VBOXSF_FARPTR_2_FLAT 10h, 3*4 ; pOpRec
movzx ecx, word [ebp + 14h] ; OpType
VBOXSF_FARPTR_2_FLAT 16h, 1*4 ; psffsd (take care...)
VBOXSF_FARPTR_2_FLAT 1ah, 0*4 ; psffsi
VBOXSF_EP16_END FS_NMPIPE
; @cproto int FS_OPENCREATE(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd,
; PSFFSI psffsi, PVBOXSFFSD psffsd, ULONG ulOpenMode, USHORT usOpenFlag,
; PUSHORT pusAction, USHORT usAttr, PBYTE pcEABuf, PUSHORT pfgenflag);
VBOXSF_EP16_BEGIN FS_OPENCREATE, 'FS_OPENCREATE'
VBOXSF_TO_32 FS_OPENCREATE, 12*4
VBOXSF_FARPTR_2_FLAT 08h, 11*4 ; pfgenflag
VBOXSF_FARPTR_2_FLAT 0ch, 10*4 ; pcEABuf
movzx ecx, word [ebp + 10h] ; usAttr
VBOXSF_FARPTR_2_FLAT 12h, 8*4 ; pusAction
movzx edx, word [ebp + 16h] ; usOpenFlag
mov eax, [ebp + 18h] ; ulOpenMode
VBOXSF_FARPTR_2_FLAT 1ch, 5*4 ; psffsd (new, no short cuts)
VBOXSF_FARPTR_2_FLAT 20h, 4*4 ; psffsi
movzx ecx, word [ebp + 24h] ; iCurDirEnd
VBOXSF_FARPTR_2_FLAT 26h, 2*4 ; pszName
VBOXSF_PCDFSD_2_FLAT 2ah, 1*4 ; pcdfsd
VBOXSF_FARPTR_2_FLAT 2eh, 0*4 ; pcdfsi
call NAME(FS32_OPENCREATE)
VBOXSF_TO_16 FS_OPENCREATE
VBOXSF_EP16_END FS_OPENCREATE
; @cproto int FS_OPENPAGEFILE(PULONG pFlag, PULONG pcMaxReq, PCSZ pszName, PSFFSI psffsi, PVBOXSFFSD psffsd,
; USHORT ulOpenMode, USHORT usOpenFlag, USHORT usAttr, ULONG Reserved)
VBOXSF_EP16_BEGIN FS_OPENPAGEFILE, 'FS_OPENPAGEFILE'
VBOXSF_TO_32 FS_OPENPAGEFILE, 9*4
mov ecx, [ebp + 08h] ; Reserved
movzx edx, word [ebp + 0ch] ; usAttr
movzx eax, word [ebp + 0eh] ; usOpenFlag
movzx ecx, word [ebp + 10h] ; usOpenMode
VBOXSF_FARPTR_2_FLAT 12h, 4*4 ; psffsd (new, no short cuts)
VBOXSF_FARPTR_2_FLAT 16h, 3*4 ; psffsi
VBOXSF_FARPTR_2_FLAT 1ah, 2*4 ; pszName
VBOXSF_FARPTR_2_FLAT 1eh, 1*4 ; pcMaxReq
VBOXSF_FARPTR_2_FLAT 22h, 0*4 ; pFlag
call NAME(FS32_OPENPAGEFILE)
VBOXSF_TO_16 FS_OPENPAGEFILE
VBOXSF_EP16_END FS_OPENPAGEFILE
; @cproto int FS_PATHINFO(USHORT flag, PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnt,
; USHORT level, PBYTE pData, USHORT cbData);
VBOXSF_EP16_BEGIN FS_PATHINFO, 'FS_PATHINFO'
VBOXSF_TO_32 FS_PATHINFO, 8*4
movzx ecx, word [ebp + 08h] ; cbData
VBOXSF_FARPTR_2_FLAT 0ah, 6*4 ; pData
movzx edx, word [ebp + 0eh] ; level
movzx eax, word [ebp + 10h] ; iCurDirEnd
VBOXSF_FARPTR_2_FLAT 12h, 3*4 ; pszName
VBOXSF_PCDFSD_2_FLAT 16h, 2*4 ; pcdfsd
VBOXSF_FARPTR_2_FLAT 1ah, 1*4 ; pcdfsi
movzx edx, word [ebp + 1eh] ; flag
VBOXSF_EP16_END FS_PATHINFO
;; @cproto int FS_PROCESSNAME(PSZ pszName);
VBOXSF_EP16_BEGIN FS_PROCESSNAME, 'FS_PROCESSNAME'
VBOXSF_TO_32 FS_PROCESSNAME, 1*4
VBOXSF_FARPTR_2_FLAT 08h, 0*4 ; pszName
call NAME(FS32_PROCESSNAME)
VBOXSF_TO_16 FS_PROCESSNAME
VBOXSF_EP16_END FS_PROCESSNAME
; @cproto int FS_READ(PSFFSI psffsi, PVBOXSFFSD psffsd, PBYTE pbData, PUSHORT pcbData, USHORT IOflag)
VBOXSF_EP16_BEGIN FS_READ, 'FS_READ'
VBOXSF_TO_32 FS_READ, 6*4 ; extra local for ULONG cbDataTmp.
movzx ecx, word [ebp + 08h] ; IOflag
les dx, [ebp + 0ah] ; cbDataTmp = *pcbData;
lea ecx, [esp + 5*4] ; pcbData = &cbDataTmp
VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pbData
VBOXSF_PSFFSD_2_FLAT 12h, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 16h, 0*4 ; psffsi
les dx, [ebp + 0ah] ; *pcbData = cbDataTmp;
; @cproto int FS_RMDIR(PCDFSI pcdfsi, PVBOXSFCD pcdfsd, PCSZ pszName, USHORT iCurDirEnd);
VBOXSF_EP16_BEGIN FS_RMDIR, 'FS_RMDIR'
VBOXSF_TO_32 FS_RMDIR, 4*4
movzx edx, word [ebp + 08h] ; iCurDirEnd
VBOXSF_FARPTR_2_FLAT 0ah, 2*4 ; pszName
VBOXSF_PCDFSD_2_FLAT 0eh, 1*4 ; pcdfsd
VBOXSF_FARPTR_2_FLAT 12h, 0*4 ; pcdfsi
; @cproto int FS_SETSWAP(PSFFSI psffsi, PVBOXSFFSD psffsd);
VBOXSF_EP16_BEGIN FS_SETSWAP, 'FS_SETSWAP'
VBOXSF_TO_32 FS_SETSWAP, 2*4
VBOXSF_PSFFSD_2_FLAT 08h, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 0ch, 0*4 ; psffsi
VBOXSF_EP16_END FS_SETSWAP
; @cproto int FS_SHUTDOWN(USHORT type, ULONG reserved);
VBOXSF_EP16_BEGIN FS_SHUTDOWN, 'FS_SHUTDOWN'
VBOXSF_TO_32 FS_SHUTDOWN, 3*4
mov ecx, [ebp + 08h] ; type
movzx edx, word [ebp + 0ah] ; reserved
VBOXSF_EP16_END FS_SHUTDOWN
; @cproto int FS_WRITE(PSFFSI psffsi, PVBOXSFFSD psffsd, PBYTE pbData, PUSHORT pcbData, USHORT IOflag)
VBOXSF_EP16_BEGIN FS_WRITE, 'FS_WRITE'
VBOXSF_TO_32 FS_WRITE, 6*4 ; extra local for ULONG cbDataTmp.
movzx ecx, word [ebp + 08h] ; IOflag
les dx, [ebp + 0ah] ; cbDataTmp = *pcbData;
lea ecx, [esp + 5*4] ; pcbData = &cbDataTmp
VBOXSF_FARPTR_2_FLAT 0eh, 2*4 ; pbData
VBOXSF_PSFFSD_2_FLAT 12h, 1*4 ; psffsd
VBOXSF_FARPTR_2_FLAT 16h, 0*4 ; psffsi
les dx, [ebp + 0ah] ; *pcbData = cbDataTmp;
; @param pMiniFS [bp + 08h] The mini-FSD. (NULL)
; @param fpfnDevHlp [bp + 0ch] The address of the DevHlp router.
; @param pszCmdLine [bp + 10h] The
config.sys command line.
VBOXSF_EP16_BEGIN FS_INIT, 'FS_INIT'
; DEBUG_STR16 'VBoxSF: FS_INIT - enter'
; Save the device help entry point.
mov [NAME(g_fpfnDevHlp)], eax
; Parse the command line.
; Doing this in assembly is kind of ugly...
cmp word [bp + 10h + 2], 3
jbe near .no_command_line
lds si, [bp + 10h] ; ds:si -> command line iterator.
mov di, si ; DI = start of argument.
cmp al, 'V' ; /V - verbose
cmp al, 'Q' ; /Q - quiet.
mov byte [es:NAME(g_fVerbose)], 1
mov byte [es:NAME(g_fVerbose)], 0
db 0dh, 0ah, '
VBoxSF.ifs: command line parse error at: ', 0
mov ax, ERROR_INVALID_PARAMETER
; Write our greeting to STDOUT.
; APIRET _Pascal DosWrite(HFILE hf, PVOID pvBuf, USHORT cbBuf, PUSHORT pcbBytesWritten);
cmp byte [NAME(g_fVerbose)], 0
db 'VirtualBox Guest Additions IFS for OS/2', 0dh, 0ah, 0
DEBUG_STR16 'VBoxSF: FS_INIT - leave'
; @param es:bx String to print. (zero terminated)
; APIRET _Pascal DosWrite(HFILE hf, PVOID pvBuf, USHORT cbBuf, PUSHORT pcbBytesWritten);
mov ax, sp ; cbBytesWritten
push ss ; pcbBytesWritten
%if 0 ;
wlink/nasm generates a non-aliased fixup here which results in 16-bit offset with the flat 32-bit selector.
; convert flat pointer to a far pointer using the tiled algorithm.
mov eax, g_pfnDos16Write wrt FLAT
movzx eax, word [eax + 2] ; High word of the flat address (in DATA32).
mov [NAME(g_fpfnDos16Write) + 2], ax ; Update the selector (in DATA16).
call far [NAME(g_fpfnDos16Write)]
; 16-bit ring-0 init routine.
; Called from various entrypoints likely to be the first to be invoked.
GLOBALNAME VBoxSFR0Init16Bit
DEBUG_STR16 'VBoxSF: VBoxSFR0Init16Bit - enter'
mov byte [NAME(g_fDoneRing0)], 1
; Try attach to the VBoxGuest driver.
mov bx, NAME(g_szVBoxGuestName)
mov di, NAME(g_VBoxGuestAttachDD)
call far [NAME(g_fpfnDevHlp)]
push seg NAME(g_VBoxGuestIDC)
push NAME(g_VBoxGuestIDC)
call far [NAME(g_VBoxGuestAttachDD) + 6]
%ifndef DONT_LOCK_SEGMENTS
; Lock the two 16-bit segments.
; Wonder if this'll work if wlink could mark the two segments as ALIASed...
;call far FSH_FORCENOSWAP
;call far FSH_FORCENOSWAP
;jmp far dword NAME(VBoxSFR0Init16Bit_32) wrt FLAT
dd NAME(VBoxSFR0Init16Bit_32) ;wrt FLAT
GLOBALNAME VBoxSFR0Init16Bit_32
;jmp far dword NAME(VBoxSFR0Init16Bit_16) wrt CODE16
dw NAME(VBoxSFR0Init16Bit_16) wrt CODE16
GLOBALNAME VBoxSFR0Init16Bit_16
DEBUG_STR16 'VBoxSF: VBoxSFR0Init16Bit - leave'
ENDPROC VBoxSFR0Init16Bit
; print the string which offset is in AX (it's in the data segment).
mov dx, 0504h ; RTLOG_DEBUG_PORT