2018-04-19 13:24:26 +02:00
|
|
|
/*
|
|
|
|
Linker script for the fx9860g platform. Most of the symbols defined
|
|
|
|
here are used in the initialization routine in core/start.c; others are
|
|
|
|
used in core/setup.c.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* fx9860g may mean SH3 or SH4 and we want full compatibility */
|
|
|
|
OUTPUT_ARCH(sh3)
|
|
|
|
/* ELF offers a lot of symbol/section/relocation insights */
|
|
|
|
OUTPUT_FORMAT(elf32-sh)
|
|
|
|
/* Located in core/start.c */
|
|
|
|
ENTRY(_start)
|
|
|
|
|
|
|
|
MEMORY
|
|
|
|
{
|
2020-06-15 20:55:18 +02:00
|
|
|
/* Userspace mapping of the add-in (G1A header takes 0x200 bytes) */
|
|
|
|
rom (rx): o = 0x00300200, l = 500k
|
kernel: dynamic loading of GMAPPED functions to user RAM
This commit introduces a large architectural change. Unlike previous
models of the fx-9860G series, the G-III models have a new user RAM
address different from 8801c000. The purpose of this change is to
dynamically load GMAPPED functions to this address by querying the TLB,
and call them through a function pointer whose address is determined
when loading.
Because of the overhead of using a function pointer in both assembly and
C code, changes have been made to avoid GMAPPED functions altogether.
Current, only cpu_setVBR() and gint_inth_callback() are left, the second
being used specifically to enable TLB misses when needed.
* Add a .gint.mappedrel section for the function pointers holding
addresses to GMAPPED functions; add function pointers for
cpu_setVBR() and gint_inth_callback()
* Move rram to address 0 instead of the hardcoded 0x8801c000
* Load GMAPPED functions at their linked address + the physical address
user RAM is mapped, to and compute their function pointers
* Remove the GMAPPED macro since no user function needs it anymore
* Add section flags "ax" (code) or "aw" (data) to every custom .section
in assembler code, as they default to unpredictable values that can
cause the section to be marked NOLOAD by the linker
* Update the main kernel, TMU, ETMU and RTC interrupt handlers to use
the new indirect calling method
This is made possible by new MMU functions giving direct access to the
physical area behind any virtualized page.
* Add an mmu_translate() function to query the TLB
* Add an mmu_uram() function to access user RAM from P1
The exception catching mechanism has been modified to avoid the use of
GMAPPED functions altogether.
* Set SR.BL=0 and SR.IMASK=15 before calling exception catchers
* Move gint_exc_skip() to normal text ROM
* Also fix registers not being popped off the stack before a panic
The timer drivers have also been modified to avoid GMAPPED functions.
* Invoke timer_stop() through gint_inth_callback() and move it to ROM
* Move and expand the ETMU driver to span 3 blocks at 0xd00 (ETMU4)
* Remove the timer_clear() function by inlining it into the ETMU handler
(TCR is provided within the storage block of each timer)
* Also split src/timer/inth.s into src/timer/inth-{tmu,etmu}.s
Additionally, VBR addresses are now determined at runtime to further
reduce hardcoded memory layout addresses in the linker script.
* Determine fx-9860G VBR addresses dynamically from mmu_uram()
* Determine fx-CG 50 VBR addresses dynamically from mmu_uram()
* Remove linker symbols for VBR addresses
Comments and documentation have been updated throughout the code to
reflect the changes.
2020-09-17 14:48:54 +02:00
|
|
|
|
2021-02-15 09:39:14 +01:00
|
|
|
/* User RAM is mapped at 0x08100000 through MMU; usually 8k on SH3, 32k
|
|
|
|
on SH4. This script exposes only 6k to the user, reserving:
|
kernel: dynamic loading of GMAPPED functions to user RAM
This commit introduces a large architectural change. Unlike previous
models of the fx-9860G series, the G-III models have a new user RAM
address different from 8801c000. The purpose of this change is to
dynamically load GMAPPED functions to this address by querying the TLB,
and call them through a function pointer whose address is determined
when loading.
Because of the overhead of using a function pointer in both assembly and
C code, changes have been made to avoid GMAPPED functions altogether.
Current, only cpu_setVBR() and gint_inth_callback() are left, the second
being used specifically to enable TLB misses when needed.
* Add a .gint.mappedrel section for the function pointers holding
addresses to GMAPPED functions; add function pointers for
cpu_setVBR() and gint_inth_callback()
* Move rram to address 0 instead of the hardcoded 0x8801c000
* Load GMAPPED functions at their linked address + the physical address
user RAM is mapped, to and compute their function pointers
* Remove the GMAPPED macro since no user function needs it anymore
* Add section flags "ax" (code) or "aw" (data) to every custom .section
in assembler code, as they default to unpredictable values that can
cause the section to be marked NOLOAD by the linker
* Update the main kernel, TMU, ETMU and RTC interrupt handlers to use
the new indirect calling method
This is made possible by new MMU functions giving direct access to the
physical area behind any virtualized page.
* Add an mmu_translate() function to query the TLB
* Add an mmu_uram() function to access user RAM from P1
The exception catching mechanism has been modified to avoid the use of
GMAPPED functions altogether.
* Set SR.BL=0 and SR.IMASK=15 before calling exception catchers
* Move gint_exc_skip() to normal text ROM
* Also fix registers not being popped off the stack before a panic
The timer drivers have also been modified to avoid GMAPPED functions.
* Invoke timer_stop() through gint_inth_callback() and move it to ROM
* Move and expand the ETMU driver to span 3 blocks at 0xd00 (ETMU4)
* Remove the timer_clear() function by inlining it into the ETMU handler
(TCR is provided within the storage block of each timer)
* Also split src/timer/inth.s into src/timer/inth-{tmu,etmu}.s
Additionally, VBR addresses are now determined at runtime to further
reduce hardcoded memory layout addresses in the linker script.
* Determine fx-9860G VBR addresses dynamically from mmu_uram()
* Determine fx-CG 50 VBR addresses dynamically from mmu_uram()
* Remove linker symbols for VBR addresses
Comments and documentation have been updated throughout the code to
reflect the changes.
2020-09-17 14:48:54 +02:00
|
|
|
* 0x200 bytes for text accessed without the TLB when SR.BL=1, linked
|
|
|
|
into the rram region below, then loaded dynamically
|
2021-02-15 09:39:14 +01:00
|
|
|
* 0x600 bytes for the VBR space, also without MMU
|
|
|
|
On SH3, the VBR space consumes these 0x600 bytes. On SH4, it spans
|
|
|
|
0x1100 bytes near the end of the user RAM, which is larger; the 6k
|
|
|
|
left for the user are honored in both cases. Unused memory from the
|
|
|
|
exposed 6k and non-exposed memory is available through malloc(). */
|
2020-07-10 15:51:54 +02:00
|
|
|
ram (rw): o = 0x08100200, l = 6k
|
kernel: dynamic loading of GMAPPED functions to user RAM
This commit introduces a large architectural change. Unlike previous
models of the fx-9860G series, the G-III models have a new user RAM
address different from 8801c000. The purpose of this change is to
dynamically load GMAPPED functions to this address by querying the TLB,
and call them through a function pointer whose address is determined
when loading.
Because of the overhead of using a function pointer in both assembly and
C code, changes have been made to avoid GMAPPED functions altogether.
Current, only cpu_setVBR() and gint_inth_callback() are left, the second
being used specifically to enable TLB misses when needed.
* Add a .gint.mappedrel section for the function pointers holding
addresses to GMAPPED functions; add function pointers for
cpu_setVBR() and gint_inth_callback()
* Move rram to address 0 instead of the hardcoded 0x8801c000
* Load GMAPPED functions at their linked address + the physical address
user RAM is mapped, to and compute their function pointers
* Remove the GMAPPED macro since no user function needs it anymore
* Add section flags "ax" (code) or "aw" (data) to every custom .section
in assembler code, as they default to unpredictable values that can
cause the section to be marked NOLOAD by the linker
* Update the main kernel, TMU, ETMU and RTC interrupt handlers to use
the new indirect calling method
This is made possible by new MMU functions giving direct access to the
physical area behind any virtualized page.
* Add an mmu_translate() function to query the TLB
* Add an mmu_uram() function to access user RAM from P1
The exception catching mechanism has been modified to avoid the use of
GMAPPED functions altogether.
* Set SR.BL=0 and SR.IMASK=15 before calling exception catchers
* Move gint_exc_skip() to normal text ROM
* Also fix registers not being popped off the stack before a panic
The timer drivers have also been modified to avoid GMAPPED functions.
* Invoke timer_stop() through gint_inth_callback() and move it to ROM
* Move and expand the ETMU driver to span 3 blocks at 0xd00 (ETMU4)
* Remove the timer_clear() function by inlining it into the ETMU handler
(TCR is provided within the storage block of each timer)
* Also split src/timer/inth.s into src/timer/inth-{tmu,etmu}.s
Additionally, VBR addresses are now determined at runtime to further
reduce hardcoded memory layout addresses in the linker script.
* Determine fx-9860G VBR addresses dynamically from mmu_uram()
* Determine fx-CG 50 VBR addresses dynamically from mmu_uram()
* Remove linker symbols for VBR addresses
Comments and documentation have been updated throughout the code to
reflect the changes.
2020-09-17 14:48:54 +02:00
|
|
|
|
|
|
|
/* This region represents the first block of user RAM. Linker arranges
|
|
|
|
sections as if linked to address 0, then gint's runtime determines
|
|
|
|
the location and relocates references (which are manual) */
|
|
|
|
rram (rwx): o = 0x00000000, l = 512
|
|
|
|
|
2019-09-15 19:29:47 +02:00
|
|
|
/* On-chip IL memory */
|
|
|
|
ilram (rwx): o = 0xe5200000, l = 4k
|
|
|
|
/* On-chip X and Y memory */
|
2022-05-04 18:21:23 +02:00
|
|
|
xyram (rwx): o = 0xe500e000, l = 16k
|
2018-04-19 13:24:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
{
|
|
|
|
/*
|
2019-09-15 19:29:47 +02:00
|
|
|
** ROM sections
|
2018-04-19 13:24:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* First address to be mapped to ROM (including G1A header) */
|
|
|
|
_brom = 0x00300000;
|
|
|
|
/* Size of ROM mappings */
|
|
|
|
_srom = 0x200
|
|
|
|
+ SIZEOF(.text) + SIZEOF(.rodata)
|
|
|
|
+ SIZEOF(.gint.drivers) + SIZEOF(.gint.blocks);
|
|
|
|
|
|
|
|
/* Machine code going to ROM:
|
2020-06-20 17:18:51 +02:00
|
|
|
- Entry function (.text.entry)
|
2018-04-19 13:24:26 +02:00
|
|
|
- Compiler-provided constructors (.ctors) and destructors (.dtors)
|
|
|
|
- All text from .text and .text.* (including user code)
|
|
|
|
- Code sections from fxlib, named "C" and "P" */
|
|
|
|
|
2020-06-20 17:18:51 +02:00
|
|
|
.text : {
|
|
|
|
*(.text.entry)
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2020-06-20 17:18:51 +02:00
|
|
|
_bctors = . ;
|
2024-05-26 18:16:31 +02:00
|
|
|
KEEP(*(.ctors .ctors.*))
|
2020-06-20 17:18:51 +02:00
|
|
|
_ectors = . ;
|
|
|
|
|
|
|
|
_bdtors = . ;
|
2024-05-26 18:16:31 +02:00
|
|
|
KEEP(*(.dtors .dtors.*))
|
2020-06-20 17:18:51 +02:00
|
|
|
_edtors = . ;
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2020-06-15 20:55:18 +02:00
|
|
|
_gint_exch_start = . ;
|
2024-05-26 18:16:31 +02:00
|
|
|
KEEP(*(.gint.exch))
|
2024-12-13 13:38:59 +01:00
|
|
|
_gint_exch_end = . ;
|
2020-06-15 20:55:18 +02:00
|
|
|
|
|
|
|
_gint_tlbh_start = . ;
|
2024-05-26 18:16:31 +02:00
|
|
|
KEEP(*(.gint.tlbh))
|
2024-12-13 13:38:59 +01:00
|
|
|
_gint_tlbh_end = . ;
|
2019-09-03 22:15:00 +02:00
|
|
|
|
2018-04-19 13:24:26 +02:00
|
|
|
*(.text .text.*)
|
|
|
|
*(C P)
|
|
|
|
} > rom
|
|
|
|
|
|
|
|
/* Interrupt handlers going to ROM:
|
|
|
|
- gint's interrupt handler blocks (.gint.blocks)
|
|
|
|
|
|
|
|
Although gint's blocks end up in VBR space, they are selected and
|
|
|
|
installed on-the-fly by the library and the drivers, so we can't
|
|
|
|
just put them in the vbr region and wait for the copy */
|
|
|
|
.gint.blocks : {
|
|
|
|
KEEP(*(.gint.blocks));
|
|
|
|
} > rom
|
|
|
|
|
|
|
|
/* Driver data going to ROM:
|
|
|
|
- Exposed driver interfaces (.gint.drivers)
|
|
|
|
|
|
|
|
The driver information is required to start and configure the
|
|
|
|
driver, even if the symbols are not referenced */
|
|
|
|
.gint.drivers : {
|
2021-04-23 18:50:20 +02:00
|
|
|
_gint_drivers = . ;
|
|
|
|
KEEP(*(SORT_BY_NAME(.gint.drivers.*)));
|
|
|
|
_gint_drivers_end = . ;
|
2018-04-19 13:24:26 +02:00
|
|
|
} > rom
|
|
|
|
|
|
|
|
/* Read-only data going to ROM:
|
|
|
|
- Resources or assets from fxconv or similar converters
|
|
|
|
- Data marked read-only by the compiler (.rodata and .rodata.*) */
|
|
|
|
.rodata : SUBALIGN(4) {
|
2019-09-15 19:29:47 +02:00
|
|
|
/* Put these first, they need to be 4-aligned */
|
|
|
|
*(.rodata.4)
|
|
|
|
|
2018-04-19 13:24:26 +02:00
|
|
|
*(.rodata .rodata.*)
|
2023-01-01 19:22:41 +01:00
|
|
|
*(.gint.rodata.sh3)
|
2018-04-19 13:24:26 +02:00
|
|
|
} > rom
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2019-09-15 19:29:47 +02:00
|
|
|
** RAM sections
|
2018-04-19 13:24:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
. = ORIGIN(ram);
|
|
|
|
|
|
|
|
/* BSS stuff going to RAM:
|
|
|
|
- Data marked BSS by the compiler
|
|
|
|
- BSS sections from fxlib, namely "B" and "R"
|
|
|
|
The BSS section is to be stripped from the ELF file later, and wiped
|
|
|
|
at startup. */
|
|
|
|
.bss (NOLOAD) : {
|
|
|
|
_rbss = . ;
|
|
|
|
|
2022-08-21 20:11:45 +02:00
|
|
|
*(.bss .bss.* COMMON)
|
2018-04-19 13:24:26 +02:00
|
|
|
*(B R)
|
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > ram :NONE
|
|
|
|
|
|
|
|
_sbss = SIZEOF(.bss);
|
|
|
|
|
|
|
|
/* Read-write data going to RAM:
|
|
|
|
- Data sections generated by the compiler (.data and .data.*)
|
2020-07-10 15:51:54 +02:00
|
|
|
- Data sections from fxlib, "D"
|
2020-07-10 16:36:05 +02:00
|
|
|
- The SH3-only data section (.gint.data.sh3) */
|
2018-04-19 13:24:26 +02:00
|
|
|
.data ALIGN(4) : ALIGN(4) {
|
|
|
|
_ldata = LOADADDR(.data);
|
|
|
|
_rdata = . ;
|
|
|
|
|
kernel: dynamic loading of GMAPPED functions to user RAM
This commit introduces a large architectural change. Unlike previous
models of the fx-9860G series, the G-III models have a new user RAM
address different from 8801c000. The purpose of this change is to
dynamically load GMAPPED functions to this address by querying the TLB,
and call them through a function pointer whose address is determined
when loading.
Because of the overhead of using a function pointer in both assembly and
C code, changes have been made to avoid GMAPPED functions altogether.
Current, only cpu_setVBR() and gint_inth_callback() are left, the second
being used specifically to enable TLB misses when needed.
* Add a .gint.mappedrel section for the function pointers holding
addresses to GMAPPED functions; add function pointers for
cpu_setVBR() and gint_inth_callback()
* Move rram to address 0 instead of the hardcoded 0x8801c000
* Load GMAPPED functions at their linked address + the physical address
user RAM is mapped, to and compute their function pointers
* Remove the GMAPPED macro since no user function needs it anymore
* Add section flags "ax" (code) or "aw" (data) to every custom .section
in assembler code, as they default to unpredictable values that can
cause the section to be marked NOLOAD by the linker
* Update the main kernel, TMU, ETMU and RTC interrupt handlers to use
the new indirect calling method
This is made possible by new MMU functions giving direct access to the
physical area behind any virtualized page.
* Add an mmu_translate() function to query the TLB
* Add an mmu_uram() function to access user RAM from P1
The exception catching mechanism has been modified to avoid the use of
GMAPPED functions altogether.
* Set SR.BL=0 and SR.IMASK=15 before calling exception catchers
* Move gint_exc_skip() to normal text ROM
* Also fix registers not being popped off the stack before a panic
The timer drivers have also been modified to avoid GMAPPED functions.
* Invoke timer_stop() through gint_inth_callback() and move it to ROM
* Move and expand the ETMU driver to span 3 blocks at 0xd00 (ETMU4)
* Remove the timer_clear() function by inlining it into the ETMU handler
(TCR is provided within the storage block of each timer)
* Also split src/timer/inth.s into src/timer/inth-{tmu,etmu}.s
Additionally, VBR addresses are now determined at runtime to further
reduce hardcoded memory layout addresses in the linker script.
* Determine fx-9860G VBR addresses dynamically from mmu_uram()
* Determine fx-CG 50 VBR addresses dynamically from mmu_uram()
* Remove linker symbols for VBR addresses
Comments and documentation have been updated throughout the code to
reflect the changes.
2020-09-17 14:48:54 +02:00
|
|
|
_lreloc = . ;
|
|
|
|
*(.gint.mappedrel);
|
|
|
|
_sreloc = ABSOLUTE(. - _lreloc);
|
|
|
|
|
2018-04-19 13:24:26 +02:00
|
|
|
*(.data .data.*)
|
|
|
|
*(D)
|
2020-07-10 16:36:05 +02:00
|
|
|
*(.gint.data.sh3)
|
2018-04-19 13:24:26 +02:00
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > ram AT> rom
|
|
|
|
|
2019-02-21 20:58:38 +01:00
|
|
|
/* Read-write data sub-aligned to 4 bytes (mainly from fxconv) */
|
|
|
|
.data.4 : SUBALIGN(4) {
|
|
|
|
*(.data.4)
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > ram AT> rom
|
|
|
|
|
|
|
|
_sdata = SIZEOF(.data) + SIZEOF(.data.4);
|
2018-04-19 13:24:26 +02:00
|
|
|
|
2020-07-10 15:51:54 +02:00
|
|
|
/* gint's uninitialized BSS section */
|
|
|
|
.gint.bss (NOLOAD) : {
|
|
|
|
/* Since it's uninitialized, the location doesn't matter */
|
2020-07-10 16:36:05 +02:00
|
|
|
*(.gint.bss .gint.bss.sh3)
|
2020-07-10 15:51:54 +02:00
|
|
|
|
|
|
|
. = ALIGN(16);
|
2021-02-15 09:39:14 +01:00
|
|
|
|
|
|
|
/* End of user RAM */
|
|
|
|
_euram = . ;
|
2020-07-10 15:51:54 +02:00
|
|
|
} > ram :NONE
|
|
|
|
|
|
|
|
_sgbss = SIZEOF(.gint.bss);
|
|
|
|
|
2019-09-15 19:29:47 +02:00
|
|
|
/* On-chip memory sections: IL, X and Y memory */
|
|
|
|
|
|
|
|
. = ORIGIN(ilram);
|
|
|
|
.ilram ALIGN(4) : ALIGN(4) {
|
|
|
|
_lilram = LOADADDR(.ilram);
|
|
|
|
_rilram = . ;
|
|
|
|
|
|
|
|
*(.ilram)
|
|
|
|
|
|
|
|
. = ALIGN(16);
|
|
|
|
} > ilram AT> rom
|
|
|
|
|
2022-05-04 18:21:23 +02:00
|
|
|
. = ORIGIN(xyram);
|
|
|
|
.xyram ALIGN(4) : ALIGN(4) {
|
|
|
|
_lxyram = LOADADDR(.xyram);
|
|
|
|
_rxyram = . ;
|
2019-09-15 19:29:47 +02:00
|
|
|
|
2022-05-04 18:21:23 +02:00
|
|
|
*(.xram .yram .xyram)
|
2019-09-15 19:29:47 +02:00
|
|
|
|
|
|
|
. = ALIGN(16);
|
2022-05-04 18:21:23 +02:00
|
|
|
} > xyram AT> rom
|
2019-09-15 19:29:47 +02:00
|
|
|
|
|
|
|
_silram = SIZEOF(.ilram);
|
2022-05-04 18:21:23 +02:00
|
|
|
_sxyram = SIZEOF(.xyram);
|
2019-09-15 19:29:47 +02:00
|
|
|
|
2018-04-19 13:24:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
kernel: dynamic loading of GMAPPED functions to user RAM
This commit introduces a large architectural change. Unlike previous
models of the fx-9860G series, the G-III models have a new user RAM
address different from 8801c000. The purpose of this change is to
dynamically load GMAPPED functions to this address by querying the TLB,
and call them through a function pointer whose address is determined
when loading.
Because of the overhead of using a function pointer in both assembly and
C code, changes have been made to avoid GMAPPED functions altogether.
Current, only cpu_setVBR() and gint_inth_callback() are left, the second
being used specifically to enable TLB misses when needed.
* Add a .gint.mappedrel section for the function pointers holding
addresses to GMAPPED functions; add function pointers for
cpu_setVBR() and gint_inth_callback()
* Move rram to address 0 instead of the hardcoded 0x8801c000
* Load GMAPPED functions at their linked address + the physical address
user RAM is mapped, to and compute their function pointers
* Remove the GMAPPED macro since no user function needs it anymore
* Add section flags "ax" (code) or "aw" (data) to every custom .section
in assembler code, as they default to unpredictable values that can
cause the section to be marked NOLOAD by the linker
* Update the main kernel, TMU, ETMU and RTC interrupt handlers to use
the new indirect calling method
This is made possible by new MMU functions giving direct access to the
physical area behind any virtualized page.
* Add an mmu_translate() function to query the TLB
* Add an mmu_uram() function to access user RAM from P1
The exception catching mechanism has been modified to avoid the use of
GMAPPED functions altogether.
* Set SR.BL=0 and SR.IMASK=15 before calling exception catchers
* Move gint_exc_skip() to normal text ROM
* Also fix registers not being popped off the stack before a panic
The timer drivers have also been modified to avoid GMAPPED functions.
* Invoke timer_stop() through gint_inth_callback() and move it to ROM
* Move and expand the ETMU driver to span 3 blocks at 0xd00 (ETMU4)
* Remove the timer_clear() function by inlining it into the ETMU handler
(TCR is provided within the storage block of each timer)
* Also split src/timer/inth.s into src/timer/inth-{tmu,etmu}.s
Additionally, VBR addresses are now determined at runtime to further
reduce hardcoded memory layout addresses in the linker script.
* Determine fx-9860G VBR addresses dynamically from mmu_uram()
* Determine fx-CG 50 VBR addresses dynamically from mmu_uram()
* Remove linker symbols for VBR addresses
Comments and documentation have been updated throughout the code to
reflect the changes.
2020-09-17 14:48:54 +02:00
|
|
|
** Relocated no-MMU RAM sections
|
2018-04-19 13:24:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
. = ORIGIN(rram);
|
|
|
|
|
kernel: dynamic loading of GMAPPED functions to user RAM
This commit introduces a large architectural change. Unlike previous
models of the fx-9860G series, the G-III models have a new user RAM
address different from 8801c000. The purpose of this change is to
dynamically load GMAPPED functions to this address by querying the TLB,
and call them through a function pointer whose address is determined
when loading.
Because of the overhead of using a function pointer in both assembly and
C code, changes have been made to avoid GMAPPED functions altogether.
Current, only cpu_setVBR() and gint_inth_callback() are left, the second
being used specifically to enable TLB misses when needed.
* Add a .gint.mappedrel section for the function pointers holding
addresses to GMAPPED functions; add function pointers for
cpu_setVBR() and gint_inth_callback()
* Move rram to address 0 instead of the hardcoded 0x8801c000
* Load GMAPPED functions at their linked address + the physical address
user RAM is mapped, to and compute their function pointers
* Remove the GMAPPED macro since no user function needs it anymore
* Add section flags "ax" (code) or "aw" (data) to every custom .section
in assembler code, as they default to unpredictable values that can
cause the section to be marked NOLOAD by the linker
* Update the main kernel, TMU, ETMU and RTC interrupt handlers to use
the new indirect calling method
This is made possible by new MMU functions giving direct access to the
physical area behind any virtualized page.
* Add an mmu_translate() function to query the TLB
* Add an mmu_uram() function to access user RAM from P1
The exception catching mechanism has been modified to avoid the use of
GMAPPED functions altogether.
* Set SR.BL=0 and SR.IMASK=15 before calling exception catchers
* Move gint_exc_skip() to normal text ROM
* Also fix registers not being popped off the stack before a panic
The timer drivers have also been modified to avoid GMAPPED functions.
* Invoke timer_stop() through gint_inth_callback() and move it to ROM
* Move and expand the ETMU driver to span 3 blocks at 0xd00 (ETMU4)
* Remove the timer_clear() function by inlining it into the ETMU handler
(TCR is provided within the storage block of each timer)
* Also split src/timer/inth.s into src/timer/inth-{tmu,etmu}.s
Additionally, VBR addresses are now determined at runtime to further
reduce hardcoded memory layout addresses in the linker script.
* Determine fx-9860G VBR addresses dynamically from mmu_uram()
* Determine fx-CG 50 VBR addresses dynamically from mmu_uram()
* Remove linker symbols for VBR addresses
Comments and documentation have been updated throughout the code to
reflect the changes.
2020-09-17 14:48:54 +02:00
|
|
|
/* Code that must remain permanently mapped (.gint.mapped); relocated
|
|
|
|
to start of user RAM at startup, accessed through P1 */
|
2020-07-10 16:36:05 +02:00
|
|
|
.gint.mapped ALIGN(4) : ALIGN(4) {
|
|
|
|
_lgmapped = LOADADDR(.gint.mapped);
|
2020-06-15 20:55:18 +02:00
|
|
|
*(.gint.mapped)
|
2018-04-19 13:24:26 +02:00
|
|
|
. = ALIGN(16);
|
|
|
|
} > rram AT> rom
|
|
|
|
|
2020-07-10 16:36:05 +02:00
|
|
|
_sgmapped = SIZEOF(.gint.mapped);
|
2018-04-19 13:24:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
kernel: dynamic loading of GMAPPED functions to user RAM
This commit introduces a large architectural change. Unlike previous
models of the fx-9860G series, the G-III models have a new user RAM
address different from 8801c000. The purpose of this change is to
dynamically load GMAPPED functions to this address by querying the TLB,
and call them through a function pointer whose address is determined
when loading.
Because of the overhead of using a function pointer in both assembly and
C code, changes have been made to avoid GMAPPED functions altogether.
Current, only cpu_setVBR() and gint_inth_callback() are left, the second
being used specifically to enable TLB misses when needed.
* Add a .gint.mappedrel section for the function pointers holding
addresses to GMAPPED functions; add function pointers for
cpu_setVBR() and gint_inth_callback()
* Move rram to address 0 instead of the hardcoded 0x8801c000
* Load GMAPPED functions at their linked address + the physical address
user RAM is mapped, to and compute their function pointers
* Remove the GMAPPED macro since no user function needs it anymore
* Add section flags "ax" (code) or "aw" (data) to every custom .section
in assembler code, as they default to unpredictable values that can
cause the section to be marked NOLOAD by the linker
* Update the main kernel, TMU, ETMU and RTC interrupt handlers to use
the new indirect calling method
This is made possible by new MMU functions giving direct access to the
physical area behind any virtualized page.
* Add an mmu_translate() function to query the TLB
* Add an mmu_uram() function to access user RAM from P1
The exception catching mechanism has been modified to avoid the use of
GMAPPED functions altogether.
* Set SR.BL=0 and SR.IMASK=15 before calling exception catchers
* Move gint_exc_skip() to normal text ROM
* Also fix registers not being popped off the stack before a panic
The timer drivers have also been modified to avoid GMAPPED functions.
* Invoke timer_stop() through gint_inth_callback() and move it to ROM
* Move and expand the ETMU driver to span 3 blocks at 0xd00 (ETMU4)
* Remove the timer_clear() function by inlining it into the ETMU handler
(TCR is provided within the storage block of each timer)
* Also split src/timer/inth.s into src/timer/inth-{tmu,etmu}.s
Additionally, VBR addresses are now determined at runtime to further
reduce hardcoded memory layout addresses in the linker script.
* Determine fx-9860G VBR addresses dynamically from mmu_uram()
* Determine fx-CG 50 VBR addresses dynamically from mmu_uram()
* Remove linker symbols for VBR addresses
Comments and documentation have been updated throughout the code to
reflect the changes.
2020-09-17 14:48:54 +02:00
|
|
|
** Unused sections
|
2018-04-19 13:24:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/DISCARD/ : {
|
kernel: dynamic loading of GMAPPED functions to user RAM
This commit introduces a large architectural change. Unlike previous
models of the fx-9860G series, the G-III models have a new user RAM
address different from 8801c000. The purpose of this change is to
dynamically load GMAPPED functions to this address by querying the TLB,
and call them through a function pointer whose address is determined
when loading.
Because of the overhead of using a function pointer in both assembly and
C code, changes have been made to avoid GMAPPED functions altogether.
Current, only cpu_setVBR() and gint_inth_callback() are left, the second
being used specifically to enable TLB misses when needed.
* Add a .gint.mappedrel section for the function pointers holding
addresses to GMAPPED functions; add function pointers for
cpu_setVBR() and gint_inth_callback()
* Move rram to address 0 instead of the hardcoded 0x8801c000
* Load GMAPPED functions at their linked address + the physical address
user RAM is mapped, to and compute their function pointers
* Remove the GMAPPED macro since no user function needs it anymore
* Add section flags "ax" (code) or "aw" (data) to every custom .section
in assembler code, as they default to unpredictable values that can
cause the section to be marked NOLOAD by the linker
* Update the main kernel, TMU, ETMU and RTC interrupt handlers to use
the new indirect calling method
This is made possible by new MMU functions giving direct access to the
physical area behind any virtualized page.
* Add an mmu_translate() function to query the TLB
* Add an mmu_uram() function to access user RAM from P1
The exception catching mechanism has been modified to avoid the use of
GMAPPED functions altogether.
* Set SR.BL=0 and SR.IMASK=15 before calling exception catchers
* Move gint_exc_skip() to normal text ROM
* Also fix registers not being popped off the stack before a panic
The timer drivers have also been modified to avoid GMAPPED functions.
* Invoke timer_stop() through gint_inth_callback() and move it to ROM
* Move and expand the ETMU driver to span 3 blocks at 0xd00 (ETMU4)
* Remove the timer_clear() function by inlining it into the ETMU handler
(TCR is provided within the storage block of each timer)
* Also split src/timer/inth.s into src/timer/inth-{tmu,etmu}.s
Additionally, VBR addresses are now determined at runtime to further
reduce hardcoded memory layout addresses in the linker script.
* Determine fx-9860G VBR addresses dynamically from mmu_uram()
* Determine fx-CG 50 VBR addresses dynamically from mmu_uram()
* Remove linker symbols for VBR addresses
Comments and documentation have been updated throughout the code to
reflect the changes.
2020-09-17 14:48:54 +02:00
|
|
|
/* Java class registration (why are they even here?!) */
|
2018-04-19 13:24:26 +02:00
|
|
|
*(.jcr)
|
kernel: dynamic loading of GMAPPED functions to user RAM
This commit introduces a large architectural change. Unlike previous
models of the fx-9860G series, the G-III models have a new user RAM
address different from 8801c000. The purpose of this change is to
dynamically load GMAPPED functions to this address by querying the TLB,
and call them through a function pointer whose address is determined
when loading.
Because of the overhead of using a function pointer in both assembly and
C code, changes have been made to avoid GMAPPED functions altogether.
Current, only cpu_setVBR() and gint_inth_callback() are left, the second
being used specifically to enable TLB misses when needed.
* Add a .gint.mappedrel section for the function pointers holding
addresses to GMAPPED functions; add function pointers for
cpu_setVBR() and gint_inth_callback()
* Move rram to address 0 instead of the hardcoded 0x8801c000
* Load GMAPPED functions at their linked address + the physical address
user RAM is mapped, to and compute their function pointers
* Remove the GMAPPED macro since no user function needs it anymore
* Add section flags "ax" (code) or "aw" (data) to every custom .section
in assembler code, as they default to unpredictable values that can
cause the section to be marked NOLOAD by the linker
* Update the main kernel, TMU, ETMU and RTC interrupt handlers to use
the new indirect calling method
This is made possible by new MMU functions giving direct access to the
physical area behind any virtualized page.
* Add an mmu_translate() function to query the TLB
* Add an mmu_uram() function to access user RAM from P1
The exception catching mechanism has been modified to avoid the use of
GMAPPED functions altogether.
* Set SR.BL=0 and SR.IMASK=15 before calling exception catchers
* Move gint_exc_skip() to normal text ROM
* Also fix registers not being popped off the stack before a panic
The timer drivers have also been modified to avoid GMAPPED functions.
* Invoke timer_stop() through gint_inth_callback() and move it to ROM
* Move and expand the ETMU driver to span 3 blocks at 0xd00 (ETMU4)
* Remove the timer_clear() function by inlining it into the ETMU handler
(TCR is provided within the storage block of each timer)
* Also split src/timer/inth.s into src/timer/inth-{tmu,etmu}.s
Additionally, VBR addresses are now determined at runtime to further
reduce hardcoded memory layout addresses in the linker script.
* Determine fx-9860G VBR addresses dynamically from mmu_uram()
* Determine fx-CG 50 VBR addresses dynamically from mmu_uram()
* Remove linker symbols for VBR addresses
Comments and documentation have been updated throughout the code to
reflect the changes.
2020-09-17 14:48:54 +02:00
|
|
|
/* Asynchronous unwind tables: no C++ exception handling */
|
2018-04-19 13:24:26 +02:00
|
|
|
*(.eh_frame_hdr)
|
|
|
|
*(.eh_frame)
|
kernel: dynamic loading of GMAPPED functions to user RAM
This commit introduces a large architectural change. Unlike previous
models of the fx-9860G series, the G-III models have a new user RAM
address different from 8801c000. The purpose of this change is to
dynamically load GMAPPED functions to this address by querying the TLB,
and call them through a function pointer whose address is determined
when loading.
Because of the overhead of using a function pointer in both assembly and
C code, changes have been made to avoid GMAPPED functions altogether.
Current, only cpu_setVBR() and gint_inth_callback() are left, the second
being used specifically to enable TLB misses when needed.
* Add a .gint.mappedrel section for the function pointers holding
addresses to GMAPPED functions; add function pointers for
cpu_setVBR() and gint_inth_callback()
* Move rram to address 0 instead of the hardcoded 0x8801c000
* Load GMAPPED functions at their linked address + the physical address
user RAM is mapped, to and compute their function pointers
* Remove the GMAPPED macro since no user function needs it anymore
* Add section flags "ax" (code) or "aw" (data) to every custom .section
in assembler code, as they default to unpredictable values that can
cause the section to be marked NOLOAD by the linker
* Update the main kernel, TMU, ETMU and RTC interrupt handlers to use
the new indirect calling method
This is made possible by new MMU functions giving direct access to the
physical area behind any virtualized page.
* Add an mmu_translate() function to query the TLB
* Add an mmu_uram() function to access user RAM from P1
The exception catching mechanism has been modified to avoid the use of
GMAPPED functions altogether.
* Set SR.BL=0 and SR.IMASK=15 before calling exception catchers
* Move gint_exc_skip() to normal text ROM
* Also fix registers not being popped off the stack before a panic
The timer drivers have also been modified to avoid GMAPPED functions.
* Invoke timer_stop() through gint_inth_callback() and move it to ROM
* Move and expand the ETMU driver to span 3 blocks at 0xd00 (ETMU4)
* Remove the timer_clear() function by inlining it into the ETMU handler
(TCR is provided within the storage block of each timer)
* Also split src/timer/inth.s into src/timer/inth-{tmu,etmu}.s
Additionally, VBR addresses are now determined at runtime to further
reduce hardcoded memory layout addresses in the linker script.
* Determine fx-9860G VBR addresses dynamically from mmu_uram()
* Determine fx-CG 50 VBR addresses dynamically from mmu_uram()
* Remove linker symbols for VBR addresses
Comments and documentation have been updated throughout the code to
reflect the changes.
2020-09-17 14:48:54 +02:00
|
|
|
/* Comments or anything the compiler might generate */
|
2018-04-19 13:24:26 +02:00
|
|
|
*(.comment)
|
|
|
|
}
|
|
|
|
}
|