OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [docs/] [man/] [man7/] [l4_exchange_registers.7] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
.TH L4_EXCHANGE_REGISTERS 7 2009-11-02 "Codezero" "Codezero Programmer's Manual"
2
.SH NAME
3
.nf
4
.BR "l4_exchange_registers" "Modifies the context of a suspended thread."
5
 
6
.SH SYNOPSIS
7
.nf
8
.B #include 
9
.B #include 
10
 
11
.BI "int l4_exchange_registers(void " "*exregs_struct" ", l4id_t " "tid" ");"
12
.SH DESCRIPTION
13
.BR "l4_exchange_registers() " " Reads and modifies the context of a suspended thread."
14
 
15
By this call, pagers can read and modify any register or other crucial information about a thread such as the pager id or utcb virtual address. An architecture specific
16
.BI "struct " exregs_data
17
is passed to the kernel for modifying the targeted thread's context. See below for a detailed description of this structure and the default context structure for the ARM architecture.
18
 
19
.nf
20
/* Exchange registers context structure for the ARM architecture */
21
.B typedef struct arm_exregs_context {
22
.BI "      u32 " "r0" ";                /* 0x4 */"
23
.BI "      u32 " "r1" ";                /* 0x8 */"
24
.BI "      u32 " "r2" ";                /* 0xC */"
25
.BI "      u32 " "r3" ";                /* 0x10 */"
26
.BI "      u32 " "r4" ";                /* 0x14 */"
27
.BI "      u32 " "r5" ";                /* 0x18 */"
28
.BI "      u32 " "r6" ";                /* 0x1C */"
29
.BI "      u32 " "r7" ";                /* 0x20 */"
30
.BI "      u32 " "r8" ";                /* 0x24 */"
31
.BI "      u32 " "r9" ";                /* 0x28 */"
32
.BI "      u32 " "r10" ";               /* 0x2C */"
33
.BI "      u32 " "r11" ";               /* 0x30 */"
34
.BI "      u32 " "r12" ";               /* 0x34 */"
35
.BI "      u32 " "sp" ";                /* 0x38 */"
36
.BI "      u32 " "lr" ";                /* 0x3C */"
37
.BI "      u32 " "pc" ";                /* 0x40 */"
38
.B } __attribute__((__packed__)) exregs_context_t;
39
 
40
.nf
41
/*
42
 * Generic structure passed by userspace pagers
43
 * for exchanging registers
44
 */
45
.B struct exregs_data {
46
.BI "      exregs_context_t " "context" ";"
47
.BI "      u32 " "valid_vect" ";"
48
.BI "      u32 " "flags" ";"
49
.BI "      l4id_t " "pagerid" ";"
50
.BI "      unsigned long " "utcb_address" ";"
51
.B };
52
 
53
.fi
54
.in 7
55
Each bit in the
56
.I valid_vect
57
field determines which register offsets are going to be modified.
58
 
59
.I flags
60
field determines whether to set or read the pager values provided, and affects the
61
.IR pagerid " and " utcb_address
62
fields of the thread:
63
.TP
64
.B EXREGS_SET_PAGER
65
Sets the pagerid value of the targeted thread.
66
.TP
67
.B EXREGS_SET_UTCB
68
Sets the utcb virtual address of the targeted thread.
69
.TP
70
.B EXREGS_READ
71
Enables read-only operation, all set fields are read back from the targeted thread's context instead of modifying it.
72
 
73
 
74
.in 8
75
.SH L4 USERSPACE LIBRARY
76
 
77
.nf
78
/*
79
 * Exchange register library calls to modify program counter,
80
 * stack, pager id, utcb address and any hardware register.
81
 */
82
.BI "void exregs_set_stack(struct exregs_data " "*s" ", unsigned long " sp);
83
.BI "void exregs_set_mr(struct exregs_data " "*s" ", int " "offset" ", unsigned long " "val" ");"
84
.BI "void exregs_set_pc(struct exregs_data " "*s" ", unsigned long " "pc" ");"
85
.BI "void exregs_set_pager(struct exregs_data " "*s" ", l4id_t " "pagerid" ");"
86
.BI "void exregs_set_utcb(struct exregs_data  "*s" ", unsigned long " "virt" ");"
87
 
88
.fi
89
Above functions may be used for convenient manipulation of the
90
.BI "struct " "exregs_data"
91
structure.
92
 
93
.SH RETURN VALUE
94
.IR "l4_exchange_registers"()
95
Returns 0 on success, and negative value on failure. See below for error codes.
96
 
97
.SH ERRORS
98
.TP
99
.B -ESRCH
100
Target thread was not found in the system.
101
 
102
.TP
103
.B -ENOCAP
104
Capabilities required don't exist or do not have sufficient privileges.
105
 
106
.TP
107
.B -EACTIVE
108
Target thread has not suspended yet.
109
 
110
.TP
111
.B -EAGAIN
112
Target thread is busy holding a mutex.
113
 
114
.SH SEE ALSO
115
.BR "l4_thread_control"(7)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.