summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-07-28 21:14:58 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-07-28 21:14:58 -0700
commit42d675278612cd573565015c41914bd6b3362678 (patch)
treef85c3df1922d27d8c9db6a2532a65684402bb18b
parent49654eaa3ccafff8ed51516ccc7c5bce210ce668 (diff)
downloadsamples-42d675278612cd573565015c41914bd6b3362678.tar.gz
samples-42d675278612cd573565015c41914bd6b3362678.tar.xz
samples-42d675278612cd573565015c41914bd6b3362678.zip
testme.s: add a far text function for testing
-rw-r--r--testme.s21
1 files changed, 18 insertions, 3 deletions
diff --git a/testme.s b/testme.s
index 6f41edd..99bec5d 100644
--- a/testme.s
+++ b/testme.s
@@ -7,6 +7,14 @@
.SEG._DATA:
.SEG._BSS:
+ .section "testme_TEXT","ax"
+.L.SEG = .
+ .globl _farfunc, "_farfunc!"
+.set "_farfunc!", .L.SEG
+_farfunc: /* Far function */
+ mov %cs,%ax
+ lret
+
.section "_TEXT!","a"
.balign 16
.SEG._TEXT: /* Local symbol! */
@@ -20,7 +28,14 @@ ___start:
mov $0,%ax
.reloc .-2, R_386_SEG16, .SEG.DGROUP
mov %ax,%ds
- nop
+
+ /* gas doesn't handle lcall with symbols */
+ .byte 0x9a
+ .word _farfunc
+ .reloc .-2, R_386_SUB16, "_farfunc!"
+ .word 0
+ .reloc .-2, R_386_SEG16, "_farfunc!"
+
nop
nop
nop
@@ -67,12 +82,12 @@ _get_cmdline:
mov $__psp + 127,%dx
.reloc .-2, R_386_SUB16, "__psp!"
ret
-
+
.section "_DATA$","aw"
.balign 2
.L.SEG = .SEG._DATA
-.set "_other!", .L.SEG
+.set "_other!", .L.SEG
_other: .word 0x5678
.set "_foo!", .L.SEG
_foo: .word 0x1234