-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
179 initialize user mode #181
Conversation
…os64 into 179_initialize_user_mode
loglinef(Verbose, "(%s) Initializing tss", __FUNCTION__); | ||
|
||
// These fields are reserved and must be set to 0 | ||
kernel_tss.reserved0 = 0x00; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that this is all explicit, but it'd be more efficient to use memset()
to zero the whole tss and then set the fields you want afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, i totally agree, but i haven't implemented memset yet XD
src/kernel/arch/x86_64/cpu/tss.c
Outdated
// LIMIT 16:19 0 DPL: 0 P: 1 G:0 | ||
gdt64[TSS_ENTRY_LOW] = 0x00; | ||
gdt64[TSS_ENTRY_HIGH] = 0x00; | ||
gdt64[TSS_ENTRY_LOW] = ((((uint64_t) &kernel_tss>>24) & 0xFF)<<56) /*bits 56:63*/ | ((uint64_t) (0 & 0xFF) << 48) /* bits 48:55 */ | ((uint64_t)0x89 << 40) /* bits 40:47*/| ((((uint64_t) &kernel_tss) & 0xFFFFFF) << 16) /* bits 15:39 */ | (uint64_t) 0x70 /* Base */; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like lisp! hahaha
It might be easier to understand if you break this down into a few smaller steps (i.e. local variables) and then assemble those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, but then shouldn't be better to create a struct with bitfields?
If i start to create local variable is more or less the same aestethically.
Am i wrong?
Btw yeah probably at least using variables, shoul make it more readable!
No description provided.