Exemplo n.º 1
0
void _init_c_runtime()
{
  // Initialize .bss section
  extern char _BSS_START_, _BSS_END_;
  streamset8(&_BSS_START_, 0, &_BSS_END_ - &_BSS_START_);
  
  // Initialize the heap before exceptions
  extern caddr_t heap_end; // used by SBRK:
  extern char _end;        // Defined by the linker 
  // Set heap to after _end (given by linker script) if needed
  if (&_end > heap_end)
    heap_end = &_end;
  
  /// initialize newlib I/O
  newlib_reent = (struct _reent) _REENT_INIT(newlib_reent);
  // set newlibs internal structure to ours
  _REENT = &newlib_reent;
  // Unix standard streams
  stdin  = _REENT->_stdin;  // stdin  == 1
  stdout = _REENT->_stdout; // stdout == 2
  stderr = _REENT->_stderr; // stderr == 3
  
  /// initialize exceptions before we can run constructors
  extern void* __eh_frame_start;
  // Tell the stack unwinder where exception frames are located
  extern void __register_frame(void*);
  __register_frame(&__eh_frame_start);  
  
  /// call global constructors emitted by compiler
  extern void _init();
  _init();
}
Exemplo n.º 2
0
 // guarantee that the directory is initalized empty
 VFSdir()
 {
   streamset8(nodes, 0, VFS::BLOCK_SIZE);
   //memset(nodes, 0, VFS::BLOCK_SIZE);
 }