Sat Nov 2 01:14:57 2019 UTC ()
Fix "Alignment Fault 3" kernel failure of NetBSD/zaurus 8.1 GENERIC.

#ifdef switch per kernel config options in definition of device driver
structure in header files could be problematic.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/31/msg000079.html

Should be pulled up to netbsd-8 and netbsd-9.


(tsutsui)
diff -r1.48 -r1.49 src/sys/dev/rasops/rasops.h

cvs diff -r1.48 -r1.49 src/sys/dev/rasops/rasops.h (expand / switch to unified diff)

--- src/sys/dev/rasops/rasops.h 2019/08/14 00:51:10 1.48
+++ src/sys/dev/rasops/rasops.h 2019/11/02 01:14:57 1.49
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rasops.h,v 1.48 2019/08/14 00:51:10 rin Exp $ */ 1/* $NetBSD: rasops.h,v 1.49 2019/11/02 01:14:57 tsutsui Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -139,30 +139,28 @@ struct rasops_info { @@ -139,30 +139,28 @@ struct rasops_info {
139 uint8_t *ri_hworigbits; /* where hw bits actually start */ 139 uint8_t *ri_hworigbits; /* where hw bits actually start */
140 int ri_xorigin; /* where ri_bits begins (x) */ 140 int ri_xorigin; /* where ri_bits begins (x) */
141 int ri_yorigin; /* where ri_bits begins (y) */ 141 int ri_yorigin; /* where ri_bits begins (y) */
142 uint32_t 142 uint32_t
143 ri_devcmap[16]; /* color -> framebuffer data */ 143 ri_devcmap[16]; /* color -> framebuffer data */
144 144
145 /* The emulops you need to use, and the screen caps for wscons */ 145 /* The emulops you need to use, and the screen caps for wscons */
146 struct wsdisplay_emulops ri_ops; 146 struct wsdisplay_emulops ri_ops;
147 int ri_caps; 147 int ri_caps;
148 148
149 /* Callbacks so we can share some code */ 149 /* Callbacks so we can share some code */
150 void (*ri_do_cursor)(struct rasops_info *); 150 void (*ri_do_cursor)(struct rasops_info *);
151 151
152#if NRASOPS_ROTATION > 0 
153 /* Used to intercept putchar to permit display rotation */ 152 /* Used to intercept putchar to permit display rotation */
154 struct wsdisplay_emulops ri_real_ops; 153 struct wsdisplay_emulops ri_real_ops;
155#endif 
156}; 154};
157 155
158#define CHAR_IN_FONT(c, font) \ 156#define CHAR_IN_FONT(c, font) \
159 ((c) >= (font)->firstchar && \ 157 ((c) >= (font)->firstchar && \
160 (c) - (font)->firstchar < (font)->numchars) 158 (c) - (font)->firstchar < (font)->numchars)
161 159
162#define PICK_FONT(ri, c) \ 160#define PICK_FONT(ri, c) \
163 ((((c) & WSFONT_FLAGS_MASK) == WSFONT_FLAG_OPT && \ 161 ((((c) & WSFONT_FLAGS_MASK) == WSFONT_FLAG_OPT && \
164 (ri)->ri_optfont.data != NULL) ? \ 162 (ri)->ri_optfont.data != NULL) ? \
165 &(ri)->ri_optfont : (ri)->ri_font) 163 &(ri)->ri_optfont : (ri)->ri_font)
166 164
167/* 165/*
168 * rasops_init(). 166 * rasops_init().