Page MenuHomeFreeBSD

(fix) [nvram2env] nvram2env scans only 1/4th of memory
ClosedPublic

Authored by mizhka on May 19 2016, 8:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 28 2024, 10:50 AM
Unknown Object (File)
Feb 28 2024, 9:02 AM
Unknown Object (File)
Dec 20 2023, 12:10 AM
Unknown Object (File)
Dec 11 2023, 12:59 PM
Unknown Object (File)
Jul 1 2023, 9:48 PM
Unknown Object (File)
Jul 1 2023, 9:48 PM
Unknown Object (File)
Jul 1 2023, 9:47 PM
Unknown Object (File)
Jul 1 2023, 9:46 PM

Details

Summary

The variable "size" stores number of words (4bytes). But the loop over memory uses size as number of bytes to scan memory. As result it fetches only 1/4th of memory.

This patch solves this problem and nvram2env fetches all NVRAM variables.

Test Plan

Pre-requisites: any MIPS board with ASCII-based NVRAM mapped into memory

  1. Add "device nvram2env" into kernel configuration
  2. Specify hints: base is mandatory (according to nvram2env(4))

hint.nvram.0.base=0x1c7f8000 (it's valid address for Asus RT-N53 with flags = 0x4)

  1. Build & load kernel with bootverbose

Actual result: only part of nvram variables are found
Expected result: all variables are found

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mizhka retitled this revision from to (fix) [nvram2env] nvram2env scans only 1/4th of memory.
mizhka updated this object.
mizhka edited the test plan for this revision. (Show Details)
mizhka added reviewers: ray, adrian.
mizhka set the repository for this revision to rS FreeBSD src repository - subversion.
mizhka added a subscriber: landon_landonf.org.
  • remove shifting for size
  • cosmetic changes like style(9), remove extra indentation, remove calculation from "for" statement condition.
This revision was automatically updated to reflect the committed changes.