ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp
(Generate patch)

Comparing SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp (file contents):
Revision 1.28 by gbeauche, 2004-02-16T15:34:55Z vs.
Revision 1.30 by gbeauche, 2004-02-24T11:12:54Z

# Line 158 | Line 158 | public:
158          void interrupt(uint32 entry);
159          void handle_interrupt();
160  
161        // Lazy memory allocator (one item at a time)
162        void *operator new(size_t size)
163                { return allocator_helper< sheepshaver_cpu, lazy_allocator >::allocate(); }
164        void operator delete(void *p)
165                { allocator_helper< sheepshaver_cpu, lazy_allocator >::deallocate(p); }
166        // FIXME: really make surre array allocation fail at link time?
167        void *operator new[](size_t);
168        void operator delete[](void *p);
169
161          // Make sure the SIGSEGV handler can access CPU registers
162          friend sigsegv_return_t sigsegv_handler(sigsegv_address_t, sigsegv_address_t);
163   };
164  
165 < // FIXME: this specialization doesn't work with GCC
166 < // template<> lazy_allocator< sheepshaver_cpu > allocator_helper< sheepshaver_cpu, lazy_allocator >::allocator;
167 < template< class data_type, template< class > class allocator_type >
168 < allocator_type< data_type > allocator_helper< data_type, allocator_type >::allocator;
165 > // Memory allocator returning areas aligned on 16-byte boundaries
166 > void *operator new(size_t size)
167 > {
168 >        void *p;
169 >
170 >        /* XXX: try different approaches */
171 >        if (posix_memalign(&p, 16, size) != 0)
172 >                throw std::bad_alloc();
173 >
174 >        return p;
175 > }
176 >
177 > void operator delete(void *p)
178 > {
179 >        free(p);
180 > }
181  
182   sheepshaver_cpu::sheepshaver_cpu()
183          : powerpc_cpu(enable_jit_p())
# Line 712 | Line 715 | static sigsegv_return_t sigsegv_handler(
715                  else if (pc == ROM_BASE + 0x4a10a0 && (cpu->gpr(20) == 0xf3012002 || cpu->gpr(20) == 0xf3012000))
716                          return SIGSEGV_RETURN_SKIP_INSTRUCTION;
717  
718 +                // Ignore writes to the zero page
719 +                else if ((uint32)(addr - SheepMem::ZeroPage()) < (uint32)SheepMem::PageSize())
720 +                        return SIGSEGV_RETURN_SKIP_INSTRUCTION;
721 +
722                  // Ignore all other faults, if requested
723                  if (PrefsFindBool("ignoresegv"))
724                          return SIGSEGV_RETURN_SKIP_INSTRUCTION;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines