remove the .gint.data section

Since both platforms now have their VBR and gint-specific data loaded
along the add-in's data, the .gint.data section is entirely unused.

The .gint.bss section is still used for uninitialized objects (it has
different semantics than .bss which is initially cleared) and the
.gint.data.sh3 and .gint.bss.sh3 sections that are dropped on the
SH4-only fx-CG 50 are also still used.
This commit is contained in:
Lephe 2020-07-10 16:36:05 +02:00
parent ece65927f0
commit 2751dcf045
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
14 changed files with 39 additions and 50 deletions

View File

@ -136,14 +136,14 @@ SECTIONS
/* Read-write data going to RAM:
- Data sections generated by the compiler (.data and .data.*)
- Data sections from fxlib, "D"
- Data sections from gint (.gint.data) */
- The SH3-only data section (.gint.data.sh3) */
.data ALIGN(4) : ALIGN(4) {
_ldata = LOADADDR(.data);
_rdata = . ;
*(.data .data.*)
*(D)
*(.gint.data .gint.data.sh3)
*(.gint.data.sh3)
. = ALIGN(16);
} > ram AT> rom
@ -159,7 +159,7 @@ SECTIONS
/* gint's uninitialized BSS section */
.gint.bss (NOLOAD) : {
/* Since it's uninitialized, the location doesn't matter */
*(.gint.bss)
*(.gint.bss .gint.bss.sh3)
. = ALIGN(16);
} > ram :NONE
@ -210,24 +210,23 @@ SECTIONS
/* VBR address: let's just start at the beginning of the RRAM area.
There's an unused 0x100-byte gap at the start of the VBR space.
The VBR space is already a large block (> 2 kiB), so I'm cutting off
The VBR space is already a large block (~2 kiB), so I'm cutting off
the gap to spare some memory */
_gint_vbr_fx9860g = ORIGIN(vbr) - 0x100;
. = ORIGIN(rram);
/* Code that must remain permanently mapped (.gint.mapped) */
.gint.data ALIGN(4) : ALIGN(4) {
_lgdata = LOADADDR(.gint.data);
_rgdata = . ;
.gint.mapped ALIGN(4) : ALIGN(4) {
_lgmapped = LOADADDR(.gint.mapped);
_rgmapped = . ;
/* Also code that must remain permanently mapped! */
*(.gint.mapped)
. = ALIGN(16);
} > rram AT> rom
_sgdata = SIZEOF(.gint.data);
_sgmapped = SIZEOF(.gint.mapped);

View File

@ -192,24 +192,11 @@ SECTIONS
. = ORIGIN(ram) + _sbss + _sdata;
/* gint's data section, going to static RAM. This section contains many
small objects from the library (static/global variables, etc) */
.gint.data ALIGN(4) : ALIGN(4) {
_lgdata = LOADADDR(.gint.data);
_rgdata = . ;
*(.gint.data .gint.data.*)
. = ALIGN(16);
} > ram AT> rom
_sgdata = SIZEOF(.gint.data);
/* gint's uninitialized BSS section, going to static 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.*)
*(.gint.bss)
. = ALIGN(16);
} > ram :NONE
@ -229,8 +216,8 @@ SECTIONS
- Asynchronous unwind tables: no C++ exception handling for now ^^
- Comments or anything the compiler might put in its assembler */
/DISCARD/ : {
*(.gint.bss.sh3)
*(.gint.data.sh3)
*(.gint.bss.sh3)
*(.debug_info .debug_abbrev .debug_loc .debug_aranges
.debug_ranges .debug_line .debug_str)

View File

@ -7,8 +7,7 @@
/* Objects from specific sections */
#define GSECTION(x) __attribute__((section(x)))
/* Objects from the .gint.data and .gint.bss sections */
#define GDATA __attribute__((section(".gint.data")))
/* Objects from the gint's uninitialized BSS section */
#define GBSS __attribute__((section(".gint.bss")))
/* Additional sections that are only needed on SH3 */
#define GDATA3 __attribute__((section(".gint.data.sh3")))

View File

@ -119,9 +119,9 @@ GNORETURN static void gint_default_panic(GUNUSED uint32_t code)
}
/* Panic handler */
GDATA GNORETURN void (*gint_exc_panic)(uint32_t code) = gint_default_panic;
GNORETURN void (*gint_exc_panic)(uint32_t code) = gint_default_panic;
/* Exception catcher */
GDATA int (*gint_exc_catcher)(uint32_t code) = NULL;
int (*gint_exc_catcher)(uint32_t code) = NULL;
/* gint_panic(): Panic handler function */
void gint_panic(uint32_t code)

View File

@ -143,7 +143,7 @@ _gint_inth_7705:
1: .long 0xa4000000 /* INTEVT2 register */
2: .long _inth_remap
.section .gint.data
.data
.align 4
/* EVENT CODE TRANSLATION TABLE - 96 BYTES

View File

@ -19,12 +19,15 @@
gint's BSS section is not mentioned here because it's never initialized */
extern uint32_t
brom, srom, /* Limits of ROM mappings */
lgdata, sgdata, rgdata, /* gint's data section */
ldata, sdata, rdata, /* User's data section */
lilram, silram, rilram, /* IL memory section */
lxram, sxram, rxram, /* X memory section */
lyram, syram, ryram, /* Y memory section */
sbss, rbss; /* User's BSS section */
#ifdef FX9860G
extern uint32_t
lgmapped, sgmapped, rgmapped; /* Permanently mapped functions */
#endif
/* Constructor and destructor arrays */
extern void (*bctors)(void), (*ectors)(void);
@ -101,8 +104,10 @@ int start(int isappli, int optnum)
/* Load data sections and wipe the bss section. This has to be done
first for static and global variables to be initialized */
regcpy(lgdata, sgdata, rgdata);
regcpy(ldata, sdata, rdata);
#ifdef FX9860G
regcpy(lgmapped, sgmapped, rgmapped);
#endif
regcpy(lilram, silram, rilram);
regcpy(lxram, sxram, rxram);
regcpy(lyram, syram, ryram);

View File

@ -21,10 +21,10 @@ GBSS static uint32_t *vrams[4];
/* Current VRAM pair used for drawing; the value can either be 0 (draws to
VRAMs 0 and 1) or 2 (draws to VRAMs 2 and 3). */
GDATA static volatile int st = 0;
static volatile int st = 0;
/* Whether the engine is running. Delays of light and dark frames. */
GDATA static int runs = 0;
static int runs = 0;
GBSS static int delays[2];
/* Underlying timer */

View File

@ -13,7 +13,7 @@ GDATA3 sh7705_intc_t SH7705_INTC = {
.ICR1 = (void *)0xa4000010,
};
GDATA sh7305_intc_t SH7305_INTC = {
sh7305_intc_t SH7305_INTC = {
.IPR = (void *)0xa4080000,
.MSK = (void *)0xa4080080,
.MSKCLR = (void *)0xa40800c0,

View File

@ -26,13 +26,13 @@
To ensure that adding pending events to the last-read state always gives the
internal driver state, this array is not updated if the generation of an
event fails. (Most likely the even will be regenerated at the next scan.) */
GDATA static volatile uint8_t state[12] = { 0 };
static volatile uint8_t state[12] = { 0 };
/* The driver's current event state. This state corresponds to the sum of all
events sent to the user so far.When the event queue is empty, this is equal
to [state]. For each generated event, this array is updated to reflect the
user's view of the keyboard. */
GDATA static uint8_t current[12] = { 0 };
static uint8_t current[12] = { 0 };
/* A driver event, which is a common change in a full row */
typedef struct
@ -49,11 +49,11 @@ typedef struct
be at least one free entry. */
GBSS static driver_event_t buffer[KEYBOARD_QUEUE_SIZE];
/* Buffer bounds */
GDATA static int buffer_start = 0;
GDATA static int buffer_end = 0;
static int buffer_start = 0;
static int buffer_end = 0;
/* Current time, in keyboard-scanning ticks */
GDATA static uint time = 0;
static uint time = 0;
/* buffer_push(): Add an event in the keyboard buffer
Returns non-zero if the event cannot be pushed. */
@ -260,7 +260,6 @@ static void init(void)
{
/* Configure the timer to do 128 keyboard scans per second. This
frequency *must* be high for the KEYSC interface to work! */
/* Note: the supporting timer always runs at 32768 Hz. */
int delay = 1000000 / KEYBOARD_SCAN_FREQUENCY;
if(!delay) delay = 1;

View File

@ -55,9 +55,9 @@ typedef word_union(entry_mode_t,
//---
/* Interface with the controller */
GDATA static volatile uint16_t *intf = (void *)0xb4000000;
static volatile uint16_t *intf = (void *)0xb4000000;
/* Bit 4 of Port R controls the RS bit of the display driver */
GDATA static volatile uint8_t *PRDR = (void *)0xa405013c;
static volatile uint8_t *PRDR = (void *)0xa405013c;
GINLINE static void select(uint16_t reg)
{

View File

@ -5,7 +5,7 @@
GSECTION(".bss") static uint32_t fx_vram[256];
/* Here is the definition of the VRAM pointer, exposed in <gint/display.h> */
GDATA uint32_t *gint_vram = fx_vram;
uint32_t *gint_vram = fx_vram;
/* dupdate() - push the video RAM to the display driver */
void dupdate(void)

View File

@ -16,7 +16,7 @@
//---
/* RTC address on SH7305, adjusted at startup on SH7337 and SH7355 */
GDATA static rtc_t *RTC = &SH7305_RTC;
static rtc_t *RTC = &SH7305_RTC;
/* Address of interrupt handler parameters */
GBSS struct {
int (*callback)(volatile void *arg);

View File

@ -52,9 +52,9 @@ enum {
pins in the address. (?) */
/* RS = 0: Register selection */
GDATA static volatile uint8_t *sel = (void *)0xb4000000;
static volatile uint8_t *sel = (void *)0xb4000000;
/* RS = 1: Command data or vram data */
GDATA static volatile uint8_t *cmd = (void *)0xb4010000;
static volatile uint8_t *cmd = (void *)0xb4010000;
/* command() - send a command to set the value of a register
@reg Register number

View File

@ -27,13 +27,13 @@ typedef struct
} GPACKED(4) inth_data_t;
/* This array references the storage areas of all timer handlers */
GDATA static inth_data_t *timers[9] = { NULL };
static inth_data_t *timers[9] = { NULL };
/* Arrays of standard and extra timers */
GDATA static tmu_t *TMU = SH7305_TMU.TMU;
GDATA static etmu_t *ETMU = SH7305_ETMU;
static tmu_t *TMU = SH7305_TMU.TMU;
static etmu_t *ETMU = SH7305_ETMU;
/* TSTR register for standard timers */
GDATA static volatile uint8_t *TSTR = &SH7305_TMU.TSTR;
static volatile uint8_t *TSTR = &SH7305_TMU.TSTR;
//---
// Local functions