summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-03-18 01:08:31 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2013-03-18 01:09:39 (GMT)
commit5aae4c665e6f7541f5126c9de2b3971e6e129cf7 (patch)
tree66fd4981bfa71367c958b373dae2e1a4861d3a17
parent4420a1bc0b335221680346af6ad7082ff2fd0273 (diff)
downloadvirtio9p-5aae4c665e6f7541f5126c9de2b3971e6e129cf7.zip
virtio9p-5aae4c665e6f7541f5126c9de2b3971e6e129cf7.tar.gz
virtio9p-5aae4c665e6f7541f5126c9de2b3971e6e129cf7.tar.bz2
virtio9p-5aae4c665e6f7541f5126c9de2b3971e6e129cf7.tar.xz
Diskspace function which actually seems to work...
Diskspace function which actually seems to work well enough. Also delete the qualify function -- we don't seem to ever need it.
-rw-r--r--Makefile9
-rw-r--r--acc.asm10
-rw-r--r--fxn.asm24
-rw-r--r--int2f.asm9
-rw-r--r--message.asm14
-rw-r--r--pathname.asm40
-rw-r--r--protomsg.asm27
-rw-r--r--v9fs.h1
8 files changed, 100 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 6f253c3..8029477 100644
--- a/Makefile
+++ b/Makefile
@@ -33,10 +33,12 @@ LD = ld
LDFLAGS = -m elf_i386 -z max-page-size=4096
OBJCOPY = objcopy
+XTOOLS := $(wildcard ../dostools/*.com ../dostools/*.exe)
+
OBJS = header.o start.o printmsg.o \
int2f.o acc.o fxn.o \
utf.o datetime.o \
- message.o
+ message.o protomsg.o pathname.o
.SUFFIXES: .s .asm .o .elf .lst .map .exe .img
@@ -66,12 +68,15 @@ cp/default.uni: cp
utf.o: cp/default.uni
-v9fs.img: v9fs.exe cp
+v9fs.img: v9fs.exe cp $(XTOOLS)
rm -f $@
qemu-img create -f raw $@ 1440K
mkdosfs -v -n V9FS $@
mcopy -i $@ v9fs.exe '::'
mcopy -i $@ cp/cp*.uni '::'
+ if [ -n '$(XTOOLS)' ]; then \
+ mcopy -i $@ $(XTOOLS) '::' ; \
+ fi
clean:
rm -f *.s *.o *.lst *.map *.elf *.exe *.img
diff --git a/acc.asm b/acc.asm
index dfaee91..8f77d42 100644
--- a/acc.asm
+++ b/acc.asm
@@ -130,13 +130,3 @@ GPROC(acc_cds_esdi)
movw F_ES,%fs
jmp acc_cds_common
END(acc_cds_esdi)
-
-/* ------------------------------------------------------------------------- *
- * acc_qualify
- * ------------------------------------------------------------------------- */
-
-GPROC(acc_qualify)
- movw F_SI,%si
- movw F_DS,%fs
- jmp acc_drive_common
-END(acc_qualify)
diff --git a/fxn.asm b/fxn.asm
index af04168..0c8a706 100644
--- a/fxn.asm
+++ b/fxn.asm
@@ -80,8 +80,15 @@ END(fxn_delete)
* ------------------------------------------------------------------------- */
GPROC(fxn_diskspace)
+ movw F_ES,%fs
+ movw F_DI,%si
+ addw %fs:CDS_ROOTOFFSET(%si),%si
+ movl $FID_DISKSPACE,%eax
+ pushl %eax
+ call path_walk
+
movw msgbuf7,%di
- movl $FID_ROOT,%eax
+ popl %eax
stosl
movb $P9_TSTATFS,%al
call simple_message
@@ -159,6 +166,9 @@ GPROC(fxn_diskspace)
movw %ax,F_CX /* Bytes/sector */
7:
+ movl $FID_DISKSPACE,%eax
+ call clunk
+
xorw %ax,%ax
retw
@@ -249,18 +259,6 @@ GPROC(fxn_open)
END(fxn_open)
/* ------------------------------------------------------------------------- *
- * fxn_qualify
- *
- * Qualify a pathname. Just return failure and let DOS do the default.
- * ------------------------------------------------------------------------- */
-
-GPROC(fxn_qualify)
- movl $0x06060001,%eax
- clc
- retw
-END(fxn_qualify)
-
-/* ------------------------------------------------------------------------- *
* fxn_readfile
* ------------------------------------------------------------------------- */
diff --git a/int2f.asm b/int2f.asm
index f4acd22..33e0163 100644
--- a/int2f.asm
+++ b/int2f.asm
@@ -121,11 +121,16 @@ LPROC(int2f_11) /* it is a redirector call */
lesw dos_sda,%bx
movb %cl,%es:3(%bx) /* Error locus */
movl %eax,%es:4(%bx) /* Error action:class:code */
+#ifdef DEBUG
jmp 3f
quit:
debugmsg "quit\r\n"
-3:
+ stc
+3:
+#else
+quit:
+#endif
lssw prev_stack,%sp
movb $0,stack_lock
@@ -188,7 +193,7 @@ dispatch_table:
.word acc_never, fxn_unknown /* 0x20 */
.word acc_file, fxn_skfmend
.word acc_never, fxn_unknown
- .word acc_qualify, fxn_qualify
+ .word acc_never, fxn_unknown
.word acc_never, fxn_unknown /* 0x24 */
.word acc_never, fxn_unknown
diff --git a/message.asm b/message.asm
index 5c2ecbd..dbd4119 100644
--- a/message.asm
+++ b/message.asm
@@ -105,6 +105,20 @@ GPROC(do_message)
movb %al,4(%si) /* Message opcode */
movw %cx,5(%si) /* Message tag */
+#ifdef DEBUG
+ /* Dump message */
+ pushaw
+ debugmsg "\r\n> "
+ movw %di,%cx
+411:
+ lodsb
+ pushw %ax
+ call debug_printhex2
+ loopw 411b
+ call debug_crlf
+ popaw
+#endif
+
/* Now build the descriptors */
movw vring_desc,%si
diff --git a/pathname.asm b/pathname.asm
index 1930f53..c13638a 100644
--- a/pathname.asm
+++ b/pathname.asm
@@ -31,10 +31,35 @@
.section ".rtext","ax"
/* ------------------------------------------------------------------------- *
+ * genpath_asciiz
+ *
+ * Convert a DOS-format path in FS:SI into a walk path in (ES|DS):DI
+ *
+ * The DOS path is expected to be an absolute path starting with \
+ * ------------------------------------------------------------------------- */
+GPROC(genpath_asciiz)
+ pushw %bx
+ pushw %ax
+ movw %si,%bx
+1:
+ movb %fs:(%bx),%al
+ incw %bx
+ andb %al,%al
+ jne 1b
+ decw %bx
+ popw %ax
+ call genpath
+ popw %bx
+ retw
+END(genpath_asciiz)
+
+/* ------------------------------------------------------------------------- *
* genpath
*
* Convert a DOS-format path in FS:SI into a walk path in (ES|DS):DI
* BX marks the end of the path to convert.
+ *
+ * The DOS path is expected to be an absolute path starting with \
* ------------------------------------------------------------------------- */
GPROC(genpath)
@@ -43,6 +68,19 @@ GPROC(genpath)
pushw %bx /* -2(%bp) - end of string */
pushw %di /* -4(%bp) - chunk count pointer */
pushw %ax /* -6(%bp) */
+
+#ifdef DEBUG
+ debugmsg "P: "
+ pushw %ds
+ pushw %fs
+ popw %ds
+ pushw %si
+ call debug_puts
+ popw %ds
+ call debug_crlf
+#endif
+
+ incw %si /* Skip leading backslash */
xorw %ax,%ax
stosw
@@ -73,7 +111,7 @@ GPROC(genpath)
jmp 1b
4:
popw %ax
- popw %di
+ popw %bx /* Drop saved %di */
popw %bx
popw %bp
retw
diff --git a/protomsg.asm b/protomsg.asm
index d76d85a..0d4f89b 100644
--- a/protomsg.asm
+++ b/protomsg.asm
@@ -33,27 +33,28 @@
/* ------------------------------------------------------------------------- *
* path_walk
*
- * Issue a walk message for the path in FS:SI.
+ * Issue a walk message for the path (absolute path starting in \) in FS:SI.
* BX marks the end of the path to convert, and EAX is the new fid.
+ * On successful exit, CF=0 and %al contains the QID type.
+ * On error, CF=1 and %ax contains the Linux error number.
* ------------------------------------------------------------------------- */
- .globl path_walk
-path_walk:
+GPROC(path_walk)
movw msgbuf7,%di
movl $FID_ROOT,(%di)
movl %eax,4(%di)
addw $8,%di
pushw %di
- call genpath
+ call genpath_asciiz
popw %si
- pushw (%di) /* Number of pathname chunks */
+ pushw (%si) /* Number of pathname chunks */
movb $P9_TWALK,%al
call simple_message
jc 1f /* Message error */
popw %dx
movw (%di),%cx /* %ax = nwqid */
imul $13,%cx,%bx /* Each qid is 13 bytes */
- movb $-11(%bx,%di),%al /* Type of the final QID */
+ movb -11(%bx,%di),%al /* Type of the final QID */
cmpw %dx,%cx
jne 2f
clc /* All good */
@@ -71,3 +72,17 @@ path_walk:
3:
stc
retw
+END(path_walk)
+
+/* ------------------------------------------------------------------------- *
+ * clunk
+ *
+ * Clunks the FID in %eax
+ * ------------------------------------------------------------------------- */
+
+GPROC(clunk)
+ movw msgbuf7,%di
+ stosl
+ movb $P9_TCLUNK,%al
+ jmp simple_message
+END(clunk)
diff --git a/v9fs.h b/v9fs.h
index cef0cbd..c3a4851 100644
--- a/v9fs.h
+++ b/v9fs.h
@@ -298,6 +298,7 @@
/* FID numbers we use */
#define FID_ROOT 2
+#define FID_DISKSPACE 3
/* Invocation frame assuming prev_stack is loaded into gs:bp */
#define F_GS %gs:(%bp)