mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 09:02:43 +00:00 
			
		
		
		
	UserspaceEmulator: Move the SoftCPU stream virtuals to the header
They don't actually get inlined yet, but at least this devirtualizes them which is nice.
This commit is contained in:
		
							parent
							
								
									868db2313f
								
							
						
					
					
						commit
						2f81c20002
					
				
					 2 changed files with 33 additions and 33 deletions
				
			
		|  | @ -74,39 +74,6 @@ void SoftCPU::update_code_cache() | ||||||
|     m_cached_code_end = region->cacheable_ptr(region->size()); |     m_cached_code_end = region->cacheable_ptr(region->size()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| u8 SoftCPU::read8() |  | ||||||
| { |  | ||||||
|     if (!m_cached_code_ptr || m_cached_code_ptr >= m_cached_code_end) |  | ||||||
|         update_code_cache(); |  | ||||||
| 
 |  | ||||||
|     u8 value = *m_cached_code_ptr; |  | ||||||
|     m_cached_code_ptr += 1; |  | ||||||
|     m_eip += 1; |  | ||||||
|     return value; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| u16 SoftCPU::read16() |  | ||||||
| { |  | ||||||
|     if (!m_cached_code_ptr || (m_cached_code_ptr + 2) >= m_cached_code_end) |  | ||||||
|         update_code_cache(); |  | ||||||
| 
 |  | ||||||
|     u16 value = *reinterpret_cast<const u16*>(m_cached_code_ptr); |  | ||||||
|     m_cached_code_ptr += 2; |  | ||||||
|     m_eip += 2; |  | ||||||
|     return value; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| u32 SoftCPU::read32() |  | ||||||
| { |  | ||||||
|     if (!m_cached_code_ptr || (m_cached_code_ptr + 4) >= m_cached_code_end) |  | ||||||
|         update_code_cache(); |  | ||||||
| 
 |  | ||||||
|     u32 value = *reinterpret_cast<const u32*>(m_cached_code_ptr); |  | ||||||
|     m_cached_code_ptr += 4; |  | ||||||
|     m_eip += 4; |  | ||||||
|     return value; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| u8 SoftCPU::read_memory8(X86::LogicalAddress address) | u8 SoftCPU::read_memory8(X86::LogicalAddress address) | ||||||
| { | { | ||||||
|     ASSERT(address.selector() == 0x18 || address.selector() == 0x20 || address.selector() == 0x28); |     ASSERT(address.selector() == 0x18 || address.selector() == 0x20 || address.selector() == 0x28); | ||||||
|  |  | ||||||
|  | @ -812,4 +812,37 @@ private: | ||||||
|     const u8* m_cached_code_end { nullptr }; |     const u8* m_cached_code_end { nullptr }; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | ALWAYS_INLINE u8 SoftCPU::read8() | ||||||
|  | { | ||||||
|  |     if (!m_cached_code_ptr || m_cached_code_ptr >= m_cached_code_end) | ||||||
|  |         update_code_cache(); | ||||||
|  | 
 | ||||||
|  |     u8 value = *m_cached_code_ptr; | ||||||
|  |     m_cached_code_ptr += 1; | ||||||
|  |     m_eip += 1; | ||||||
|  |     return value; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | ALWAYS_INLINE u16 SoftCPU::read16() | ||||||
|  | { | ||||||
|  |     if (!m_cached_code_ptr || (m_cached_code_ptr + 2) >= m_cached_code_end) | ||||||
|  |         update_code_cache(); | ||||||
|  | 
 | ||||||
|  |     u16 value = *reinterpret_cast<const u16*>(m_cached_code_ptr); | ||||||
|  |     m_cached_code_ptr += 2; | ||||||
|  |     m_eip += 2; | ||||||
|  |     return value; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | ALWAYS_INLINE u32 SoftCPU::read32() | ||||||
|  | { | ||||||
|  |     if (!m_cached_code_ptr || (m_cached_code_ptr + 4) >= m_cached_code_end) | ||||||
|  |         update_code_cache(); | ||||||
|  | 
 | ||||||
|  |     u32 value = *reinterpret_cast<const u32*>(m_cached_code_ptr); | ||||||
|  |     m_cached_code_ptr += 4; | ||||||
|  |     m_eip += 4; | ||||||
|  |     return value; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling