/[cmucl]/src/lisp/sunos-os.c
ViewVC logotype

Diff of /src/lisp/sunos-os.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by dtc, Wed Jun 18 08:57:23 1997 UTC revision 1.6 by dtc, Fri Oct 27 19:33:05 2000 UTC
# Line 36  extern int errno; Line 36  extern int errno;
36  #endif /* SOLARIS */  #endif /* SOLARIS */
37    
38  #include "os.h"  #include "os.h"
39    /* To get dynamic_0_space and friends */
40    #include "globals.h"
41    /* To get memory map */
42    #include "sparc-validate.h"
43    
44  /* block size must be larger than the system page size */  /* block size must be larger than the system page size */
45  #define SPARSE_BLOCK_SIZE (1<<15)  #define SPARSE_BLOCK_SIZE (1<<15)
# Line 987  sigsetmask(int mask) Line 991  sigsetmask(int mask)
991  }  }
992    
993  #endif /* SOLARIS */  #endif /* SOLARIS */
994    
995    os_vm_address_t
996    round_up_sparse_size(os_vm_address_t addr)
997    {
998      return (addr + SPARSE_BLOCK_SIZE - 1) & ~SPARSE_SIZE_MASK;
999    }
1000    
1001    /*
1002     * An array of the start of the spaces which should have holes placed
1003     * after them.  Must not include the dynamic spaces because the size
1004     * of the dynamic space can be controlled from the command line.
1005     */
1006    static os_vm_address_t spaces[] =
1007    {
1008      READ_ONLY_SPACE_START, STATIC_SPACE_START,
1009      BINDING_STACK_START, CONTROL_STACK_START
1010    };
1011    
1012    /*
1013    
1014     * The corresponding array for the size of each space.  Be sure that
1015     * the spaces and holes don't overlap!  The sizes MUST be on
1016     * SPARSE_BLOCK_SIZE boundaries.
1017    
1018     */
1019    static unsigned long space_size[] =
1020    {
1021      READ_ONLY_SPACE_SIZE, STATIC_SPACE_SIZE,
1022      BINDING_STACK_SIZE, CONTROL_STACK_SIZE
1023    };
1024    
1025    /*
1026     * The size of the hole to make.  It should be strictly smaller than
1027     * SPARSE_BLOCK_SIZE.
1028     */
1029    
1030    #define HOLE_SIZE 0x2000
1031    
1032    void make_holes(void)
1033    {
1034      int k;
1035      os_vm_address_t hole;
1036    
1037      /* Make holes of the appropriate size for desired spaces */
1038    
1039      for (k = 0; k < sizeof(spaces)/sizeof(spaces[0]); ++k)
1040        {
1041    
1042          hole = spaces[k] + space_size[k];
1043    
1044          if (os_validate(hole, HOLE_SIZE) == NULL) {
1045            fprintf(stderr,
1046                    "ensure_space: Failed to validate hole of %ld bytes at 0x%08X\n",
1047                    HOLE_SIZE,
1048                    (unsigned long)hole);
1049            exit(1);
1050          }
1051          /* Make it inaccessible */
1052          os_protect(hole, HOLE_SIZE, 0);
1053        }
1054    
1055      /* Round up the dynamic_space_size to the nearest SPARSE_BLOCK_SIZE */
1056      dynamic_space_size = round_up_sparse_size(dynamic_space_size);
1057    
1058      /* Now make a hole for the dynamic spaces */
1059      hole = dynamic_space_size + (os_vm_address_t) dynamic_0_space;
1060    
1061      if (os_validate(hole, HOLE_SIZE) == NULL)
1062        {
1063          fprintf(stderr,
1064                  "ensure_space: Failed to validate hold of %ld bytes at 0x%08X\n",
1065                  HOLE_SIZE,
1066                  (unsigned long)hole);
1067          exit(1);
1068        }
1069      os_protect(hole, HOLE_SIZE, 0);
1070    
1071      hole = dynamic_space_size + (os_vm_address_t) dynamic_1_space;
1072      if (os_validate(hole, HOLE_SIZE) == NULL)
1073        {
1074          fprintf(stderr,
1075                  "ensure_space: Failed to validate hole of %ld bytes at 0x%08X\n",
1076                  HOLE_SIZE,
1077                  (unsigned long)hole);
1078          exit(1);
1079        }
1080      os_protect(hole, HOLE_SIZE, 0);
1081    }
1082    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.5