Diff for /gforth/engine/main.c between versions 1.255 and 1.256

version 1.255, 2012/07/23 13:27:48 version 1.256, 2012/07/23 14:15:52
Line 651  void set_stack_sizes(ImageHeader * heade Line 651  void set_stack_sizes(ImageHeader * heade
 #define NEXTPAGE(addr) ((Address)((((UCell)(addr)-1)&-pagesize)+pagesize))  #define NEXTPAGE(addr) ((Address)((((UCell)(addr)-1)&-pagesize)+pagesize))
 #define NEXTPAGE2(addr) ((Address)((((UCell)(addr)-1)&-pagesize)+2*pagesize))  #define NEXTPAGE2(addr) ((Address)((((UCell)(addr)-1)&-pagesize)+2*pagesize))
   
 int gforth_go(void *image, int stack, Cell *entries)  int gforth_go(Xt* ip0)
 {  {
   volatile ImageHeader *image_header = (ImageHeader *)image;  
   Xt *ip0=(Xt *)(image_header->boot_entry);  
 #ifdef SYSSIGNALS  #ifdef SYSSIGNALS
   int throw_code;    int throw_code;
   jmp_buf throw_jmp_buf;    jmp_buf throw_jmp_buf;
Line 663  int gforth_go(void *image, int stack, Ce Line 661  int gforth_go(void *image, int stack, Ce
   Cell signal_return_stack[16];    Cell signal_return_stack[16];
   Float signal_fp_stack[1];    Float signal_fp_stack[1];
   
   /* ensure that the cached elements (if any) are accessible */  
 #if !(defined(GFORTH_DEBUGGING) || defined(INDIRECT_THREADED) || defined(DOUBLY_INDIRECT) || defined(VM_PROFILING))  
   gforth_SP -= 8; /* make stuff below bottom accessible for stack caching */  
   gforth_FP--;  
 #endif  
     
   for(;stack>0;stack--)  
     *--gforth_SP=entries[stack-1];  
   
 #if defined(SYSSIGNALS) && !defined(STANDALONE)  #if defined(SYSSIGNALS) && !defined(STANDALONE)
   get_winsize();  
      
   install_signal_handlers(); /* right place? */  
   
   throw_jmp_handler = &throw_jmp_buf;    throw_jmp_handler = &throw_jmp_buf;
   
   debugp(stderr, "setjmp(%p)\n", *throw_jmp_handler);    debugp(stderr, "setjmp(%p)\n", *throw_jmp_handler);
Line 700  int gforth_go(void *image, int stack, Ce Line 685  int gforth_go(void *image, int stack, Ce
 #endif /* !defined(GFORTH_DEBUGGING) */  #endif /* !defined(GFORTH_DEBUGGING) */
     /* fprintf(stderr, "rp=$%x\n",rp0);*/      /* fprintf(stderr, "rp=$%x\n",rp0);*/
           
     ip0=image_header->throw_entry;      ip0=gforth_header->throw_entry;
     gforth_SP=signal_data_stack+15;      gforth_SP=signal_data_stack+15;
     gforth_FP=signal_fp_stack;      gforth_FP=signal_fp_stack;
   }    }
Line 1867  void gforth_init() Line 1852  void gforth_init()
 #endif /* defined(HAS_OS) */  #endif /* defined(HAS_OS) */
 #endif  #endif
   code_here = ((void *)0)+code_area_size;    code_here = ((void *)0)+code_area_size;
   
     get_winsize();
      
     install_signal_handlers(); /* right place? */
 }  }
   
 /* pointer to last '/' or '\' in file, 0 if there is none. */  /* pointer to last '/' or '\' in file, 0 if there is none. */
Line 2437  user_area* gforth_stacks(Cell dsize, Cel Line 2426  user_area* gforth_stacks(Cell dsize, Cel
 void gforth_setstacks()  void gforth_setstacks()
 {  {
   gforth_UP->next_task = NULL; /* mark user area as need-to-be-set */    gforth_UP->next_task = NULL; /* mark user area as need-to-be-set */
   
     /* ensure that the cached elements (if any) are accessible */
   #if !(defined(GFORTH_DEBUGGING) || defined(INDIRECT_THREADED) || defined(DOUBLY_INDIRECT) || defined(VM_PROFILING))
     gforth_UP->sp0 -= 8; /* make stuff below bottom accessible for stack caching */
     gforth_UP->fp0--;
   #endif
   
   gforth_SP = gforth_UP->sp0;    gforth_SP = gforth_UP->sp0;
   gforth_RP = gforth_UP->rp0;    gforth_RP = gforth_UP->rp0;
   gforth_FP = gforth_UP->fp0;    gforth_FP = gforth_UP->fp0;
Line 2453  int gforth_main(int argc, char **argv, c Line 2449  int gforth_main(int argc, char **argv, c
   progname = argv[0];    progname = argv[0];
   
   gforth_args(argc, argv, &path, &imagename);    gforth_args(argc, argv, &path, &imagename);
   image = gforth_loader(imagename, path);    gforth_header = gforth_loader(imagename, path);
   gforth_UP = gforth_stacks(dsize, rsize, fsize, lsize);    gforth_UP = gforth_stacks(dsize, rsize, fsize, lsize);
   gforth_setstacks();    gforth_setstacks();
   gforth_header=(ImageHeader *)image; /* used in SIGSEGV handler */  
   
   {    {
     char path2[strlen(path)+1];      char path2[strlen(path)+1];
     char *p1, *p2;      char *p1, *p2;
     Cell environ[]= {  
       (Cell)argc-(optind-1),  
       (Cell)(argv+(optind-1)),  
       (Cell)strlen(path),  
       (Cell)path2};  
     argv[optind-1] = progname;      argv[optind-1] = progname;
     /*      /*
        for (i=0; i<environ[0]; i++)         for (i=0; i<environ[0]; i++)
Line 2478  int gforth_main(int argc, char **argv, c Line 2469  int gforth_main(int argc, char **argv, c
       else        else
         *p2 = *p1;          *p2 = *p1;
     *p2='\0';      *p2='\0';
     retvalue = gforth_go(image, 4, environ);  
       *--gforth_SP=(Cell)path2;
       *--gforth_SP=(Cell)strlen(path);
       *--gforth_SP=(Cell)(argv+(optind-1));
       *--gforth_SP=(Cell)(argc-(optind-1));
   
       debugp(stderr, "Booting Gforth: %p\n", gforth_header->boot_entry);
       retvalue = gforth_go(gforth_header->boot_entry);
       if(retvalue > 0) {
         debugp(stderr, "Quit into Gforth: %p\n", gforth_header->quit_entry);
         retvalue = gforth_go(gforth_header->quit_entry);
       }
     gforth_cleanup();      gforth_cleanup();
     gforth_printmetrics();      gforth_printmetrics();
   }    }

Removed from v.1.255  
changed lines
  Added in v.1.256


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>