2 * librm: a library for interfacing to real-mode code
4 * Michael Brown <mbrown@fensystems.co.uk>
8 FILE_LICENCE ( GPL2_OR_LATER
);
14 * This file provides functions for managing librm.
19 * Allocate space on the real-mode stack and copy data there from a
23 * @v size Size of stack data
24 * @ret sp New value of real-mode stack pointer
26 uint16_t copy_user_to_rm_stack ( userptr_t data
, size_t size
) {
29 rm_stack
= real_to_user ( rm_ss
, rm_sp
);
30 memcpy_user ( rm_stack
, 0, data
, 0, size
);
35 * Deallocate space on the real-mode stack, optionally copying back
36 * data to a user buffer.
39 * @v size Size of stack data
41 void remove_user_from_rm_stack ( userptr_t data
, size_t size
) {
43 userptr_t rm_stack
= real_to_user ( rm_ss
, rm_sp
);
44 memcpy_user ( rm_stack
, 0, data
, 0, size
);
49 PROVIDE_UACCESS_INLINE ( librm
, phys_to_user
);
50 PROVIDE_UACCESS_INLINE ( librm
, user_to_phys
);
51 PROVIDE_UACCESS_INLINE ( librm
, virt_to_user
);
52 PROVIDE_UACCESS_INLINE ( librm
, user_to_virt
);
53 PROVIDE_UACCESS_INLINE ( librm
, userptr_add
);
54 PROVIDE_UACCESS_INLINE ( librm
, memcpy_user
);
55 PROVIDE_UACCESS_INLINE ( librm
, memmove_user
);
56 PROVIDE_UACCESS_INLINE ( librm
, memset_user
);
57 PROVIDE_UACCESS_INLINE ( librm
, strlen_user
);
58 PROVIDE_UACCESS_INLINE ( librm
, memchr_user
);