Use usize/isize instead of (s)size_t

Since we're using Rust-style integer types already, why not go all in?
This commit is contained in:
apio 2022-11-16 20:30:34 +01:00
parent 7fc5a6b753
commit 30ac95bcf8
7 changed files with 11 additions and 9 deletions

View File

@ -157,7 +157,7 @@ namespace MemoryManager
return {};
}
Result<void> remap(u64 address, size_t count, int flags)
Result<void> remap(u64 address, usize count, int flags)
{
check(is_aligned(address, MMU::page_size()));
@ -170,7 +170,7 @@ namespace MemoryManager
return {};
}
Result<void> remap_unaligned(u64 address, size_t count, int flags)
Result<void> remap_unaligned(u64 address, usize count, int flags)
{
if (!is_aligned(address, MMU::page_size())) count++;
address = align_down(address, MMU::page_size());

View File

@ -14,8 +14,8 @@ namespace MemoryManager
void lock_page(u64 page);
void lock_pages(u64 pages, u64 count);
Result<void> remap(u64 address, size_t count, int flags);
Result<void> remap_unaligned(u64 address, size_t count, int flags);
Result<void> remap(u64 address, usize count, int flags);
Result<void> remap_unaligned(u64 address, usize count, int flags);
u64 free();
u64 used();

View File

@ -29,5 +29,5 @@ namespace MMU
Result<PageDirectory*> create_page_directory_for_userspace();
void setup_initial_page_directory();
size_t page_size();
usize page_size();
}

View File

@ -2,7 +2,7 @@
namespace Serial
{
void write(const char* str, size_t size)
void write(const char* str, usize size)
{
while (size--) putchar(*str++);
}

View File

@ -4,7 +4,7 @@
namespace Serial
{
void putchar(u8 c);
void write(const char* str, size_t size);
void write(const char* str, usize size);
void print(const char* str);
void println(const char* str);
}

View File

@ -52,7 +52,7 @@ static_assert(sizeof(PageDirectory) == PAGE_SIZE);
namespace MMU
{
size_t page_size()
usize page_size()
{
return PAGE_SIZE;
}

View File

@ -8,4 +8,6 @@ typedef uint64_t u64;
typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef int64_t i64;
typedef size_t usize;
typedef long isize;