Message type for SYS_MEMSET

Change-Id: Icebd04e0c53d9653301550bb598df8719aa66ada
This commit is contained in:
Lionel Sambuc 2014-05-20 13:18:39 +02:00
parent 1576ef5542
commit 3ed35f3958
4 changed files with 22 additions and 15 deletions

View file

@ -274,12 +274,6 @@
SYS_TIMES, SYS_SETALARM, SYS_SETGRANT, \ SYS_TIMES, SYS_SETALARM, SYS_SETGRANT, \
SYS_PROFBUF, SYS_DIAGCTL, SYS_STATECTL, SYS_SAFEMEMSET SYS_PROFBUF, SYS_DIAGCTL, SYS_STATECTL, SYS_SAFEMEMSET
/* Field names for SYS_MEMSET. */
#define MEM_PTR m2_p1 /* base */
#define MEM_COUNT m2_l1 /* count */
#define MEM_PATTERN m2_l2 /* pattern to write */
#define MEM_PROCESS m2_i1 /* NONE (phys) or process id (vir) */
/* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */ /* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
#define DIO_REQUEST m2_i3 /* device in or output */ #define DIO_REQUEST m2_i3 /* device in or output */
# define _DIO_INPUT 0x001 # define _DIO_INPUT 0x001

View file

@ -700,6 +700,16 @@ typedef struct {
} mess_lsys_krn_schedctl; } mess_lsys_krn_schedctl;
_ASSERT_MSG_SIZE(mess_lsys_krn_schedctl); _ASSERT_MSG_SIZE(mess_lsys_krn_schedctl);
typedef struct {
phys_bytes base;
phys_bytes count;
unsigned long pattern;
endpoint_t process;
uint8_t padding[40];
} mess_lsys_krn_sys_memset;
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_memset);
typedef struct { typedef struct {
int devind; int devind;
int port; int port;
@ -1423,6 +1433,7 @@ typedef struct {
mess_lsys_krn_schedctl m_lsys_krn_schedctl; mess_lsys_krn_schedctl m_lsys_krn_schedctl;
mess_lsys_krn_schedule m_lsys_krn_schedule; mess_lsys_krn_schedule m_lsys_krn_schedule;
mess_lsys_krn_sys_memset m_lsys_krn_sys_memset;
mess_lsys_pci_busc_get_bar m_lsys_pci_busc_get_bar; mess_lsys_pci_busc_get_bar m_lsys_pci_busc_get_bar;

View file

@ -2,9 +2,9 @@
* m_type: SYS_MEMSET * m_type: SYS_MEMSET
* *
* The parameters for this kernel call are: * The parameters for this kernel call are:
* m2_p1: MEM_PTR (virtual address) * m_lsys_krn_sys_memset.base (virtual address)
* m2_l1: MEM_COUNT (returns physical address) * m_lsys_krn_sys_memset.count (returns physical address)
* m2_l2: MEM_PATTERN (pattern byte to be written) * m_lsys_krn_sys_memset.pattern (pattern byte to be written)
*/ */
#include "kernel/system.h" #include "kernel/system.h"
@ -17,8 +17,10 @@
int do_memset(struct proc * caller, message * m_ptr) int do_memset(struct proc * caller, message * m_ptr)
{ {
/* Handle sys_memset(). This writes a pattern into the specified memory. */ /* Handle sys_memset(). This writes a pattern into the specified memory. */
vm_memset(caller, m_ptr->MEM_PROCESS, (phys_bytes) m_ptr->MEM_PTR, vm_memset(caller, m_ptr->m_lsys_krn_sys_memset.process,
m_ptr->MEM_PATTERN, (phys_bytes) m_ptr->MEM_COUNT); m_ptr->m_lsys_krn_sys_memset.base,
m_ptr->m_lsys_krn_sys_memset.pattern,
m_ptr->m_lsys_krn_sys_memset.count);
return(OK); return(OK);
} }

View file

@ -8,10 +8,10 @@ int sys_memset(endpoint_t who, unsigned long pattern,
if (bytes == 0L) return(OK); if (bytes == 0L) return(OK);
mess.MEM_PTR = (char *) base; mess.m_lsys_krn_sys_memset.base = base;
mess.MEM_COUNT = bytes; mess.m_lsys_krn_sys_memset.count = bytes;
mess.MEM_PATTERN = pattern; mess.m_lsys_krn_sys_memset.pattern = pattern;
mess.MEM_PROCESS = who; mess.m_lsys_krn_sys_memset.process = who;
return(_kernel_call(SYS_MEMSET, &mess)); return(_kernel_call(SYS_MEMSET, &mess));
} }