Commit Graph

286908 Commits

Author SHA1 Message Date
rillig
65a86d028a lint: rewrite handling of initializations, fixing several bugs
The previous implementation had a wrong model of how initialization
happens in C99, its assertions failed in all kind of edge cases and it
was not possible to fix the remaining bugs one at a time without running
into even more obscure assertion failures.

The debug logging was detailed but did not help to clarify the
situation.  After about 20 failed attempts at fixing the small details I
decided to start all over and rewrite the initialization code from
scratch.  I left the low-level parts of handling designators, the code
that is independent of brace_level and the high-level parts of how the
parser calls into this module.  Everything else is completely new.

The concept of a brace level stays since that is how C99 describes
initialization.  The previous code could not handle multi-level
designations (see d_init_pop_member.c).  There are no more assertion
failures in the initialization code.

Some TODO comments have been left in the tests to keep the line numbers
the same in this commit.  These will be cleaned up in a follow-up
commit.

The new implementation does not handle initialization with "missing"
braces.  This is an edge case that both GCC and Clang warn about, so it
is not widely used.  If necessary, it may be added later.

The new implementation does not use any global variables in the vast
majority of the functions, to make all dependencies and possible
modifications obvious.
2021-03-30 14:25:28 +00:00
simonb
1f97927d7f Fix nearly 20 year old type - cache sizes are 2048 bytes, not 2848 bytes. 2021-03-30 13:41:46 +00:00
rin
77d6c0548b - G/C unused.
- Sort headers.

No binary changes.
2021-03-30 05:18:37 +00:00
rin
735442fdd9 - Explicitly include <powerpc/spr.h>.
- Drop unused headers.
- Group headers.

No binary changes.
2021-03-30 05:14:00 +00:00
rin
d2a4e1ff51 - Include tlb.h directly, instead of uvm_extern.h.
- Drop unused headers.
- Sort and group headers.

No binary changes.
2021-03-30 05:08:16 +00:00
rin
d21b878d05 - Include tlb.h directly, instead of uvm_extern.h.
- Explicitly include param.h.
- Drop unused headers.
- Sort and group headers.

No binary changes.
2021-03-30 04:53:13 +00:00
rin
485fe15112 - Explicitly include <sys/param.h>.
- Drop unused headers.
- Sort headers.

No binary changes.
2021-03-30 04:41:30 +00:00
rin
44487c0a64 - Include tlb.h directly instead of uvm_extern.h.
- Remove unused/duplicated header include.
- Sort and group headers.

No binary changes.
2021-03-30 04:28:50 +00:00
rin
1a6eafb9e9 - Explicitly include <sys/param.h>.
- G/C headers.
- Sort headers.

No binary changes.
2021-03-30 04:11:29 +00:00
rin
2a7d2f9aed Include <dev/ic/comreg.h> for COM_FREQ. 2021-03-30 04:08:02 +00:00
rin
1fb740f55d Sort & group headers. No binary changes. 2021-03-30 04:02:17 +00:00
rin
a73fb2076c G/C unused. Use tlb.h directly instead of uvm_extern.h.
No binary changes.
2021-03-30 03:57:03 +00:00
rin
0cf1b2e30c G/C <evbppc/obs405.h>. 2021-03-30 03:45:34 +00:00
rin
bf9f8ea773 Sort headers. Fix style. No binary changes. 2021-03-30 03:20:13 +00:00
rin
331fceca56 G/C misleading <evbppc/tlb.h>. Use <powerpc/ibm4xx/tlb.h> directly. 2021-03-30 03:15:53 +00:00
rin
2fc1d77801 G/C unused. No binary changes (except for __LINE__ for KASSERT). 2021-03-30 03:04:51 +00:00
rin
cbd99c87b8 Move common global variables, i.e., phys_map, machine, and machine_arch to
evbppc/evbppc_machdep.c (bad naming; used only for 4xx boards).
2021-03-30 02:41:14 +00:00
rin
2d558d5339 According to "PPC405GP Embedded Processor User’s Manual",
405GP has 16KB instruction cache, not 8KB.
2021-03-30 02:27:00 +00:00
rin
5d3d34d0b3 Support OPB running @ 33MHz for 405GP based boards.
No need to modify EMAC_MR1 register this case
(STACR_OPBC fields are reserved for 405GP).
2021-03-30 02:25:24 +00:00
rin
648aa3729f Convert walnut to use powerpc/ibm4xx/openbios.
No functional changes.
2021-03-30 02:04:43 +00:00
rin
331e73520e Use mnemonic "bdneq". Add missing register prefix.
No binary changes.
2021-03-30 01:57:20 +00:00
rin
d74f1c2664 - Document IBM/AMCC Walnut is supported by this file.
- Misc style fixes.
2021-03-30 01:50:13 +00:00
rin
ce3776b020 Remove unused "startkernel" argument for openbios_board_init(). 2021-03-30 01:47:44 +00:00
rin
c98afc16b5 Centralize cpu_reboot(). 2021-03-30 01:33:50 +00:00
rin
b0ae137ba4 G/C bootpath. 2021-03-30 01:16:45 +00:00
rillig
a14413219e tests/lint: test initialization without braces 2021-03-29 22:59:03 +00:00
rin
ba5a109ded Remove obsoleted file; we had switched to powerpc/ibm4xx/pci/pchb.c long ago. 2021-03-29 22:54:19 +00:00
rillig
e94cc75f40 tests/lint: demonstrate assertion failures for union initialization 2021-03-29 22:42:10 +00:00
rillig
8473828968 tests/lint: test unknown member name in struct
I had not expected to trigger another assertion, I just wanted to make
sure my latest ongoing refactoring will not break this case.  Apparently
there is no need to worry about that.
2021-03-29 22:36:31 +00:00
rillig
58b48e79c1 tests/lint: test initialization of union in traditional C 2021-03-29 22:24:34 +00:00
rillig
4bf66febf4 tests/lint: ensure initialization does not modify shared type
In my not yet published rewrite of lint's init.c, I forgot to copy the
array type. Guard against this bug, which would have been hard to find.

