forked from OSchip/llvm-project
				
			builtins: make sure that flags is setup properly for __clear_cache
On Linux ARM, the syscall will take 3 arguments (start, end, flags). Ensure that we do not pass garbage to the flags, which can cause the cacheflush call to fail, and therefore cause an abort at runtime. llvm-svn: 280877
This commit is contained in:
		
							parent
							
								
									3989c9f96f
								
							
						
					
					
						commit
						d14c2c0139
					
				| 
						 | 
				
			
			@ -110,10 +110,12 @@ void __clear_cache(void *start, void *end) {
 | 
			
		|||
    #elif defined(__linux__)
 | 
			
		||||
         register int start_reg __asm("r0") = (int) (intptr_t) start;
 | 
			
		||||
         const register int end_reg __asm("r1") = (int) (intptr_t) end;
 | 
			
		||||
         const register int flags __asm("r2") = 0;
 | 
			
		||||
         const register int syscall_nr __asm("r7") = __ARM_NR_cacheflush;
 | 
			
		||||
         __asm __volatile("svc 0x0"
 | 
			
		||||
                          : "=r"(start_reg)
 | 
			
		||||
                          : "r"(syscall_nr), "r"(start_reg), "r"(end_reg));
 | 
			
		||||
                          : "r"(syscall_nr), "r"(start_reg), "r"(end_reg),
 | 
			
		||||
                            "r"(flags));
 | 
			
		||||
         if (start_reg != 0) {
 | 
			
		||||
             compilerrt_abort();
 | 
			
		||||
         }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue