view include/svc_prog.h @ 99:2a0aa3efc228

The shell script will now theroretically load the program into memory, will not run it. The shell script loads a program into memory and displays the address but as of now does not jump to it (though it does display the address it would jump to) Added a memset function Added a python script (credit for its writing to Jeff) that sets up a filesystem
author Jonathan Pevarnek <pevarnj@gmail.com>
date Sat, 14 May 2011 19:40:18 -0400
parents e7b9148156c4
children fb73c5728eaf
line wrap: on
line source

#ifndef __SVC_PROG_H
#define __SVC_PROG_H

/* invokes the specified SVC with 0 to 4 args */

#define invoke_svc0(n) ({ \
				u64 _ret; \
				asm volatile( \
					"svc	%1\n" \
					"lgr	%0,%%r2\n" \
				: /* output */ \
				  "=r" (_ret) \
				: /* input */ \
				  "i" (n) \
				: /* clobber */ \
				  "cc", "r2", "r3" \
				); \
				_ret; \
			})

#define invoke_svc1(n, a1) ({ \
				u64 _ret; \
				asm volatile( \
					"lgr	%%r2,%2\n" \
					"svc	%1\n" \
					"lgr	%0,%%r2\n" \
				: /* output */ \
				  "=r" (_ret) \
				: /* input */ \
				  "i" (n) \
				  "d" (a1) \
				: /* clobber */ \
				  "cc", "r2", "r3" \
				); \
				_ret; \
			})

#define invoke_svc2(n, a1, a2) ({ \
				u64 _ret; \
				asm volatile( \
					"lgr	%%r2,%2\n" \
					"lgr	%%r3,%3\n" \
					"svc	%1\n" \
					"lgr	%0,%%r2\n" \
				: /* output */ \
				  "=r" (_ret) \
				: /* input */ \
				  "i" (n) \
				  "d" (a1) \
				  "d" (a2) \
				: /* clobber */ \
				  "cc", "r2", "r3" \
				); \
				_ret; \
			})

#define invoke_svc3(n, a1, a2, a3) ({ \
				u64 _ret; \
				asm volatile( \
					"lgr	%%r2,%2\n" \
					"lgr	%%r3,%3\n" \
					"lgr	%%r4,%4\n" \
					"svc	%1\n" \
					"lgr	%0,%%r2\n" \
				: /* output */ \
				  "=r" (_ret) \
				: /* input */ \
				  "i" (n) \
				  "d" (a1) \
				  "d" (a2) \
				  "d" (a3) \
				: /* clobber */ \
				  "cc", "r2", "r3", "r4" \
				); \
				_ret; \
			})

#define invoke_svc4(n, a1, a2, a3, a4) ({ \
				u64 _ret; \
				asm volatile( \
					"lgr	%%r2,%2\n" \
					"lgr	%%r3,%3\n" \
					"lgr	%%r4,%4\n" \
					"lgr	%%r5,%5\n" \
					"svc	%1\n" \
					"lgr	%0,%%r2\n" \
				: /* output */ \
				  "=r" (_ret) \
				: /* input */ \
				  "i" (n) \
				  "d" (a1) \
				  "d" (a2) \
				  "d" (a3) \
				: /* clobber */ \
				  "cc", "r2", "r3", "r4", "r5" \
				); \
				_ret; \
			})

#endif