ref: f8fd3d5d28472644f87484c3e7ef921fc31e0af5
parent: dfb4b522830edab8f3856289d326d6cf5e930644
author: Keegan Saunders <[email protected]>
date: Sun Oct 1 13:26:43 EDT 2023
7l: use wider INITTEXT and INITDAT Currently we use a 32-bit value for these values which means that large values passed to -T will be truncated and sign-extended, rather than stored verbatim. This means load addresses in between low 2GB and high 2GB will not be respected. It appears this has been fixed in 6l already, so we can leave it alone.
--- a/sys/src/cmd/7l/asm.c
+++ b/sys/src/cmd/7l/asm.c
@@ -45,8 +45,8 @@
asmb(void)
{
Prog *p;
- long magic, etext;
- vlong vl;
+ long magic;
+ vlong vl, etext;
Optab *o;
uchar *sbuf, *dbuf;
@@ -382,9 +382,9 @@
void
asmlc(void)
{
- long oldpc, oldlc;
+ vlong oldpc;
Prog *p;
- long v, s;
+ long v, s, oldlc;
oldpc = INITTEXT;
oldlc = 0;
--- a/sys/src/cmd/7l/l.h
+++ b/sys/src/cmd/7l/l.h
@@ -253,10 +253,10 @@
EXTERN long HEADR; /* length of header */
EXTERN int HEADTYPE; /* type of header */
-EXTERN long INITDAT; /* data location */
+EXTERN vlong INITDAT; /* data location */
EXTERN long INITRND; /* data round above text location */
-EXTERN long INITTEXT; /* text location */
-EXTERN long INITTEXTP; /* text location (physical) */
+EXTERN vlong INITTEXT; /* text location */
+EXTERN vlong INITTEXTP; /* text location (physical) */
EXTERN char* INITENTRY; /* entry point */
EXTERN long autosize;
EXTERN Biobuf bso;
--- a/sys/src/cmd/7l/obj.c
+++ b/sys/src/cmd/7l/obj.c
@@ -162,10 +162,10 @@
if (INITTEXTP == -1)
INITTEXTP = INITTEXT;
if(INITDAT != 0 && INITRND != 0)
- print("warning: -D0x%lux is ignored because of -R0x%lux\n",
+ print("warning: -D0x%llux is ignored because of -R0x%lux\n",
INITDAT, INITRND);
if(debug['v'])
- Bprint(&bso, "HEADER = -H0x%d -T0x%lux -D0x%lux -R0x%lux\n",
+ Bprint(&bso, "HEADER = -H0x%d -T0x%llux -D0x%llux -R0x%lux\n",
HEADTYPE, INITTEXT, INITDAT, INITRND);
Bflush(&bso);
zprg.as = AGOK;
--- a/sys/src/cmd/7l/span.c
+++ b/sys/src/cmd/7l/span.c
@@ -21,7 +21,8 @@
Sym *setext, *s;
Optab *o;
int m, bflag, i;
- long c, otxt, v;
+ vlong c, otxt;
+ long v;
if(debug['v'])
Bprint(&bso, "%5.2f span\n", cputime());