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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [mmixware/] [sbrk.c] - Blame information for rev 148

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* sbrk for MMIXware.
2
 
3
   Copyright (C) 2001 Hans-Peter Nilsson
4
 
5
   Permission to use, copy, modify, and distribute this software is
6
   freely granted, provided that the above copyright notice, this notice
7
   and the following disclaimer are preserved with no changes.
8
 
9
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
10
   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
11
   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
12
   PURPOSE.  */
13
 
14
#include <_ansi.h>
15
#include <sys/types.h>
16
#include <sys/stat.h>
17
#include "sys/syscall.h"
18
 
19
extern char *_Sbrk_high;
20
 
21
/* When the program is loaded, the first location in Pool_Segment holds
22
   the first available octabyte in the memory pool (a.k.a. the heap);
23
   somewhere after the command-line parameters.  We don't have to
24
   initialize that location, we can just use it straight up as a pointer;
25
   just point the symbol there.
26
 
27
   This file will be compiled with -no-builtin-syms, so we need to define
28
   Pool_Segment and any other symbols that would be predefined in mmixal.  */
29
 
30
__asm__ (" .global _Sbrk_high\n"
31
         "_Sbrk_high    IS      Pool_Segment\n"
32
         "Pool_Segment  IS      0x40<<56");
33
 
34
caddr_t
35
_sbrk (size_t incr)
36
{
37
  extern char end;              /* Defined by the linker */
38
  char *prev_heap_end;
39
 
40
  prev_heap_end = _Sbrk_high;
41
  _Sbrk_high += incr;
42
  return (caddr_t) prev_heap_end;
43
}

powered by: WebSVN 2.1.0

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