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:
parent
7fc5a6b753
commit
30ac95bcf8
@ -157,7 +157,7 @@ namespace MemoryManager
|
|||||||
return {};
|
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()));
|
check(is_aligned(address, MMU::page_size()));
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ namespace MemoryManager
|
|||||||
return {};
|
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++;
|
if (!is_aligned(address, MMU::page_size())) count++;
|
||||||
address = align_down(address, MMU::page_size());
|
address = align_down(address, MMU::page_size());
|
||||||
|
@ -14,8 +14,8 @@ namespace MemoryManager
|
|||||||
void lock_page(u64 page);
|
void lock_page(u64 page);
|
||||||
void lock_pages(u64 pages, u64 count);
|
void lock_pages(u64 pages, u64 count);
|
||||||
|
|
||||||
Result<void> remap(u64 address, size_t count, int flags);
|
Result<void> remap(u64 address, usize count, int flags);
|
||||||
Result<void> remap_unaligned(u64 address, size_t count, int flags);
|
Result<void> remap_unaligned(u64 address, usize count, int flags);
|
||||||
|
|
||||||
u64 free();
|
u64 free();
|
||||||
u64 used();
|
u64 used();
|
||||||
|
@ -29,5 +29,5 @@ namespace MMU
|
|||||||
Result<PageDirectory*> create_page_directory_for_userspace();
|
Result<PageDirectory*> create_page_directory_for_userspace();
|
||||||
void setup_initial_page_directory();
|
void setup_initial_page_directory();
|
||||||
|
|
||||||
size_t page_size();
|
usize page_size();
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Serial
|
namespace Serial
|
||||||
{
|
{
|
||||||
void write(const char* str, size_t size)
|
void write(const char* str, usize size)
|
||||||
{
|
{
|
||||||
while (size--) putchar(*str++);
|
while (size--) putchar(*str++);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
namespace Serial
|
namespace Serial
|
||||||
{
|
{
|
||||||
void putchar(u8 c);
|
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 print(const char* str);
|
||||||
void println(const char* str);
|
void println(const char* str);
|
||||||
}
|
}
|
@ -52,7 +52,7 @@ static_assert(sizeof(PageDirectory) == PAGE_SIZE);
|
|||||||
|
|
||||||
namespace MMU
|
namespace MMU
|
||||||
{
|
{
|
||||||
size_t page_size()
|
usize page_size()
|
||||||
{
|
{
|
||||||
return PAGE_SIZE;
|
return PAGE_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -8,4 +8,6 @@ typedef uint64_t u64;
|
|||||||
typedef int8_t i8;
|
typedef int8_t i8;
|
||||||
typedef int16_t i16;
|
typedef int16_t i16;
|
||||||
typedef int32_t i32;
|
typedef int32_t i32;
|
||||||
typedef int64_t i64;
|
typedef int64_t i64;
|
||||||
|
typedef size_t usize;
|
||||||
|
typedef long isize;
|
Loading…
Reference in New Issue
Block a user