summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-03-06 03:31:52 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2013-03-06 03:31:52 (GMT)
commit88a77633e643602cdf631fb432d5e5fffbb6a48c (patch)
tree3a4cdec4b671d40efdf748c8fb10049437c5378b
parent331a16cba36fafd32babbbd543398f3575d52a91 (diff)
downloadvirtio9p-88a77633e643602cdf631fb432d5e5fffbb6a48c.zip
virtio9p-88a77633e643602cdf631fb432d5e5fffbb6a48c.tar.gz
virtio9p-88a77633e643602cdf631fb432d5e5fffbb6a48c.tar.bz2
virtio9p-88a77633e643602cdf631fb432d5e5fffbb6a48c.tar.xz
Use procedure start/end macros
Use procedure start/end macros instead of opencoding all the directives.
-rw-r--r--acc.asm46
-rw-r--r--datetime.asm7
-rw-r--r--fxn.asm161
-rw-r--r--header.asm4
-rw-r--r--int2f.asm14
-rw-r--r--message.asm17
-rw-r--r--pathname.asm6
-rw-r--r--printmsg.asm46
-rw-r--r--start.asm8
-rw-r--r--utf.asm22
-rw-r--r--v9fs.h6
11 files changed, 115 insertions, 222 deletions
diff --git a/acc.asm b/acc.asm
index 23c0b4d..b36ded7 100644
--- a/acc.asm
+++ b/acc.asm
@@ -36,13 +36,10 @@
* Always accept an incoming request.
* ------------------------------------------------------------------------- */
- .globl acc_always
-acc_always:
+GPROC(acc_always)
clc
retw
-
- .size acc_always,.-acc_always
- .type acc_always,@function
+END(acc_always)
/* ------------------------------------------------------------------------- *
* acc_file
@@ -50,21 +47,19 @@ acc_always:
* Check drive in the System File Table
* ------------------------------------------------------------------------- */
- .globl acc_file
-acc_file:
+GPROC(acc_file)
movw F_DI,%si
movw F_ES,%fs
addw $SFT_DEVINFO,%si /* Byte 5 in SFT entry = drive */
/* fall through */
- .size acc_file,.-acc_file
- .type acc_file,@function
+END(acc_file)
/*
* 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:
+LPROC(acc_drive_common)
movb %fs:(%si),%al /* Device info word (low half) */
andb $0x5f,%al /* Drive number + conforming bit (6) */
incw %ax
@@ -72,21 +67,17 @@ acc_drive_common:
jne acc_fail
/* CF = 0 if equal */
retw
- .size acc_drive_common,.-acc_drive_common
- .type acc_drive_common,@function
+END(acc_drive_common)
/* ------------------------------------------------------------------------- *
* acc_findnext
* ------------------------------------------------------------------------- */
- .globl acc_findnext
-acc_findnext:
+GPROC(acc_findnext)
lfsw dos_sdafn,%si
addw $SDN_SEARCHDATA,%si /* First byte in srcrec = drive no */
jmp acc_drive_common
-
- .size acc_findnext,.-acc_findnext
- .type acc_findnext,@function
+END(acc_findnext)
/* ------------------------------------------------------------------------- *
* acc_never
@@ -95,14 +86,11 @@ acc_findnext:
* anything with it anyway.
* ------------------------------------------------------------------------- */
- .globl acc_never
-acc_never:
+GPROC(acc_never)
acc_fail: /* Used as common tail */
stc
retw
-
- .size acc_never,.-acc_never
- .type acc_never,@function
+END(acc_never)
.globl fxn_unknown
fxn_unknown = acc_never
@@ -114,8 +102,7 @@ fxn_unknown = acc_never
* determine if this is for us.
* ------------------------------------------------------------------------- */
- .globl acc_cds
-acc_cds:
+GPROC(acc_cds)
lfsw dos_sdafn,%si
addw $SDN_CDS,%si
cmpw $CDS_MAGIC,%fs:CDS_DPBPTR(%si) /* Our magic? */
@@ -128,19 +115,14 @@ acc_cds:
/* XXX: check for a character device */
/* CF = 0 if equal */
retw
-
- .size acc_cds,.-acc_cds
- .type acc_cds,@function
+END(acc_cds)
/* ------------------------------------------------------------------------- *
* acc_qualify
* ------------------------------------------------------------------------- */
- .globl acc_qualify
-acc_qualify:
+GPROC(acc_qualify)
movw F_SI,%si
movw F_DS,%fs
jmp acc_drive_common
-
- .size acc_qualify,.-acc_qualify
- .type acc_qualify,@function
+END(acc_qualify)
diff --git a/datetime.asm b/datetime.asm
index 162eaf2..e95f01e 100644
--- a/datetime.asm
+++ b/datetime.asm
@@ -39,8 +39,7 @@
* offset. Input & output in %eax, all other regs preserved.
* ------------------------------------------------------------------------- */
- .globl unix2dos
-unix2dos:
+GPROC(unix2dos)
pushl %edx
pushl %ecx
pushw %bx /* Accumulator for date */
@@ -146,6 +145,4 @@ unix2dos:
movw $0x21,%ax /* 1980-01-01 */
xorw %si,%si /* 00:00:00 */
jmp 4b
-
- .size unix2dos,.-unix2dos
- .type unix2dos,@function
+END(unix2dos)
diff --git a/fxn.asm b/fxn.asm
index b5b80f7..b518ea2 100644
--- a/fxn.asm
+++ b/fxn.asm
@@ -34,109 +34,82 @@
* fxn_chdir
* ------------------------------------------------------------------------- */
- .globl fxn_chdir
-fxn_chdir:
+GPROC(fxn_chdir)
stc
retw
-
- .size fxn_chdir,.-fxn_chdir
- .type fxn_chdir,@function
+END(fxn_chdir)
/* ------------------------------------------------------------------------- *
* fxn_closefile
* ------------------------------------------------------------------------- */
- .globl fxn_closefile
-fxn_closefile:
+GPROC(fxn_closefile)
stc
retw
-
- .size fxn_closefile,.-fxn_closefile
- .type fxn_closefile,@function
+END(fxn_closefile)
/* ------------------------------------------------------------------------- *
* fxn_commitfile
* ------------------------------------------------------------------------- */
- .globl fxn_commitfile
-fxn_commitfile:
+GPROC(fxn_commitfile)
stc
retw
-
- .size fxn_commitfile,.-fxn_commitfile
- .type fxn_commitfile,@function
+END(fxn_commitfile)
/* ------------------------------------------------------------------------- *
* fxn_create
* ------------------------------------------------------------------------- */
- .globl fxn_create
-fxn_create:
+GPROC(fxn_create)
stc
retw
-
- .size fxn_create,.-fxn_create
- .type fxn_create,@function
+END(fxn_create)
/* ------------------------------------------------------------------------- *
* fxn_delete
* ------------------------------------------------------------------------- */
- .globl fxn_delete
-fxn_delete:
+GPROC(fxn_delete)
stc
retw
-
- .size fxn_delete,.-fxn_delete
- .type fxn_delete,@function
+END(fxn_delete)
/* ------------------------------------------------------------------------- *
* fxn_diskspace
* ------------------------------------------------------------------------- */
- .globl fxn_diskspace
-fxn_diskspace:
+GPROC(fxn_diskspace)
stc
retw
-
- .size fxn_diskspace,.-fxn_diskspace
- .type fxn_diskspace,@function
+END(fxn_diskspace)
/* ------------------------------------------------------------------------- *
* fxn_findfirst
* ------------------------------------------------------------------------- */
- .globl fxn_findfirst
-fxn_findfirst:
+GPROC(fxn_findfirst)
stc
retw
-
- .size fxn_findfirst,.-fxn_findfirst
- .type fxn_findfirst,@function
+END(fxn_findfirst)
/* ------------------------------------------------------------------------- *
* fxn_findnext
* ------------------------------------------------------------------------- */
- .globl fxn_findnext
-fxn_findnext:
+GPROC(fxn_findnext)
stc
retw
-
- .size fxn_findnext,.-fxn_findnext
- .type fxn_findnext,@function
+END(fxn_findnext)
/* ------------------------------------------------------------------------- *
* fxn_getattr
* ------------------------------------------------------------------------- */
- .globl fxn_getattr
-fxn_getattr:
+GPROC(fxn_getattr)
stc
retw
-
- .size fxn_getattr,.-fxn_getattr
- .type fxn_getattr,@function
+END(fxn_getattr)
/* ------------------------------------------------------------------------- *
* fxn_inquiry
@@ -144,50 +117,38 @@ fxn_getattr:
* Indicate that a redirector is present, but that more can be installed.
* ------------------------------------------------------------------------- */
- .globl fxn_inquiry
-fxn_inquiry:
+GPROC(fxn_inquiry)
movb $0xff,F_AL /* Redirector installed, OK to install more */
xorw %ax,%ax /* No error (AX=0), no chain (CF=0) */
retw
-
- .size fxn_inquiry,.-fxn_inquiry
- .type fxn_inquiry,@function
+END(fxn_inquiry)
/* ------------------------------------------------------------------------- *
* fxn_lockfile
* ------------------------------------------------------------------------- */
- .globl fxn_lockfile
-fxn_lockfile:
+GPROC(fxn_lockfile)
stc
retw
-
- .size fxn_lockfile,.-fxn_lockfile
- .type fxn_lockfile,@function
+END(fxn_lockfile)
/* ------------------------------------------------------------------------- *
* fxn_mkdir
* ------------------------------------------------------------------------- */
- .globl fxn_mkdir
-fxn_mkdir:
+GPROC(fxn_mkdir)
stc
retw
-
- .size fxn_mkdir,.-fxn_mkdir
- .type fxn_mkdir,@function
+END(fxn_mkdir)
/* ------------------------------------------------------------------------- *
* fxn_open
* ------------------------------------------------------------------------- */
- .globl fxn_open
-fxn_open:
+GPROC(fxn_open)
stc
retw
-
- .size fxn_open,.-fxn_open
- .type fxn_open,@function
+END(fxn_open)
/* ------------------------------------------------------------------------- *
* fxn_qualify
@@ -195,120 +156,90 @@ fxn_open:
* Qualify a pathname. Just return failure and let DOS do the default.
* ------------------------------------------------------------------------- */
- .globl fxn_qualify
-fxn_qualify:
+GPROC(fxn_qualify)
movl $0x06060001,%eax
clc
retw
-
- .size fxn_qualify,.-fxn_qualify
- .type fxn_qualify,@function
+END(fxn_qualify)
/* ------------------------------------------------------------------------- *
* fxn_readfile
* ------------------------------------------------------------------------- */
- .globl fxn_readfile
-fxn_readfile:
+GPROC(fxn_readfile)
stc
retw
-
- .size fxn_readfile,.-fxn_readfile
- .type fxn_readfile,@function
+END(fxn_readfile)
/* ------------------------------------------------------------------------- *
* fxn_rename
* ------------------------------------------------------------------------- */
- .globl fxn_rename
-fxn_rename:
+GPROC(fxn_rename)
stc
retw
-
- .size fxn_rename,.-fxn_rename
- .type fxn_rename,@function
+END(fxn_rename)
/* ------------------------------------------------------------------------- *
* fxn_rmdir
* ------------------------------------------------------------------------- */
- .globl fxn_rmdir
-fxn_rmdir:
+GPROC(fxn_rmdir)
stc
retw
-
- .size fxn_rmdir,.-fxn_rmdir
- .type fxn_rmdir,@function
+END(fxn_rmdir)
/* ------------------------------------------------------------------------- *
* fxn_setattr
* ------------------------------------------------------------------------- */
- .globl fxn_setattr
-fxn_setattr:
+GPROC(fxn_setattr)
stc
retw
-
- .size fxn_setattr,.-fxn_setattr
- .type fxn_setattr,@function
+END(fxn_setattr)
/* ------------------------------------------------------------------------- *
* fxn_skfmend
* ------------------------------------------------------------------------- */
- .globl fxn_skfmend
-fxn_skfmend:
+GPROC(fxn_skfmend)
stc
retw
-
- .size fxn_skfmend,.-fxn_skfmend
- .type fxn_skfmend,@function
+END(fxn_skfmend)
/* ------------------------------------------------------------------------- *
* fxn_spopenfile
* ------------------------------------------------------------------------- */
- .globl fxn_spopenfile
-fxn_spopenfile:
+GPROC(fxn_spopenfile)
stc
retw
-
- .size fxn_spopenfile,.-fxn_spopenfile
- .type fxn_spopenfile,@function
+END(fxn_spopenfile)
/* ------------------------------------------------------------------------- *
* fxn_unknown_2d
* ------------------------------------------------------------------------- */
- .globl fxn_unknown_2d
-fxn_unknown_2d:
+GPROC(fxn_unknown_2d)
movw $2,F_AX /* This is what MSCDEX returns */
xorw %ax,%ax /* No error (AX=0), no chain (CF=0) */
retw
-
- .size fxn_unknown_2d,.-fxn_unknown_2d
- .type fxn_unknown_2d,@function
+END(fxn_unknown_2d)
/* ------------------------------------------------------------------------- *
* fxn_unlockfile
* ------------------------------------------------------------------------- */
- .globl fxn_unlockfile
-fxn_unlockfile:
+GPROC(fxn_unlockfile)
stc
retw
-
- .size fxn_unlockfile,.-fxn_unlockfile
- .type fxn_unlockfile,@function
+END(fxn_unlockfile)
/* ------------------------------------------------------------------------- *
* fxn_writefile
* ------------------------------------------------------------------------- */
- .globl fxn_writefile
-fxn_writefile:
+GPROC(fxn_writefile)
stc
retw
-
- .size fxn_writefile,.-fxn_writefile
- .type fxn_writefile,@function
+END(fxn_writefile)
diff --git a/header.asm b/header.asm
index a4c0bc7..e2fea74 100644
--- a/header.asm
+++ b/header.asm
@@ -52,7 +52,11 @@ __reloc:
__header_end:
.section ".heap","aw"
+ .if HEAP_SIZE > 0
.space HEAP_SIZE
+ .endif
.section ".stack","aw"
+ .if STACK_SIZE > 0
.space STACK_SIZE
+ .endif
diff --git a/int2f.asm b/int2f.asm
index 2f41e0c..ee373e8 100644
--- a/int2f.asm
+++ b/int2f.asm
@@ -35,19 +35,17 @@
#define MAX_FUNCTION 0x2E
.section ".rtext","ax"
- .globl int2f
- .globl int2f_chain
-int2f:
+GPROC(int2f)
cmpb $0x11,%ah
je int2f_11
not_us:
.byte 0xea /* ljmpw */
+ .globl int2f_chain
int2f_chain:
.long 0
- .size int2f, .-int2f
- .type int2f,@function
+END(int2f)
-int2f_11: /* it is a redirector call */
+LPROC(int2f_11) /* it is a redirector call */
cmpb $MAX_FUNCTION,%ah
ja not_us
btsw $0,%cs:stack_lock
@@ -119,8 +117,7 @@ quit:
popal
jc not_us
iret
- .size int2f_11, .-int2f_11
- .type int2f_11,@function
+END(int2f_11)
lrbword stack_lock /* Local stack is busy */
@@ -188,4 +185,5 @@ dispatch_table:
.word acc_file, fxn_unknown_2d
.word acc_cds, fxn_spopenfile
+ .type dispatch_table, @object
.size dispatch_table, .-dispatch_table
diff --git a/message.asm b/message.asm
index 12275bc..5c2ecbd 100644
--- a/message.asm
+++ b/message.asm
@@ -60,16 +60,12 @@ de_ranges = data_edds + 0x10
/* The VERSION message must have tag 0xffff by protocol */
grdword last_tag 0xfffe
- .globl simple_message
-simple_message:
+GPROC(simple_message)
xorb %ah,%ah /* No data in or out */
/* fall through */
- .size simple_message,.-simple_message
- .type simple_message,@function
-
- .globl do_message
-do_message:
+END(simple_message)
+GPROC(do_message)
/* VDS input entries */
movw %bx,de_offset
@@ -196,6 +192,7 @@ error:
stc
ok:
retw
+END(do_message)
/* ------------------------------------------------------------------------- *
* Convert the EDDS to virtio descriptor format
@@ -203,7 +200,7 @@ ok:
* %si points to the first unused virtio descriptor both before & after
* %ah = 1 for output, 2 for input
* ------------------------------------------------------------------------- */
-edds_to_virtio:
+LPROC(edds_to_virtio)
pushl %edx
pushw %ax
pushw %cx
@@ -230,6 +227,4 @@ edds_to_virtio:
popw %ax
popl %edx
retw
-
- .size edds_to_virtio,.-edds_to_virtio
- .type edds_to_virtio,@function
+END(edds_to_virtio)
diff --git a/pathname.asm b/pathname.asm
index dd666c2..1930f53 100644
--- a/pathname.asm
+++ b/pathname.asm
@@ -37,8 +37,7 @@
* BX marks the end of the path to convert.
* ------------------------------------------------------------------------- */
- .globl genpath
-genpath:
+GPROC(genpath)
pushw %bp
movw %sp,%bp
pushw %bx /* -2(%bp) - end of string */
@@ -78,5 +77,4 @@ genpath:
popw %bx
popw %bp
retw
- .size genpath,.-genpath
- .type genpath,@function
+END(genpath)
diff --git a/printmsg.asm b/printmsg.asm
index 4293877..f936856 100644
--- a/printmsg.asm
+++ b/printmsg.asm
@@ -36,20 +36,18 @@
* Print a message (pointer on the stack) on standard error, prefixed by
* "v9fs: "
* ------------------------------------------------------------------------- */
- .globl puterr
-puterr:
+GPROC(puterr)
printmsg "v9fs: "
/* Fall through */
- .size puterr,.-puterr
- .type puterr,@function
+END(puterr)
/* ------------------------------------------------------------------------- *
* puts
*
* Print a message (pointer on the stack) on standard error.
* ------------------------------------------------------------------------- */
- .globl puts
-puts:
+
+GPROC(puts)
pushaw
movw %sp,%bp
movw 18(%bp),%di
@@ -73,17 +71,15 @@ puts:
2:
popaw
retw $2
-
- .size puts,.-puts
- .type puts,@function
+END(puts)
/* ------------------------------------------------------------------------- *
* printnum
*
* Print an unsigned 32-bit integer on the stack
* ------------------------------------------------------------------------- */
- .globl printnum
-printnum:
+
+GPROC(printnum)
pushl %eax
pushl %edx
pushl %ecx
@@ -113,17 +109,15 @@ printnum:
popl %edx
popl %eax
retw $4
-
- .size printnum,.-printnum
- .type printnum,@function
+END(printnum)
/* ------------------------------------------------------------------------- *
* printhex4
*
* Print an hexadecimal 4-digit number from the stack
* ------------------------------------------------------------------------- */
- .globl printhex4
-printhex4:
+
+GPROC(printhex4)
pushw %ax
pushw %cx
pushw %dx
@@ -154,17 +148,15 @@ printhex4:
popw %cx
popw %ax
retw $2
-
- .size printhex4,.-printhex4
- .type printhex4,@function
+END(printhex4)
/* ------------------------------------------------------------------------- *
* printhex8
*
* Print an hexadecimal 8-digit number from the stack
* ------------------------------------------------------------------------- */
- .globl printhex8
-printhex8:
+
+GPROC(printhex8)
pushw %bp
movw %sp,%bp
pushw 6(%bp)
@@ -173,19 +165,15 @@ printhex8:
call printhex4
popw %bp
retw $4
-
- .size printhex8,.-printhex8
- .type printhex8,@function
+END(printhex8)
/* ------------------------------------------------------------------------- *
* crlf
*
* Print a newline
* ------------------------------------------------------------------------- */
- .globl crlf
-crlf:
+
+GPROC(crlf)
printmsg "\r\n"
retw
-
- .size crlf,.-crlf
- .type crlf,@function
+END(crlf)
diff --git a/start.asm b/start.asm
index 668467d..8ce964a 100644
--- a/start.asm
+++ b/start.asm
@@ -35,8 +35,7 @@
.section ".textearly","ax"
/* _start must be position-independent */
- .globl _start
-_start:
+GPROC(_start)
push %es /* Save PSP segment */
movw %cs,%ax
movw %ax,%ds
@@ -57,6 +56,7 @@ _start:
/* This has to be absolute, so we can't just jmp */
movw $start,%di
jmp *%di
+END(_start)
.section ".text","ax"
start:
@@ -76,13 +76,13 @@ start:
movw $psp,%di
movw $(256/4),%cx
fs rep movsl
-
+
/* ------------------------------------------------------------------------- *
* Check DOS specifics
* ------------------------------------------------------------------------- */
gibword dos_version
-check_dos_ok:
+check_dos_ok:
/* Check DOS version */
movw $0x3000,%ax
int $0x21
diff --git a/utf.asm b/utf.asm
index e324b10..6de0d82 100644
--- a/utf.asm
+++ b/utf.asm
@@ -40,8 +40,7 @@
* for plain ASCII characters.
* ------------------------------------------------------------------------- */
- .globl cptoutf
-cptoutf:
+GPROC(cptoutf)
pushw %bx
movzbw %al,%bx
addw %bx,%bx
@@ -82,9 +81,7 @@ cptoutf:
stosb
popw %bx
retw
-
- .size cptoutf,.-cptoutf
- .type cptoutf,@function
+END(cptoutf)
/* ------------------------------------------------------------------------- *
* utftocp
@@ -97,7 +94,7 @@ cptoutf:
* gets converted to lowercase and transmitted as U+0061 ('a').
* ------------------------------------------------------------------------- */
-utftocp:
+GPROC(utftocp)
pushw %cx
pushw %dx
@@ -162,6 +159,7 @@ utftocp:
popw %dx
popw %cx
retw
+END(utftocp)
lrbuf cptoutftbl, 512+32, 2
canonmap = cptoutftbl + 512
@@ -201,22 +199,17 @@ lcbitmap = unicasetable + 2*256 /* Case-swap is to lower case */
.section ".text","ax"
- .globl utf_init_plain
-utf_init_plain:
+GPROC(utf_init_plain)
movw $unitable,%si
movw $cptoutftbl,%di
movw $(512/4),%cx
rep movsl
retw
-
- .size utf_init_plain,.-utf_init_plain
- .type utf_init_plain,@function
-
- .globl utf_init_case
+END(utf_init_plain)
libuf uctbl, 5, 1
-utf_init_case:
+GPROC(utf_init_case)
pushaw
cmpw $0x31e,dos_version /* Use case table from DOS? */
@@ -261,3 +254,4 @@ utf_init_case:
popaw
retw
+END(utf_init_case)
diff --git a/v9fs.h b/v9fs.h
index 48b1bd5..3ef7ad5 100644
--- a/v9fs.h
+++ b/v9fs.h
@@ -335,6 +335,12 @@
/* Magic number we store in the CDS */
#define CDS_MAGIC 0xe882
+/* Procedure wrappers */
+#define GLOBAL(x) .globl x ; x ## :
+#define GPROC(x) .globl x ; .type x,@function ; x ## :
+#define LPROC(x) .type x,@function ; x ## :
+#define END(x) .size x,.-x
+
/*
* Macros to print out a message and an error
*/