summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-03-18 03:54:03 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2013-03-18 03:56:03 (GMT)
commite18ab632a9b45689f5b92b67c94c2bfef726868c (patch)
tree22ff062660299277c2ac5c6f6bfe56254f2e1b41
parent57c693d2d06451540db9fe688262db8fe1e01de7 (diff)
downloadvirtio9p-e18ab632a9b45689f5b92b67c94c2bfef726868c.zip
virtio9p-e18ab632a9b45689f5b92b67c94c2bfef726868c.tar.gz
virtio9p-e18ab632a9b45689f5b92b67c94c2bfef726868c.tar.bz2
virtio9p-e18ab632a9b45689f5b92b67c94c2bfef726868c.tar.xz
Include a mask of non-permitted filename characters
Include a bitmask specifying filename disallowed bytes. We use this as the starting point for canonmap; we can clear bits but won't set them.
-rw-r--r--utf.asm29
1 files changed, 24 insertions, 5 deletions
diff --git a/utf.asm b/utf.asm
index 6de0d82..c050f22 100644
--- a/utf.asm
+++ b/utf.asm
@@ -161,8 +161,28 @@ GPROC(utftocp)
retw
END(utftocp)
- lrbuf cptoutftbl, 512+32, 2
-canonmap = cptoutftbl + 512
+ lrbuf cptoutftbl, 512, 2
+
+ .section ".rdata","aw"
+ .balign 2
+
+ /*
+ * Bytes permitted in filenames - not counting case effects.
+ * Note: DOS permits a spaces in filenames, but the rules are
+ * infernally complicated. For now, just disallow them.
+ */
+canonmap:
+ .long 0x00000000 /* Control characters */
+ .long 0x03ff23fa /* Numbers, specials */
+ .long 0xc7ffffff /* Upper case & co */
+ .long 0xefffffff /* Lower case & co */
+ .long 0xffffffff /* Extended characters */
+ .long 0xffffffff
+ .long 0xffffffff
+ .long 0xffffffff
+
+ .type canonmap,@object
+ .size canonmap,.-canonmap
/* ------------------------------------------------------------------------- *
* Unicode table
@@ -237,10 +257,9 @@ GPROC(utf_init_case)
movw $cptoutftbl,%di
2:
movzbw uctable(%bx),%si
- btrw %bx,canonmap
cmpw %bx,%si /* Is this canonical? */
- jne 3f
- btsw %bx,canonmap /* 1 in map = canonical */
+ je 3f
+ btcw %bx,canonmap /* Not canonical */
3:
btw %si,lcbitmap /* Is alternate case lower case? */
jnc 4f