Add Instructions for PIC Support #15

Closed
opened 2023-09-15 23:24:59 +00:00 by InfernoDeity · 0 comments

Add the following instructions to the ISA, to support generation of PIC and PIE code. In all instructions PC is computed from the byte immediately following the last byte of the instruction

| Instruction Name | Mode | Effects |
|==================|======|========================|
| LRA | BBD |#1 <- #2 + imm #3 + PC|
| LDR | BBDH | #0 <- imm #4 [#2 + imm #3 + PC] |
| STR | BBDH | imm #4 [#2 + imm #3 + PC] |
| JMPR | D | Jumps tp #1 + PC |
| JALR | BBD | #0 <- PC Jumps to #1 + imm #2 + PC |
| JEQR | BBD | If #0 == #1 Jumps to imm #2 + PC |
| JNER | BBD | If #0 != #1 Jumps to imm #2 + PC |
| JLTR | BBD | If #0 < #1 (signed) Jumps to imm #2 + PC |
| JGTR | BBD | If #0 > #1 (signed) Jumps to imm #2 + PC |
| JLTUR | BBD | If #0 < #1 (unsigned) Jumps to imm #2 + PC |
| JGTUR | BBD | If #0 > #1 (unsigned) Jumps to imm #2 + PC |

Also add relaxed 8-bit and 32-bit version replacing the D operand with B or W respectively, for more compact codegen in common cases. Suggested mnemonics: _8 (IE. LRA8) and _32 (IE. LRA32)

Add the following instructions to the ISA, to support generation of PIC and PIE code. In all instructions `PC` is computed from the byte immediately following the last byte of the instruction | Instruction Name | Mode | Effects | |==================|======|========================| | LRA | BBD |`#1 <- #2 + imm #3 + PC`| | LDR | BBDH | `#0 <- imm #4 [#2 + imm #3 + PC]` | | STR | BBDH | `imm #4 [#2 + imm #3 + PC]` | | JMPR | D | Jumps tp `#1 + PC` | | JALR | BBD | `#0 <- PC` Jumps to `#1 + imm #2 + PC` | | JEQR | BBD | If `#0 == #1` Jumps to `imm #2 + PC` | | JNER | BBD | If `#0 != #1` Jumps to `imm #2 + PC` | | JLTR | BBD | If `#0 < #1` (signed) Jumps to `imm #2 + PC` | | JGTR | BBD | If `#0 > #1` (signed) Jumps to `imm #2 + PC` | | JLTUR | BBD | If `#0 < #1` (unsigned) Jumps to `imm #2 + PC` | | JGTUR | BBD | If `#0 > #1` (unsigned) Jumps to `imm #2 + PC` | Also add relaxed 8-bit and 32-bit version replacing the D operand with B or W respectively, for more compact codegen in common cases. Suggested mnemonics: `_8` (IE. `LRA8`) and `_32` (IE. `LRA32`)
Ghost closed this issue 2023-10-01 01:56:16 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: AbleOS/holey-bytes#15
There is no content yet.