Given that in C, the declaration 'int a[], b[]' creates two different
type objects anyway, it's not easy to come up with a test case that
actually triggers this possible bug.  I'm not sure whether this test
indeed catches this bug.  If not, I'll add another test.
2021-03-29 22:07:00 +00:00
rillig
bcdf6c3e99 lint: rename variable 'level' to 'bl'
For consistency with its type prefix and the other variables.  This
variable is used so often that it makes sense to abbreviate it.

No functional change.
2021-03-29 21:34:17 +00:00
rillig
3915aeb0e8 lint: add helper functions
No functional change.
2021-03-29 21:09:21 +00:00
rillig
2bc143b2cb lint: rename struct members in init.c
No functional change.
2021-03-29 20:52:00 +00:00
rillig
53e378632b lint: remove outdated comments, clean up style
No functional change.
2021-03-29 20:39:18 +00:00
rillig
49daf9079c tests/lint: add examples for initialization from C99
These all pass lint without any warnings.  Both Clang and GCC warn about
these in -Wall mode, so they are unlikely to be seen in practice.
2021-03-29 17:13:07 +00:00
christos
6a8fead050 PR/56083: RVP: tar -c hangs when reading from FUSE-ext2 filesystems since
it returns 0 for statvfs members and libarchive handles only -1. Centralize
the transfer setting code.
2021-03-29 15:31:46 +00:00
rin
739ca84513 Use ibm4xx_cpu_startup() and board_info_init(). 2021-03-29 14:37:01 +00:00
rin
587104a0c9 Use IBM405GP_UART0_BASE instead of hard-coded magic number 0xef000000.
No functional changes since:

	IBM405GP_UART0_BASE & ~(TLB_PG_SIZE - 1) == 0xef000000

See ppc4xx_tlb_reserve() in ibm4xx/pmap.c.
2021-03-29 14:27:36 +00:00
rin
11aec2c379 Use ibm40x_machdep.c. 2021-03-29 14:21:08 +00:00
rin
f6f13710c0 Use com_opb_cnattach(). 2021-03-29 13:59:15 +00:00
rin
58300879b4 Use genppc_cpu_configure(). 2021-03-29 13:49:15 +00:00
rin
36cc593427 Set com(4) frequency in ibm4xx_device_register() in order to dedup codes. 2021-03-29 13:38:31 +00:00
rin
2e55efcf25 Centralize cpu_rootconf(). 2021-03-29 13:17:53 +00:00
rin
0ded96f539 Make VIRTEX_* kernels compile. Not tested. 2021-03-29 13:14:13 +00:00
rin
00df33e1f6 Fix copy-paste; These boards are 405, not 403. 2021-03-29 13:12:38 +00:00
simonb
566f9e2cfa On MIPS if we compile C files as N64, compile assembly with the same ABI. 2021-03-29 05:22:49 +00:00
simonb
08e52375a3 Compile MIPS specific code. 2021-03-29 05:18:02 +00:00
simonb
b5c47949a4 Work in progress dtrace for MIPS. MIPS support mostly copied from
FreeBSD, with NetBSD-specific changes largely based on aarch64 dtrace
support.  Working well enough for system call tracing.
2021-03-29 05:17:09 +00:00
simonb
d5378b09d6 Add cyclic_machdep.c for MIPS
The code is identical to i386's one.
2021-03-29 03:27:38 +00:00