This source file includes following definitions.
- spu_alloc_lscsa
- spu_free_lscsa
1
2
3
4
5
6
7
8 #undef DEBUG
9
10 #include <linux/kernel.h>
11 #include <linux/mm.h>
12 #include <linux/slab.h>
13 #include <linux/vmalloc.h>
14
15 #include <asm/spu.h>
16 #include <asm/spu_csa.h>
17 #include <asm/mmu.h>
18
19 #include "spufs.h"
20
21 int spu_alloc_lscsa(struct spu_state *csa)
22 {
23 struct spu_lscsa *lscsa;
24 unsigned char *p;
25
26 lscsa = vzalloc(sizeof(*lscsa));
27 if (!lscsa)
28 return -ENOMEM;
29 csa->lscsa = lscsa;
30
31
32 for (p = lscsa->ls; p < lscsa->ls + LS_SIZE; p += PAGE_SIZE)
33 SetPageReserved(vmalloc_to_page(p));
34
35 return 0;
36 }
37
38 void spu_free_lscsa(struct spu_state *csa)
39 {
40
41 unsigned char *p;
42
43 if (csa->lscsa == NULL)
44 return;
45
46 for (p = csa->lscsa->ls; p < csa->lscsa->ls + LS_SIZE; p += PAGE_SIZE)
47 ClearPageReserved(vmalloc_to_page(p));
48
49 vfree(csa->lscsa);
50 }