Compare commits

..

74 Commits

Author SHA1 Message Date
26623f8a0d
wind: Move more fallible operations before window creation
All checks were successful
continuous-integration/drone/pr Build is passing
2023-09-10 18:55:47 +02:00
0cc2b64cee
wind: Make sure stdin is always a TTY 2023-09-10 18:55:46 +02:00
1a79a3beda
libui+wind+libos: Move shared memory handling code to os::SharedMemory 2023-09-10 18:55:46 +02:00
b415e9a81a
libui: Add default handlers for events in Widget 2023-09-10 18:55:46 +02:00
77da94339d
libui: Propagate Container events only if they are in the child widget's rect 2023-09-10 18:55:46 +02:00
072793ce43
libui+wind: Handle mouse leave events when the mouse leaves a window 2023-09-10 18:55:46 +02:00
ffc7274272
wind: Stop using the removed 'signal' pledge 2023-09-10 18:55:46 +02:00
2fbf75a8b5
libui: Install the built library into the system root 2023-09-10 18:55:46 +02:00
f79515ed00
wind: Show memory usage in debug output 2023-09-10 18:55:45 +02:00
7d4d797d01
wind: Handle ftruncate() and mmap() errors properly 2023-09-10 18:55:45 +02:00
c7c7d7b751
wind: Fix client references being out-of-date in windows when disconnecting other clients
Classic "keeping a pointer to an element inside a vector after the vector is updated" bug, ah yes.
2023-09-10 18:55:45 +02:00
fd77ec4fab
taskbar: Wait for terminated child windows 2023-09-10 18:55:45 +02:00
a3751d9ce5
wind: Add debug keybind 2023-09-10 18:55:45 +02:00
869bbbe122
wind+libos+libui: Handle interrupted reads properly 2023-09-10 18:55:45 +02:00
17dde92c7b
base: Actually add the start icon to source control 2023-09-10 18:55:45 +02:00
f60ab19ed1
libui: Add Buttons 2023-09-10 18:55:44 +02:00
364556911f
libui: Handle other mouse events 2023-09-10 18:55:44 +02:00
d26ef849d9
libui: Add aligned items using Containers, ImageWidget 2023-09-10 18:55:44 +02:00
03cdd125d1
libui: Add VerticalLayout 2023-09-10 18:55:44 +02:00
815c2321a1
wind+libui+taskbar: Add GetScreenRect IPC, non-decorated windows, taskbar 2023-09-10 18:55:44 +02:00
a044b14b75
libui: Actually fill window backgrounds with the correct color 2023-09-10 18:55:44 +02:00
6701530f7f
libui: Add basic widget and layout system =D 2023-09-10 18:55:44 +02:00
0000bdaac5
ui+wind: Send mouse move events through IPC 2023-09-10 18:55:44 +02:00
b870cd1f8b
wind+libui: Add protocol for window close requests 2023-09-10 18:55:44 +02:00
21da3c7bda
libos+libui+wind: Use uppercase for static struct IDs to avoid confusion with fields 2023-09-10 18:55:43 +02:00
113fce5792
libui+gclient: Add basic OOP wrappers around the IPC protocol 2023-09-10 18:55:43 +02:00
ec61bdbfc5
wind+gclient: Add SetWindowTitle and support shm buffers 2023-09-10 18:55:43 +02:00
b9967cd0a7
gclient: Create two example windows 2023-09-10 18:55:43 +02:00
af78427228
wind: Handle CreateWindow IPC messages 2023-09-10 18:55:43 +02:00
89f156ad64
libui: Add CreateWindow IPC message definitions 2023-09-10 18:55:43 +02:00
8536752646
libos: Add basic IPC message framework 2023-09-10 18:55:43 +02:00
3359a8be90
kernel: Fix poll syscall 2023-09-10 18:55:43 +02:00
f4cd33a94a
wind: Monitor data on client connections 2023-09-10 18:55:42 +02:00
8966690b34
kernel: Add POLLHUP and store it when a polled socket's peer disconnects 2023-09-10 18:55:42 +02:00
841de6efcb
libui: Add copyright/author text 2023-09-10 18:55:42 +02:00
39d6128095
libos: Add copyright/author comments to LocalServer and LocalClient 2023-09-10 18:55:42 +02:00
faaea22d11
wind: Use init --user and pledge() 2023-09-10 18:55:42 +02:00
fe5936e507
Update .gitignore 2023-09-10 18:55:42 +02:00
7570724525
libos: Remove some shared pointers and change them to owned/live on the stack 2023-09-10 18:55:42 +02:00
e21b7d645d
wind: Spawn a new client process after startup
Also, create the socket after dropping privileges.
2023-09-10 18:55:42 +02:00
3750c1da57
apps: Add gclient 2023-09-10 18:55:41 +02:00
ca8306bc35
libos: Add os::LocalClient 2023-09-10 18:55:41 +02:00
a5b3b10a98
libui: Change 'into' to 'onto' 2023-09-10 18:55:41 +02:00
20f6ef04d3
libui: Document ui::Font 2023-09-10 18:55:41 +02:00
37332b2a67
libui+wind: Move some static variables inside functions 2023-09-10 18:55:41 +02:00
01cf9735eb
wind: Generate random windows on keypresses 2023-09-10 18:55:41 +02:00
fc35c32671
wind: Make sure windows have a minimum size to fit the titlebar 2023-09-10 18:55:41 +02:00
889588599b
libui: Properly cut off the last drawn character if necessary 2023-09-10 18:55:41 +02:00
47ea92536a
libui: Add Rect::contains(Rect) 2023-09-10 18:55:40 +02:00
33a4cd0616
libui: Render font characters properly with no spacing, matching the width calculations 2023-09-10 18:55:40 +02:00
d23df0672c
wind: Render an actual TGA mouse cursor 2023-09-10 18:55:40 +02:00
8cc882b4e2
wind: Add a close button to windows using a TGA icon 2023-09-10 18:55:40 +02:00
d30a40f3bf
libui: Add support for TGA image loading 2023-09-10 18:55:40 +02:00
a8d3c0b400
libui: Add an interface to fill a Canvas with an array of pixels 2023-09-10 18:55:40 +02:00
c66330d319
wind: Add window titlebars using ui::Font 2023-09-10 18:55:40 +02:00
cb54c16852
libui: Add PSF font loading and rendering 2023-09-10 18:55:40 +02:00
8d2f5f1de0
libui: Add Color::GRAY 2023-09-10 18:55:40 +02:00
de72ae340b
libui: Rename Rect::absolute to normalized and add a new absolute function 2023-09-10 18:55:39 +02:00
0dcd890a5a
libluna: Add assignment operators to Buffer 2023-09-10 18:55:39 +02:00
9c1e85dbdd
wind: Reorder drag sequence 2023-09-10 18:55:39 +02:00
943677f2e5
libui: Add Rect::relative 2023-09-10 18:55:39 +02:00
3287f4fe55
libui: Remove redundant statement 2023-09-10 18:55:39 +02:00
aa9abdcd5a
libui: Add getters for separate color values 2023-09-10 18:55:39 +02:00
f6e60bd715
libui: Remove unnecessary stuff 2023-09-10 18:55:39 +02:00
b7ecc9e776
base: Remove startup items not necessary for GUI startup 2023-09-10 18:55:39 +02:00
731601cc13
libui+wind: (Draggable) windows 2023-09-10 18:55:39 +02:00
d43f33e289
wind: Create a local server object 2023-09-10 18:55:39 +02:00
60a292c12c
libos: Add a new LocalServer class for local domain sockets 2023-09-10 18:55:38 +02:00
ad3446e82b
kernel: Support listening sockets in poll() 2023-09-10 18:55:38 +02:00
ad888ebf3e
base: Start wind on startup instead of the shell 2023-09-10 18:55:38 +02:00
ef26e7400e
wind: Add a simple display server skeleton using libui
No client functionality yet, but it's a start.
2023-09-10 18:55:38 +02:00
bd4e2ba351
libui: Add a GUI and graphics library 2023-09-10 18:55:33 +02:00
66e3d71dbc
kernel/ATA: Fix sector number calculation for ATA drives
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-07 11:28:46 +02:00
6065b63801
kernel/ext2: Add support for files larger than 4MB
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-06 09:56:24 +02:00
3 changed files with 54 additions and 15 deletions

