⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stormy-abi

📁 linux下的gcc编译器
💻
字号:
xStormy16 ABI************!!!!! NOTE !!!!!This document is a draft and is subject to change.!!!!! NOTE !!!!!This part of the file describes the conventions required to writeELF object files that are link-compatible with the ones producedby the GNU toolchains.Bit and Byte Ordering=====================This implementation is little-endian.   Bits are numbered starting from 0 being the LSB.In this document, 'word' means 16 bits.Calling Sequence================The registers are allocated as follows:Register	Purpose-------------------------------------------------------------------r0, r1          Call-volatile.  May be changed during the execution                of a call instruction.r2 through r7   Argument passing;  call-clobbered.r8, r9		Call-volatile.  May be changed during the execution		of a call instruction.r10 through r13	Call-saved.r14		Program status word.r15		Stack pointer.Scalar values are returned in register r2-r7 if the value fits.Otherwise, a pointer is passed as a 'hidden' first argument andthe return value is placed there.Arguments are passed in registers starting in r2, then on the stack.Arguments of size not a multiple of a word are padded to whole words.If an argument would otherwise be passed partially in registers, andpartially on the stack, the whole of it is passed on the stack.  Thelast argument is pushed on the stack first.After a procedure's arguments are pushed on the stack,the return address is pushed on the stack, as if by the callinstruction.  The return address is on the top of the stack whena procedure is called.Objects whose size is a multiple of 16 bits are aligned to a 16-bitboundary.Pointers are 16 bits, referencing addresses between 0 and 0xFFFF.Procedure pointers are also implemented as 16-bit pointers.Variable Argument Functions===========================The C type 'va_list' is implemented as a structure, as follows:struct {  char *base;  unsigned count;}Both fields are 16 bits.  An argument of size N bytes(N will be even) is accessed as if by the following code:char *result;/* count = #bytes non-variable arguments *//* 12 = #bytes for register arguments */if (count + N > 12)  {    if (count < 12)      count = 12;    result = base - (count + N - 12 + 4);  }else  {    result = base + count;  }count += N;/* The argument is at `*result'.  */One implementation of this is if a variadic function firstpushes registers 2 through 7 in sequence at entry, andsets 'base' to the address of the first word pushed, producing a stack that appears like:SP ->	[other data]	r7	r6	r5	r4	r3count->	r2	Return address (two words)	7th procedure parameter word	8th procedure parameter word	...	last procedure parameter wordand initializes 'count' to be the number of bytes of non-variablearguments to the function.ELF File Format===============ELF file header---------------xStormy16 ELF files are distinguished by the value EM_XSTORMY16 inthe e_machine field of the ELF file header:#define EM_XSTORMY16	        0xad45DWARF Register Number Mapping-----------------------------Registers r0 through r15 are mapped to numbers 0 through 15.Relocations-----------RELA relocs are used exclusively.  The relocation types defined are:Name			Value	Field	Calculation	Overflow----------------------------------------------------------------R_XSTORMY16_NONE		0	none	none		noneR_XSTORMY16_32		1	32	S + A		noneR_XSTORMY16_16		2	16	S + A		unsignedR_XSTORMY16_8		3	8	S + A		unsignedR_XSTORMY16_PC32		4	32	S + A - P	noneR_XSTORMY16_PC16		5	16	S + A - P	signedR_XSTORMY16_PC8		6	8	S + A - P	signedR_XSTORMY16_REL_12	7	16:12:0	S + A - P	signedR_XSTORMY16_24		8	32:23:1	(S + A) >> 1	unsignedR_XSTORMY16_GNU_VTINHERIT 9	n/a	n/a		n/aR_XSTORMY16_GNU_VTENTRY	10	n/a	n/a		n/aIn the 'Calculation' column, 'S' is the value of the symbol to whichthe reloc refers, 'A' is the addend, and 'P' represents the place ofthe storage unit being relocated.In the 'Field' column, the first number indicates whether therelocation refers to a byte, word or doubleword.  The second number,if any, indicates the size of the bit-field into which the relocationis to occur (and also the size for overflow checking).  The thirdnumber indicates the first bit of the bit-field in the word ordoubleword, counting the LSB as bit 0.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -