Date: Mon, 9 Jul 2012 22:59:44 GMT From: Brooks Davis <brooks@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 214150 for review Message-ID: <201207092259.q69MxiKh066393@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@214150?ac=10 Change 214150 by brooks@brooks_ecr_current on 2012/07/09 22:59:10 Add the ability to disable certain protection modes. Use this to disable CHERI which is not yet ready. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd/browser/browser.c#7 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd/browser/browser.c#7 (text+ko) ==== @@ -163,13 +163,14 @@ struct _sbdata { enum _sbtype sbtype; + int enabled; int bcol; int ecol; } sbdata[] = { - { SB_NONE, SB_IMG_NONE_BCOL, SB_IMG_NONE_ECOL }, - { SB_CAPSICUM, SB_IMG_CAPSICUM_BCOL, SB_IMG_CAPSICUM_ECOL }, - { SB_CHERI, SB_IMG_CHERI_BCOL, SB_IMG_CHERI_ECOL }, - { 0, 0, 0 } + { SB_NONE, 1, SB_IMG_NONE_BCOL, SB_IMG_NONE_ECOL }, + { SB_CAPSICUM, 1, SB_IMG_CAPSICUM_BCOL, SB_IMG_CAPSICUM_ECOL }, + { SB_CHERI, 0, SB_IMG_CHERI_BCOL, SB_IMG_CHERI_ECOL }, + { 0, 0, 0, 0 } }; static u_int32_t *bgimage; @@ -235,6 +236,28 @@ } static void +init_bgimage(void) +{ + int i, j, pixel, sb; + + bgimage = malloc(sizeof(u_int32_t) * fb_height * fb_width); + if (bgimage == NULL) + err(1, "malloc"); + read_png_file(BASEIMG, bgimage, fb_width, fb_height); + + for (sb = 0; sbdata[sb].sbtype != 0; sb++) { + if (sbdata[sb].enabled) + continue; + for (j = SB_MINROW; j < SB_MAXROW; j++) { + for (i = sbdata[sb].bcol; i <= sbdata[sb].ecol; i++) { + pixel = (j * fb_width) + i; + bgimage[pixel] = vwhite(((bgimage[pixel] >> 24) & 0xFF) / 2); + } + } + } +} + +static void update_sandbox(enum _sbtype type) { int bcol, ecol, i, j, pixel, value; @@ -375,6 +398,9 @@ ts->ts_x1 > sbdata[i].ecol; i++) /* do nothing */; assert(sbdata[i].sbtype != 0); + if (sbdata[i].sbtype == sbtype || + !sbdata[i].enabled) + continue; update_sandbox(sbdata[i].sbtype); return (ACT_REFRESH); } @@ -528,11 +554,7 @@ init_magic(); fb_init(); fb_load_syscons_font(NULL, "/usr/share/syscons/fonts/iso-8x16.fnt"); - - bgimage = malloc(sizeof(u_int32_t) * fb_height * fb_width); - if (bgimage == NULL) - err(1, "malloc"); - read_png_file(BASEIMG, bgimage, fb_width, fb_height); + init_bgimage(); icons = malloc(sizeof(u_int32_t) * ICON_WH * 640); if (icons == NULL)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207092259.q69MxiKh066393>