kernel: move VBR to user RAM on fx9860g

This change puts an end to the illegal occupation of some random RAM
area, solving most of the return-to-menu issues, including (but not
limited to) random key presses, multiple return, and VBR being
overwritten.

There are still known return-to-menu issues on SH3 (mainly just
GetKeyWait() returning immediately to gint probably due to multiple
KEY_CTRL_MENU being injected), but nothing crashy.
This commit is contained in:
Lephe 2020-07-10 15:51:54 +02:00
parent 0aceb6f93e
commit b2f580a009
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 22 additions and 24 deletions

View File

@ -15,12 +15,14 @@ MEMORY
{
/* Userspace mapping of the add-in (G1A header takes 0x200 bytes) */
rom (rx): o = 0x00300200, l = 500k
/* This is mapped to RAM; 8k on SH3, apparently 32k on SH4 */
ram (rw): o = 0x08100000, l = 8k
/* gint's VBR space, mentioned here for completeness */
vbr (rwx): o = 0x8800e000, l = 5k
/* Some RAM region from P1 area; gint's data will reside here */
rram (rwx): o = 0x8800f400, l = 3k
/* This is mapped to RAM; 8k on SH3, 32k on SH4. Since gint uses the
last 2k for its VBR and mapped code, 6k are left */
ram (rw): o = 0x08100200, l = 6k
/* This is the VBR space. The [ram] region is mapped to 8801c000. This
region is used at load time and mentioned here for completeness */
vbr (rwx): o = 0x8801da00, l = 1536
/* These first bits of RAM are used for gint's perma-mapped code */
rram (rwx): o = 0x8801c000, l = 512
/* On-chip IL memory */
ilram (rwx): o = 0xe5200000, l = 4k
/* On-chip X and Y memory */
@ -133,13 +135,15 @@ SECTIONS
/* Read-write data going to RAM:
- Data sections generated by the compiler (.data and .data.*)
- Data sections from fxlib, "D" */
- Data sections from fxlib, "D"
- Data sections from gint (.gint.data) */
.data ALIGN(4) : ALIGN(4) {
_ldata = LOADADDR(.data);
_rdata = . ;
*(.data .data.*)
*(D)
*(.gint.data .gint.data.sh3)
. = ALIGN(16);
} > ram AT> rom
@ -152,6 +156,16 @@ SECTIONS
_sdata = SIZEOF(.data) + SIZEOF(.data.4);
/* gint's uninitialized BSS section */
.gint.bss (NOLOAD) : {
/* Since it's uninitialized, the location doesn't matter */
*(.gint.bss)
. = ALIGN(16);
} > ram :NONE
_sgbss = SIZEOF(.gint.bss);
/* On-chip memory sections: IL, X and Y memory */
. = ORIGIN(ilram);
@ -192,8 +206,6 @@ SECTIONS
/*
** RRAM sections
** 8800e000:5k VBR space
** 8800f400:3k .gint.data and .gint.bss
*/
/* VBR address: let's just start at the beginning of the RRAM area.
@ -204,14 +216,11 @@ SECTIONS
. = ORIGIN(rram);
/* gint's data section, going to Real RAM. This section contains many
small objects from the library (static/global variables, etc) */
/* Code that must remain permanently mapped (.gint.mapped) */
.gint.data ALIGN(4) : ALIGN(4) {
_lgdata = LOADADDR(.gint.data);
_rgdata = . ;
*(.gint.data .gint.data.*)
/* Also code that must remain permanently mapped! */
*(.gint.mapped)
@ -220,17 +229,6 @@ SECTIONS
_sgdata = SIZEOF(.gint.data);
/* gint's uninitialized BSS section, going to Real RAM. All the large
data arrays will be located here */
.gint.bss (NOLOAD) : {
/* Since it's uninitialized, the location doesn't matter */
*(.gint.bss .gint.bss.*)
. = ALIGN(16);
} > rram :NONE
_sgbss = SIZEOF(.gint.bss);
/*