Помощь - Поиск - Пользователи - Календарь
Полная версия этой страницы: Проверьте перевод
Форум разработчиков электроники ELECTRONIX.ru > Микроконтроллеры (MCs) > MSP430
d7d1cd
Привет всем. Изучаю CompilerReference и хочу попросить знающих, правильно ли я понимаю следующий текст:
Цитата
PRESERVED VERSUS SCRATCH REGISTERS
The general MSP430 CPU registers are divided into three separate sets, which are
described in this section.

Scratch registers
Any function is permitted to destroy the contents of a scratch register. If a function needs
the register value after a call to another function, it must store it during the call, for
example on the stack.
Any of the registers R12 to R15, as well as the return address registers, are considered
scratch registers and can be used by the function.
When the registers R11:R10:R9:R8 are used for passing a 64-bit scalar parameter, they
are also considered to be scratch registers.

Preserved registers
Preserved registers, on the other hand, are preserved across function calls. The called
function can use the register for other purposes, but must save the value before using the
register and restore it at the exit of the function.
The registers R4 to R11 are preserved registers.
If the registers R11:R10:R9:R8 are used for passing a 64-bit scalar parameter, they do
not have to be preserved.

Как я понял, функция может использовать регистры с R12 по R15 не сохраняя их значение. Содержимое регистров с R4 по R11 перед использованием функция должна сохранить и перед завершением работы восстановить их значения. Правильно?
Kompot
Цитата(d7d1cd @ Nov 22 2013, 11:45) *
Привет всем. Изучаю CompilerReference и хочу попросить знающих, правильно ли я понимаю следующий текст:

Как я понял, функция может использовать регистры с R12 по R15 не сохраняя их значение. Содержимое регистров с R4 по R11 перед использованием функция должна сохранить и перед завершением работы восстановить их значения. Правильно?

Верно. Не забудьте про нюанс с регистрами R11:R10:R9:R8.
d7d1cd
Цитата(Kompot @ Nov 22 2013, 12:04) *
Верно. Не забудьте про нюанс с регистрами R11:R10:R9:R8.

Спасибо. Про нюанс понял.
Для просмотра полной версии этой страницы, пожалуйста, пройдите по ссылке.
Invision Power Board © 2001-2025 Invision Power Services, Inc.