重构内存分配器、增加中断支持、整理rust运行时环境 #4
|
@ -2,6 +2,7 @@
|
||||||
#define X86_64_INTERRUPT_H 1
|
#define X86_64_INTERRUPT_H 1
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
#include <utils.h>
|
||||||
|
|
||||||
typedef struct __gate_descriptor_t
|
typedef struct __gate_descriptor_t
|
||||||
{
|
{
|
||||||
|
@ -11,7 +12,7 @@ typedef struct __gate_descriptor_t
|
||||||
u16 offset_23;
|
u16 offset_23;
|
||||||
u32 offset_4567;
|
u32 offset_4567;
|
||||||
u32 reserved;
|
u32 reserved;
|
||||||
} gate_descriptor_t;
|
} DISALIGNED gate_descriptor_t;
|
||||||
|
|
||||||
// interrupt stack table,每个表项都指向tss
|
// interrupt stack table,每个表项都指向tss
|
||||||
// 需要加载寄存器IA32_INTERRUPT_SSP_TABLE
|
// 需要加载寄存器IA32_INTERRUPT_SSP_TABLE
|
||||||
|
|
|
@ -15,7 +15,7 @@ typedef enum __memm_page_size
|
||||||
|
|
||||||
extern u64 PML4[512];
|
extern u64 PML4[512];
|
||||||
|
|
||||||
#define MEMM_PAGE_TABLE_FLAGS_AREA ((u64)0xfff)
|
#define MEMM_PAGE_TABLE_FLAGS_MASK ((u64)0xfff)
|
||||||
|
|
||||||
/* 页对齐掩码 */
|
/* 页对齐掩码 */
|
||||||
#define MEMM_4K_ALIGN_MASK ((u64)0xfff)
|
#define MEMM_4K_ALIGN_MASK ((u64)0xfff)
|
||||||
|
|
|
@ -33,7 +33,7 @@ bool lst_remove(lst_iterator_t *lst, usize left, usize right, bool force);
|
||||||
/*
|
/*
|
||||||
在`lst`中添加一个线段[left,right)
|
在`lst`中添加一个线段[left,right)
|
||||||
force=true时忽略已经存在于`lst`中的线段
|
force=true时忽略已经存在于`lst`中的线段
|
||||||
force=false时若有存在于`lst`中的线段,只添加这些部分之外的线段,返回false,否则返回true
|
force=false时若有存在于`lst`中的线段,不添加任何线段,返回false,否则返回true
|
||||||
*/
|
*/
|
||||||
bool lst_add(lst_iterator_t *lst, usize left, usize right, bool force);
|
bool lst_add(lst_iterator_t *lst, usize left, usize right, bool force);
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,6 @@
|
||||||
|
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
#define UTILS_BIT_GET(byte, bit) ((byte) & (1 << (bit)))
|
|
||||||
#define UTILS_BIT_SET(byte, bit) ((byte) |= (1 << (bit)));
|
|
||||||
#define UTILS_BIT_RESET(byte, bit) ((byte) &= ~(1 << (bit)));
|
|
||||||
|
|
||||||
#define UTILS_BITMAP_GET(map, bit) (((u8 *)(map))[bit / 8] & (1 << ((bit) % 8)))
|
|
||||||
#define UTILS_BITMAP_SET(map, bit) (((u8 *)(map))[bit / 8] |= (1 << ((bit) % 8)));
|
|
||||||
#define UTILS_BITMAP_RESET(map, bit) (((u8 *)(map))[bit / 8] &= ~(1 << ((bit) % 8)));
|
|
||||||
|
|
||||||
#define DISALIGNED __attribute__((packed))
|
#define DISALIGNED __attribute__((packed))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Reference in New Issue