On 31/05/17 17:20, Nisal Menuka wrote: > Hi, > Is it possible to reserve any other general purpose registers? > Yes, provided it doesn't have a special role in the procedure call standard, you can reserve any register, whether callee or caller saved. Note two things, however. 1) You will probably have to rebuild all the libraries and hand-check any assembly code to ensure that it conforms to your changed 'ABI' 2) This is generally not well tested, so your mileage may vary. Report any bugs in the compiler as you find them. Library developers almost certainly won't be interested in changing their code for your specialist case. My recommendation is to stick to x18 if you want a specialist register. The PCS recommends this and most assembler code will avoid using it for that reason - you'll still need to recompile your libraries for that, however. R. > Nisal > > On Wed, May 31, 2017 at 8:37 AM, Richard Earnshaw (lists) > <Richard.Earnshaw@xxxxxxx> wrote: >> On 31/05/17 00:34, Nisal Menuka wrote: >>> Hi, >>> I would like to reserve some registers in ARM64 processor and prohibit >>> the compiler from using them in any scenario. >>> >>> For example: ARM64 Thirty-one 64-bit general-purpose registers X0-X30. >>> I want to reserve register X30, and make sure when I compile any code >>> using gcc, it won't use register X30 in any situation. >>> >> >> You can't reserve x30, it's the link register and clobbered by call >> instructions. >> >> R. >> >>> How can this be done? Any help would be greatly appreciated. >>> >>> Thanks, >>> Nisal >>> >>