14 #define __data16( variable ) variable 15 #define __data16_array( variable, array ) variable array 16 #define __bss16( variable ) variable 17 #define __bss16_array( variable, array ) variable array 18 #define __text16( variable ) variable 19 #define __text16_array( variable,array ) variable array 20 #define __use_data16( variable ) variable 21 #define __use_text16( variable ) variable 22 #define __from_data16( pointer ) pointer 23 #define __from_text16( pointer ) pointer 26 static inline __attribute__ (( always_inline ))
unsigned int _rm_cs (
void ) {
32 static inline __attribute__ (( always_inline ))
unsigned int _rm_ds (
void ) {
38 #define rm_cs ( _rm_cs() ) 39 #define rm_ds ( _rm_ds() ) 45 const void *
src,
size_t n ) {
54 :
"r" ( dest_seg ),
"D" (
dest_off ),
73 "r" ( src_seg ),
"S" (
src_off ),
78 #define copy_to_real copy_to_real_libkir 79 #define copy_from_real copy_from_real_libkir 98 #define put_real_kir_const_off( var, seg, off ) \ 99 __asm__ ( "movw %w1, %%es\n\t" \ 100 "mov %0, %%es:%c2\n\t" \ 104 : "r,r" ( var ), "rm,rm" ( seg ), "i,!r" ( off ) \ 107 #define put_real_kir_nonconst_off( var, seg, off ) \ 108 __asm__ ( "movw %w1, %%es\n\t" \ 109 "mov %0, %%es:(%2)\n\t" \ 113 : "r" ( var ), "rm" ( seg ), "r" ( off ) \ 116 #define put_real_kir( var, seg, off ) \ 118 if ( __builtin_constant_p ( off ) ) \ 119 put_real_kir_const_off ( var, seg, off ); \ 121 put_real_kir_nonconst_off ( var, seg, off ); \ 124 #define get_real_kir_const_off( var, seg, off ) \ 125 __asm__ ( "movw %w1, %%es\n\t" \ 126 "mov %%es:%c2, %0\n\t" \ 130 : "rm,rm" ( seg ), "i,!r" ( off ) \ 133 #define get_real_kir_nonconst_off( var, seg, off ) \ 134 __asm__ ( "movw %w1, %%es\n\t" \ 135 "mov %%es:(%2), %0\n\t" \ 139 : "rm" ( seg ), "r" ( off ) \ 142 #define get_real_kir( var, seg, off ) \ 144 if ( __builtin_constant_p ( off ) ) \ 145 get_real_kir_const_off ( var, seg, off ); \ 147 get_real_kir_nonconst_off ( var, seg, off ); \ 150 #define put_real put_real_kir 151 #define get_real get_real_kir 217 #define TEXT16_CODE( asm_code_str ) \ 218 ".section \".text16\", \"ax\", @progbits\n\t" \ 221 asm_code_str "\n\t" \ 226 #define REAL_CODE( asm_code_str ) \ 228 asm_code_str "\n\t" \ uint16_t segment
Code segment.
static off_t const void * src
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
static off_t const void size_t len
static __attribute__((always_inline)) unsigned int _rm_cs(void)
Copy data to user buffer.
uint32_t userptr_t
A pointer to a user buffer.
static __always_inline void off_t userptr_t off_t src_off
static void copy_from_real_libkir(void *dest, unsigned int src_seg, unsigned int src_off, size_t n)
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
static __always_inline void off_t dest_off
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
userptr_t virt_to_user(volatile const void *addr)
Convert virtual address to user pointer.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
static void copy_to_real_libkir(unsigned int dest_seg, unsigned int dest_off, const void *src, size_t n)
static __always_inline userptr_t real_to_user(unsigned int segment, unsigned int offset)
Convert segment:offset address to user buffer.