Subversion Repositories HelenOS-historic

Rev

Rev 1386 | Rev 1474 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1386 Rev 1448
Line 45... Line 45...
45
#include <ddi/ddi.h>
45
#include <ddi/ddi.h>
46
#include <security/cap.h>
46
#include <security/cap.h>
47
#include <syscall/copy.h>
47
#include <syscall/copy.h>
48
#include <sysinfo/sysinfo.h>
48
#include <sysinfo/sysinfo.h>
49
 
49
 
-
 
50
/** Print using kernel facility
-
 
51
 *
-
 
52
 * Some simulators can print only through kernel. Userspace can use
-
 
53
 * this syscall to facilitate it.
-
 
54
 */
50
static __native sys_io(int fd, const void * buf, size_t count)
55
static __native sys_io(int fd, const void * buf, size_t count)
51
{
56
{
52
//  return count; /*Syscall deprecated*/
-
 
53
    // TODO: buf sanity checks and a lot of other stuff ...
-
 
54
 
-
 
55
    size_t i;
57
    size_t i;
-
 
58
    char *data;
-
 
59
    int rc;
-
 
60
 
-
 
61
    if (count > PAGE_SIZE)
-
 
62
        return ELIMIT;
-
 
63
 
-
 
64
    data = malloc(count, 0);
-
 
65
    if (!data)
-
 
66
        return ENOMEM;
56
   
67
   
-
 
68
    rc = copy_from_uspace(data, buf, count);
-
 
69
    if (rc) {
-
 
70
        free(data);
-
 
71
        return rc;
-
 
72
    }
-
 
73
 
57
    for (i = 0; i < count; i++)
74
    for (i = 0; i < count; i++)
58
        putchar(((char *) buf)[i]);
75
        putchar(data[i]);
-
 
76
    free(data);
59
   
77
   
60
    return count;
78
    return count;
61
}
79
}
62
 
80
 
63
/** Dispatch system call */
81
/** Dispatch system call */