Back to index

plt-scheme  4.2.1
Defines | Functions | Variables
AmigaOS.c File Reference
#include "gc_priv.h"
#include <stdio.h>
#include <signal.h>
#include <exec/exec.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <dos/dosextens.h>
#include <workbench/startup.h>

Go to the source code of this file.

Defines

#define GC_AMIGA_DEF
#define GC_AMIGA_SB
#define GC_AMIGA_DS
#define GC_AMIGA_AM

Functions

ptr_t GC_get_stack_base ()
void GC_register_data_segments ()
voidGC_amiga_allocwrapper (size_t size, void *(*AllocFunction)(size_t size2))
voidGC_amiga_realloc (void *old_object, size_t new_size_in_bytes)

Variables

void *(* GC_amiga_allocwrapper_do )(size_t size, void *(*AllocFunction)(size_t size2)) = GC_amiga_allocwrapper

Define Documentation

#define GC_AMIGA_AM

Definition at line 18 of file AmigaOS.c.

#define GC_AMIGA_DEF

Definition at line 15 of file AmigaOS.c.

#define GC_AMIGA_DS

Definition at line 17 of file AmigaOS.c.

#define GC_AMIGA_SB

Definition at line 16 of file AmigaOS.c.


Function Documentation

void* GC_amiga_allocwrapper ( size_t  size,
void *(*)(size_t size2)  AllocFunction 
)

Definition at line 214 of file AmigaOS.c.

                                                                             {
       return (*AllocFunction)(size);
}
void* GC_amiga_realloc ( void old_object,
size_t  new_size_in_bytes 
)

Definition at line 577 of file AmigaOS.c.

                                                                 {
#ifndef GC_AMIGA_FASTALLOC
       return GC_realloc(old_object,new_size_in_bytes);
#else
       void *ret;
       latestsize=new_size_in_bytes;
       ret=GC_realloc(old_object,new_size_in_bytes);
       if(ret==NULL && GC_AMIGA_MEMF==(MEMF_FAST | MEMF_CLEAR)){
              /* Out of fast-mem. */
#ifdef GC_AMIGA_GC
              if(!GC_dont_gc){
                     GC_gcollect();
#ifdef GC_AMIGA_PRINTSTATS
                     numcollects++;
#endif
                     ret=GC_realloc(old_object,new_size_in_bytes);
              }
#endif
              if(ret==NULL){
#ifndef GC_AMIGA_ONLYFAST
                     GC_AMIGA_MEMF=MEMF_ANY | MEMF_CLEAR;
                     if(GC_amiga_toany!=NULL) (*GC_amiga_toany)();
                     GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_any;
                     ret=GC_realloc(old_object,new_size_in_bytes);
#endif
              }
#ifdef GC_AMIGA_PRINTSTATS
              else{
                     nullretries++;
              }
#endif
       }
       if(ret==NULL){
              WARN("Out of Memory!  Returning NIL!\n", 0);
       }
#ifdef GC_AMIGA_PRINTSTATS
       if(((char *)ret)<chipmax && ret!=NULL){
              chipa+=new_size_in_bytes;
       }
#endif
       return ret;
#endif
}

Here is the call graph for this function:

Definition at line 43 of file AmigaOS.c.

{
    struct Process *proc = (struct Process*)SysBase->ThisTask;
 
    /* Reference: Amiga Guru Book Pages: 42,567,574 */
    if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS
        && proc->pr_CLI != NULL) {
       /* first ULONG is StackSize */
       /*longPtr = proc->pr_ReturnAddr;
       size = longPtr[0];*/

       return (char *)proc->pr_ReturnAddr + sizeof(ULONG);
    } else {
       return (char *)proc->pr_Task.tc_SPUpper;
    }
}

Here is the caller graph for this function:

Definition at line 96 of file AmigaOS.c.

   {
     struct Process  *proc;
     struct CommandLineInterface *cli;
     BPTR myseglist;
     ULONG *data;
 
     int      num;


#    ifdef __GNUC__
        ULONG dataSegSize;
        GC_bool found_segment = FALSE;
       extern char __data_size[];

       dataSegSize=__data_size+8;
       /* Can`t find the Location of __data_size, because
           it`s possible that is it, inside the segment. */

#     endif

       proc= (struct Process*)SysBase->ThisTask;

       /* Reference: Amiga Guru Book Pages: 538ff,565,573
                   and XOper.asm */
       if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS) {
         if (proc->pr_CLI == NULL) {
           myseglist = proc->pr_SegList;
         } else {
           /* ProcLoaded    'Loaded as a command: '*/
           cli = BADDR(proc->pr_CLI);
           myseglist = cli->cli_Module;
         }
       } else {
         ABORT("Not a Process.");
       }

       if (myseglist == NULL) {
           ABORT("Arrrgh.. can't find segments, aborting");
       }

       /* xoper hunks Shell Process */

       num=0;
        for (data = (ULONG *)BADDR(myseglist); data != NULL;
             data = (ULONG *)BADDR(data[0])) {
         if (((ULONG) GC_register_data_segments < (ULONG) &data[1]) ||
             ((ULONG) GC_register_data_segments > (ULONG) &data[1] + data[-1])) {
#             ifdef __GNUC__
              if (dataSegSize == data[-1]) {
                found_segment = TRUE;
              }
#            endif
             GC_add_roots_inner((char *)&data[1],
                             ((char *)&data[1]) + data[-1], FALSE);
          }
          ++num;
        } /* for */
#      ifdef __GNUC__
          if (!found_segment) {
            ABORT("Can`t find correct Segments.\nSolution: Use an newer version of ixemul.library");
          }
#      endif
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

void*(* GC_amiga_allocwrapper_do)(size_t size, void *(*AllocFunction)(size_t size2)) = GC_amiga_allocwrapper

Definition at line 218 of file AmigaOS.c.