summaryrefslogtreecommitdiffstats
path: root/pathname.S
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-02-26 20:44:02 -0800
committerH. Peter Anvin <hpa@zytor.com>2013-02-26 20:44:02 -0800
commit584879fbf448b06be153ef09422626d489ae0702 (patch)
tree03c855a225d02eeb05c10d1d83d45689eda96d5d /pathname.S
parent40d6f2b0c1e594899ca94821012fa84679700b75 (diff)
downloadvirtio9p-584879fbf448b06be153ef09422626d489ae0702.tar.gz
virtio9p-584879fbf448b06be153ef09422626d489ae0702.tar.xz
virtio9p-584879fbf448b06be153ef09422626d489ae0702.zip
Code to generate a walk message; errno constants
Code to convert pathnames and to actually generate a walk message. The Rlerror message contains Linux errno constants, include them as macros.
Diffstat (limited to 'pathname.S')
-rw-r--r--pathname.S55
1 files changed, 55 insertions, 0 deletions
diff --git a/pathname.S b/pathname.S
new file mode 100644
index 0000000..9b6ec89
--- /dev/null
+++ b/pathname.S
@@ -0,0 +1,55 @@
+#include "v9fs.h"
+
+ .code16
+ .section ".rtext","ax"
+
+/* ------------------------------------------------------------------------- *
+ * 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.
+ * ------------------------------------------------------------------------- */
+
+ .globl genpath
+genpath:
+ pushw %bp
+ movw %sp,%bp
+ pushw %bx /* -2(%bp) - end of string */
+ pushw %di /* -4(%bp) - chunk count pointer */
+ pushw %ax /* -6(%bp) */
+
+ xorw %ax,%ax
+ stosw
+
+1:
+ cmpw -2(%bp),%si
+ jae 4f /* End of string */
+
+ stosw /* Chunk length */
+ movw %di,%bx /* Save pointer to chunk beginning */
+
+2:
+ fs lodsb
+ cmpb $0x5c,%al /* Backslash */
+ je 3f
+
+ call cptoutf
+ jmp 2b
+3:
+ /* Update chunk length */
+ movw %di,%ax
+ subw %bx,%ax
+ movw %ax,-2(%bx)
+
+ /* Update chunk count */
+ movw -4(%bp),%bx
+ incw (%bx)
+ jmp 1b
+4:
+ popw %ax
+ popw %di
+ popw %bx
+ popw %bp
+ retw
+ .size genpath,.-genpath
+ .type genpath,@function