Commit graph

378 commits

Author SHA1 Message Date
bunnie
e4e6db8bc9 fix implicit lifetime warning 2024-12-02 18:54:26 +08:00
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
bunnie
a8f2e9da27 fix up a tts bug 2024-09-23 23:02:32 +08:00
bunnie
921be1cf8b add bounds checking to a TextView string length
Before xous-ipc's fixed-length string guaranteed this thing
fit into a single page. Now, we can send potentially unbounded
amounts of text between servers.

I don't think it makes sense to send more than a few k of text to
render on the screen at once, given our screen sizes, so I've added
a patch that truncates the text to the previous length that things
would truncate to.

The behavior is the same as before, except that you will
over-allocate memory on the heap in the sending process
as you shove more string data into a TextView than can be rendered.
Previously, the TextView would just truncate the data and discard
the data.

The truncation happens at the point where you try to hand the
record off to another process, so, one could in theory try
to make this recoverable by adding a layer that splits the
textview into more manageable chunks or pages the data, but that
is an exercise for another day.
2024-09-23 17:35:27 +08:00
bunnie
7141a02e10 ah yes. This was the kind of xous-ipc abuse I was worried I would have done.
And I did it! and it's now fixed.

I was using xous-ipc String to make a fixed-length string in a
structure that's not strictly an IPC structure.

The solution to this is to just implement a fixed length string
directly.
2024-09-22 18:49:26 +08:00
bunnie
0cdbfdfcc3 format cleanup & copy remove
a bunch of code has to be re-formatted because spacing changed
and we have a strict formatting rule
2024-09-22 15:29:23 +08:00
bunnie
58527ea38b manual cleanup Copy derive: gam crate
There isn't a simple regex to deal with the loss of Copy when
deprecating xous_ipc, so this has to be a manual pass.

Losing the copy trait means (maybe) some loss of efficiency
in the API because we have to clone some structures instead
of copying them, although, I think actually what might have
been happening under the hood anyways is the copy was implemented
as a clone-under-the-hood for the xous-ipc.

Either way, this happens in the high level management structures
for modals, so it's not the end of the world to incur a clone
on the description of the structures -- we'd have to pay
more attention if this happened e.g. at the pixel shuffling
level, but a few UI strings at human-interaction rates
isn't going to kill us.
2024-09-22 14:50:21 +08:00
bunnie
f8719d781e security-related: implement missing clear_volatile() 2024-09-22 14:49:51 +08:00
bunnie
f1d263359d security-relevant: clear_volatile() API missing on String
xous_ipc::<String> had a clear-volatile() API for zeroizing
sensitive strings.

This is now missing in String, so it has been manually implemented
here by casting the String to a slice-u8 and then iterating
through it using raw pointers and volatile writes with a compiler
barrier to hopefully avoid all of the landmines I know of for
zeroizing a string...

