source: sqlite3_toppers/libc/libc_syscall.c@ 58

Last change on this file since 58 was 58, checked in by ertl-honda, 11 years ago

追加.

  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1/*
2 * TOPPERS Software
3 * Toyohashi Open Platform for Embedded Real-Time Systems
4 *
5 * Copyright (C) 2013 by Kijineko Inc.
6 *
7 * $B>e5-Cx:n8"<T$O!$0J2<$N(B(1)$B!A(B(4)$B$N>r7o$rK~$?$9>l9g$K8B$j!$K\%=%U%H%&%'(B
8 * $B%"!JK\%=%U%H%&%'%"$r2~JQ$7$?$b$N$r4^$`!%0J2<F1$8!K$r;HMQ!&J#@=!&2~(B
9 * $BJQ!&:FG[I[!J0J2<!$MxMQ$H8F$V!K$9$k$3$H$rL5=~$G5vBz$9$k!%(B
10 * (1) $BK\%=%U%H%&%'%"$r%=!<%9%3!<%I$N7A$GMxMQ$9$k>l9g$K$O!$>e5-$NCx:n(B
11 * $B8"I=<(!$$3$NMxMQ>r7o$*$h$S2<5-$NL5J]>Z5,Dj$,!$$=$N$^$^$N7A$G%=!<(B
12 * $B%9%3!<%ICf$K4^$^$l$F$$$k$3$H!%(B
13 * (2) $BK\%=%U%H%&%'%"$r!$%i%$%V%i%j7A<0$J$I!$B>$N%=%U%H%&%'%"3+H/$K;H(B
14 * $BMQ$G$-$k7A$G:FG[I[$9$k>l9g$K$O!$:FG[I[$KH<$&%I%-%e%a%s%H!JMxMQ(B
15 * $B<T%^%K%e%"%k$J$I!K$K!$>e5-$NCx:n8"I=<(!$$3$NMxMQ>r7o$*$h$S2<5-(B
16 * $B$NL5J]>Z5,Dj$r7G:\$9$k$3$H!%(B
17 * (3) $BK\%=%U%H%&%'%"$r!$5!4o$KAH$_9~$`$J$I!$B>$N%=%U%H%&%'%"3+H/$K;H(B
18 * $BMQ$G$-$J$$7A$G:FG[I[$9$k>l9g$K$O!$<!$N$$$:$l$+$N>r7o$rK~$?$9$3(B
19 * $B$H!%(B
20 * (a) $B:FG[I[$KH<$&%I%-%e%a%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$9(B
42 * $BI,MW$,$"$k!#(B
43 */
44
45#include <reent.h>
46#include <unistd.h>
47#include <kernel.h>
48#include "kernel_cfg.h"
49
50/* $B%R!<%W%5%$%:(B */
51#ifndef HEAP_SIZE
52# define HEAP_SIZE 0x100000
53#endif
54
55void *_sbrk_r(struct _reent *ptr, ptrdiff_t incr)
56{
57 static uint64_t storage[HEAP_SIZE / sizeof(uint64_t)];
58 static size_t pos = 0;
59 char *result;
60
61 if (pos + incr >= sizeof(storage))
62 return NULL;
63
64 incr = (incr + sizeof(uint64_t) - 1) / sizeof(uint64_t) * sizeof(uint64_t);
65 result = (char*)storage + pos;
66 pos += incr;
67 return result;
68}
69
70void __malloc_lock (struct _reent *ptr)
71{
72 (void)ptr;
73 if (!sns_ker())
74 dis_dsp();
75}
76
77void __malloc_unlock (struct _reent *ptr)
78{
79 (void)ptr;
80 if (!sns_ker())
81 ena_dsp();
82}
83
Note: See TracBrowser for help on using the repository browser.