summary refs log tree commit diff stats
path: root/tinyc/lib/armflush.c
blob: eae32605f24190f78da2989ec383b6040bd2b122 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* armflush.c - flush the instruction cache

   __clear_cache is used in tccrun.c,  It is a built-in
   intrinsic with gcc.  However tcc in order to compile
   itself needs this function */

#ifdef __TINYC__

/* syscall wrapper */
unsigned syscall(unsigned syscall_nr, ...);

/* arm-tcc supports only fake asm currently */
__asm__(
    ".global syscall\n"
    "syscall:\n"
    ".int 0xe92d4080\n"  // push    {r7, lr}
    ".int 0xe1a07000\n"  // mov     r7, r0
    ".int 0xe1a00001\n"  // mov     r0, r1
    ".int 0xe1a01002\n"  // mov     r1, r2
    ".int 0xe1a02003\n"  // mov     r2, r3
    ".int 0xef000000\n"  // svc     0x00000000
    ".int 0xe8bd8080\n"  // pop     {r7, pc}
    );

/* from unistd.h: */
#if defined(__thumb__) || defined(__ARM_EABI__)
# define __NR_SYSCALL_BASE      0x0
#else
# define __NR_SYSCALL_BASE      0x900000
#endif
#define __ARM_NR_BASE           (__NR_SYSCALL_BASE+0x0f0000)
#define __ARM_NR_cacheflush     (__ARM_NR_BASE+2)

#else

#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <stdio.h>

#endif

/* Flushing for tccrun */
void __clear_cache(void *beginning, void *end)
{
/* __ARM_NR_cacheflush is kernel private and should not be used in user space.
 * However, there is no ARM asm parser in tcc so we use it for now */
#if 1
    syscall(__ARM_NR_cacheflush, beginning, end, 0);
#else
    __asm__ ("push {r7}\n\t"
             "mov r7, #0xf0002\n\t"
             "mov r2, #0\n\t"
             "swi 0\n\t"
             "pop {r7}\n\t"
             "ret");
#endif
}
font color="#ffffff">colorschemes</font></a>.jungle</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/work/ranger/ranger/colorschemes/jungle.py">/home/hut/work/ranger/ranger/colorschemes/jungle.py</a></font></td></tr></table> <p></p> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#aa55cc"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> <tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="curses.html">curses</a><br> </td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ee77aa"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> <tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><dl> <dt><font face="helvetica, arial"><a href="ranger.gui.colorscheme.html#ColorScheme">ranger.gui.colorscheme.ColorScheme</a>(<a href="builtins.html#object">builtins.object</a>) </font></dt><dd> <dl> <dt><font face="helvetica, arial"><a href="ranger.colorschemes.jungle.html#Default">Default</a> </font></dt></dl> </dd> </dl> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="Default">class <strong>Default</strong></a>(<a href="ranger.gui.colorscheme.html#ColorScheme">ranger.gui.colorscheme.ColorScheme</a>)</font></td></tr> <tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><dl><dt>Method resolution order:</dt> <dd><a href="ranger.colorschemes.jungle.html#Default">Default</a></dd> <dd><a href="ranger.gui.colorscheme.html#ColorScheme">ranger.gui.colorscheme.ColorScheme</a></dd> <dd><a href="builtins.html#object">builtins.object</a></dd> </dl> <hr> Methods defined here:<br> <dl><dt><a name="Default-use"><strong>use</strong></a>(self, context)</dt></dl> <hr> Methods inherited from <a href="ranger.gui.colorscheme.html#ColorScheme">ranger.gui.colorscheme.ColorScheme</a>:<br> <dl><dt><a name="Default-__init__"><strong>__init__</strong></a>(self)</dt></dl> <dl><dt><a name="Default-get"><strong>get</strong></a>(self, *keys)</dt><dd><tt>Determine&nbsp;the&nbsp;(fg,&nbsp;bg,&nbsp;attr)&nbsp;tuple&nbsp;or&nbsp;get&nbsp;it&nbsp;from&nbsp;cache</tt></dd></dl> <dl><dt><a name="Default-get_attr"><strong>get_attr</strong></a>(self, *keys)</dt><dd><tt>Returns&nbsp;the&nbsp;curses&nbsp;attr&nbsp;integer&nbsp;for&nbsp;the&nbsp;specified&nbsp;keys</tt></dd></dl> <hr> Data descriptors inherited from <a href="ranger.gui.colorscheme.html#ColorScheme">ranger.gui.colorscheme.ColorScheme</a>:<br> <dl><dt><strong>__dict__</strong></dt> <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> </td></tr></table></td></tr></table><p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#55aa55"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> <tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><strong>COLOR_PAIRS</strong> = {10: 0}<br> <strong>black</strong> = 0<br> <strong>blue</strong> = 4<br> <strong>bold</strong> = 2097152<br> <strong>cyan</strong> = 6<br> <strong>default</strong> = -1<br> <strong>default_colors</strong> = (-1, -1, 0)<br> <strong>green</strong> = 2<br> <strong>invisible</strong> = 8388608<br> <strong>magenta</strong> = 5<br> <strong>normal</strong> = 0<br> <strong>red</strong> = 1<br> <strong>reverse</strong> = 262144<br> <strong>underline</strong> = 131072<br> <strong>white</strong> = 7<br> <strong>yellow</strong> = 3</td></tr></table> </body></html>