View File

@ -503,11 +503,17 @@ namespace ATA
}
else
{
if (m_identify_data.big_lba) m_is_lba48 = true;
u8 buf[8];
memcpy(buf, &m_identify_words[100], 8);
if (m_is_lba48) m_block_count = m_identify_data.sectors_48;
else
m_block_count = m_identify_data.sectors_28;
m_block_count = *reinterpret_cast<u64*>(buf);
if (!m_block_count)
{
memcpy(buf, &m_identify_words[60], 4);
m_block_count = *reinterpret_cast<u32*>(buf);
}
else { m_is_lba48 = true; }
// FIXME: Should we check for CHS?

View File

@ -7,6 +7,13 @@ namespace Ext2
{
}
Result<void> Inode::prepare_buffer() const
{
if (!m_block_buffer.is_empty()) return {};
return m_block_buffer.try_resize(m_fs->m_block_size);
}
// FIXME: This code seems awfully similar to BlockDevice::read(). Can this be merged with it in some way?
Result<usize> Inode::read(u8* buf, usize offset, usize length) const
{
if (length == 0) return 0;
@ -66,22 +73,47 @@ namespace Ext2
{
if (index < 12) return m_raw_inode.direct_pointers[index];
usize block_index = (index - 12) * sizeof(u32);
if (block_index >= m_fs->m_block_size)
{
fail("ext2: Finding blocks beyond the singly indirect pointer block is not yet supported");
}
const usize block_size = m_fs->m_block_size;
const usize blocks_per_indirect_block = block_size / sizeof(u32);
usize block_size = m_fs->m_block_size;
index -= 12;
if (m_singly_indirect_block.is_empty())
TRY(prepare_buffer());
// Singly indirect block
if (index < blocks_per_indirect_block)
{
TRY(m_singly_indirect_block.try_resize(block_size));
TRY(m_fs->m_host_device->read(m_singly_indirect_block.data(), m_raw_inode.singly_indirect_ptr * block_size,
TRY(m_fs->m_host_device->read(m_block_buffer.data(), m_raw_inode.singly_indirect_ptr * block_size,
block_size));
return ((u32*)m_block_buffer.data())[index];
}
return *reinterpret_cast<u32*>(&m_singly_indirect_block.data()[block_index]);
index -= blocks_per_indirect_block;
// Doubly indirect block
if (index < blocks_per_indirect_block * blocks_per_indirect_block)
{
TRY(m_fs->m_host_device->read(m_block_buffer.data(), m_raw_inode.doubly_indirect_ptr * block_size,
block_size));
const u32 block = ((u32*)m_block_buffer.data())[index / blocks_per_indirect_block];
TRY(m_fs->m_host_device->read(m_block_buffer.data(), block * block_size, block_size));
return ((u32*)m_block_buffer.data())[index % blocks_per_indirect_block];
}
index -= blocks_per_indirect_block * blocks_per_indirect_block;
check(index < blocks_per_indirect_block * blocks_per_indirect_block * blocks_per_indirect_block);
// Triply indirect block
TRY(m_fs->m_host_device->read(m_block_buffer.data(), m_raw_inode.triply_indirect_ptr * block_size, block_size));
u32 block = ((u32*)m_block_buffer.data())[index / (blocks_per_indirect_block * blocks_per_indirect_block)];
TRY(m_fs->m_host_device->read(m_block_buffer.data(), block * block_size, block_size));
block = ((u32*)m_block_buffer.data())[(index / blocks_per_indirect_block) % blocks_per_indirect_block];
TRY(m_fs->m_host_device->read(m_block_buffer.data(), block * block_size, block_size));
return ((u32*)m_block_buffer.data())[index % blocks_per_indirect_block];
}
Result<void> Inode::lazy_initialize_dir() const

View File

@ -115,7 +115,7 @@ namespace Ext2
FileSystem* m_fs;
ino_t m_inum;
mutable Buffer m_singly_indirect_block;
mutable Buffer m_block_buffer;
String m_link;
@ -123,6 +123,7 @@ namespace Ext2
mutable bool m_dir_already_lazily_initialized { false };
Result<usize> find_block(usize index) const;
Result<void> prepare_buffer() const;
friend class FileSystem;
};