directly return structs
This commit is contained in:
parent
289bd04621
commit
018c4a2c1a
1 changed files with 6 additions and 10 deletions
|
|
@ -46,8 +46,7 @@ void init_gdt() {
|
|||
// TODO set code segment -> iret?
|
||||
}
|
||||
|
||||
struct __attribute__((packed))
|
||||
int_desc_entry {
|
||||
struct int_desc_entry {
|
||||
uint16_t offset1;
|
||||
uint16_t selector;
|
||||
uint8_t ist;
|
||||
|
|
@ -56,6 +55,7 @@ int_desc_entry {
|
|||
uint32_t offset3;
|
||||
uint32_t pad;
|
||||
};
|
||||
STATIC_ASSERT(sizeof(struct int_desc_entry) == 16);
|
||||
|
||||
#define PRIV_KERNEL 0
|
||||
#define PRIV_USER 3
|
||||
|
|
@ -277,8 +277,7 @@ void pt_walk() {
|
|||
|
||||
struct va va_from_value(uint64_t value) {
|
||||
ASSERT(value < (1ull << 48));
|
||||
struct va va = { .value = value };
|
||||
return va;
|
||||
return (struct va){ .value = value };
|
||||
}
|
||||
|
||||
struct va va_from_canonical(uint64_t canonical) {
|
||||
|
|
@ -287,8 +286,7 @@ struct va va_from_canonical(uint64_t canonical) {
|
|||
} else {
|
||||
ASSERT(canonical >> 48 == 0ull);
|
||||
}
|
||||
struct va va = { .value = canonical & 0x0000ffffffffffffull };
|
||||
return va;
|
||||
return (struct va){ .value = canonical & 0x0000ffffffffffffull };
|
||||
}
|
||||
|
||||
struct va va_from_vpn_with_offset(struct vpn vpn, uint64_t offset) {
|
||||
|
|
@ -315,13 +313,11 @@ struct vpn vpn_from_pagenum(uint64_t pagenum) {
|
|||
|
||||
struct vpn vpn_from_aligned_va(struct va va) {
|
||||
ASSERT((va_to_value(va) & 0xfffull) == 0);
|
||||
struct vpn vpn = { .pagenum = va_to_value(va) >> 12 };
|
||||
return vpn;
|
||||
return (struct vpn){ .pagenum = va_to_value(va) >> 12 };
|
||||
}
|
||||
|
||||
struct vpn vpn_from_unaligned_va(struct va va) {
|
||||
struct vpn vpn = { .pagenum = va_to_value(va) >> 12 };
|
||||
return vpn;
|
||||
return (struct vpn){ .pagenum = va_to_value(va) >> 12 };
|
||||
}
|
||||
|
||||
uint64_t vpn_to_pagenum(struct vpn vpn) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue