Author: trasz
Date: Tue May 14 20:03:19 2019
New Revision: 347572
URL: https://svnweb.freebsd.org/changeset/base/347572

Log:
  MFC r345448:
  
  Remove trunc_page_ps() and round_page_ps() macros.  This completes
  the undoing of r100384.
  
  Sponsored by: DARPA, AFRL

Modified:
  stable/12/sys/kern/imgact_elf.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/imgact_elf.c
==============================================================================
--- stable/12/sys/kern/imgact_elf.c     Tue May 14 19:52:18 2019        
(r347571)
+++ stable/12/sys/kern/imgact_elf.c     Tue May 14 20:03:19 2019        
(r347572)
@@ -159,9 +159,7 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, honor_sbrk, CTLFLA
 
 static Elf_Brandinfo *elf_brand_list[MAX_BRANDS];
 
-#define        trunc_page_ps(va, ps)   rounddown2(va, ps)
-#define        round_page_ps(va, ps)   roundup2(va, ps)
-#define        aligned(a, t)   (trunc_page_ps((u_long)(a), sizeof(t)) == 
(u_long)(a))
+#define        aligned(a, t)   (rounddown2((u_long)(a), sizeof(t)) == 
(u_long)(a))
 
 static const char FREEBSD_ABI_VENDOR[] = "FreeBSD";
 
@@ -569,8 +567,8 @@ __elfN(load_section)(struct image_params *imgp, vm_oof
 
        object = imgp->object;
        map = &imgp->proc->p_vmspace->vm_map;
-       map_addr = trunc_page_ps((vm_offset_t)vmaddr, PAGE_SIZE);
-       file_addr = trunc_page_ps(offset, PAGE_SIZE);
+       map_addr = trunc_page((vm_offset_t)vmaddr);
+       file_addr = trunc_page(offset);
 
        /*
         * We have two choices.  We can either clear the data in the last page
@@ -581,9 +579,9 @@ __elfN(load_section)(struct image_params *imgp, vm_oof
        if (filsz == 0)
                map_len = 0;
        else if (memsz > filsz)
-               map_len = trunc_page_ps(offset + filsz, PAGE_SIZE) - file_addr;
+               map_len = trunc_page(offset + filsz) - file_addr;
        else
-               map_len = round_page_ps(offset + filsz, PAGE_SIZE) - file_addr;
+               map_len = round_page(offset + filsz) - file_addr;
 
        if (map_len != 0) {
                /* cow flags: don't dump readonly sections in core */
@@ -612,11 +610,10 @@ __elfN(load_section)(struct image_params *imgp, vm_oof
         * segment in the file is extended to provide bss.  It's a neat idea
         * to try and save a page, but it's a pain in the behind to implement.
         */
-       copy_len = filsz == 0 ? 0 : (offset + filsz) - trunc_page_ps(offset +
-           filsz, PAGE_SIZE);
-       map_addr = trunc_page_ps((vm_offset_t)vmaddr + filsz, PAGE_SIZE);
-       map_len = round_page_ps((vm_offset_t)vmaddr + memsz, PAGE_SIZE) -
-           map_addr;
+       copy_len = filsz == 0 ? 0 : (offset + filsz) - trunc_page(offset +
+           filsz);
+       map_addr = trunc_page((vm_offset_t)vmaddr + filsz);
+       map_len = round_page((vm_offset_t)vmaddr + memsz) - map_addr;
 
        /* This had damn well better be true! */
        if (map_len != 0) {
@@ -632,8 +629,7 @@ __elfN(load_section)(struct image_params *imgp, vm_oof
                        return (EIO);
 
                /* send the page fragment to user space */
-               off = trunc_page_ps(offset + filsz, PAGE_SIZE) -
-                   trunc_page(offset + filsz);
+               off = trunc_page(offset + filsz) - trunc_page(offset + filsz);
                error = copyout((caddr_t)sf_buf_kva(sf) + off,
                    (caddr_t)map_addr, copy_len);
                vm_imgact_unmap_page(sf);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to