Registers and CPUs

AROS has put some effort in defining a way to write code which is hardware independant. To achieve this, a couple of macros have been definied.

AROS_ASMSYMNAME(n) Use this macro to access the assembler symbol |n| from C.

AROS_CSYMNAME(n) Use this macro to access the C symbol |n| from assembler.

AROS_CDEFNAME(n) Use this macro to define the assembler symbol |n| in such a way that it can be accessed from C.

AROS_SLIB_ENTRY(n,l) Use this macro to get the name of a function n which is part of the shared library l.

AROS_UFH#(...) Use this macro to declare a function which needs its arguments passed in registers. # is the number of arguments the function expects. The parameters of the macro are the return type of the function, its name and the parameters in |AROS_UFHA()| macros. If the function is an assembler function, you must use the |AROS_ASMSYMNAME()| macro to get it's name.

AROS_UFHA(t,n,r) Use this macro to declare a parameter for a function which is declared with the |AROS_UFH*()| macro. It takes three arguments: The type of the parameter, the name of the parameter and the register the parameter is expected in.

AROS_UFC#(...) Call a function which needs its arguments in registers. Works the same way as |AROS_UFH*()|.

AROS_LH#[I](...) Use this macro to declare a function which is part of a shared library. # is the number of arguments the function expects. If the function doesn't need the library base passed, you can speed up things by appending "I" to the macros name. The parameters of the macro are the return type of the function, its name, the parameters in |AROS_LHA()| macros, the type of the library, the name of the variable the library base is passed in, the offset in the function table (1 is the first offset and 5 is the first offset for a user function) and the name of the library.

AROS_LHA(t,n,r) Use this macro to declare a parameter for a function which is declared with the |AROS_LH*()| macro. It takes three arguments: The type of the parameter, the name of the parameter and the register the parameter is expected in.

AROS_LC#[I](...) Call a function which is part of a shared library. Works the same way as |AROS_LH*()|.

AROS_STACK_GROWS_DOWNWARDS has the value 1 if it is true and 0 otherwise.

AROS_BIG_ENDIAN has the value 1 if the machine is big endian (eg. Amiga) or little endian (eg. PCs). Endianess means the way a number is stored in memory. Amiga stores |0x11223344| as |0x11 0x22 0x33 0x44| in memory while a PC does it as |0x44 0x33 0x22 0x11|.

AROS_SIZEOFULONG The result of |sizeof(ULONG)|.

AROS_WORDALIGN The minimal alignment of 16bit numbers in the memory of computer (|WORD| and |UWORD|).

AROS_LONGALIGN The minimal alignment of 32bit numbers in the memory of computer (|LONG| and |ULONG|).

AROS_PTRALIGN The minimal alignment of pointers in the memory of computer (eg. |char *| or |APTR|).

AROS_DOUBLEALIGN The minimal alignment of 64bit IEEE floating point numbers in the memory of computer (|double|).

AROS_WORSTALIGN The worst possible alignment of any data type in the memory of computer (mostly the same as |AROS_DOUBLEALIGN|).

AROS_ALIGN(x) Get the next possible address where one can put any data type. This macro will return |x| if any data type can be put at |x|. Most of the time, this macro is used like this: Get a buffer, put some data in it and then use |AROS_ALIGN()| to find out where the next data can be put.

AROS_SLOWSTACKTAGS is defined, if you must use |GetTagsFromStack()| and |FreeTagsFromStack()| instead of just passing the address of the tag of the first tagitem.

AROS_SLOWSTACKMETHODS is defined, if you must use |GetMsgFromStack()| and |FreeMsgFromStack()| instead of just passing the address of the method ID.