annotate include/os/pcb.h @ 150:e72f984619c7

Consolidated a lot of the defines which relate to the memory layout There is a new file (include/os/memLayout.h) which now includes just about all the #defines
author Jonathan Pevarnek <pevarnj@gmail.com>
date Wed, 02 Nov 2011 09:55:09 -0400
parents cf569b2ab76c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
123
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
1 #ifndef __PCB_H
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
2 #define __PCB_H
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
3
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
4 #include <os/psw.h>
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
5 #include <os/svc.h>
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
6
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
7 typedef struct {
144
cf569b2ab76c Removed a magic number
Jonathan Pevarnek <pevarnj@gmail.com>
parents: 123
diff changeset
8 u64 registers[NUM_GPRS];
123
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
9 Psw psw;
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
10 } PCB;
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
11
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
12 static inline void setcontext_pcb(PCB *pcb)
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
13 {
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
14 setcontext(&(pcb->psw), pcb->registers);
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
15 }
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
16
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
17 static inline void savecontext_pcb(PCB *pcb)
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
18 {
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
19 savecontext(&(pcb->psw), pcb->registers);
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
20 }
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
21
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
22 static inline void swapcontext_pcb(PCB *old, PCB *new)
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
23 {
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
24 swapcontext(&(old->psw), old->registers, &(new->psw), new->registers);
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
25 }
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
26
2a35ea7e123b Moved the psw and registers into a program control block structure
Jonathan Pevarnek <pevarnj@gmail.com>
parents:
diff changeset
27 #endif