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

Comparing SheepShaver/src/Unix/main_unix.cpp (file contents):
Revision 1.19 by gbeauche, 2003-12-05T12:41:19Z vs.
Revision 1.20 by gbeauche, 2003-12-05T13:37:54Z

# Line 204 | Line 204 | static bool ready_for_signals = false;
204   static int64 num_segv = 0;                                      // Number of handled SEGV signals
205  
206   static struct sigaction sigusr2_action;         // Interrupt signal (of emulator thread)
207 < #if !EMULATED_PPC
207 > #if EMULATED_PPC
208 > static uintptr sig_stack = 0;                           // Stack for PowerPC interrupt routine
209 > #else
210   static struct sigaction sigsegv_action;         // Data access exception signal (of emulator thread)
211   static struct sigaction sigill_action;          // Illegal instruction signal (of emulator thread)
212   static void *sig_stack = NULL;                          // Stack for signal handlers
# Line 253 | Line 255 | extern void paranoia_check(void);
255  
256   #if EMULATED_PPC
257   /*
258 + *  Return signal stack base
259 + */
260 +
261 + uintptr SignalStackBase(void)
262 + {
263 +        return sig_stack + SIG_STACK_SIZE;
264 + }
265 +
266 +
267 + /*
268   *  Atomic operations
269   */
270  
# Line 1773 | Line 1785 | rti:;
1785  
1786   bool SheepMem::Init(void)
1787   {
1788 +        const int page_size = getpagesize();
1789 +
1790 +        // Allocate SheepShaver globals
1791          if (vm_acquire_fixed((char *)base, size) < 0)
1792                  return false;
1793  
1794 +        // Allocate page with all bits set to 0
1795          zero_page = base + size;
1780
1781        int page_size = getpagesize();
1796          if (vm_acquire_fixed((char *)zero_page, page_size) < 0)
1797                  return false;
1798          memset((char *)zero_page, 0, page_size);
1799          if (vm_protect((char *)zero_page, page_size, VM_PAGE_READ) < 0)
1800                  return false;
1801  
1802 + #if EMULATED_PPC
1803 +        // Allocate alternate stack for PowerPC interrupt routine
1804 +        sig_stack = zero_page + page_size;
1805 +        if (vm_acquire_fixed((char *)sig_stack, SIG_STACK_SIZE) < 0)
1806 +                return false;
1807 + #endif
1808 +
1809          top = base + size;
1810          return true;
1811   }
# Line 1792 | Line 1813 | bool SheepMem::Init(void)
1813   void SheepMem::Exit(void)
1814   {
1815          if (top) {
1816 <                // The zero page is next to SheepShaver globals
1817 <                vm_release((void *)base, size + getpagesize());
1816 >                const int page_size = getpagesize();
1817 >
1818 >                // Delete SheepShaver globals
1819 >                vm_release((void *)base, size);
1820 >
1821 >                // Delete zero page
1822 >                vm_release((void *)zero_page, page_size);
1823 >
1824 > #if EMULATED_PPC
1825 >                // Delete alternate stack for PowerPC interrupt routine
1826 >                vm_release((void *)sig_stack, SIG_STACK_SIZE);
1827 > #endif
1828          }
1829   }
1830  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines