-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
display page fault address in oopses, improve how page fault codes are displayed #420
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hawkw
added a commit
that referenced
this pull request
Apr 9, 2023
The `fmt::Display` implementation for bitfields uses Unicode box-drawing characters. In some contexts, where Unicode is not supported or box-drawing characters are not rendered nicely, it may be desirable to use an ASCII-only version of the multi-line format, instead. Therefore, in addition to the `Display` implementation, this commit adds a new generated `display_ascii` method to bitfield types. `display_ascii` returns an `impl fmt::Display` value that renders the bitfield in an ASCII-only version of the multi-line format. The ASCII-only format also uses slightly fewer horizontal characters than the Unicode box-drawing format, so it may also be useful in cases where text fields have limited width. For example: ``` 00000000000000000011010110011110 ..............................10 ENUM_VALUE: Baz ........................100111.. SOME_BITS: 39 .......................1........ FLAG_1: true ......................0......... FLAG_2: false ..............00001101.......... A_BYTE: 13 ``` This was added primarily in order to allow displaying page fault error codes nicely in mycelium's oops screen, because the `embedded_graphics` crate doesn't render Unicode box-drawing characters.
hawkw
added a commit
that referenced
this pull request
Apr 9, 2023
Debugging page faults in Mycelium is currently a bit difficult, because the oops message doesn't display the virtual address at which the page fault occurred. We can fix this quite easily by reading the `cr2` control register, which contains the linear address of the page fault.
hawkw
added a commit
that referenced
this pull request
Apr 9, 2023
This commit changes the generated bitfield types to default to using the ASCII `fmt::Display` multi-line format, with the Unicode format selectable using the alt-mode formatting specifier (`{:#}`). This is to make it easier for downstream callers to select which format is used. The `display_ascii()` method can be used to select ASCII only regardless of a downstream caller's format specifier, and a similar `display_unicode()` method is added to guarantee Unicode formatting. I don't think this should be considered a breaking change, since existing code will still compile, and I don't consider the output of human-readable formats not intended for machine consumption to be part of the semver API surface. But, it will change the default behavior...
hawkw
force-pushed
the
eliza/page-fault-codes
branch
from
April 9, 2023 19:07
0892092
to
84810d8
Compare
The `fmt::Display` implementation for bitfields uses Unicode box-drawing characters. In some contexts, where Unicode is not supported or box-drawing characters are not rendered nicely, it may be desirable to use an ASCII-only version of the multi-line format, instead. Therefore, in addition to the `Display` implementation, this commit adds a new generated `display_ascii` method to bitfield types. `display_ascii` returns an `impl fmt::Display` value that renders the bitfield in an ASCII-only version of the multi-line format. The ASCII-only format also uses slightly fewer horizontal characters than the Unicode box-drawing format, so it may also be useful in cases where text fields have limited width. For example: ``` 00000000000000000011010110011110 ..............................10 ENUM_VALUE: Baz ........................100111.. SOME_BITS: 39 .......................1........ FLAG_1: true ......................0......... FLAG_2: false ..............00001101.......... A_BYTE: 13 ``` This was added primarily in order to allow displaying page fault error codes nicely in mycelium's oops screen, because the `embedded_graphics` crate doesn't render Unicode box-drawing characters.
Debugging page faults in Mycelium is currently a bit difficult, because the oops message doesn't display the virtual address at which the page fault occurred. We can fix this quite easily by reading the `cr2` control register, which contains the linear address of the page fault.
hawkw
added a commit
that referenced
this pull request
Apr 9, 2023
This commit changes the generated bitfield types to default to using the ASCII `fmt::Display` multi-line format, with the Unicode format selectable using the alt-mode formatting specifier (`{:#}`). This is to make it easier for downstream callers to select which format is used. The `display_ascii()` method can be used to select ASCII only regardless of a downstream caller's format specifier, and a similar `display_unicode()` method is added to guarantee Unicode formatting. I don't think this should be considered a breaking change, since existing code will still compile, and I don't consider the output of human-readable formats not intended for machine consumption to be part of the semver API surface. But, it will change the default behavior...
hawkw
force-pushed
the
eliza/page-fault-codes
branch
from
April 9, 2023 19:07
84810d8
to
e171e13
Compare
PR #420, BLAZE IT 🍁🔥 |
This commit changes the generated bitfield types to default to using the ASCII `fmt::Display` multi-line format, with the Unicode format selectable using the alt-mode formatting specifier (`{:#}`). This is to make it easier for downstream callers to select which format is used. The `display_ascii()` method can be used to select ASCII only regardless of a downstream caller's format specifier, and a similar `display_unicode()` method is added to guarantee Unicode formatting. I don't think this should be considered a breaking change, since existing code will still compile, and I don't consider the output of human-readable formats not intended for machine consumption to be part of the semver API surface. But, it will change the default behavior...
hawkw
force-pushed
the
eliza/page-fault-codes
branch
from
April 9, 2023 19:25
e171e13
to
1e7e13d
Compare
hawkw
added a commit
that referenced
this pull request
Apr 9, 2023
The `fmt::Display` implementation for bitfields uses Unicode box-drawing characters. In some contexts, where Unicode is not supported or box-drawing characters are not rendered nicely, it may be desirable to use an ASCII-only version of the multi-line format, instead. Therefore, in addition to the `Display` implementation, this commit adds a new generated `display_ascii` method to bitfield types. `display_ascii` returns an `impl fmt::Display` value that renders the bitfield in an ASCII-only version of the multi-line format. The ASCII-only format also uses slightly fewer horizontal characters than the Unicode box-drawing format, so it may also be useful in cases where text fields have limited width. For example: ``` 00000000000000000011010110011110 ..............................10 ENUM_VALUE: Baz ........................100111.. SOME_BITS: 39 .......................1........ FLAG_1: true ......................0......... FLAG_2: false ..............00001101.......... A_BYTE: 13 ``` This was added primarily in order to allow displaying page fault error codes nicely in mycelium's oops screen, because the `embedded_graphics` crate doesn't render Unicode box-drawing characters.
hawkw
added a commit
that referenced
this pull request
Apr 9, 2023
Debugging page faults in Mycelium is currently a bit difficult, because the oops message doesn't display the virtual address at which the page fault occurred. We can fix this quite easily by reading the `cr2` control register, which contains the linear address of the page fault.
hawkw
added a commit
that referenced
this pull request
Jul 23, 2023
## mycelium-bitfield-v0.1.3 - (2023-07-23) [d0a6f13](https://github.com/hawkw/mycelium/d0a6f13cc53e0cd5dbd493b63ba0711fd06dc985)...[ab096b4](https://github.com/hawkw/mycelium/ab096b4bcf64beda092b3980ca32cb50ad4c2682) ### Added - Generate `fmt::UpperHex` and `LowerHex` ([#292](#292)) ([b6138c8](https://github.com/hawkw/mycelium/b6138c8b7b704c59e394fd5600c321d7eede0a46)) - Add `Pack::pair_with` ([#294](#294)) ([47b08b7](https://github.com/hawkw/mycelium/47b08b7506712cf5664cf62bf5f0c72fa226a994)) - Add `Pair::pack_from_{src, dst}` ([#294](#294)) ([48f48ca](https://github.com/hawkw/mycelium/48f48cab628c88edc4fa3ce6a045c522976a62e7)) - Skip `_` fields in `fmt::Debug` ([#375](#375)) ([46ca526](https://github.com/hawkw/mycelium/46ca52615338f5341fd0006b56a20379a1a797de)) - Add `display_ascii` to generated bitfields ([#420](#420)) ([7842802](https://github.com/hawkw/mycelium/7842802e1b52da0d7939c972b69964cddc4f875a)) - Select Unicode format with `Display` alt-mode ([#420](#420)) ([a09d55b](https://github.com/hawkw/mycelium/a09d55b7dd81aed292ec8265ce28c8f70f0b293d)) - Add `enum_from_bits!` macro ([#450](#450)) ([ab096b4](https://github.com/hawkw/mycelium/ab096b4bcf64beda092b3980ca32cb50ad4c2682), closes [#443](#443)) ### Documented - Fix main branch docs link ([#290](#290)) ([4dbdf37](https://github.com/hawkw/mycelium/4dbdf376aab37ba88d48abf6c25ec2f386f62c44)) - Replace tables with bulleted lists ([#451](#451)) ([10cd876](https://github.com/hawkw/mycelium/10cd8765964ce98e18787f7ba5c299ed7a11a86d)) ### Fixed - Remove recursion in `fmt::Binary` ([#292](#292)) ([0488696](https://github.com/hawkw/mycelium/04886961ba460fceb662fdff8f80d481e54ed241)) - Don't have `fmt::alt` control struct formatting ([#292](#292)) ([03055f0](https://github.com/hawkw/mycelium/03055f086dbdbb68be6cb2a6eef96ffa450df61c)) - Make `pair_with` work with other bitfields ([#295](#295)) ([532ee98](https://github.com/hawkw/mycelium/532ee987e0eddd203fc7ff3698a4c9f36232c669)) - Make `Packing` work with typed specs ([#295](#295)) ([7b86e81](https://github.com/hawkw/mycelium/7b86e811a77831f4745e2b9437b3125ac27be8c8))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.