ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/video_vosf.h
(Generate patch)

Comparing BasiliskII/src/Unix/video_vosf.h (file contents):
Revision 1.16 by gbeauche, 2001-05-20T20:31:50Z vs.
Revision 1.17 by gbeauche, 2001-06-26T22:35:41Z

# Line 28 | Line 28
28   *  Page-aligned memory allocation
29   */
30  
31 < // Align on page boundaries
32 < static uintptr align_on_page_boundary(uintptr size)
31 > // Extend size to page boundary
32 > static uint32 page_extend(uint32 size)
33   {
34          const uint32 page_size = getpagesize();
35          const uint32 page_mask = page_size - 1;
36          return (size + page_mask) & ~page_mask;
37   }
38  
39 // Allocate memory on page boundary
40 static void * allocate_framebuffer(uint32 size, uint8 * hint = 0)
41 {
42        // Remind that the system can allocate at 0x00000000...
43        return mmap((caddr_t)hint, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, zero_fd, 0);
44 }
45
39   // Screen fault handler
40   static bool screen_fault_handler(sigsegv_address_t fault_address, sigsegv_address_t fault_instruction)
41   {
# Line 55 | Line 48 | static bool screen_fault_handler(sigsegv
48           */
49          if ((addr >= mainBuffer.memStart) && (addr < mainBuffer.memEnd)) {
50                  const int page  = (addr - mainBuffer.memStart) >> mainBuffer.pageBits;
51 <                caddr_t page_ad = (caddr_t)(addr & ~(mainBuffer.pageSize - 1));
51 >                caddr_t page_ad = (caddr_t)(addr & -mainBuffer.pageSize);
52                  LOCK_VOSF;
53                  PFLAG_SET(page);
54 <                mprotect(page_ad, mainBuffer.pageSize, PROT_READ | PROT_WRITE);
54 >                vm_protect((char *)page_ad, mainBuffer.pageSize, VM_PAGE_READ | VM_PAGE_WRITE);
55                  mainBuffer.dirty = true;
56                  UNLOCK_VOSF;
57                  return true;
# Line 127 | Line 120 | static inline void update_display_window
120                  // Make the dirty pages read-only again
121                  const int32 offset  = first_page << mainBuffer.pageBits;
122                  const uint32 length = (page - first_page) << mainBuffer.pageBits;
123 <                mprotect((caddr_t)(mainBuffer.memStart + offset), length, PROT_READ);
123 >                vm_protect((char *)mainBuffer.memStart + offset, length, VM_PAGE_READ);
124                  
125                  // There is at least one line to update
126                  const int y1 = mainBuffer.pageInfo[first_page].top;
# Line 185 | Line 178 | static inline void update_display_dga_vo
178                  // Make the dirty pages read-only again
179                  const int32 offset  = first_page << mainBuffer.pageBits;
180                  const uint32 length = (page - first_page) << mainBuffer.pageBits;
181 <                mprotect((caddr_t)(mainBuffer.memStart + offset), length, PROT_READ);
181 >                vm_protect((char *)mainBuffer.memStart + offset, length, VM_PAGE_READ);
182                  
183                  // I am sure that y2 >= y1 and depth != 1
184                  const int y1 = mainBuffer.pageInfo[first_page].top;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines