- #define __NO_RETURN __declspec(noreturn)
- #define osEvent_type osEvent
- #define osEvent_ret_status ret
- #define osEvent_ret_value ret
- #define osEvent_ret_msg ret
- #define osEvent_ret_mail ret
- #define osCallback_type osCallback
- #define osCallback_ret ret
- #define SVC_0_1(f,t,...) \
- __svc_indirect(0) t _##f (t(*)()); \
- t f (void); \
- __attribute__((always_inline)) \
- static __inline t __##f (void) { \
- return _##f(f); \
- }
- #define SVC_1_0(f,t,t1,...) \
- __svc_indirect(0) t _##f (t(*)(t1),t1); \
- t f (t1 a1); \
- __attribute__((always_inline)) \
- static __inline t __##f (t1 a1) { \
- _##f(f,a1); \
- }
- #define SVC_1_1(f,t,t1,...) \
- __svc_indirect(0) t _##f (t(*)(t1),t1); \
- t f (t1 a1); \
- __attribute__((always_inline)) \
- static __inline t __##f (t1 a1) { \
- return _##f(f,a1); \
- }
- #define SVC_2_1(f,t,t1,t2,...) \
- __svc_indirect(0) t _##f (t(*)(t1,t2),t1,t2); \
- t f (t1 a1, t2 a2); \
- __attribute__((always_inline)) \
- static __inline t __##f (t1 a1, t2 a2) { \
- return _##f(f,a1,a2); \
- }
- #define SVC_3_1(f,t,t1,t2,t3,...) \
- __svc_indirect(0) t _##f (t(*)(t1,t2,t3),t1,t2,t3); \
- t f (t1 a1, t2 a2, t3 a3); \
- __attribute__((always_inline)) \
- static __inline t __##f (t1 a1, t2 a2, t3 a3) { \
- return _##f(f,a1,a2,a3); \
- }
- #define SVC_4_1(f,t,t1,t2,t3,t4,...) \
- __svc_indirect(0) t _##f (t(*)(t1,t2,t3,t4),t1,t2,t3,t4); \
- t f (t1 a1, t2 a2, t3 a3, t4 a4); \
- __attribute__((always_inline)) \
- static __inline t __##f (t1 a1, t2 a2, t3 a3, t4 a4) { \
- return _##f(f,a1,a2,a3,a4); \
- }
- #define SVC_1_2 SVC_1_1
- #define SVC_1_3 SVC_1_1
- #define SVC_2_3 SVC_2_1
复制代码
如上代码,只是知道这段代码的意思是在非特权等级下通过SVC来调用内核代码,但是不晓得其中原理是什么,还请各位高手指点一下!多谢。 |