1 /* The kernel call implemented in this file:
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
10 #include "kernel/system.h"
12 /*===========================================================================*
14 *===========================================================================*/
15 int do_readbios(struct proc
* caller
, message
* m_ptr
)
17 struct vir_addr src
, dst
;
18 size_t len
= m_ptr
->m_lsys_krn_readbios
.size
;
21 src
.offset
= m_ptr
->m_lsys_krn_readbios
.addr
;
22 dst
.offset
= m_ptr
->m_lsys_krn_readbios
.buf
;
24 dst
.proc_nr_e
= m_ptr
->m_source
;
26 limit
= src
.offset
+ len
- 1;
28 #define VINRANGE(v, a, b) ((a) <= (v) && (v) <= (b))
29 #define SUBRANGE(a,b,c,d) (VINRANGE((a), (c), (d)) && VINRANGE((b),(c),(d)))
30 #define USERRANGE(a, b) SUBRANGE(src.offset, limit, (a), (b))
32 if(!USERRANGE(BIOS_MEM_BEGIN
, BIOS_MEM_END
) &&
33 !USERRANGE(BASE_MEM_TOP
, UPPER_MEM_END
))
36 return virtual_copy_vmcheck(caller
, &src
, &dst
, m_ptr
->m_lsys_krn_readbios
.size
);