tools/llvm: Do not build with symbols
[minix3.git] / minix / kernel / arch / i386 / do_readbios.c
blobb7ad3c524127c29a9faa5796cffe566201cc8df5
1 /* The kernel call implemented in this file:
2 * m_type: SYS_READBIOS
4 * The parameters for this kernel call are:
5 * m_lsys_krn_readbios.size number of bytes to copy
6 * m_lsys_krn_readbios.addr absolute address in BIOS area
7 * m_lsys_krn_readbios.buf buffer address in requesting process
8 */
10 #include "kernel/system.h"
11 #include <minix/type.h>
13 /*===========================================================================*
14 * do_readbios *
15 *===========================================================================*/
16 int do_readbios(struct proc * caller, message * m_ptr)
18 struct vir_addr src, dst;
19 size_t len = m_ptr->m_lsys_krn_readbios.size;
20 vir_bytes limit;
22 src.offset = m_ptr->m_lsys_krn_readbios.addr;
23 dst.offset = m_ptr->m_lsys_krn_readbios.buf;
24 src.proc_nr_e = NONE;
25 dst.proc_nr_e = m_ptr->m_source;
27 limit = src.offset + len - 1;
29 #define VINRANGE(v, a, b) ((a) <= (v) && (v) <= (b))
30 #define SUBRANGE(a,b,c,d) (VINRANGE((a), (c), (d)) && VINRANGE((b),(c),(d)))
31 #define USERRANGE(a, b) SUBRANGE(src.offset, limit, (a), (b))
33 if(!USERRANGE(BIOS_MEM_BEGIN, BIOS_MEM_END) &&
34 !USERRANGE(BASE_MEM_TOP, UPPER_MEM_END))
35 return EPERM;
37 return virtual_copy_vmcheck(caller, &src, &dst, m_ptr->m_lsys_krn_readbios.size);