1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:28:13 +00:00

Lots of hacking:

- Turn Keyboard into a CharacterDevice (85,1) at /dev/keyboard.
- Implement MM::unmapRegionsForTask() and MM::unmapRegion()
- Save SS correctly on interrupt.
- Add a simple Spawn syscall for launching another process.
- Move a bunch of IO syscall debug output behind DEBUG_IO.
- Have ASSERT do a "cli" immediately when failing.
  This makes the output look proper every time.
- Implement a bunch of syscalls in LibC.
- Add a simple shell ("sh"). All it can do now is read a line
  of text from /dev/keyboard and then try launching the specified
  executable by calling spawn().

There are definitely bugs in here, but we're moving on forward.
This commit is contained in:
Andreas Kling 2018-10-23 10:12:50 +02:00
parent 72514c8b97
commit fe237ee215
29 changed files with 276 additions and 32 deletions

View file

@ -47,7 +47,7 @@ void Keyboard::handleIRQ()
case 0x9D: m_modifiers &= ~MOD_CTRL; break;
case 0x2A: m_modifiers |= MOD_SHIFT; break;
case 0xAA: m_modifiers &= ~MOD_SHIFT; break;
case 0x1C: /* enter */ kprintf("\n"); break;
case 0x1C: /* enter */ m_queue.enqueue('\n'); break;
case 0xFA: /* i8042 ack */ break;
default:
if (ch & 0x80) {
@ -55,11 +55,14 @@ void Keyboard::handleIRQ()
break;
}
if (!m_modifiers)
kprintf("%c", map[ch]);
m_queue.enqueue(map[ch]);
else if (m_modifiers & MOD_SHIFT)
kprintf("%c", shift_map[ch]);
else if (m_modifiers & MOD_CTRL)
kprintf("^%c", shift_map[ch]);
m_queue.enqueue(shift_map[ch]);
else if (m_modifiers & MOD_CTRL) {
// FIXME: This is obviously not a good enough way to process ctrl+whatever.
m_queue.enqueue('^');
m_queue.enqueue(shift_map[ch]);
}
}
//break;
}
@ -81,3 +84,18 @@ Keyboard::~Keyboard()
ASSERT_NOT_REACHED();
}
ssize_t Keyboard::read(byte* buffer, size_t size)
{
ssize_t nread = 0;
while (nread < size) {
if (m_queue.isEmpty())
break;
buffer[nread++] = m_queue.dequeue();
}
return nread;
}
ssize_t Keyboard::write(const byte* data, size_t size)
{
return 0;
}