2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-23 19:51:46 +00:00

Allow access to variables in .text16 as well as .data16. Chained

interrupt vectors, for example, will be easiest to handle if placed in
.text16.
This commit is contained in:
Michael Brown 2006-05-06 18:57:31 +00:00
parent c10d1aa9d7
commit f8e087767b
3 changed files with 16 additions and 2 deletions

View File

@ -10,9 +10,11 @@
*
*/
/* Access to variables in .data16, in a way compatible with librm */
/* Access to variables in .data16 and .text16 in a way compatible with librm */
#define __data16( variable ) variable
#define __text16( variable ) variable
#define __use_data16( variable ) variable
#define __use_text16( variable ) variable
/* Copy to/from base memory */

View File

@ -15,17 +15,26 @@
*
*/
/* Access to variables in .data16 */
/* Access to variables in .data16 and .text16 */
extern char *data16;
extern char *text16;
#define __data16( variable ) \
_data16_ ## variable __asm__ ( #variable ) \
__attribute__ (( section ( ".data16" ) ))
#define __text16( variable ) \
_text16_ ## variable __asm__ ( #variable ) \
__attribute__ (( section ( ".text16" ) ))
#define __use_data16( variable ) \
( * ( ( typeof ( _data16_ ## variable ) * ) \
& ( data16 [ ( size_t ) & ( _data16_ ## variable ) ] ) ) )
#define __use_text16( variable ) \
( * ( ( typeof ( _text16_ ## variable ) * ) \
& ( text16 [ ( size_t ) & ( _text16_ ## variable ) ] ) ) )
/* Variables in librm.S, present in the normal data segment */
extern uint16_t rm_sp;
extern uint16_t rm_ss;

View File

@ -80,6 +80,9 @@ typedef struct {
* return foo;
* }
*
* Variables may also be placed in .text16 using __text16 and
* __use_text16. Some variables (e.g. chained interrupt vectors) fit
* most naturally in .text16; most should be in .data16.
*/
/*