Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 4kb paging #84

Merged
merged 6 commits into from
Sep 24, 2019
Merged

Add 4kb paging #84

merged 6 commits into from
Sep 24, 2019

Conversation

SamTebbs33
Copy link
Collaborator

This PR adds 4KB paging support. Closes #79

Copy link
Member

@DrDeano DrDeano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few points ;)

src/kernel/arch/x86/paging.zig Outdated Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Outdated Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Outdated Show resolved Hide resolved
@@ -1,83 +1,138 @@
const std = @import("std");
const builtin = @import("builtin");
const panic = @import("../../kmain.zig").panic;
const arch = @import("../../arch.zig").internals;
const isr = @import("isr.zig");
const assert = std.debug.assert;
const MemProfile = @import("../../mem.zig").MemProfile;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const mem= @import("../../mem.zig");
const MemProfile = mem.MemProfile;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But mem is only used to get MemProfile so there's no point importing it separately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in that case, surly just const mem = @import("../../mem.zig"); and use `mem.MemProfile. Bc what if you want to use something else from mem?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use const MemProfile = @import("../../mem.zig").MemProfile and later on want to use something else from mem, then you can change it to

const mem = @import("../../mem.zig");
const MemProfile = mem.MemProfile;

and use mem wherever.

src/kernel/arch/x86/paging.zig Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Outdated Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Show resolved Hide resolved
Copy link
Member

@DrDeano DrDeano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a few comments

src/kernel/arch/x86/paging.zig Outdated Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Show resolved Hide resolved
Copy link
Member

@DrDeano DrDeano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, but confused why you use 4KB in places and others 4MB.

src/kernel/arch/x86/paging.zig Outdated Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Outdated Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Outdated Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Outdated Show resolved Hide resolved
src/kernel/arch/x86/paging.zig Show resolved Hide resolved
Copy link
Member

@DrDeano DrDeano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good :)

Copy link
Member

@DrDeano DrDeano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No cheating ;)

@@ -372,7 +372,8 @@ test "virtToPhys" {
const offset: usize = @ptrToInt(&KERNEL_ADDR_OFFSET);
expectEqual(virtToPhys(offset + 0), 0);
expectEqual(virtToPhys(offset + 123), 123);
expectEqual(@ptrToInt(virtToPhys(@intToPtr(*usize, offset + 123))), 123);
if (builtin.mode != builtin.Mode.ReleaseSafe)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XD, This is cheating. I think it is bc ur comparing a pointer to a uint. @ptrToInt() != u32

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:( I hoped you wouldn't notice the sneakyness. How do you think I could fix this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a workaround. It's not nice, but is all I can get working at the moment. I'll add an issue to monitor it once this is merged.

Copy link
Member

@DrDeano DrDeano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@SamTebbs33 SamTebbs33 merged commit 5d42beb into develop Sep 24, 2019
@SamTebbs33 SamTebbs33 deleted the feature/4kb-paging branch September 24, 2019 10:36
SamTebbs33 added a commit that referenced this pull request Sep 24, 2019
SamTebbs33 added a commit that referenced this pull request Oct 7, 2019
SamTebbs33 added a commit that referenced this pull request Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4KB x86 paging
2 participants