| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | typedef enum { | 
					
						
							|  |  |  | 	/* arg is a primitive number */ | 
					
						
							|  |  |  | 	RT_PRIMITIVE, | 
					
						
							|  |  |  | 	/* arg is a literal table index, holding an array pair (symbol/dll) */ | 
					
						
							|  |  |  | 	RT_DLSYM, | 
					
						
							|  |  |  | 	/* an indirect literal from the word's literal table */ | 
					
						
							|  |  |  | 	RT_LITERAL, | 
					
						
							|  |  |  | 	/* a pointer to a compiled word reference */ | 
					
						
							|  |  |  | 	RT_DISPATCH, | 
					
						
							|  |  |  | 	/* a compiled word reference */ | 
					
						
							|  |  |  | 	RT_XT, | 
					
						
							| 
									
										
										
										
											2008-01-13 17:07:59 -05:00
										 |  |  | 	/* current offset */ | 
					
						
							|  |  |  | 	RT_HERE, | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 	/* a local label */ | 
					
						
							| 
									
										
										
										
											2008-07-12 23:27:28 -04:00
										 |  |  | 	RT_LABEL, | 
					
						
							|  |  |  | 	/* immeditae literal */ | 
					
						
							|  |  |  | 	RT_IMMEDIATE | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | } F_RELTYPE; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef enum { | 
					
						
							|  |  |  | 	/* absolute address in a 64-bit location */ | 
					
						
							|  |  |  | 	RC_ABSOLUTE_CELL, | 
					
						
							|  |  |  | 	/* absolute address in a 32-bit location */ | 
					
						
							|  |  |  | 	RC_ABSOLUTE, | 
					
						
							|  |  |  | 	/* relative address in a 32-bit location */ | 
					
						
							|  |  |  | 	RC_RELATIVE, | 
					
						
							|  |  |  | 	/* relative address in a PowerPC LIS/ORI sequence */ | 
					
						
							|  |  |  | 	RC_ABSOLUTE_PPC_2_2, | 
					
						
							|  |  |  | 	/* relative address in a PowerPC LWZ/STW/BC instruction */ | 
					
						
							|  |  |  | 	RC_RELATIVE_PPC_2, | 
					
						
							|  |  |  | 	/* relative address in a PowerPC B/BL instruction */ | 
					
						
							|  |  |  | 	RC_RELATIVE_PPC_3, | 
					
						
							|  |  |  | 	/* relative address in an ARM B/BL instruction */ | 
					
						
							|  |  |  | 	RC_RELATIVE_ARM_3, | 
					
						
							|  |  |  | 	/* pointer to address in an ARM LDR/STR instruction */ | 
					
						
							|  |  |  | 	RC_INDIRECT_ARM, | 
					
						
							|  |  |  | 	/* pointer to address in an ARM LDR/STR instruction offset by 8 bytes */ | 
					
						
							|  |  |  | 	RC_INDIRECT_ARM_PC | 
					
						
							|  |  |  | } F_RELCLASS; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define REL_RELATIVE_PPC_2_MASK 0xfffc
 | 
					
						
							|  |  |  | #define REL_RELATIVE_PPC_3_MASK 0x3fffffc
 | 
					
						
							|  |  |  | #define REL_INDIRECT_ARM_MASK 0xfff
 | 
					
						
							|  |  |  | #define REL_RELATIVE_ARM_3_MASK 0xffffff
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* the rel type is built like a cell to avoid endian-specific code in
 | 
					
						
							|  |  |  | the compiler */ | 
					
						
							|  |  |  | #define REL_TYPE(r) ((r)->type & 0x000000ff)
 | 
					
						
							|  |  |  | #define REL_CLASS(r) (((r)->type & 0x0000ff00) >> 8)
 | 
					
						
							|  |  |  | #define REL_ARGUMENT(r) (((r)->type & 0xffff0000) >> 16)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* code relocation consists of a table of entries for each fixup */ | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  | 	unsigned int type; | 
					
						
							|  |  |  | 	unsigned int offset; | 
					
						
							|  |  |  | } F_REL; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-05-30 02:31:05 -04:00
										 |  |  | void relocate_code_block(F_COMPILED *relocating, CELL code_start, CELL literals_start); | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-01-09 01:33:40 -05:00
										 |  |  | void default_word_code(F_WORD *word, bool relocate); | 
					
						
							| 
									
										
										
										
											2008-01-02 19:36:36 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | void set_word_code(F_WORD *word, F_COMPILED *compiled); | 
					
						
							| 
									
										
										
										
											2007-10-28 04:33:36 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | F_COMPILED *add_compiled_block( | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 	CELL type, | 
					
						
							|  |  |  | 	F_ARRAY *code, | 
					
						
							|  |  |  | 	F_ARRAY *labels, | 
					
						
							| 
									
										
										
										
											2008-05-30 02:31:05 -04:00
										 |  |  | 	CELL relocation, | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 	F_ARRAY *literals); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | CELL compiled_code_format(void); | 
					
						
							| 
									
										
										
										
											2008-01-07 16:14:09 -05:00
										 |  |  | bool stack_traces_p(void); | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-16 15:17:28 -05:00
										 |  |  | DECLARE_PRIMITIVE(modify_code_heap); |