diff options
author | Benji Dial <benji6283@gmail.com> | 2020-09-13 17:12:29 -0400 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2020-09-13 17:12:29 -0400 |
commit | 5481848e27fdd4fc859def9841a0283665531a46 (patch) | |
tree | 990a8df008214d85141a3bd10bd96898e64b0c37 /src/user/knob | |
parent | 1e4a254674f668839e5de273916024c16814b045 (diff) | |
download | portland-os-5481848e27fdd4fc859def9841a0283665531a46.tar.gz |
fixed some paging bugs, added fault handlers and new programs
Diffstat (limited to 'src/user/knob')
-rw-r--r-- | src/user/knob/entry.asm | 1 | ||||
-rw-r--r-- | src/user/knob/format.c | 14 | ||||
-rw-r--r-- | src/user/knob/user.c | 14 |
3 files changed, 23 insertions, 6 deletions
diff --git a/src/user/knob/entry.asm b/src/user/knob/entry.asm index 18faf7f..acf6f5f 100644 --- a/src/user/knob/entry.asm +++ b/src/user/knob/entry.asm @@ -12,7 +12,6 @@ _entry: mov esp, stack push edx - ;TODO: heap stuff? ;TODO: determine current_disk ;any further needed initialization diff --git a/src/user/knob/format.c b/src/user/knob/format.c index 087f6fd..645fb73 100644 --- a/src/user/knob/format.c +++ b/src/user/knob/format.c @@ -28,4 +28,18 @@ void itosz(uint32_t i, char *out) { } } *out = '\0'; +} + +const char *const hex_digits = "0123456789abcdef"; + +void itosz_h8(uint8_t i, char *out) { + out[0] = hex_digits[i >> 4]; + out[1] = hex_digits[i & 0xf]; + out[2] = '\0'; +} + +void itosz_h32(uint32_t i, char *out) { + for (uint8_t digit = 0; digit < 8; ++digit) + out[digit] = hex_digits[(i >> (28 - digit * 4)) & 0xf]; + out[8] = '\0'; }
\ No newline at end of file diff --git a/src/user/knob/user.c b/src/user/knob/user.c index 4ef3321..c84977c 100644 --- a/src/user/knob/user.c +++ b/src/user/knob/user.c @@ -165,16 +165,20 @@ uint32_t ask_user_line_sz(char *sz, uint32_t max_length) { goto replace; if (key & 0x80) goto replace;//TODO + if (key == '\b') { + if (i) { + --i; + _log_string("\b"); + } + goto replace; + } log_buf[0] = key; _log_string(log_buf); - if (key == '\b') - i -= i ? 2 : 1; - else if (key == '\n') + if (key == '\n') break; - else - sz[i] = key; + sz[i] = key; } sz[i] = '\0'; |