-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Having an actual linkable `libgcc.a` allows this port to define a separate `crt0.S` startup routine which sets up the stack pointer and halts the machine after `main()` finishes running. This commit fixes some bugs along the way, most notably: * missing bss from the linker script * missing COMMON from the linker script (required for the `.lcomm` asm directive) * miscellaneous bugs in the `c-test-arithmetic` sample Signed-off-by: Filip Kokosiński <[email protected]>
- Loading branch information
1 parent
669911c
commit 4347b61
Showing
15 changed files
with
86 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,56 @@ | ||
int x = 21; | ||
int y = 37; | ||
|
||
void _start(void) | ||
void main(void) | ||
{ | ||
/* TODO: handle sp/fp init better -- separate crt0.S? */ | ||
asm volatile ("law 03000"); | ||
asm volatile ("dac 0131"); | ||
asm volatile ("law 04000"); | ||
asm volatile ("dac 0130"); | ||
|
||
/* test addition with two variables */ | ||
*(volatile int *)(01000) = x + y; | ||
*(volatile int *)(02000) = x + y; | ||
|
||
/* test addition with an immediate value */ | ||
*(volatile int *)(01001) = x + 20; | ||
*(volatile int *)(02001) = x + 20; | ||
|
||
/* test addition with an immediate value equal 1 */ | ||
*(volatile int *)(01002) = x + 1; | ||
*(volatile int *)(02002) = x + 1; | ||
|
||
/* test subtraction with two variables */ | ||
*(volatile int *)(01003) = y - x; | ||
*(volatile int *)(02003) = y - x; | ||
|
||
/* test subtraction with an immediate value */ | ||
*(volatile int *)(01004) = y - 10; | ||
*(volatile int *)(02004) = y - 10; | ||
|
||
/* test multiplication with two variables */ | ||
*(volatile int *)(01005) = x * y; | ||
*(volatile int *)(02005) = x * y; | ||
|
||
/* test division with two variables */ | ||
*(volatile int *)(01006) = y / x; | ||
*(volatile int *)(02006) = y / x; | ||
|
||
/* test modulo with two variables */ | ||
*(volatile int *)(01007) = y % x; | ||
*(volatile int *)(02007) = y % x; | ||
|
||
/* test logical negation with a variable */ | ||
*(volatile int *)(01010) = ~x; | ||
*(volatile int *)(02010) = ~x; | ||
|
||
/* test logical and with two variables */ | ||
*(volatile int *)(01011) = x & y; | ||
*(volatile int *)(02011) = x & y; | ||
|
||
/* test logical and with an immediate value */ | ||
*(volatile int *)(01012) = x & 12; | ||
*(volatile int *)(02012) = x & 12; | ||
|
||
/* test logical or with two variables */ | ||
*(volatile int *)(01013) = x | y; | ||
*(volatile int *)(02013) = x | y; | ||
|
||
/* test logical or with an immediate value */ | ||
*(volatile int *)(01014) = x | 12; | ||
*(volatile int *)(02014) = x | 12; | ||
|
||
/* test logical xor with two variables */ | ||
*(volatile int *)(01015) = x ^ y; | ||
*(volatile int *)(02015) = x ^ y; | ||
|
||
/* test logical xor with an immediate value */ | ||
*(volatile int *)(01016) = x ^ 12; | ||
*(volatile int *)(02016) = x ^ 12; | ||
|
||
/* test shift left */ | ||
*(volatile int *)(01016) = x << 6; | ||
*(volatile int *)(02017) = x << 6; | ||
|
||
/* test shift right */ | ||
*(volatile int *)(01017) = x >> 3; | ||
|
||
asm volatile ("hlt"); | ||
__builtin_unreachable(); | ||
*(volatile int *)(02020) = x >> 3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.global _start | ||
_start: | ||
# stack pointer | ||
law _stack_end | ||
dac 0131 | ||
|
||
# jump to main | ||
jsp main | ||
|
||
# stop | ||
hlt |
Submodule pdp1-gcc
updated
13 files
+6 −0 | config.sub | |
+2 −0 | configure.ac | |
+4 −4 | gcc/config/pdp1/pdp1-modes.def | |
+2 −11 | gcc/config/pdp1/pdp1.h | |
+12 −10 | gcc/config/pdp1/pdp1.md | |
+17 −13 | libgcc/Makefile.in | |
+3 −3 | libgcc/config.host | |
+15 −0 | libgcc/config/pdp1/crti.S | |
+7 −0 | libgcc/config/pdp1/crtn.S | |
+49 −0 | libgcc/config/pdp1/lib1funcs.S | |
+11 −0 | libgcc/config/pdp1/t-pdp1 | |
+3 −3 | libgcc/crtstuff.c | |
+37 −37 | libgcc/hardcfr.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters