Propagate volatile-ness from g_fbkva or g_regkva etc. as best as possible.

Some uses of __UNVOLATILE(), either in preparation of calls to bcopy()
or in the invocations themselves.
This commit is contained in:
he 2007-03-05 20:29:07 +00:00
parent d152127c07
commit 3ba91b0595
7 changed files with 77 additions and 70 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite_cl.c,v 1.8 2005/12/11 12:16:28 christos Exp $ */
/* $NetBSD: ite_cl.c,v 1.9 2007/03/05 20:29:07 he Exp $ */
/*
* Copyright (c) 1995 Ezra Story
@ -36,7 +36,7 @@
#include "opt_amigacons.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite_cl.c,v 1.8 2005/12/11 12:16:28 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ite_cl.c,v 1.9 2007/03/05 20:29:07 he Exp $");
#include "grfcl.h"
#if NGRFCL > 0
@ -150,7 +150,7 @@ void
cl_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
{
volatile unsigned char *ba = ip->grf->g_regkva;
unsigned char *fb = ip->grf->g_fbkva;
volatile unsigned char *fb = ip->grf->g_fbkva;
unsigned char attr;
volatile unsigned char *cp;
@ -183,7 +183,8 @@ cl_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
if (ip->flags & ITE_INGRF)
return;
dst = ip->grf->g_fbkva + (sy * ip->cols) + sx;
dst = (unsigned char*)__UNVOLATILE(ip->grf->g_fbkva) +
(sy * ip->cols) + sx;
src = dst + (ip->rows*ip->cols);
len = w*h;
@ -202,7 +203,7 @@ cl_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
if (ip->flags & ITE_INGRF)
return;
fb = ip->grf->g_fbkva + sy * ip->cols;
fb = (unsigned char*)__UNVOLATILE(ip->grf->g_fbkva) + sy * ip->cols;
SetTextPlane(ba, 0x00);
switch (dir) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite_cv.c,v 1.7 2007/03/04 05:59:22 christos Exp $ */
/* $NetBSD: ite_cv.c,v 1.8 2007/03/05 20:29:07 he Exp $ */
/*
* Copyright (c) 1995 Michael Teske
@ -40,7 +40,7 @@
#include "opt_amigacons.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite_cv.c,v 1.7 2007/03/04 05:59:22 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ite_cv.c,v 1.8 2007/03/05 20:29:07 he Exp $");
#include "grfcv.h"
#if NGRFCV > 0
@ -205,9 +205,9 @@ cv_cursor(struct ite_softc *ip, int flag)
void
cv_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
{
void *fb = ip->grf->g_fbkva;
volatile char *fb = ip->grf->g_fbkva;
unsigned char attr;
unsigned char *cp;
volatile unsigned char *cp;
attr = (unsigned char) ((mode & ATTR_INV) ? (0x70) : (0x07));
if (mode & ATTR_UL) attr = 0x01;
@ -231,10 +231,12 @@ cv_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
* which describe continuous regions. For a VT200 terminal,
* this is safe behavior.
*/
unsigned short *dst;
volatile unsigned short *dst;
int len;
dst = (unsigned short *) (ip->grf->g_fbkva + (((sy * ip->cols) + sx) << 2));
dst = (volatile unsigned short *)
((volatile char*)ip->grf->g_fbkva +
(((sy * ip->cols) + sx) << 2));
for (len = w * h; len > 0 ; len--) {
*dst = 0x2007;
@ -250,11 +252,12 @@ cv_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
void
cv_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
{
unsigned short *src, *dst, *dst2;
volatile unsigned short *src, *dst, *dst2;
int i;
int len;
src = (unsigned short *)(ip->grf->g_fbkva + (cv_rowc[sy] << 2));
src = (volatile unsigned short *)
((volatile char*)ip->grf->g_fbkva + (cv_rowc[sy] << 2));
switch (dir) {
case SCROLL_UP:
@ -265,13 +268,13 @@ cv_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
if (count > sy) { /* boundary checks */
dst2 = console_buffer;
dst = (unsigned short *)(ip->grf->g_fbkva);
dst = (volatile unsigned short *)(ip->grf->g_fbkva);
len -= cv_rowc[(count - sy)];
src += cv_rowc[(count - sy)];
} else
dst2 = &console_buffer[cv_rowc[(sy-count)]];
bcopy (src, dst2, len << 1);
bcopy (__UNVOLATILE(src), __UNVOLATILE(dst2), len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;
@ -288,7 +291,7 @@ cv_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
if (len < 0)
return; /* do some boundary check */
bcopy (src, dst2, len << 1);
bcopy (__UNVOLATILE(src), __UNVOLATILE(dst2), len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;
@ -300,7 +303,7 @@ cv_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
src = &console_buffer[cv_rowc[sy] + sx];
len = ip->cols - (sx + count);
dst2 = &console_buffer[cv_rowc[sy] + sx + count];
bcopy (src, dst2, len << 1);
bcopy (__UNVOLATILE(src), __UNVOLATILE(dst2), len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;
@ -312,7 +315,7 @@ cv_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
src = &console_buffer[cv_rowc[sy] + sx];
len = ip->cols - sx;
dst2 = &console_buffer[cv_rowc[sy] + sx - count];
bcopy (src, dst2, len << 1);
bcopy (__UNVOLATILE(src), __UNVOLATILE(dst2), len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite_cv3d.c,v 1.6 2007/03/04 05:59:22 christos Exp $ */
/* $NetBSD: ite_cv3d.c,v 1.7 2007/03/05 20:29:07 he Exp $ */
/*
* Copyright (c) 1995 Michael Teske
@ -40,7 +40,7 @@
#include "opt_amigacons.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite_cv3d.c,v 1.6 2007/03/04 05:59:22 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ite_cv3d.c,v 1.7 2007/03/05 20:29:07 he Exp $");
#include "grfcv3d.h"
#if NGRFCV3D > 0
@ -205,20 +205,20 @@ cv3d_cursor(struct ite_softc *ip, int flag)
void
cv3d_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
{
void *fb = ip->grf->g_fbkva;
volatile void *fb = ip->grf->g_fbkva;
unsigned char attr;
unsigned char *cp;
volatile unsigned char *cp;
attr = (unsigned char) ((mode & ATTR_INV) ? (0x70) : (0x07));
if (mode & ATTR_UL) attr = 0x01;
if (mode & ATTR_BOLD) attr |= 0x08;
if (mode & ATTR_BLINK) attr |= 0x80;
cp = fb + ((cv3d_rowc[dy] + dx) << 2); /* *4 */
cp = (volatile char*)fb + ((cv3d_rowc[dy] + dx) << 2); /* *4 */
*cp++ = (unsigned char) c;
*cp = (unsigned char) attr;
cp = (unsigned char *) &console_buffer[cv3d_rowc[dy]+dx];
cp = (volatile unsigned char *) &console_buffer[cv3d_rowc[dy]+dx];
*cp++ = (unsigned char) c;
*cp = (unsigned char) attr;
}
@ -231,10 +231,12 @@ cv3d_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
* which describe continuous regions. For a VT200 terminal,
* this is safe behavior.
*/
unsigned short *dst;
volatile unsigned short *dst;
int len;
dst = (unsigned short *) (ip->grf->g_fbkva + (((sy * ip->cols) + sx) << 2));
dst = (volatile unsigned short *)
((volatile char*)ip->grf->g_fbkva +
(((sy * ip->cols) + sx) << 2));
for (len = w * h; len > 0 ; len--) {
*dst = 0x2007;
@ -250,11 +252,12 @@ cv3d_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
void
cv3d_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
{
unsigned short *src, *dst, *dst2;
volatile unsigned short *src, *dst, *dst2;
int i;
int len;
src = (unsigned short *)(ip->grf->g_fbkva + (cv3d_rowc[sy] << 2));
src = (volatile unsigned short *)
((volatile char*)ip->grf->g_fbkva + (cv3d_rowc[sy] << 2));
switch (dir) {
case SCROLL_UP:
@ -265,13 +268,13 @@ cv3d_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
if (count > sy) { /* boundary checks */
dst2 = console_buffer;
dst = (unsigned short *)(ip->grf->g_fbkva);
dst = (volatile unsigned short *)(ip->grf->g_fbkva);
len -= cv3d_rowc[(count - sy)];
src += cv3d_rowc[(count - sy)];
} else
dst2 = &console_buffer[cv3d_rowc[(sy-count)]];
bcopy (src, dst2, len << 1);
bcopy (__UNVOLATILE(src), __UNVOLATILE(dst2), len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;
@ -288,7 +291,7 @@ cv3d_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
if (len < 0)
return; /* do some boundary check */
bcopy (src, dst2, len << 1);
bcopy (__UNVOLATILE(src), __UNVOLATILE(dst2), len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;
@ -300,7 +303,7 @@ cv3d_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
src = &console_buffer[cv3d_rowc[sy] + sx];
len = ip->cols - (sx + count);
dst2 = &console_buffer[cv3d_rowc[sy] + sx + count];
bcopy (src, dst2, len << 1);
bcopy (__UNVOLATILE(src), __UNVOLATILE(dst2), len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;
@ -312,7 +315,7 @@ cv3d_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
src = &console_buffer[cv3d_rowc[sy] + sx];
len = ip->cols - sx;
dst2 = &console_buffer[cv3d_rowc[sy] + sx - count];
bcopy (src, dst2, len << 1);
bcopy (__UNVOLATILE(src), __UNVOLATILE(dst2), len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite_et.c,v 1.11 2006/06/07 10:07:03 he Exp $ */
/* $NetBSD: ite_et.c,v 1.12 2007/03/05 20:29:07 he Exp $ */
/*
* Copyright (c) 1995 Ezra Story
@ -36,7 +36,7 @@
#include "opt_amigacons.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite_et.c,v 1.11 2006/06/07 10:07:03 he Exp $");
__KERNEL_RCSID(0, "$NetBSD: ite_et.c,v 1.12 2007/03/05 20:29:07 he Exp $");
#include "grfet.h"
#if NGRFET > 0
@ -68,7 +68,7 @@ void et_deinit(struct ite_softc *ip);
void et_putc(struct ite_softc *ip, int c, int dy, int dx, int mode);
void et_clear(struct ite_softc *ip, int sy, int sx, int h, int w);
void et_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir);
static void etbcopy(const void *src, void *dst, size_t len);
static void etbcopy(const volatile void *src, volatile void *dst, size_t len);
/*
@ -155,7 +155,7 @@ void
et_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
{
volatile unsigned char *ba = ip->grf->g_regkva;
unsigned char *fb = ip->grf->g_fbkva;
volatile unsigned char *fb = ip->grf->g_fbkva;
unsigned char attr;
volatile unsigned char *cp;
@ -182,14 +182,14 @@ et_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
* which describe continuous regions. For a VT200 terminal,
* this is safe behavior.
*/
unsigned char *src, *dst;
volatile unsigned char *src, *dst;
volatile unsigned char *ba = ip->grf->g_regkva;
int len;
if (ip->flags & ITE_INGRF)
return;
dst = ip->grf->g_fbkva + (sy * ip->cols) + sx;
dst = (volatile unsigned char*)ip->grf->g_fbkva + (sy * ip->cols) + sx;
src = dst + (ip->rows*ip->cols);
len = w*h;
@ -203,13 +203,13 @@ et_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
void
et_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
{
unsigned char *fb;
volatile unsigned char *fb;
volatile unsigned char *ba = ip->grf->g_regkva;
if (ip->flags & ITE_INGRF)
return;
fb = ip->grf->g_fbkva + sy * ip->cols;
fb = (volatile unsigned char*)ip->grf->g_fbkva + sy * ip->cols;
SetTextPlane(ba, 0x00);
switch (dir) {
@ -250,14 +250,14 @@ et_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
}
static void etbcopy(const void *src, void *dst, size_t len)
static void etbcopy(const volatile void *src, volatile void *dst, size_t len)
{
int i;
char *cdst;
const char *csrc;
volatile char *cdst;
volatile const char *csrc;
cdst = (char*)dst;
csrc = (const char*)src;
cdst = (volatile char*)dst;
csrc = (volatile const char*)src;
if (csrc == cdst)
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite_rh.c,v 1.10 2002/01/28 09:57:00 aymeric Exp $ */
/* $NetBSD: ite_rh.c,v 1.11 2007/03/05 20:29:07 he Exp $ */
/*
* Copyright (c) 1994 Markus Wild
@ -33,7 +33,7 @@
#include "opt_retina.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite_rh.c,v 1.10 2002/01/28 09:57:00 aymeric Exp $");
__KERNEL_RCSID(0, "$NetBSD: ite_rh.c,v 1.11 2007/03/05 20:29:07 he Exp $");
#include "grfrh.h"
#if NGRFRH > 0
@ -218,7 +218,7 @@ void
rh_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
{
#ifndef RETINA_SPEED_HACK
u_long * fb = (u_long *) ip->grf->g_fbkva;
u_long *fb = (u_long *)__UNVOLATILE(ip->grf->g_fbkva);
#endif
rh_cursor(ip, ERASE_CURSOR);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite_rt.c,v 1.21 2007/03/04 05:59:23 christos Exp $ */
/* $NetBSD: ite_rt.c,v 1.22 2007/03/05 20:29:07 he Exp $ */
/*
* Copyright (c) 1993 Markus Wild
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite_rt.c,v 1.21 2007/03/04 05:59:23 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ite_rt.c,v 1.22 2007/03/05 20:29:07 he Exp $");
#include "grfrt.h"
#if NGRFRT > 0
@ -398,7 +398,7 @@ retina_deinit(struct ite_softc *ip)
void
retina_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
{
volatile void *fb = ip->grf->g_fbkva;
volatile char *fb = (volatile char*)ip->grf->g_fbkva;
register u_char attr;
attr = (mode & ATTR_INV) ? 0x21 : 0x10;
@ -414,7 +414,7 @@ retina_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
void
retina_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
{
u_short * fb = (u_short *) ip->grf->g_fbkva;
volatile u_short * fb = (volatile u_short *) ip->grf->g_fbkva;
short x;
const u_short fillval = 0x2010;
@ -440,7 +440,7 @@ retina_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
u_long *fb;
ba = ip->grf->g_regkva;
fb = (u_long *)ip->grf->g_fbkva;
fb = (u_long *)__UNVOLATILE(ip->grf->g_fbkva);
retina_cursor(ip, ERASE_CURSOR);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ite_ul.c,v 1.11 2002/01/28 09:57:00 aymeric Exp $ */
/* $NetBSD: ite_ul.c,v 1.12 2007/03/05 20:29:07 he Exp $ */
/*-
* Copyright (c) 1995 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ite_ul.c,v 1.11 2002/01/28 09:57:00 aymeric Exp $");
__KERNEL_RCSID(0, "$NetBSD: ite_ul.c,v 1.12 2007/03/05 20:29:07 he Exp $");
#include "grful.h"
#if NGRFUL > 0
@ -146,14 +146,14 @@ grful_iteinit(struct grf_softc *gp)
void
ulowell_init(struct ite_softc *ip)
{
struct gspregs *ba;
volatile struct gspregs *ba;
u_int16_t *sp;
u_int16_t cmd[8];
int i;
ba = (struct gspregs *) ip->grf->g_regkva;
ba = (volatile struct gspregs *) ip->grf->g_regkva;
ip->font = kernel_font;
ip->font_lo = kernel_font_lo;
@ -232,10 +232,10 @@ ulowell_init(struct ite_softc *ip)
void ulowell_cursor(struct ite_softc *ip, int flag)
{
struct gspregs *ba;
volatile struct gspregs *ba;
u_int16_t cmd[7];
ba = (struct gspregs *)ip->grf->g_regkva;
ba = (volatile struct gspregs *)ip->grf->g_regkva;
if (flag == END_CURSOROPT)
--ip->cursor_opt;
@ -306,11 +306,11 @@ void ulowell_cursor(struct ite_softc *ip, int flag)
static void screen_up(struct ite_softc *ip, int top, int bottom, int lines)
{
struct gspregs *ba;
volatile struct gspregs *ba;
u_int16_t cmd[7];
ba = (struct gspregs *)ip->grf->g_regkva;
ba = (volatile struct gspregs *)ip->grf->g_regkva;
#ifdef DEBUG_UL
printf("screen_up %d %d %d ->",top,bottom,lines);
@ -340,11 +340,11 @@ static void screen_up(struct ite_softc *ip, int top, int bottom, int lines)
static void screen_down(struct ite_softc *ip, int top, int bottom, int lines)
{
struct gspregs *ba;
volatile struct gspregs *ba;
u_int16_t cmd[7];
ba = (struct gspregs *)ip->grf->g_regkva;
ba = (volatile struct gspregs *)ip->grf->g_regkva;
#ifdef DEBUG_UL
printf("screen_down %d %d %d ->",top,bottom,lines);
@ -381,10 +381,10 @@ void ulowell_deinit(struct ite_softc *ip)
void ulowell_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
{
struct gspregs *ba;
volatile struct gspregs *ba;
u_int16_t cmd[8];
ba = (struct gspregs *)ip->grf->g_regkva;
ba = (volatile struct gspregs *)ip->grf->g_regkva;
cmd[0] = GCMD_CHAR;
cmd[1] = c & 0xff;
@ -399,14 +399,14 @@ void ulowell_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
void ulowell_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
{
/* XXX TBD */
struct gspregs * ba;
volatile struct gspregs * ba;
u_int16_t cmd[7];
#ifdef DEBUG_UL
printf("ulowell_clear %d %d %d %d ->",sy,sx,h,w);
#endif
ba = (struct gspregs *)ip->grf->g_regkva;
ba = (volatile struct gspregs *)ip->grf->g_regkva;
cmd[0] = GCMD_FILL;
cmd[1] = 0x0; /* XXX */
@ -421,10 +421,10 @@ void ulowell_clear(struct ite_softc *ip, int sy, int sx, int h, int w)
void ulowell_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
{
struct gspregs *ba;
volatile struct gspregs *ba;
u_int16_t cmd[7];
ba = (struct gspregs *)ip->grf->g_regkva;
ba = (volatile struct gspregs *)ip->grf->g_regkva;
#ifdef DEBUG_UL
printf("ulowell_scroll %d %d %d %d ->",sy,sx,count,dir);