diff options
| author | Richard Miller <miller.research@gmail.com> | 2020-11-09 11:33:44 +0000 |
|---|---|---|
| committer | Richard Miller <miller.research@gmail.com> | 2020-11-09 11:33:44 +0000 |
| commit | 2a571cc0ece4073eb56d5ccfc3e061a09a353e13 (patch) | |
| tree | 7daccd0dac9144a55a00570e3fb11af7f0862659 /utils/libmach/executable.c | |
| parent | ed97654bd7a11d480b44505c8300d06b42e5fefe (diff) | |
Add riscv and riscv64 support to libmach
Diffstat (limited to 'utils/libmach/executable.c')
| -rw-r--r-- | utils/libmach/executable.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/utils/libmach/executable.c b/utils/libmach/executable.c index b9954f0a..2734cf44 100644 --- a/utils/libmach/executable.c +++ b/utils/libmach/executable.c @@ -65,6 +65,8 @@ extern Mach mamd64; extern Mach marm; extern Mach mpower; extern Mach mpower64; +extern Mach mriscv; +extern Mach mriscv64; ExecTable exectab[] = { @@ -203,6 +205,24 @@ ExecTable exectab[] = sizeof(Exec), leswal, armdotout }, + { Z_MAGIC, /* riscv i.out */ + "riscv executable", + nil, + FRISCV, + 0, + &mriscv, + sizeof(Exec), + beswal, + common }, + { Y_MAGIC, /* riscv j.out */ + "riscv64 executable", + nil, + FRISCV64, + 0, + &mriscv64, + sizeof(Exec), + beswal, + common }, { 0 }, }; @@ -357,6 +377,12 @@ commonboot(Fhdr *fp) fp->name = "amd64 plan 9 boot image"; fp->dataddr = _round(fp->txtaddr+fp->txtsz, mach->pgsize); break; + case FRISCV: + fp->type = FRISCVB; + fp->txtaddr = (u32int)fp->entry; + fp->name = "riscv plan 9 boot image"; + fp->dataddr = _round(fp->txtaddr+fp->txtsz, mach->pgsize); + break; default: return; } @@ -580,6 +606,10 @@ elfdotout(int fd, Fhdr *fp, ExecHdr *hp) mach = &marm; fp->type = FARM; break; + case RISCV: + mach = &mriscv; + fp->type = FRISCV; + break; default: return 0; } |
