aboutsummaryrefslogtreecommitdiff
path: root/libgloss/mips
diff options
context:
space:
mode:
Diffstat (limited to 'libgloss/mips')
-rw-r--r--libgloss/mips/array.ld2
-rw-r--r--libgloss/mips/crt0.S46
-rw-r--r--libgloss/mips/ddb-kseg0.ld2
-rw-r--r--libgloss/mips/ddb.ld2
-rw-r--r--libgloss/mips/dve.ld2
-rw-r--r--libgloss/mips/idt.ld2
-rw-r--r--libgloss/mips/idt32.ld2
-rw-r--r--libgloss/mips/idt64.ld2
-rw-r--r--libgloss/mips/idtecoff.ld2
-rw-r--r--libgloss/mips/jmr3904app-java.ld2
-rw-r--r--libgloss/mips/jmr3904app.ld2
-rw-r--r--libgloss/mips/jmr3904dram-java.ld2
-rw-r--r--libgloss/mips/jmr3904dram.ld2
-rw-r--r--libgloss/mips/lsi.ld2
-rw-r--r--libgloss/mips/nullmon.ld2
-rw-r--r--libgloss/mips/pmon.ld2
16 files changed, 75 insertions, 1 deletions
diff --git a/libgloss/mips/array.ld b/libgloss/mips/array.ld
index 4675105..8390621 100644
--- a/libgloss/mips/array.ld
+++ b/libgloss/mips/array.ld
@@ -74,6 +74,8 @@ PROVIDE (__stack = 1M - 8);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/crt0.S b/libgloss/mips/crt0.S
index 8bd46eb..1cc4304 100644
--- a/libgloss/mips/crt0.S
+++ b/libgloss/mips/crt0.S
@@ -54,11 +54,13 @@
*/
nop
+ .globl hardware_hazard_hook .text
.globl _start
.ent _start
_start:
.set noreorder
#ifdef __mips_embedded_pic
+#define PICBASE start_PICBASE
PICBASE = .+8
bal PICBASE
nop
@@ -75,6 +77,14 @@ _start:
mtc0 zero, C0_CAUSE
nop
+ /* Avoid hazard from FPU enable and other SR changes. */
+ LA (t0, hardware_hazard_hook)
+ beq t0,zero,1f
+ nop
+ jal t0
+ nop
+1:
+
/* Check for FPU presence. Don't check if we know that soft_float is
being used. (This also avoids illegal instruction exceptions.) */
@@ -97,6 +107,12 @@ _start:
li v0, (STATUS_MASK-(STATUS_MASK & SR_CU1))
mtc0 v0, C0_SR
nop
+ /* Avoid hazard from FPU disable. */
+ LA (t0, hardware_hazard_hook)
+ beq t0,zero,2f
+ nop
+ jal t0
+ nop
2:
@@ -205,6 +221,11 @@ init:
# destructors
move a0,v0 # pass through the exit code
.end init
+
+/* Assume the PICBASE set up above is no longer valid below here. */
+#ifdef __mips_embedded_pic
+#undef PICBASE
+#endif
/*
* _exit -- Exit from the application. Normally we cause a user trap
@@ -214,14 +235,32 @@ init:
* executables that contain a complete world to be linked with
* just the crt0.o object.
*/
+ .globl hardware_exit_hook .text
.globl _exit
.ent _exit
_exit:
7:
+#ifdef __mips_embedded_pic
+ /* Need to reinit PICBASE, since we might be called via exit()
+ rather than via a return path which would restore old s0. */
+#define PICBASE exit_PICBASE
+ PICBASE = .+8
+ bal PICBASE
+ nop
+ move s0,$31
+#endif
#ifdef GCRT0
- jal _mcleanup
+ LA (t0, _mcleanup)
+ jal t0
nop
#endif
+ LA (t0, hardware_exit_hook)
+ beq t0,zero,1f
+ nop
+ jal t0
+ nop
+1:
+
# break instruction can cope with 0xfffff, but GAS limits the range:
break 1023
nop
@@ -229,4 +268,9 @@ _exit:
nop
.end _exit
+/* Assume the PICBASE set up above is no longer valid below here. */
+#ifdef __mips_embedded_pic
+#undef PICBASE
+#endif
+
/* EOF crt0.S */
diff --git a/libgloss/mips/ddb-kseg0.ld b/libgloss/mips/ddb-kseg0.ld
index 420fb6f..86e0965 100644
--- a/libgloss/mips/ddb-kseg0.ld
+++ b/libgloss/mips/ddb-kseg0.ld
@@ -22,6 +22,8 @@ PROVIDE (__stack = 0);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/ddb.ld b/libgloss/mips/ddb.ld
index 73dbad9..a433781 100644
--- a/libgloss/mips/ddb.ld
+++ b/libgloss/mips/ddb.ld
@@ -22,6 +22,8 @@ PROVIDE (__stack = 0);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/dve.ld b/libgloss/mips/dve.ld
index a09eeee..c3e63e7 100644
--- a/libgloss/mips/dve.ld
+++ b/libgloss/mips/dve.ld
@@ -22,6 +22,8 @@ PROVIDE (__stack = 0);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/idt.ld b/libgloss/mips/idt.ld
index 5dd26fa..6ca3749 100644
--- a/libgloss/mips/idt.ld
+++ b/libgloss/mips/idt.ld
@@ -23,6 +23,8 @@ PROVIDE (__stack = 0);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/idt32.ld b/libgloss/mips/idt32.ld
index 4214b7b..a8f31c3 100644
--- a/libgloss/mips/idt32.ld
+++ b/libgloss/mips/idt32.ld
@@ -25,6 +25,8 @@ PROVIDE (__stack = 0);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/idt64.ld b/libgloss/mips/idt64.ld
index 751c0f1..aa2f1ba 100644
--- a/libgloss/mips/idt64.ld
+++ b/libgloss/mips/idt64.ld
@@ -25,6 +25,8 @@ PROVIDE (__stack = 0);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/idtecoff.ld b/libgloss/mips/idtecoff.ld
index 08534d2..2910db6 100644
--- a/libgloss/mips/idtecoff.ld
+++ b/libgloss/mips/idtecoff.ld
@@ -25,6 +25,8 @@ PROVIDE (__stack = 0);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/jmr3904app-java.ld b/libgloss/mips/jmr3904app-java.ld
index b23d8e3..c5d9515 100644
--- a/libgloss/mips/jmr3904app-java.ld
+++ b/libgloss/mips/jmr3904app-java.ld
@@ -22,6 +22,8 @@ PROVIDE (_Jv_QthreadsStackSize = 0x10000);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/jmr3904app.ld b/libgloss/mips/jmr3904app.ld
index f5808fd..387d38f 100644
--- a/libgloss/mips/jmr3904app.ld
+++ b/libgloss/mips/jmr3904app.ld
@@ -19,6 +19,8 @@ PROVIDE (_mem_size = 0x100000); /* JMR3904 comes as standard with 512k of RAM */
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/jmr3904dram-java.ld b/libgloss/mips/jmr3904dram-java.ld
index ce9595d..3cd84a4 100644
--- a/libgloss/mips/jmr3904dram-java.ld
+++ b/libgloss/mips/jmr3904dram-java.ld
@@ -23,6 +23,8 @@ PROVIDE (_Jv_QthreadsStackSize = 0x10000);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/jmr3904dram.ld b/libgloss/mips/jmr3904dram.ld
index cf28364..4322f6f 100644
--- a/libgloss/mips/jmr3904dram.ld
+++ b/libgloss/mips/jmr3904dram.ld
@@ -20,6 +20,8 @@ PROVIDE (_mem_size = 0x100000); /* JMR3904 comes as standard with 512k of RAM */
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/lsi.ld b/libgloss/mips/lsi.ld
index c567157..74bc594 100644
--- a/libgloss/mips/lsi.ld
+++ b/libgloss/mips/lsi.ld
@@ -23,6 +23,8 @@ PROVIDE (__stack = 0);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/nullmon.ld b/libgloss/mips/nullmon.ld
index 82d8016..1fc1ae7 100644
--- a/libgloss/mips/nullmon.ld
+++ b/libgloss/mips/nullmon.ld
@@ -23,6 +23,8 @@ PROVIDE (__stack = 0);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);
diff --git a/libgloss/mips/pmon.ld b/libgloss/mips/pmon.ld
index f8dc54b..54ce95d 100644
--- a/libgloss/mips/pmon.ld
+++ b/libgloss/mips/pmon.ld
@@ -23,6 +23,8 @@ PROVIDE (__stack = 0);
* We have to initalize them twice, so we multiple object file
* formats, as some prepend an underscore.
*/
+PROVIDE (hardware_exit_hook = 0);
+PROVIDE (hardware_hazard_hook = 0);
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0);