| 
									
										
										
										
											2009-05-04 02:46:13 -04:00
										 |  |  | namespace factor | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-04 05:50:24 -04:00
										 |  |  | enum relocation_type { | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 	/* arg is a primitive number */ | 
					
						
							|  |  |  | 	RT_PRIMITIVE, | 
					
						
							|  |  |  | 	/* arg is a literal table index, holding an array pair (symbol/dll) */ | 
					
						
							|  |  |  | 	RT_DLSYM, | 
					
						
							|  |  |  | 	/* a pointer to a compiled word reference */ | 
					
						
							|  |  |  | 	RT_DISPATCH, | 
					
						
							| 
									
										
										
										
											2009-05-06 20:22:22 -04:00
										 |  |  | 	/* a word or quotation's general entry point */ | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 	RT_XT, | 
					
						
							| 
									
										
										
										
											2009-05-06 20:22:22 -04:00
										 |  |  | 	/* a word's PIC entry point */ | 
					
						
							|  |  |  | 	RT_XT_PIC, | 
					
						
							|  |  |  | 	/* a word's tail-call PIC entry point */ | 
					
						
							|  |  |  | 	RT_XT_PIC_TAIL, | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 	/* current offset */ | 
					
						
							|  |  |  | 	RT_HERE, | 
					
						
							|  |  |  | 	/* current code block */ | 
					
						
							|  |  |  | 	RT_THIS, | 
					
						
							|  |  |  | 	/* immediate literal */ | 
					
						
							|  |  |  | 	RT_IMMEDIATE, | 
					
						
							| 
									
										
										
										
											2009-10-16 12:39:22 -04:00
										 |  |  | 	/* address of ctx var */ | 
					
						
							|  |  |  | 	RT_CONTEXT, | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 	/* untagged fixnum literal */ | 
					
						
							|  |  |  | 	RT_UNTAGGED, | 
					
						
							| 
									
										
										
										
											2009-05-07 15:26:08 -04:00
										 |  |  | 	/* address of megamorphic_cache_hits var */ | 
					
						
							|  |  |  | 	RT_MEGAMORPHIC_CACHE_HITS, | 
					
						
							| 
									
										
										
										
											2009-09-23 13:18:23 -04:00
										 |  |  | 	/* address of vm object */ | 
					
						
							| 
									
										
										
										
											2009-08-18 15:40:26 -04:00
										 |  |  | 	RT_VM, | 
					
						
							| 
									
										
										
										
											2009-10-14 03:06:01 -04:00
										 |  |  | 	/* value of vm->cards_offset */ | 
					
						
							|  |  |  | 	RT_CARDS_OFFSET, | 
					
						
							|  |  |  | 	/* value of vm->decks_offset */ | 
					
						
							|  |  |  | 	RT_DECKS_OFFSET, | 
					
						
							| 
									
										
										
										
											2009-05-04 05:50:24 -04:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-04 05:50:24 -04:00
										 |  |  | enum relocation_class { | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 	/* 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, | 
					
						
							| 
									
										
										
										
											2009-05-05 21:56:23 -04:00
										 |  |  | 	/* absolute address in a PowerPC LIS/ORI sequence */ | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 	RC_ABSOLUTE_PPC_2_2, | 
					
						
							| 
									
										
										
										
											2009-05-05 21:56:23 -04:00
										 |  |  | 	/* absolute address in a PowerPC LWZ instruction */ | 
					
						
							|  |  |  | 	RC_ABSOLUTE_PPC_2, | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 	/* 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 | 
					
						
							| 
									
										
										
										
											2009-05-04 05:50:24 -04:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-08 16:05:55 -04:00
										 |  |  | static const cell rel_absolute_ppc_2_mask = 0xffff; | 
					
						
							|  |  |  | static const cell rel_relative_ppc_2_mask = 0xfffc; | 
					
						
							|  |  |  | static const cell rel_relative_ppc_3_mask = 0x3fffffc; | 
					
						
							|  |  |  | static const cell rel_indirect_arm_mask = 0xfff; | 
					
						
							|  |  |  | static const cell rel_relative_arm_3_mask = 0xffffff; | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* code relocation table consists of a table of entries for each fixup */ | 
					
						
							| 
									
										
										
										
											2009-05-04 05:50:24 -04:00
										 |  |  | typedef u32 relocation_entry; | 
					
						
							| 
									
										
										
										
											2009-05-02 05:04:19 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-04 02:46:13 -04:00
										 |  |  | } |