POK(kernelpart)
Main Page
Data Structures
Files
File List
Globals
syscalls.c
Go to the documentation of this file.
1
/*
2
* POK header
3
*
4
* The following file is a part of the POK project. Any modification should
5
* made according to the POK licence. You CANNOT use this file or a part of
6
* this file is this part of a file for your own project
7
*
8
* For more information on the POK licence, please see our LICENCE FILE
9
*
10
* Please follow the coding guidelines described in doc/CODING_GUIDELINES
11
*
12
* Copyright (c) 2007-2009 POK team
13
*
14
* Created by julien on Thu Jan 15 23:34:13 2009
15
*/
16
23
#include <
errno.h
>
24
#include <
core/debug.h
>
25
#include <
core/syscall.h
>
26
#include <
core/partition.h
>
27
28
#include <types.h>
29
#include <
libc.h
>
30
31
#include "
thread.h
"
32
#include "
context_offset.h
"
33
#include "
traps.h
"
34
#include "
arch.h
"
35
39
void
pok_arch_sc_int
(
void
)
40
{
41
uint8_t
*ctx = (
uint8_t
*)
pok_arch_sp
;
42
uint32_t
num = *(
uint32_t
*)((
char
*)ctx -
I0_OFFSET
);
43
uint8_t
part_id;
44
pok_syscall_info_t
syscall_info;
45
pok_ret_t
syscall_ret;
46
pok_syscall_args_t
syscall_args;
47
pok_syscall_id_t
syscall_id;
48
49
50
part_id = pok_current_partition;
51
52
/* prepare syscall_info */
53
syscall_info.
partition
= part_id;
54
syscall_info.
base_addr
= pok_partitions[part_id].base_addr;
55
syscall_info.
thread
= POK_SCHED_CURRENT_THREAD;
56
57
/* prepare syscall_args */
58
syscall_args.
arg1
= *(
uint32_t
*)(ctx -
I1_OFFSET
);
59
syscall_args.
arg2
= *(
uint32_t
*)(ctx -
I2_OFFSET
);
60
syscall_args.
arg3
= *(
uint32_t
*)(ctx -
I3_OFFSET
);
61
syscall_args.
arg4
= *(
uint32_t
*)(ctx -
I4_OFFSET
);
62
syscall_args.
arg5
= *(
uint32_t
*)(ctx -
I5_OFFSET
);
63
64
syscall_args.
nargs
= 5;
65
66
/* prepare syscall_id */
67
syscall_id = (
pok_syscall_id_t
) num;
68
69
/*
70
* No pointer check needed, syscall_args is allocated in kernel stack.
71
*/
72
syscall_ret =
pok_core_syscall
(syscall_id, &syscall_args, &syscall_info);
73
74
*(
uint32_t
*)(ctx -
I0_OFFSET
) = syscall_ret;
75
*(
uint32_t
*)(ctx -
PC_OFFSET
) += 4;
// skip "ta" instruction
76
*(
uint32_t
*)(ctx -
NPC_OFFSET
) += 4;
77
}
78
83
void
pok_syscalls_init
(
void
)
84
{
85
pok_arch_event_register
(
SPARC_TRAP_SYSCALL_BASE
+ 0x2,
pok_arch_sc_int
);
86
}
kernel
arch
sparc
syscalls.c
Generated on Fri Jun 1 2012 19:07:12 for POK(kernelpart) by
1.8.1