summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-02-25 04:55:02 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2013-02-25 04:55:02 (GMT)
commitbdb86406343d11deee1c8de8fd0e15a64fa1666b (patch)
treeebd231e25f757f97d25805082d1765bddd4ae842
parentea40dc090a1303cde1871c39070e2ec5cdd88cfb (diff)
downloadvirtio9p-bdb86406343d11deee1c8de8fd0e15a64fa1666b.zip
virtio9p-bdb86406343d11deee1c8de8fd0e15a64fa1666b.tar.gz
virtio9p-bdb86406343d11deee1c8de8fd0e15a64fa1666b.tar.bz2
virtio9p-bdb86406343d11deee1c8de8fd0e15a64fa1666b.tar.xz
acc.S: complete the accept test functions
Complete the various accept test functions, except that we do not yet test for character devices in acc_other.
-rw-r--r--acc.S52
-rw-r--r--start.S11
2 files changed, 54 insertions, 9 deletions
diff --git a/acc.S b/acc.S
index dcc28c4..e0fe95b 100644
--- a/acc.S
+++ b/acc.S
@@ -19,24 +19,44 @@ acc_always:
/* ------------------------------------------------------------------------- *
* acc_file
+ *
+ * Check drive in the System File Table
* ------------------------------------------------------------------------- */
.globl acc_file
acc_file:
- stc
- retw
-
+ movw F_DI,%si
+ movw F_ES,%fs
+ addw $5,%si /* Byte 5 in SFT entry = drive */
+ /* fall through */
.size acc_file,.-acc_file
.type acc_file,@function
+ /*
+ * Available for multiple users of a modified drive number
+ * at %fs:(%si) - specifically a zero-based drive number where
+ * bit 6 is expected to be set for a conforming redirector.
+ */
+acc_drive_common:
+ movb %fs:(%si),%al /* Device info word (low half) */
+ andb $0x5f,%al /* Drive number + conforming bit (6) */
+ incw %ax
+ cmpb drive_letter,%al
+ jne acc_fail
+ /* CF = 0 if equal */
+ retw
+ .size acc_drive_common,.-acc_drive_common
+ .type acc_drive_common,@function
+
/* ------------------------------------------------------------------------- *
* acc_findnext
* ------------------------------------------------------------------------- */
.globl acc_findnext
acc_findnext:
- stc
- retw
+ lfsw dos_sdafn,%si
+ addw $0x100,%si /* First byte in srcrec = drive no */
+ jmp acc_drive_common
.size acc_findnext,.-acc_findnext
.type acc_findnext,@function
@@ -45,11 +65,12 @@ acc_findnext:
* acc_never
*
* This is never for us; either we don't support it or we don't do
- * anything with it anyway.
+ * anything with it anyway.
* ------------------------------------------------------------------------- */
.globl acc_never
acc_never:
+acc_fail: /* Used as common tail */
stc
retw
@@ -61,11 +82,23 @@ fxn_unknown = acc_never
/* ------------------------------------------------------------------------- *
* acc_other
+ *
+ * The SDA contains a copy of the CDS for the current access - use it to
+ * determine if this is for us.
* ------------------------------------------------------------------------- */
.globl acc_other
acc_other:
- stc
+ lfsw dos_sdafn,%si
+ cmpw $CDS_MAGIC,%fs:(0x135 + 0x45)(%si) /* Our magic? */
+ jne acc_fail
+ movb drive_letter,%al
+ cmpb %al,%fs:(0x135+0)(%si) /* Our drive letter? */
+ jne acc_fail
+ cmpw $0x5c3a,%fs:(0x135+1)(%si) /* Path starts with X:\? */
+ jne acc_fail
+ /* XXX: check for a character device */
+ /* CF = 0 if equal */
retw
.size acc_other,.-acc_other
@@ -77,8 +110,9 @@ acc_other:
.globl acc_qualify
acc_qualify:
- stc
- retw
+ movw F_SI,%si
+ movw F_DS,%fs
+ jmp acc_drive_common
.size acc_qualify,.-acc_qualify
.type acc_qualify,@function
diff --git a/start.S b/start.S
index e1833d2..6bfd423 100644
--- a/start.S
+++ b/start.S
@@ -167,6 +167,7 @@ tag_too_long:
* drive is available
* ------------------------------------------------------------------------- */
grblong dos_sda /* Pointer to Swappable Data Area */
+ grblong dos_sdafn /* Pointer to first filename in SDA */
liblong dos_lol /* Pointer to List of Lists */
liblong dos_cds /* Pointer to Current Directory Structures */
liblong our_cds /* Pointer to our own CDS */
@@ -177,9 +178,19 @@ get_dos_bits:
pushw %ds
movw $0x5d06,%ax /* Get SDA pointer */
+ cmpb $4,dos_version+1 /* DOS 4.x? */
+ pushfw
+ jne 1f
+ movb $0x0e,%al /* DOS 4.x only: function 0x5d0e not 0x5d06 */
int $0x21
movw %si,%cs:dos_sda
movw %ds,%cs:dos_sda+2
+ addw $0x92,%si /* DOS 3.x: searchdata @ 0x92 */
+ popfw /* DOS 4+? */
+ jb 1f
+ addw $(0x9e-0x92),%si
+ movw %si,%cs:dos_sdafn
+ movw %ds,%cs:dos_sdafn+2
movw $0x5200,%ax
int $0x21 /* Get list of lists pointer */