OS_GetEnv result

John Tytgat John.Tytgat at aaug.net
Sat Aug 3 13:44:54 PDT 2002


In message <2d8f49604b.ajw498 at alexwaugh.com>
          Alex Waugh <alex at alexwaugh.com> wrote:

> How about something along the lines of the following?
> 
> somewhere.s:
> 
> IMPORT |__riscosify_control|, WEAK
> EXPORT |__riscosify_control_ptr|
> 
> |__riscosify_control_ptr|
>     DCD |__riscosify_control|
> 
> riscosify.c:
> 
> replace all reads of __riscosify_control to
> __riscosify_control_ptr ? *__riscosify_control_ptr : 0;

I think the following would be easier:

	;Gets the __riscosify_control value which can be defined by
	;the global variable __riscosify_control in the user program.
	;Returns 0 (= default value) when not defined.
	;
	;int __get_riscosify_control(void)
	IMPORT	|__riscosify_control|, WEAK
	EXPORT	|__get_riscosify_control|
	NAME	"__get_riscosify_control"
|__get_riscosify_control|
	LDR	a1, =|__riscosify_control|
	TEQ	a1, #0
	LDRNE	a1, [a1, #0]
	return	AL, pc, lr

And somewhere.h:

int __get_riscosify_control(void);

John.
-- 
John Tytgat, in his comfy chair at home                                 BASS
John.Tytgat at aaug.net                             ARM powered, RISC OS driven



More information about the gcc mailing list