commit is called out separately because this one is one of the
more "dangerous" security-related changes in the API migration.
2024-09-22 14:28:29 +08:00
bunnie
1fd59f0fc9 regex search/replace instances of xous_ipc::String to String 2024-09-22 14:28:16 +08:00
bunnie
6eab1c48bb patches to clean up warnings in rust-1.80 2024-08-19 02:24:24 +08:00
bunnie
a8b262af60 change font height based on target for status bar 2024-06-13 22:06:23 +08:00
bunnie
b003b4f88f modernize debug output 2024-05-29 13:48:19 +08:00
bunnie
01a5d0aba9 create context list for cramium target 2024-05-23 14:42:16 +08:00
bunnie
b1e3e81a6f add patches to GAM for cramium-soc compatibility 2024-05-22 02:24:10 +08:00
bunnie
370288dffa ...right, wrong hash type. no acceleration option available. 2024-01-31 04:05:03 +08:00
bunnie
ee95bc1306 specify use of sw-only hasher in bip39
the hash is tiny, hw overhead not worth it
2024-01-31 04:04:16 +08:00
bunnie
577646288a fix bip39 api changes 2024-01-31 04:02:57 +08:00
bunnie
e2460db596 fix comparison on previous PR
helps to test things...couldn't do that earlier due to system
issues. this actually works now.
2024-01-26 23:14:56 +08:00
bunnie
73b6d919af rate limit debug output in allow_untrustable_code() 2024-01-26 01:33:35 +08:00
bunnie
9f141fe4cc strip trailing whitespace on gam 2024-01-15 00:00:00 +08:00
bunnie
dae43a51c5 format services/gam 2024-01-14 22:13:08 +08:00
bunnie
5a0461cb01 make menu building a bit more efficient by not locking when not necessary 2023-12-24 23:51:04 +08:00
bunnie
23a9b0cc34 add more helpful debug output for token claim failure 2023-12-24 22:14:39 +08:00
bunnie
aaa52ca02c fix warning in en-tts build 2023-12-23 23:50:57 +08:00
bunnie
4f75cd76a8 Merge branch 'main' of github.com:betrusted-io/xous-core into main 2023-11-11 23:13:19 +08:00
bunnie
5ad6106daf fix missing arg on unsafe-app-loading 2023-11-11 23:12:51 +08:00
bunnie
d4624124c9
Merge pull request #443 from betrusted-io/chat-status
WIP: Chat status
2023-11-03 13:54:34 +08:00
bunnie
699372d8d3 add hashmarks to the status bar when a new name is registered
we can't guarantee that we're running only signed code at this point,
so create a visual indicator of this.
2023-10-31 00:42:25 +08:00
bunnie
c346485832 isolate unsafe app loading features behind unsafe-app-loading feature gate 2023-10-31 00:18:42 +08:00
bunnie
ae7ee770ee expose the GAM minimum redraw period
this could be useful for functions that have to rapidly
toggle events on the screen and want to make sure that
the last event actually is rendered.
2023-10-29 23:02:44 +08:00
bunnie
cdada99705 miss copy-back of the animation state 2023-10-29 19:14:57 +08:00
bunnie
4423339059 move wifi delay hook to the correct area
- remove modal pop-up for wifi connection, and replace with
busy animation
- specify units of delay in the constants (_MS to indicate milliseconds;
this is a convention I'm trying to adhere to)
- partial progress on debugging why the animation isn't running
(value of animation variable is not being passed back at the GAM layer).

Also a general note on coding styles that probably is going to cause
confusion now that more people are contributing to the code base.

Generally, when a lot of "generic" library functions fail, we've been
passing an error message up the stack. However, these functions are
actually meant to be infalliable, and when you kick the error up the
stack you just end up with a panic at an unhelpful location (because
you finally catch the error only at the main loop or something and
by that point there's nothing you can really do about it but panic,
since it's supposed to be an infalliable operation).

As a result I have been trying to tamp down on needless error propagations
and having them fail with a unwrap or expect at the point where the
abstraction should be infalliable. This helps in debugging the actual
failure root cause because you're closer to the line of code that
actually broke, instead of just some line at a generic error handler.

Of course if you build with stack unwinding the top-level unwraps are more
useful because you can peer down into the call chain, but even then,
with the limited screen real estate I think deeply nested failures
would probably overflow any panic display. So even with panic unwinding
I think we stil want to keep the root cause within a few stack frames,
instead of errors being passed up sixteen levels of abstraction before
finally dying.

This only applies to things that are meant to be truly infalliable,
like syscalls that should not fail, or like unpacking a buffer or
memory message that has already been allocated. In this case the errors
are more like asserts, and are helpful if they fail at the line where
they break instead of being passed up the call stack (which was the
original architecture).

Probably I should add a note about this to the Xous Book.
2023-10-29 16:33:03 +08:00
Vihaan Jim
5dda363157 Merge branch 'main' of https://github.com/betrusted-io/xous-core 2023-09-30 18:07:58 -04:00
bunnie
9f57ad96fd
Merge pull request #408 from nworbnhoj/chat
mtxchat app and chat library
2023-09-19 19:09:56 +08:00
bunnie
8a67c95d70 cleanup new lints from Rust 1.72 2023-09-17 17:38:49 +08:00
nworbnhoj
a7d3b34563 Merge branch 'main' into chat 2023-09-08 13:48:45 +10:00
nworbnhoj
ce8c7f51c3 gam forward ALL rawkeys to the current context even when IMEF active
Forwarding of rawkeys to upper layers is important to enable apps to layer additional functionality on top of base.
2023-09-07 11:10:23 +10:00
nworbnhoj
6362ff9e4d capture typesetting overflow in ComposedType and pass thru to gam.post_textview() 2023-08-26 03:42:05 +10:00
Vihaan Jim
2d6e12f6b3 Fix to allow `app-loader' to switch app
`EXPECTED_APP_CONTEXTS' was added to the list of authorized
switchers. I don't think this is ideal, but I think it would be
difficult to come up with a better solution that doesn't make
`app-loader' "special" in some way.
2023-08-05 09:59:20 -04:00
Vihaan Jim
1e645a4b94 Allow registration of GAM names
This allows `app-loader' to register new names (which are then used by
the loaded apps to claim tokens). At the moment this is restricted to
apps that are pre-registered, i.e. included in the image.
2023-08-04 21:32:35 -04:00
Vihaan Jim
218e783053 Merge branch 'main' of https://github.com/betrusted-io/xous-core 2023-07-26 15:13:59 -04:00
bunnie
b2c64eb61a aesthetic cleanup; change default font for all modals
I decided to go back on the idea of not changing the modals
and now all modals use the new larger font as well.

This creates issue #396, which I will deal with later once
I have the time to do some more testing. I'm pretty sure
some other dialog boxes are broken now too.
2023-07-05 15:13:38 +08:00
bunnie
2f54ae39d4 Merge branch 'fonts' into main 2023-07-05 13:47:26 +08:00
bunnie
dfffa48715 move default system font to gam/src/lib.rs SYSTEM_STYLE
default system font can be statically changed by modifying
the SYSTEM_STYLE constant.

This of course will lead to a request for a dynamically
configurable preference for font size. However, early
on it was decided this is a bad idea. Here's why.

We don't provide for dynamic system-wide font selection
because this adds a lot of complexity to what would otherwise
be static code: this is a deliberate choice to improve code
density and performance. If the system font were dynamically
adjustable, then every character rendered we would potentially
have to query the PDDB for the current system font setting.

The impact of this could be mitigated by caching values but
then what happens when you actually change the font? now
you need a registry to fire messages off to all dependent
crates with cached values to flush their caches and redraw
(or you punt and force a reboot if you change font sizes,
but still, you're creating a dependency on a lot of plumbing
for even the simplest crates).

Plus, with a static font selection, the compiler can take constants
like the font height and compose them with other fitting
parameters into optimized load/stores of borders and spacings
for the static case; if you make it dynamic, all those multiplies,
adds and divides now get pulled into the main rendering loop
and are recomputed all the time. For example, if you have a static
const list of items that need to be rendered, even if the code to
compute the height of the list is written as a for loop, the compiler
will know the list is constant, and the font height is constant,
and it can condense that all into a single number at compile time,
eliminating all the code for the for loop.

If you leave the option open to change that, that entire piece
of code has to be generated and executed even though in practice
nobody changes the parameter.
2023-07-05 13:39:11 +08:00
Vihaan Jim
fe73bb40e7 Merge branch 'main' of https://github.com/betrusted-io/xous-core 2023-06-29 19:46:42 -04:00
nworbnhoj
80ff0cb52a increase modal ItemName length to 128 2023-06-23 07:26:12 +10:00
nworbnhoj
874086c413 extend checkboxes modal to handle explicit newline in item 2023-06-23 04:26:10 +10:00
Jean-Pierre De Jesus DIAZ
2af737b57e
xous-rs: move LANG variable to locales
This change is made with the intention of making the xous-rs crate a bit
more freestanding without depending on the xtask build system.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-06-15 18:23:12 +02:00
bunnie
d1af22f861 fix trust level of framebuffer canvas
this is some bit-rot that happened to the `ball` demo because
it's currently the only application that uses the framebuffer
canvas.

the trust level of the framebuffer canvas has to be lower than
that of the modals, otherwise a modals box is not allowed to
draw on top of the framebuffer.

in this case, a patch that was applied when trust levels were
refactored was missed on the framebuffer canvas, which caused
the trust level of the canvas to be higher than that of a modals.

Thus, when a modal attempts to pop up over the ball demo,
one just sees the defacement lines but no actal content.
2023-05-21 18:13:20 +08:00