Move functions not available in PRE_RAM into seperate file. Makes it easier to share code between rom and ramstage. Change-Id: I0b9833fbf6742d110ee4bfc00cd650f219aebb2c Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/31141 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
		
			
				
	
	
		
			22 lines
		
	
	
		
			383 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			383 B
		
	
	
	
		
			C
		
	
	
	
	
	
#include <string.h>
 | 
						|
#include <stddef.h>
 | 
						|
#include <stdlib.h>
 | 
						|
 | 
						|
char *strdup(const char *s)
 | 
						|
{
 | 
						|
	size_t sz = strlen(s) + 1;
 | 
						|
	char *d = malloc(sz);
 | 
						|
	memcpy(d, s, sz);
 | 
						|
	return d;
 | 
						|
}
 | 
						|
 | 
						|
char *strconcat(const char *s1, const char *s2)
 | 
						|
{
 | 
						|
	size_t sz_1 = strlen(s1);
 | 
						|
	size_t sz_2 = strlen(s2);
 | 
						|
	char *d = malloc(sz_1 + sz_2 + 1);
 | 
						|
	memcpy(d, s1, sz_1);
 | 
						|
	memcpy(d + sz_1, s2, sz_2 + 1);
 | 
						|
	return d;
 | 
						|
}
 |