git://scm.lunaixsky.com
/
lunaix-os.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
40941f9
)
refactor: replace all stdint::uint32_t into short and more manageable u32_t
author
Minep
<zelong56@gmail.com>
Sun, 13 Nov 2022 22:20:45 +0000
(22:20 +0000)
committer
Minep
<zelong56@gmail.com>
Sun, 13 Nov 2022 22:20:45 +0000
(22:20 +0000)
58 files changed:
lunaix-os/arch/x86/hhk.c
patch
|
blob
|
history
lunaix-os/hal/acpi/acpi.c
patch
|
blob
|
history
lunaix-os/hal/ahci/ahci.c
patch
|
blob
|
history
lunaix-os/hal/ahci/ata.c
patch
|
blob
|
history
lunaix-os/hal/ahci/atapi.c
patch
|
blob
|
history
lunaix-os/hal/ahci/hbadev_export.c
patch
|
blob
|
history
lunaix-os/hal/ahci/utils.c
patch
|
blob
|
history
lunaix-os/hal/apic.c
patch
|
blob
|
history
lunaix-os/hal/cpu.c
patch
|
blob
|
history
lunaix-os/hal/ioapic.c
patch
|
blob
|
history
lunaix-os/hal/pci.c
patch
|
blob
|
history
lunaix-os/includes/arch/x86/tss.h
patch
|
blob
|
history
lunaix-os/includes/hal/acpi/acpi.h
patch
|
blob
|
history
lunaix-os/includes/hal/acpi/fadt.h
patch
|
blob
|
history
lunaix-os/includes/hal/acpi/madt.h
patch
|
blob
|
history
lunaix-os/includes/hal/acpi/mcfg.h
patch
|
blob
|
history
lunaix-os/includes/hal/acpi/sdt.h
patch
|
blob
|
history
lunaix-os/includes/hal/ahci/hba.h
patch
|
blob
|
history
lunaix-os/includes/hal/ahci/scsi.h
patch
|
blob
|
history
lunaix-os/includes/hal/cpu.h
patch
|
blob
|
history
lunaix-os/includes/hal/io.h
patch
|
blob
|
history
lunaix-os/includes/hal/ioapic.h
patch
|
blob
|
history
lunaix-os/includes/hal/pci.h
patch
|
blob
|
history
lunaix-os/includes/lib/hash.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/block.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/clock.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/device.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/ds/btrie.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/ds/hstr.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/ds/lru.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/fs.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/fs/twifs.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/input.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/mm/dmm.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/mm/mmio.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/mm/page.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/mm/pmm.h
patch
|
blob
|
history
lunaix-os/includes/lunaix/timer.h
patch
|
blob
|
history
lunaix-os/kernel/asm/x86/gdt.c
patch
|
blob
|
history
lunaix-os/kernel/asm/x86/intr_routines.c
patch
|
blob
|
history
lunaix-os/kernel/asm/x86/intrhnds.c
patch
|
blob
|
history
lunaix-os/kernel/asm/x86/tss.c
patch
|
blob
|
history
lunaix-os/kernel/device/device.c
patch
|
blob
|
history
lunaix-os/kernel/ds/btrie.c
patch
|
blob
|
history
lunaix-os/kernel/fs/iso9660/mount.c
patch
|
blob
|
history
lunaix-os/kernel/fs/pcache.c
patch
|
blob
|
history
lunaix-os/kernel/fs/twifs/twifs.c
patch
|
blob
|
history
lunaix-os/kernel/fs/vfs.c
patch
|
blob
|
history
lunaix-os/kernel/mm/kalloc.c
patch
|
blob
|
history
lunaix-os/kernel/mm/mmio.c
patch
|
blob
|
history
lunaix-os/kernel/mm/pmm.c
patch
|
blob
|
history
lunaix-os/kernel/mm/vmm.c
patch
|
blob
|
history
lunaix-os/kernel/time/timer.c
patch
|
blob
|
history
lunaix-os/kernel/tty/lxconsole.c
patch
|
blob
|
history
lunaix-os/kernel/tty/tty.c
patch
|
blob
|
history
lunaix-os/libs/hash.c
patch
|
blob
|
history
lunaix-os/libs/klibc/stdio/ksprintf.c
patch
|
blob
|
history
lunaix-os/scripts/x86_idt_generator.py
patch
|
blob
|
history
diff --git
a/lunaix-os/arch/x86/hhk.c
b/lunaix-os/arch/x86/hhk.c
index 997bbdf86bcd886a84c0f37179f8aa2f8fc181bf..5854b626b580f057ba92adc7d2115f85d5ec2aaa 100644
(file)
--- a/
lunaix-os/arch/x86/hhk.c
+++ b/
lunaix-os/arch/x86/hhk.c
@@
-36,7
+36,7
@@
_init_page(ptd_t* ptd)
// 对低1MiB空间进行对等映射(Identity
// mapping),也包括了我们的VGA,方便内核操作。
// 对低1MiB空间进行对等映射(Identity
// mapping),也包括了我们的VGA,方便内核操作。
- for (u
int
32_t i = 0; i < 256; i++) {
+ for (u32_t i = 0; i < 256; i++) {
SET_PTE(ptd,
PG_TABLE_IDENTITY,
i,
SET_PTE(ptd,
PG_TABLE_IDENTITY,
i,
@@
-46,7
+46,7
@@
_init_page(ptd_t* ptd)
// 对等映射我们的hhk_init,这样一来,当分页与地址转换开启后,我们依然能够照常执行最终的
// jmp 指令来跳转至
// 内核的入口点
// 对等映射我们的hhk_init,这样一来,当分页与地址转换开启后,我们依然能够照常执行最终的
// jmp 指令来跳转至
// 内核的入口点
- for (u
int
32_t i = 0; i < HHK_PAGE_COUNT; i++) {
+ for (u32_t i = 0; i < HHK_PAGE_COUNT; i++) {
SET_PTE(ptd,
PG_TABLE_IDENTITY,
256 + i,
SET_PTE(ptd,
PG_TABLE_IDENTITY,
256 + i,
@@
-57,14
+57,14
@@
_init_page(ptd_t* ptd)
// 这里是一些计算,主要是计算应当映射进的 页目录 与 页表 的条目索引(Entry
// Index)
// 这里是一些计算,主要是计算应当映射进的 页目录 与 页表 的条目索引(Entry
// Index)
- u
int
32_t kernel_pde_index = L1_INDEX(sym_val(__kernel_start));
- u
int
32_t kernel_pte_index = L2_INDEX(sym_val(__kernel_start));
- u
int
32_t kernel_pg_counts = KERNEL_PAGE_COUNT;
+ u32_t kernel_pde_index = L1_INDEX(sym_val(__kernel_start));
+ u32_t kernel_pte_index = L2_INDEX(sym_val(__kernel_start));
+ u32_t kernel_pg_counts = KERNEL_PAGE_COUNT;
// 将内核所需要的页表注册进页目录
// 当然,就现在而言,我们的内核只占用不到50个页(每个页表包含1024个页)
// 这里分配了3个页表(12MiB),未雨绸缪。
// 将内核所需要的页表注册进页目录
// 当然,就现在而言,我们的内核只占用不到50个页(每个页表包含1024个页)
// 这里分配了3个页表(12MiB),未雨绸缪。
- for (u
int
32_t i = 0; i < PG_TABLE_STACK - PG_TABLE_KERNEL; i++) {
+ for (u32_t i = 0; i < PG_TABLE_STACK - PG_TABLE_KERNEL; i++) {
SET_PDE(ptd,
kernel_pde_index + i,
NEW_L1_ENTRY(PG_PREM_URW, PT_ADDR(ptd, PG_TABLE_KERNEL + i)))
SET_PDE(ptd,
kernel_pde_index + i,
NEW_L1_ENTRY(PG_PREM_URW, PT_ADDR(ptd, PG_TABLE_KERNEL + i)))
@@
-82,7
+82,7
@@
_init_page(ptd_t* ptd)
uintptr_t kernel_pm = V2P(&__kernel_start);
// 重映射内核至高半区地址(>=0xC0000000)
uintptr_t kernel_pm = V2P(&__kernel_start);
// 重映射内核至高半区地址(>=0xC0000000)
- for (u
int
32_t i = 0; i < kernel_pg_counts; i++) {
+ for (u32_t i = 0; i < kernel_pg_counts; i++) {
// FIXME: 只是用作用户模式(R3)测试!
// 在实际中,内核代码除了极少部分需要暴露给R3(如从信号返回),其余的应为R0。
SET_PTE(ptd,
// FIXME: 只是用作用户模式(R3)测试!
// 在实际中,内核代码除了极少部分需要暴露给R3(如从信号返回),其余的应为R0。
SET_PTE(ptd,
@@
-95,7
+95,7
@@
_init_page(ptd_t* ptd)
SET_PDE(ptd, PG_MAX_ENTRIES - 1, NEW_L1_ENTRY(T_SELF_REF_PERM, ptd));
}
SET_PDE(ptd, PG_MAX_ENTRIES - 1, NEW_L1_ENTRY(T_SELF_REF_PERM, ptd));
}
-u
int
32_t
+u32_t
__save_subset(uint8_t* destination, uint8_t* base, unsigned int size)
{
unsigned int i = 0;
__save_subset(uint8_t* destination, uint8_t* base, unsigned int size)
{
unsigned int i = 0;
@@
-108,7
+108,7
@@
__save_subset(uint8_t* destination, uint8_t* base, unsigned int size)
void
_save_multiboot_info(multiboot_info_t* info, uint8_t* destination)
{
void
_save_multiboot_info(multiboot_info_t* info, uint8_t* destination)
{
- u
int
32_t current = 0;
+ u32_t current = 0;
uint8_t* info_b = (uint8_t*)info;
for (; current < sizeof(multiboot_info_t); current++) {
*(destination + current) = *(info_b + current);
uint8_t* info_b = (uint8_t*)info;
for (; current < sizeof(multiboot_info_t); current++) {
*(destination + current) = *(info_b + current);
@@
-129,13
+129,13
@@
_save_multiboot_info(multiboot_info_t* info, uint8_t* destination)
}
void
}
void
-_hhk_init(ptd_t* ptd, u
int
32_t kpg_size)
+_hhk_init(ptd_t* ptd, u32_t kpg_size)
{
// 初始化 kpg 全为0
// P.s. 真没想到GRUB会在这里留下一堆垃圾! 老子的页表全乱套了!
uint8_t* kpg = (uint8_t*)ptd;
{
// 初始化 kpg 全为0
// P.s. 真没想到GRUB会在这里留下一堆垃圾! 老子的页表全乱套了!
uint8_t* kpg = (uint8_t*)ptd;
- for (u
int
32_t i = 0; i < kpg_size; i++) {
+ for (u32_t i = 0; i < kpg_size; i++) {
*(kpg + i) = 0;
}
*(kpg + i) = 0;
}
diff --git
a/lunaix-os/hal/acpi/acpi.c
b/lunaix-os/hal/acpi/acpi.c
index 67f5adebcd0c0ccf4e0255b5575292e466cf7129..419b1360fc17c16f7aaec63f795a2d632b3537c7 100644
(file)
--- a/
lunaix-os/hal/acpi/acpi.c
+++ b/
lunaix-os/hal/acpi/acpi.c
@@
-113,8
+113,8
@@
acpi_locate_rsdp(multiboot_info_t* mb_info)
uint8_t* mem_start = entry.addr_low & ~0xf;
size_t len = entry.len_low;
for (size_t j = 0; j < len; j += 16) {
uint8_t* mem_start = entry.addr_low & ~0xf;
size_t len = entry.len_low;
for (size_t j = 0; j < len; j += 16) {
- u
int32_t sig_low = *((uint
32_t*)(mem_start + j));
- // u
int32_t sig_high = *((uint
32_t*)(mem_start+j) + 1);
+ u
32_t sig_low = *((u
32_t*)(mem_start + j));
+ // u
32_t sig_high = *((u
32_t*)(mem_start+j) + 1);
if (sig_low == ACPI_RSDP_SIG_L) {
rsdp = (acpi_rsdp_t*)(mem_start + j);
break;
if (sig_low == ACPI_RSDP_SIG_L) {
rsdp = (acpi_rsdp_t*)(mem_start + j);
break;
@@
-125,9
+125,9
@@
acpi_locate_rsdp(multiboot_info_t* mb_info)
// You know what, I just search the entire 1MiB for Celestia's sake.
uint8_t* mem_start = 0x4000;
for (; mem_start < 0x100000; mem_start += 16) {
// You know what, I just search the entire 1MiB for Celestia's sake.
uint8_t* mem_start = 0x4000;
for (; mem_start < 0x100000; mem_start += 16) {
- u
int32_t sig_low = *((uint
32_t*)(mem_start));
+ u
32_t sig_low = *((u
32_t*)(mem_start));
// XXX: do we need to compare this as well?
// XXX: do we need to compare this as well?
- // u
int32_t sig_high = *((uint
32_t*)(mem_start+j) + 1);
+ // u
32_t sig_high = *((u
32_t*)(mem_start+j) + 1);
if (sig_low == ACPI_RSDP_SIG_L) {
rsdp = (acpi_rsdp_t*)(mem_start);
break;
if (sig_low == ACPI_RSDP_SIG_L) {
rsdp = (acpi_rsdp_t*)(mem_start);
break;
diff --git
a/lunaix-os/hal/ahci/ahci.c
b/lunaix-os/hal/ahci/ahci.c
index e07200ed2c942feea50b5d91de8f1653f56c8aa6..c12244ecec6b9379b392fb1ad5a3a413538486fc 100644
(file)
--- a/
lunaix-os/hal/ahci/ahci.c
+++ b/
lunaix-os/hal/ahci/ahci.c
@@
-192,7
+192,7
@@
ahci_driver_init(struct pci_device* ahci_dev)
i,
hbadev->model,
hbadev->block_size,
i,
hbadev->model,
hbadev->block_size,
- (u
int
32_t)hbadev->max_lba);
+ (u32_t)hbadev->max_lba);
ahci_register_device(hbadev);
}
ahci_register_device(hbadev);
}
@@
-218,7
+218,7
@@
__get_free_slot(struct hba_port* port)
hba_reg_t pxsact = port->regs[HBA_RPxSACT];
hba_reg_t pxci = port->regs[HBA_RPxCI];
hba_reg_t free_bmp = pxsact | pxci;
hba_reg_t pxsact = port->regs[HBA_RPxSACT];
hba_reg_t pxci = port->regs[HBA_RPxCI];
hba_reg_t free_bmp = pxsact | pxci;
- u
int
32_t i = 0;
+ u32_t i = 0;
for (; i <= port->hba->cmd_slots && (free_bmp & 0x1); i++, free_bmp >>= 1)
;
return i | -(i > port->hba->cmd_slots);
for (; i <= port->hba->cmd_slots && (free_bmp & 0x1); i++, free_bmp >>= 1)
;
return i | -(i > port->hba->cmd_slots);
@@
-393,7
+393,7
@@
ahci_init_device(struct hba_port* port)
goto fail;
}
goto fail;
}
- scsi_parse_capacity(port->device, (u
int
32_t*)data_in);
+ scsi_parse_capacity(port->device, (u32_t*)data_in);
done:
// reset interrupt status and unmask D2HR interrupt
done:
// reset interrupt status and unmask D2HR interrupt
diff --git
a/lunaix-os/hal/ahci/ata.c
b/lunaix-os/hal/ahci/ata.c
index 877ed86c6f52f4cb39e73cf4f6ff355f719e54b8..de59eb93f0d8cd741e27d84307304e5f74706a10 100644
(file)
--- a/
lunaix-os/hal/ahci/ata.c
+++ b/
lunaix-os/hal/ahci/ata.c
@@
-9,7
+9,7
@@
void
sata_read_error(struct hba_port* port)
{
void
sata_read_error(struct hba_port* port)
{
- u
int
32_t tfd = port->regs[HBA_RPxTFD];
+ u32_t tfd = port->regs[HBA_RPxTFD];
port->device->last_result.sense_key = (tfd & 0xf000) >> 12;
port->device->last_result.error = (tfd & 0x0f00) >> 8;
port->device->last_result.status = tfd & 0x00ff;
port->device->last_result.sense_key = (tfd & 0xf000) >> 12;
port->device->last_result.error = (tfd & 0x0f00) >> 8;
port->device->last_result.status = tfd & 0x00ff;
diff --git
a/lunaix-os/hal/ahci/atapi.c
b/lunaix-os/hal/ahci/atapi.c
index bf3e8c92fb26046434c424e735d2c751a4d0f42b..59733f0132b283db1e564851f571994872c9c80c 100644
(file)
--- a/
lunaix-os/hal/ahci/atapi.c
+++ b/
lunaix-os/hal/ahci/atapi.c
@@
-12,8
+12,8
@@
void
scsi_create_packet12(struct scsi_cdb12* cdb,
uint8_t opcode,
void
scsi_create_packet12(struct scsi_cdb12* cdb,
uint8_t opcode,
- u
int
32_t lba,
- u
int
32_t alloc_size)
+ u32_t lba,
+ u32_t alloc_size)
{
memset(cdb, 0, sizeof(*cdb));
cdb->opcode = opcode;
{
memset(cdb, 0, sizeof(*cdb));
cdb->opcode = opcode;
@@
-25,17
+25,17
@@
void
scsi_create_packet16(struct scsi_cdb16* cdb,
uint8_t opcode,
uint64_t lba,
scsi_create_packet16(struct scsi_cdb16* cdb,
uint8_t opcode,
uint64_t lba,
- u
int
32_t alloc_size)
+ u32_t alloc_size)
{
memset(cdb, 0, sizeof(*cdb));
cdb->opcode = opcode;
{
memset(cdb, 0, sizeof(*cdb));
cdb->opcode = opcode;
- cdb->lba_be_hi = SCSI_FLIP((u
int
32_t)(lba >> 32));
- cdb->lba_be_lo = SCSI_FLIP((u
int
32_t)lba);
+ cdb->lba_be_hi = SCSI_FLIP((u32_t)(lba >> 32));
+ cdb->lba_be_lo = SCSI_FLIP((u32_t)lba);
cdb->length = SCSI_FLIP(alloc_size);
}
void
cdb->length = SCSI_FLIP(alloc_size);
}
void
-scsi_parse_capacity(struct hba_device* device, u
int
32_t* parameter)
+scsi_parse_capacity(struct hba_device* device, u32_t* parameter)
{
if (device->cbd_size == SCSI_CDB16) {
device->max_lba =
{
if (device->cbd_size == SCSI_CDB16) {
device->max_lba =
@@
-62,7
+62,7
@@
scsi_submit(struct hba_device* dev, struct blkio_req* io_req)
header->options |= (HBA_CMDH_WRITE * (write == 1)) | HBA_CMDH_ATAPI;
size_t size = vbuf_size(io_req->vbuf);
header->options |= (HBA_CMDH_WRITE * (write == 1)) | HBA_CMDH_ATAPI;
size_t size = vbuf_size(io_req->vbuf);
- u
int
32_t count = ICEIL(size, port->device->block_size);
+ u32_t count = ICEIL(size, port->device->block_size);
struct sata_reg_fis* fis = (struct sata_reg_fis*)table->command_fis;
void* cdb = table->atapi_cmd;
struct sata_reg_fis* fis = (struct sata_reg_fis*)table->command_fis;
void* cdb = table->atapi_cmd;
diff --git
a/lunaix-os/hal/ahci/hbadev_export.c
b/lunaix-os/hal/ahci/hbadev_export.c
index d193937c8376ff1ae68deb899ae490c697f11fb7..3fea81d9c4c736f0c944a66a4ec904faf2ad341c 100644
(file)
--- a/
lunaix-os/hal/ahci/hbadev_export.c
+++ b/
lunaix-os/hal/ahci/hbadev_export.c
@@
-38,8
+38,8
@@
void
__blk_rd_wwid(struct twimap* map)
{
struct hba_device* hbadev = twimap_data(map, struct hba_device*);
__blk_rd_wwid(struct twimap* map)
{
struct hba_device* hbadev = twimap_data(map, struct hba_device*);
- u
int
32_t h = hbadev->wwn >> 32;
- u
int32_t l = (uint
32_t)hbadev->wwn;
+ u32_t h = hbadev->wwn >> 32;
+ u
32_t l = (u
32_t)hbadev->wwn;
if ((h | l)) {
twimap_printf(map, "wwn:%x%x", h, l);
} else {
if ((h | l)) {
twimap_printf(map, "wwn:%x%x", h, l);
} else {
diff --git
a/lunaix-os/hal/ahci/utils.c
b/lunaix-os/hal/ahci/utils.c
index f11ffb4fd05325cff6e31879b15d2483c143e2b7..4a86cc3fe2e3bf98dc8a43670f27eb0ce0ec789f 100644
(file)
--- a/
lunaix-os/hal/ahci/utils.c
+++ b/
lunaix-os/hal/ahci/utils.c
@@
-17,18
+17,18
@@
#define IDDEV_OFFLPP 106
#define IDDEV_OFFCAPABILITIES 49
#define IDDEV_OFFLPP 106
#define IDDEV_OFFCAPABILITIES 49
-static u
int
32_t cdb_size[] = { SCSI_CDB12, SCSI_CDB16, 0, 0 };
+static u32_t cdb_size[] = { SCSI_CDB12, SCSI_CDB16, 0, 0 };
void
ahci_parse_dev_info(struct hba_device* dev_info, uint16_t* data)
{
void
ahci_parse_dev_info(struct hba_device* dev_info, uint16_t* data)
{
- dev_info->max_lba = *((u
int
32_t*)(data + IDDEV_OFFMAXLBA));
- dev_info->block_size = *((u
int
32_t*)(data + IDDEV_OFFLSECSIZE));
+ dev_info->max_lba = *((u32_t*)(data + IDDEV_OFFMAXLBA));
+ dev_info->block_size = *((u32_t*)(data + IDDEV_OFFLSECSIZE));
dev_info->cbd_size = cdb_size[(*data & 0x3)];
dev_info->wwn = *(uint64_t*)(data + IDDEV_OFFWWN);
dev_info->block_per_sec = 1 << (*(data + IDDEV_OFFLPP) & 0xf);
dev_info->alignment_offset = *(data + IDDEV_OFFALIGN) & 0x3fff;
dev_info->cbd_size = cdb_size[(*data & 0x3)];
dev_info->wwn = *(uint64_t*)(data + IDDEV_OFFWWN);
dev_info->block_per_sec = 1 << (*(data + IDDEV_OFFLPP) & 0xf);
dev_info->alignment_offset = *(data + IDDEV_OFFALIGN) & 0x3fff;
- dev_info->capabilities = *((u
int
32_t*)(data + IDDEV_OFFCAPABILITIES));
+ dev_info->capabilities = *((u32_t*)(data + IDDEV_OFFCAPABILITIES));
if (!dev_info->block_size) {
dev_info->block_size = 512;
if (!dev_info->block_size) {
dev_info->block_size = 512;
diff --git
a/lunaix-os/hal/apic.c
b/lunaix-os/hal/apic.c
index 00995252120892cde34712677f641795ea390634..2f5b5be02afe5c092c16242a1c41bd8660bd2ceb 100644
(file)
--- a/
lunaix-os/hal/apic.c
+++ b/
lunaix-os/hal/apic.c
@@
-53,8
+53,8
@@
apic_init()
: "eax", "ecx", "edx");
// Print the basic information of our current local APIC
: "eax", "ecx", "edx");
// Print the basic information of our current local APIC
- u
int
32_t apic_id = apic_read_reg(APIC_IDR) >> 24;
- u
int
32_t apic_ver = apic_read_reg(APIC_VER);
+ u32_t apic_id = apic_read_reg(APIC_IDR) >> 24;
+ u32_t apic_ver = apic_read_reg(APIC_VER);
kprintf(KINFO "ID: %x, Version: %x, Max LVT: %u\n",
apic_id,
kprintf(KINFO "ID: %x, Version: %x, Max LVT: %u\n",
apic_id,
@@
-74,7
+74,7
@@
apic_init()
apic_write_reg(APIC_TPR, APIC_PRIORITY(2, 0));
// enable APIC
apic_write_reg(APIC_TPR, APIC_PRIORITY(2, 0));
// enable APIC
- u
int
32_t spiv = apic_read_reg(APIC_SPIVR);
+ u32_t spiv = apic_read_reg(APIC_SPIVR);
// install our handler for spurious interrupt.
spiv = (spiv & ~0xff) | APIC_SPIV_APIC_ENABLE | APIC_SPIV_IV;
// install our handler for spurious interrupt.
spiv = (spiv & ~0xff) | APIC_SPIV_APIC_ENABLE | APIC_SPIV_IV;
diff --git
a/lunaix-os/hal/cpu.c
b/lunaix-os/hal/cpu.c
index ab5432c9642402556c0282eb8f0ee5982d22d9fb..9517445e1e2b31938391c86254f3ffffd9fb4452 100644
(file)
--- a/
lunaix-os/hal/cpu.c
+++ b/
lunaix-os/hal/cpu.c
@@
-1,11
+1,13
@@
+#include <cpuid.h>
#include <hal/cpu.h>
#include <stdint.h>
#include <hal/cpu.h>
#include <stdint.h>
-#include <cpuid.h>
-void cpu_get_model(char* model_out) {
- uint32_t* out = (uint32_t*)model_out;
+void
+cpu_get_model(char* model_out)
+{
+ u32_t* out = (u32_t*)model_out;
reg32 eax = 0, ebx = 0, edx = 0, ecx = 0;
reg32 eax = 0, ebx = 0, edx = 0, ecx = 0;
-
+
__get_cpuid(0, &eax, &ebx, &ecx, &edx);
out[0] = ebx;
__get_cpuid(0, &eax, &ebx, &ecx, &edx);
out[0] = ebx;
@@
-16,44
+18,47
@@
void cpu_get_model(char* model_out) {
#define BRAND_LEAF 0x80000000UL
#define BRAND_LEAF 0x80000000UL
-int cpu_brand_string_supported() {
+int
+cpu_brand_string_supported()
+{
reg32 supported = __get_cpuid_max(BRAND_LEAF, 0);
return (supported >= 0x80000004UL);
}
reg32 supported = __get_cpuid_max(BRAND_LEAF, 0);
return (supported >= 0x80000004UL);
}
-void cpu_get_brand(char* brand_out) {
- if(!cpu_brand_string_supported()) {
+void
+cpu_get_brand(char* brand_out)
+{
+ if (!cpu_brand_string_supported()) {
brand_out[0] = '?';
brand_out[1] = '\0';
}
brand_out[0] = '?';
brand_out[1] = '\0';
}
- u
int32_t* out = (uint32_t*)
brand_out;
+ u
32_t* out = (u32_t*)
brand_out;
reg32 eax = 0, ebx = 0, edx = 0, ecx = 0;
reg32 eax = 0, ebx = 0, edx = 0, ecx = 0;
- for (uint32_t i = 2, j = 0; i < 5; i++)
- {
+ for (u32_t i = 2, j = 0; i < 5; i++) {
__get_cpuid(BRAND_LEAF + i, &eax, &ebx, &ecx, &edx);
out[j] = eax;
out[j + 1] = ebx;
out[j + 2] = ecx;
out[j + 3] = edx;
__get_cpuid(BRAND_LEAF + i, &eax, &ebx, &ecx, &edx);
out[j] = eax;
out[j + 1] = ebx;
out[j + 2] = ecx;
out[j + 3] = edx;
- j
+=
4;
+ j
+=
4;
}
brand_out[48] = '\0';
}
}
brand_out[48] = '\0';
}
-
int
int
-cpu_has_apic() {
+cpu_has_apic()
+{
// reference: Intel manual, section 10.4.2
reg32 eax = 0, ebx = 0, edx = 0, ecx = 0;
__get_cpuid(1, &eax, &ebx, &ecx, &edx);
// reference: Intel manual, section 10.4.2
reg32 eax = 0, ebx = 0, edx = 0, ecx = 0;
__get_cpuid(1, &eax, &ebx, &ecx, &edx);
-
+
return (edx & 0x100);
}
void
return (edx & 0x100);
}
void
-cpu_rdmsr(u
int32_t msr_idx, uint32_t* reg_high, uint
32_t* reg_low)
+cpu_rdmsr(u
32_t msr_idx, u32_t* reg_high, u
32_t* reg_low)
{
{
- u
int
32_t h = 0, l = 0;
+ u32_t h = 0, l = 0;
asm volatile("rdmsr" : "=d"(h), "=a"(l) : "c"(msr_idx));
*reg_high = h;
asm volatile("rdmsr" : "=d"(h), "=a"(l) : "c"(msr_idx));
*reg_high = h;
@@
-61,7
+66,7
@@
cpu_rdmsr(uint32_t msr_idx, uint32_t* reg_high, uint32_t* reg_low)
}
void
}
void
-cpu_wrmsr(u
int32_t msr_idx, uint32_t reg_high, uint
32_t reg_low)
+cpu_wrmsr(u
32_t msr_idx, u32_t reg_high, u
32_t reg_low)
{
asm volatile("wrmsr" : : "d"(reg_high), "a"(reg_low), "c"(msr_idx));
}
\ No newline at end of file
{
asm volatile("wrmsr" : : "d"(reg_high), "a"(reg_low), "c"(msr_idx));
}
\ No newline at end of file
diff --git
a/lunaix-os/hal/ioapic.c
b/lunaix-os/hal/ioapic.c
index edd374fcc2056936283e1cfb52d0a8fcae70a002..004f889b18514c8d4a1abbc8e8ee32746010ee7f 100644
(file)
--- a/
lunaix-os/hal/ioapic.c
+++ b/
lunaix-os/hal/ioapic.c
@@
-4,8
+4,8
@@
#include <lunaix/common.h>
#include <lunaix/mm/mmio.h>
#include <lunaix/common.h>
#include <lunaix/mm/mmio.h>
-#define IOAPIC_REG_SEL *((volatile u
int
32_t*)(_ioapic_base + IOAPIC_IOREGSEL))
-#define IOAPIC_REG_WIN *((volatile u
int
32_t*)(_ioapic_base + IOAPIC_IOWIN))
+#define IOAPIC_REG_SEL *((volatile u32_t*)(_ioapic_base + IOAPIC_IOREGSEL))
+#define IOAPIC_REG_WIN *((volatile u32_t*)(_ioapic_base + IOAPIC_IOWIN))
static volatile uintptr_t _ioapic_base;
static volatile uintptr_t _ioapic_base;
@@
-20,13
+20,13
@@
ioapic_init()
}
void
}
void
-ioapic_write(uint8_t sel, u
int
32_t val)
+ioapic_write(uint8_t sel, u32_t val)
{
IOAPIC_REG_SEL = sel;
IOAPIC_REG_WIN = val;
}
{
IOAPIC_REG_SEL = sel;
IOAPIC_REG_WIN = val;
}
-u
int
32_t
+u32_t
ioapic_read(uint8_t sel)
{
IOAPIC_REG_SEL = sel;
ioapic_read(uint8_t sel)
{
IOAPIC_REG_SEL = sel;
@@
-34,7
+34,7
@@
ioapic_read(uint8_t sel)
}
void
}
void
-ioapic_redirect(uint8_t irq, uint8_t vector, uint8_t dest, u
int
32_t flags)
+ioapic_redirect(uint8_t irq, uint8_t vector, uint8_t dest, u32_t flags)
{
uint8_t reg_sel = IOAPIC_IOREDTBL_BASE + irq * 2;
{
uint8_t reg_sel = IOAPIC_IOREDTBL_BASE + irq * 2;
diff --git
a/lunaix-os/hal/pci.c
b/lunaix-os/hal/pci.c
index cb7cfe75351ca7ad6e1b48f14298827c7bd70f34..8969224502e492c4141220c5b8f87be4772695e8 100644
(file)
--- a/
lunaix-os/hal/pci.c
+++ b/
lunaix-os/hal/pci.c
@@
-28,7
+28,7
@@
pci_probe_msi_info(struct pci_device* device);
void
pci_probe_device(int bus, int dev, int funct)
{
void
pci_probe_device(int bus, int dev, int funct)
{
- u
int
32_t base = PCI_ADDRESS(bus, dev, funct);
+ u32_t base = PCI_ADDRESS(bus, dev, funct);
pci_reg_t reg1 = pci_read_cspace(base, 0);
// Vendor=0xffff则表示设备不存在
pci_reg_t reg1 = pci_read_cspace(base, 0);
// Vendor=0xffff则表示设备不存在
@@
-102,7
+102,7
@@
pci_probe()
void
pci_probe_bar_info(struct pci_device* device)
{
void
pci_probe_bar_info(struct pci_device* device)
{
- u
int
32_t bar;
+ u32_t bar;
struct pci_base_addr* ba;
for (size_t i = 0; i < 6; i++) {
ba = &device->bar[i];
struct pci_base_addr* ba;
for (size_t i = 0; i < 6; i++) {
ba = &device->bar[i];
@@
-132,7
+132,7
@@
pci_probe_msi_info(struct pci_device* device)
}
pci_reg_t cap_ptr = pci_read_cspace(device->cspace_base, 0x34) & 0xff;
}
pci_reg_t cap_ptr = pci_read_cspace(device->cspace_base, 0x34) & 0xff;
- u
int
32_t cap_hdr;
+ u32_t cap_hdr;
while (cap_ptr) {
cap_hdr = pci_read_cspace(device->cspace_base, cap_ptr);
while (cap_ptr) {
cap_hdr = pci_read_cspace(device->cspace_base, cap_ptr);
@@
-242,7
+242,7
@@
pci_build_fsmapping()
}
size_t
}
size_t
-pci_bar_sizing(struct pci_device* dev, u
int32_t* bar_out, uint
32_t bar_num)
+pci_bar_sizing(struct pci_device* dev, u
32_t* bar_out, u
32_t bar_num)
{
pci_reg_t bar = pci_read_cspace(dev->cspace_base, PCI_REG_BAR(bar_num));
if (!bar) {
{
pci_reg_t bar = pci_read_cspace(dev->cspace_base, PCI_REG_BAR(bar_num));
if (!bar) {
@@
-265,10
+265,10
@@
void
pci_setup_msi(struct pci_device* device, int vector)
{
// Dest: APIC#0, Physical Destination, No redirection
pci_setup_msi(struct pci_device* device, int vector)
{
// Dest: APIC#0, Physical Destination, No redirection
- u
int
32_t msi_addr = (__APIC_BASE_PADDR);
+ u32_t msi_addr = (__APIC_BASE_PADDR);
// Edge trigger, Fixed delivery
// Edge trigger, Fixed delivery
- u
int
32_t msi_data = vector;
+ u32_t msi_data = vector;
pci_write_cspace(
device->cspace_base, PCI_MSI_ADDR(device->msi_loc), msi_addr);
pci_write_cspace(
device->cspace_base, PCI_MSI_ADDR(device->msi_loc), msi_addr);
@@
-294,7
+294,7
@@
pci_setup_msi(struct pci_device* device, int vector)
struct pci_device*
pci_get_device_by_id(uint16_t vendorId, uint16_t deviceId)
{
struct pci_device*
pci_get_device_by_id(uint16_t vendorId, uint16_t deviceId)
{
- u
int
32_t dev_info = vendorId | (deviceId << 16);
+ u32_t dev_info = vendorId | (deviceId << 16);
struct pci_device *pos, *n;
llist_for_each(pos, n, &pci_devices, dev_chain)
{
struct pci_device *pos, *n;
llist_for_each(pos, n, &pci_devices, dev_chain)
{
@@
-307,7
+307,7
@@
pci_get_device_by_id(uint16_t vendorId, uint16_t deviceId)
}
struct pci_device*
}
struct pci_device*
-pci_get_device_by_class(u
int
32_t class)
+pci_get_device_by_class(u32_t class)
{
struct pci_device *pos, *n;
llist_for_each(pos, n, &pci_devices, dev_chain)
{
struct pci_device *pos, *n;
llist_for_each(pos, n, &pci_devices, dev_chain)
diff --git
a/lunaix-os/includes/arch/x86/tss.h
b/lunaix-os/includes/arch/x86/tss.h
index d8256f7b721cbee5a2885001e80cf5a9e8780794..6643344f9955019b1b71d1bbf2ea4b8d970954bd 100644
(file)
--- a/
lunaix-os/includes/arch/x86/tss.h
+++ b/
lunaix-os/includes/arch/x86/tss.h
@@
-1,14
+1,16
@@
#ifndef __LUNAIX_TSS_H
#define __LUNAIX_TSS_H
#ifndef __LUNAIX_TSS_H
#define __LUNAIX_TSS_H
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
-struct x86_tss {
- uint32_t link;
- uint32_t esp0;
+struct x86_tss
+{
+ u32_t link;
+ u32_t esp0;
uint16_t ss0;
uint8_t __padding[94];
} __attribute__((packed));
uint16_t ss0;
uint8_t __padding[94];
} __attribute__((packed));
-void tss_update_esp(uint32_t esp0);
-
+void
+tss_update_esp(u32_t esp0);
+
#endif /* __LUNAIX_TSS_H */
#endif /* __LUNAIX_TSS_H */
diff --git
a/lunaix-os/includes/hal/acpi/acpi.h
b/lunaix-os/includes/hal/acpi/acpi.h
index 46713b8f54f618fed20db0bed74bed181831dd13..a8d18bf7f86565595b7180a74e305d305aacaad9 100644
(file)
--- a/
lunaix-os/includes/hal/acpi/acpi.h
+++ b/
lunaix-os/includes/hal/acpi/acpi.h
@@
-24,14
+24,14
@@
typedef struct
{
typedef struct
{
- u
int
32_t signature_l;
- u
int
32_t signature_h;
+ u32_t signature_l;
+ u32_t signature_h;
uint8_t chksum;
char oem_id[6];
// Revision
uint8_t rev;
acpi_rsdt_t* rsdt;
uint8_t chksum;
char oem_id[6];
// Revision
uint8_t rev;
acpi_rsdt_t* rsdt;
- u
int
32_t length;
+ u32_t length;
acpi_sdthdr_t* xsdt;
uint8_t x_chksum;
char reserved[3]; // Reserved field
acpi_sdthdr_t* xsdt;
uint8_t x_chksum;
char reserved[3]; // Reserved field
diff --git
a/lunaix-os/includes/hal/acpi/fadt.h
b/lunaix-os/includes/hal/acpi/fadt.h
index e0b99431f584f070a3e1dc7006b76379d91ad9ba..21251e616600d9a6add96b5b7aee8568cfa9b2ab 100644
(file)
--- a/
lunaix-os/includes/hal/acpi/fadt.h
+++ b/
lunaix-os/includes/hal/acpi/fadt.h
@@
-5,7
+5,8
@@
// Pulled from ACPI Specification (v6.4) section 5.2.9
// Pulled from ACPI Specification (v6.4) section 5.2.9
-enum PMProfile {
+enum PMProfile
+{
Desktop = 1,
Mobile = 2,
Workstation = 3,
Desktop = 1,
Mobile = 2,
Workstation = 3,
@@
-32,28
+33,29
@@
enum PMProfile {
#define ITIME_MON_ALARM 1
#define ITIME_CENTURY 2
#define ITIME_MON_ALARM 1
#define ITIME_CENTURY 2
-#define IAPC_ARCH_LEGACY
0x1
-#define IAPC_ARCH_8042
0x2
-#define IAPC_ARCH_NO_VGA
0x4
-#define IAPC_ARCH_NO_MSI
0x8
-#define IAPC_ARCH_ASPM
0x10
-#define IAPC_ARCH_NO_RTC
0x20
+#define IAPC_ARCH_LEGACY 0x1
+#define IAPC_ARCH_8042 0x2
+#define IAPC_ARCH_NO_VGA 0x4
+#define IAPC_ARCH_NO_MSI 0x8
+#define IAPC_ARCH_ASPM 0x10
+#define IAPC_ARCH_NO_RTC 0x20
-typedef struct acpi_fadt {
+typedef struct acpi_fadt
+{
acpi_sdthdr_t header;
acpi_sdthdr_t header;
- u
int
32_t firmware_controller_addr;
- u
int
32_t dsdt_addr;
+ u32_t firmware_controller_addr;
+ u32_t dsdt_addr;
uint8_t reserved;
uint8_t pm_profile;
uint16_t sci_int;
uint8_t reserved;
uint8_t pm_profile;
uint16_t sci_int;
- u
int
32_t smi_cmd_port_addr;
+ u32_t smi_cmd_port_addr;
uint8_t smi_acpi_enable;
uint8_t smi_acpi_disable;
uint8_t smi_s4bios_state;
uint8_t smi_pstate;
uint8_t smi_acpi_enable;
uint8_t smi_acpi_disable;
uint8_t smi_s4bios_state;
uint8_t smi_pstate;
- u
int
32_t pm_reg_ports[6];
- u
int
32_t gpe0_port_addr;
- u
int
32_t gpe1_port_addr;
+ u32_t pm_reg_ports[6];
+ u32_t gpe0_port_addr;
+ u32_t gpe1_port_addr;
uint8_t pm_reg_lens[4];
uint8_t gpe0_len;
uint8_t gpe1_len;
uint8_t pm_reg_lens[4];
uint8_t gpe0_len;
uint8_t gpe1_len;
diff --git
a/lunaix-os/includes/hal/acpi/madt.h
b/lunaix-os/includes/hal/acpi/madt.h
index ef03bfd5b013dc74ef97dec0c60e3d394faec940..1dd0bca4015c61c5c7f0774fc25da0a15c4622b0 100644
(file)
--- a/
lunaix-os/includes/hal/acpi/madt.h
+++ b/
lunaix-os/includes/hal/acpi/madt.h
@@
-28,7
+28,7
@@
typedef struct
acpi_ics_hdr_t header;
uint8_t processor_id;
uint8_t apic_id;
acpi_ics_hdr_t header;
uint8_t processor_id;
uint8_t apic_id;
- u
int
32_t flags;
+ u32_t flags;
} ACPI_TABLE_PACKED acpi_apic_t;
/**
} ACPI_TABLE_PACKED acpi_apic_t;
/**
@@
-43,9
+43,10
@@
typedef struct
acpi_ics_hdr_t header;
uint8_t ioapic_id;
uint8_t reserved;
acpi_ics_hdr_t header;
uint8_t ioapic_id;
uint8_t reserved;
- uint32_t ioapic_addr;
- // The global system interrupt offset for this IOAPIC. (Kind of IRQ offset for a slave IOAPIC)
- uint32_t gis_offset;
+ u32_t ioapic_addr;
+ // The global system interrupt offset for this IOAPIC. (Kind of IRQ offset
+ // for a slave IOAPIC)
+ u32_t gis_offset;
} ACPI_TABLE_PACKED acpi_ioapic_t;
/**
} ACPI_TABLE_PACKED acpi_ioapic_t;
/**
@@
-65,7
+66,7
@@
typedef struct
// PIC
uint8_t source;
// global system interrupt. The override of source in APIC mode
// PIC
uint8_t source;
// global system interrupt. The override of source in APIC mode
- u
int
32_t gsi;
+ u32_t gsi;
uint16_t flags;
} ACPI_TABLE_PACKED acpi_intso_t;
uint16_t flags;
} ACPI_TABLE_PACKED acpi_intso_t;
@@
-73,7
+74,7
@@
typedef struct
{
acpi_sdthdr_t header;
void* apic_addr;
{
acpi_sdthdr_t header;
void* apic_addr;
- u
int
32_t flags;
+ u32_t flags;
// Here is a bunch of packed ICS reside here back-to-back.
} ACPI_TABLE_PACKED acpi_madt_t;
// Here is a bunch of packed ICS reside here back-to-back.
} ACPI_TABLE_PACKED acpi_madt_t;
diff --git
a/lunaix-os/includes/hal/acpi/mcfg.h
b/lunaix-os/includes/hal/acpi/mcfg.h
index 0ff86e08a187ef1f400367c438aa5f68bb7b84a3..5a40f26ac171e11aaf755c8c36c8788c616c44b9 100644
(file)
--- a/
lunaix-os/includes/hal/acpi/mcfg.h
+++ b/
lunaix-os/includes/hal/acpi/mcfg.h
@@
-5,17
+5,17
@@
struct acpi_mcfg_alloc
{
struct acpi_mcfg_alloc
{
- u
int
32_t base_addr_lo;
- u
int
32_t base_addr_hi;
+ u32_t base_addr_lo;
+ u32_t base_addr_hi;
uint16_t pci_seg_num;
uint8_t pci_bus_start;
uint8_t pci_bus_end;
uint16_t pci_seg_num;
uint8_t pci_bus_start;
uint8_t pci_bus_end;
- u
int
32_t reserve;
+ u32_t reserve;
} ACPI_TABLE_PACKED;
struct mcfg_alloc_info
{
} ACPI_TABLE_PACKED;
struct mcfg_alloc_info
{
- u
int
32_t base_addr;
+ u32_t base_addr;
uint16_t pci_seg_num;
uint8_t pci_bus_start;
uint8_t pci_bus_end;
uint16_t pci_seg_num;
uint8_t pci_bus_start;
uint8_t pci_bus_end;
diff --git
a/lunaix-os/includes/hal/acpi/sdt.h
b/lunaix-os/includes/hal/acpi/sdt.h
index fc4a332428e4424da18c4a1088ffc1b9dfaacc1f..e5b1d11d233d7c56d84a713d88c3cfc27a2deb2b 100644
(file)
--- a/
lunaix-os/includes/hal/acpi/sdt.h
+++ b/
lunaix-os/includes/hal/acpi/sdt.h
@@
-1,22
+1,22
@@
#ifndef __LUNAIX_ACPI_SDT_H
#define __LUNAIX_ACPI_SDT_H
#ifndef __LUNAIX_ACPI_SDT_H
#define __LUNAIX_ACPI_SDT_H
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
-#define ACPI_TABLE_PACKED
__attribute__((packed))
+#define ACPI_TABLE_PACKED __attribute__((packed))
typedef struct acpi_sdthdr
{
typedef struct acpi_sdthdr
{
- u
int
32_t signature;
- u
int
32_t length;
+ u32_t signature;
+ u32_t length;
// Revision
uint8_t rev;
uint8_t chksum;
char oem_id[6];
char oem_table_id[8];
// Revision
uint8_t rev;
uint8_t chksum;
char oem_id[6];
char oem_table_id[8];
- u
int
32_t oem_rev;
- u
int
32_t vendor_id;
- u
int
32_t vendor_rev;
+ u32_t oem_rev;
+ u32_t vendor_id;
+ u32_t vendor_rev;
} ACPI_TABLE_PACKED acpi_sdthdr_t;
typedef struct acpi_rsdt
} ACPI_TABLE_PACKED acpi_sdthdr_t;
typedef struct acpi_rsdt
diff --git
a/lunaix-os/includes/hal/ahci/hba.h
b/lunaix-os/includes/hal/ahci/hba.h
index 9bebe8e3cd81dfab94900ec7e08c02adc0f3a5e9..f6c63922f2d8c43c0dbf62e57d7131af55ebc84c 100644
(file)
--- a/
lunaix-os/includes/hal/ahci/hba.h
+++ b/
lunaix-os/includes/hal/ahci/hba.h
@@
-81,18
+81,18
@@
struct hba_cmdh
{
uint16_t options;
uint16_t prdt_len;
{
uint16_t options;
uint16_t prdt_len;
- u
int
32_t transferred_size;
- u
int
32_t cmd_table_base;
- u
int
32_t reserved[5];
+ u32_t transferred_size;
+ u32_t cmd_table_base;
+ u32_t reserved[5];
} __HBA_PACKED__;
#define HBA_PRDTE_BYTE_CNT(cnt) ((cnt & 0x3FFFFF) | 0x1)
struct hba_prdte
{
} __HBA_PACKED__;
#define HBA_PRDTE_BYTE_CNT(cnt) ((cnt & 0x3FFFFF) | 0x1)
struct hba_prdte
{
- u
int
32_t data_base;
- u
int
32_t reserved[2];
- u
int
32_t byte_count;
+ u32_t data_base;
+ u32_t reserved[2];
+ u32_t byte_count;
} __HBA_PACKED__;
struct hba_cmdt
} __HBA_PACKED__;
struct hba_cmdt
@@
-113,9
+113,9
@@
struct hba_device
{
char serial_num[20];
char model[40];
{
char serial_num[20];
char model[40];
- u
int
32_t flags;
+ u32_t flags;
uint64_t max_lba;
uint64_t max_lba;
- u
int
32_t block_size;
+ u32_t block_size;
uint64_t wwn;
uint8_t cbd_size;
struct
uint64_t wwn;
uint8_t cbd_size;
struct
@@
-125,9
+125,9
@@
struct hba_device
uint8_t status;
uint8_t reserve;
} last_result;
uint8_t status;
uint8_t reserve;
} last_result;
- u
int
32_t alignment_offset;
- u
int
32_t block_per_sec;
- u
int
32_t capabilities;
+ u32_t alignment_offset;
+ u32_t block_per_sec;
+ u32_t capabilities;
struct hba_port* port;
struct ahci_hba* hba;
struct hba_port* port;
struct ahci_hba* hba;
diff --git
a/lunaix-os/includes/hal/ahci/scsi.h
b/lunaix-os/includes/hal/ahci/scsi.h
index e1bbb713e2b99c3ae73050f29679275e73d30187..d6582293470a59015c050912d7c36fdcc605339a 100644
(file)
--- a/
lunaix-os/includes/hal/ahci/scsi.h
+++ b/
lunaix-os/includes/hal/ahci/scsi.h
@@
-21,8
+21,8
@@
struct scsi_cdb12
{
uint8_t opcode;
uint8_t misc1;
{
uint8_t opcode;
uint8_t misc1;
- u
int
32_t lba_be;
- u
int
32_t length;
+ u32_t lba_be;
+ u32_t length;
uint8_t misc2;
uint8_t ctrl;
} __attribute__((packed));
uint8_t misc2;
uint8_t ctrl;
} __attribute__((packed));
@@
-31,9
+31,9
@@
struct scsi_cdb16
{
uint8_t opcode;
uint8_t misc1;
{
uint8_t opcode;
uint8_t misc1;
- u
int
32_t lba_be_hi;
- u
int
32_t lba_be_lo;
- u
int
32_t length;
+ u32_t lba_be_hi;
+ u32_t lba_be_lo;
+ u32_t length;
uint8_t misc2;
uint8_t ctrl;
} __attribute__((packed));
uint8_t misc2;
uint8_t ctrl;
} __attribute__((packed));
@@
-41,19
+41,19
@@
struct scsi_cdb16
void
scsi_create_packet12(struct scsi_cdb12* cdb,
uint8_t opcode,
void
scsi_create_packet12(struct scsi_cdb12* cdb,
uint8_t opcode,
- u
int
32_t lba,
- u
int
32_t alloc_size);
+ u32_t lba,
+ u32_t alloc_size);
void
scsi_create_packet16(struct scsi_cdb16* cdb,
uint8_t opcode,
uint64_t lba,
void
scsi_create_packet16(struct scsi_cdb16* cdb,
uint8_t opcode,
uint64_t lba,
- u
int
32_t alloc_size);
+ u32_t alloc_size);
void
scsi_submit(struct hba_device* dev, struct blkio_req* io_req);
void
void
scsi_submit(struct hba_device* dev, struct blkio_req* io_req);
void
-scsi_parse_capacity(struct hba_device* device, u
int
32_t* parameter);
+scsi_parse_capacity(struct hba_device* device, u32_t* parameter);
#endif /* __LUNAIX_ATAPI_H */
#endif /* __LUNAIX_ATAPI_H */
diff --git
a/lunaix-os/includes/hal/cpu.h
b/lunaix-os/includes/hal/cpu.h
index 5789d4a41430f955d8c939f4e79d168d445a26cd..ae9926b7c0e6e6bedfd8d497cea59dc9e6c67d63 100644
(file)
--- a/
lunaix-os/includes/hal/cpu.h
+++ b/
lunaix-os/includes/hal/cpu.h
@@
-1,7
+1,7
@@
#ifndef __LUNAIX_CPU_H
#define __LUNAIX_CPU_H
#ifndef __LUNAIX_CPU_H
#define __LUNAIX_CPU_H
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
#define SEL_RPL(selector) ((selector)&0x3)
#define SEL_RPL(selector) ((selector)&0x3)
@@
-124,9
+124,9
@@
cpu_int(int vect)
}
void
}
void
-cpu_rdmsr(u
int32_t msr_idx, uint32_t* reg_high, uint
32_t* reg_low);
+cpu_rdmsr(u
32_t msr_idx, u32_t* reg_high, u
32_t* reg_low);
void
void
-cpu_wrmsr(u
int32_t msr_idx, uint32_t reg_high, uint
32_t reg_low);
+cpu_wrmsr(u
32_t msr_idx, u32_t reg_high, u
32_t reg_low);
#endif
\ No newline at end of file
#endif
\ No newline at end of file
diff --git
a/lunaix-os/includes/hal/io.h
b/lunaix-os/includes/hal/io.h
index dd445098bf7240b7c64e623457005e3aa898f6ce..f4f61920f4ad809b8d18821add13a0eff30c9f53 100644
(file)
--- a/
lunaix-os/includes/hal/io.h
+++ b/
lunaix-os/includes/hal/io.h
@@
-1,7
+1,7
@@
#ifndef __LUNAIX_IO_H
#define __LUNAIX_IO_H
#ifndef __LUNAIX_IO_H
#define __LUNAIX_IO_H
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
static inline uint8_t
io_inb(int port)
static inline uint8_t
io_inb(int port)
@@
-41,10
+41,10
@@
io_insw(int port, void* addr, int cnt)
: "memory", "cc");
}
: "memory", "cc");
}
-static inline u
int
32_t
+static inline u32_t
io_inl(int port)
{
io_inl(int port)
{
- u
int
32_t data;
+ u32_t data;
asm volatile("inl %w1,%0" : "=a"(data) : "d"(port));
return data;
}
asm volatile("inl %w1,%0" : "=a"(data) : "d"(port));
return data;
}
@@
-106,19
+106,18
@@
io_outsl(int port, const void* addr, int cnt)
}
static inline void
}
static inline void
-io_outl(int port, u
int
32_t data)
+io_outl(int port, u32_t data)
{
asm volatile("outl %0,%w1" : : "a"(data), "d"(port));
}
static inline void
io_delay(int counter)
{
{
asm volatile("outl %0,%w1" : : "a"(data), "d"(port));
}
static inline void
io_delay(int counter)
{
- asm volatile (
- " test %0, %0\n"
- " jz 1f\n"
- "2: dec %0\n"
- " jnz 2b\n"
- "1: dec %0"::"a"(counter));
+ asm volatile(" test %0, %0\n"
+ " jz 1f\n"
+ "2: dec %0\n"
+ " jnz 2b\n"
+ "1: dec %0" ::"a"(counter));
}
#endif /* __LUNAIX_IO_H */
}
#endif /* __LUNAIX_IO_H */
diff --git
a/lunaix-os/includes/hal/ioapic.h
b/lunaix-os/includes/hal/ioapic.h
index 76e515269d691c9b3c7403863a1365b5952da7d5..ec749ef3befd357868d2ebb9d72be896cd69524f 100644
(file)
--- a/
lunaix-os/includes/hal/ioapic.h
+++ b/
lunaix-os/includes/hal/ioapic.h
@@
-26,12
+26,12
@@
void
ioapic_init();
void
ioapic_init();
void
-ioapic_write(uint8_t sel, u
int
32_t val);
+ioapic_write(uint8_t sel, u32_t val);
-u
int
32_t
+u32_t
ioapic_read(uint8_t sel);
void
ioapic_read(uint8_t sel);
void
-ioapic_redirect(uint8_t irq, uint8_t vector, uint8_t dest, u
int
32_t flags);
+ioapic_redirect(uint8_t irq, uint8_t vector, uint8_t dest, u32_t flags);
#endif /* __LUNAIX_IOAPIC_H */
#endif /* __LUNAIX_IOAPIC_H */
diff --git
a/lunaix-os/includes/hal/pci.h
b/lunaix-os/includes/hal/pci.h
index 21952f2c6a828e22bb2f3e5ac819eafeb4f163a7..56ca3df8810bbdd37425dcf92cdda46167c1099b 100644
(file)
--- a/
lunaix-os/includes/hal/pci.h
+++ b/
lunaix-os/includes/hal/pci.h
@@
-65,18
+65,18
@@
struct pci_driver;
struct pci_base_addr
{
struct pci_base_addr
{
- u
int
32_t start;
- u
int
32_t size;
- u
int
32_t type;
+ u32_t start;
+ u32_t size;
+ u32_t type;
};
struct pci_device
{
struct llist_header dev_chain;
};
struct pci_device
{
struct llist_header dev_chain;
- u
int
32_t device_info;
- u
int
32_t class_info;
- u
int
32_t cspace_base;
- u
int
32_t msi_loc;
+ u32_t device_info;
+ u32_t class_info;
+ u32_t cspace_base;
+ u32_t msi_loc;
uint16_t intr_info;
struct
{
uint16_t intr_info;
struct
{
@@
-101,14
+101,14
@@
struct pci_driver
// Refer to "PCI Local Bus Specification, Rev.3, Section 3.2.2.3.2"
static inline pci_reg_t
// Refer to "PCI Local Bus Specification, Rev.3, Section 3.2.2.3.2"
static inline pci_reg_t
-pci_read_cspace(u
int
32_t base, int offset)
+pci_read_cspace(u32_t base, int offset)
{
io_outl(PCI_CONFIG_ADDR, base | (offset & ~0x3));
return io_inl(PCI_CONFIG_DATA);
}
static inline void
{
io_outl(PCI_CONFIG_ADDR, base | (offset & ~0x3));
return io_inl(PCI_CONFIG_DATA);
}
static inline void
-pci_write_cspace(u
int
32_t base, int offset, pci_reg_t data)
+pci_write_cspace(u32_t base, int offset, pci_reg_t data)
{
io_outl(PCI_CONFIG_ADDR, base | (offset & ~0x3));
io_outl(PCI_CONFIG_DATA, data);
{
io_outl(PCI_CONFIG_ADDR, base | (offset & ~0x3));
io_outl(PCI_CONFIG_DATA, data);
@@
-128,7
+128,7
@@
pci_init();
*
* @return struct pci_device*
*/
*
* @return struct pci_device*
*/
-struct pci_device* pci_get_device_by_class(u
int
32_t class);
+struct pci_device* pci_get_device_by_class(u32_t class);
/**
* @brief 根据设备商ID和设备ID,在拓扑中寻找一个设备
/**
* @brief 根据设备商ID和设备ID,在拓扑中寻找一个设备
@@
-151,7
+151,7
@@
pci_get_device_by_id(uint16_t vendorId, uint16_t deviceId);
* @return size_t
*/
size_t
* @return size_t
*/
size_t
-pci_bar_sizing(struct pci_device* dev, u
int32_t* bar_out, uint
32_t bar_num);
+pci_bar_sizing(struct pci_device* dev, u
32_t* bar_out, u
32_t bar_num);
/**
* @brief 配置并启用设备MSI支持。
/**
* @brief 配置并启用设备MSI支持。
diff --git
a/lunaix-os/includes/lib/hash.h
b/lunaix-os/includes/lib/hash.h
index f98fe28e24200d07e6792749d8ae1ca6f844527d..69df34b8a1233c053b0819db6b3789734e5c8753 100644
(file)
--- a/
lunaix-os/includes/lib/hash.h
+++ b/
lunaix-os/includes/lib/hash.h
@@
-1,12
+1,12
@@
#ifndef __LUNAIX_HASH_H
#define __LUNAIX_HASH_H
#ifndef __LUNAIX_HASH_H
#define __LUNAIX_HASH_H
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
#define HASH_SIZE_BITS 32
#define HASH_SIZE_BITS 32
-u
int
32_t
-strhash_32(const char* str, u
int
32_t truncate_to);
+u32_t
+strhash_32(const char* str, u32_t truncate_to);
/**
* @brief Simple generic hash function
/**
* @brief Simple generic hash function
@@
-15,10
+15,10
@@
strhash_32(const char* str, uint32_t truncate_to);
* https://elixir.bootlin.com/linux/v5.18.12/source/include/linux/hash.h#L60
*
* @param val
* https://elixir.bootlin.com/linux/v5.18.12/source/include/linux/hash.h#L60
*
* @param val
- * @return u
int
32_t
+ * @return u32_t
*/
*/
-inline u
int
32_t
-hash_32(const u
int32_t val, uint
32_t truncate_to)
+inline u32_t
+hash_32(const u
32_t val, u
32_t truncate_to)
{
return (val * 0x61C88647u) >> (HASH_SIZE_BITS - truncate_to);
}
{
return (val * 0x61C88647u) >> (HASH_SIZE_BITS - truncate_to);
}
diff --git
a/lunaix-os/includes/lunaix/block.h
b/lunaix-os/includes/lunaix/block.h
index c574dd346d32e9d789b3f29680530e1af3e39047..0ddd00058cb585a22fdf6b17095d26582c85b00c 100644
(file)
--- a/
lunaix-os/includes/lunaix/block.h
+++ b/
lunaix-os/includes/lunaix/block.h
@@
-44,7
+44,7
@@
struct lpt_header
} __attribute__((packed));
typedef u64_t partition_t;
} __attribute__((packed));
typedef u64_t partition_t;
-typedef u
int
32_t bdev_t;
+typedef u32_t bdev_t;
typedef void (*devfs_exporter)(struct block_dev* bdev, void* fsnode);
void
typedef void (*devfs_exporter)(struct block_dev* bdev, void* fsnode);
void
diff --git
a/lunaix-os/includes/lunaix/clock.h
b/lunaix-os/includes/lunaix/clock.h
index 8c9ab15a5eecdcbd28fd01ce3ed2c6428fb8dae5..889490e9af0fb54d14fa5668ca3f422c549931a4 100644
(file)
--- a/
lunaix-os/includes/lunaix/clock.h
+++ b/
lunaix-os/includes/lunaix/clock.h
@@
-3,11
+3,11
@@
#include <lunaix/types.h>
#include <lunaix/types.h>
-typedef u
int
32_t time_t;
+typedef u32_t time_t;
typedef struct
{
typedef struct
{
- u
int
32_t year; // use int32 as we need to store the 4-digit year
+ u32_t year; // use int32 as we need to store the 4-digit year
uint8_t month;
uint8_t day;
uint8_t weekday;
uint8_t month;
uint8_t day;
uint8_t weekday;
diff --git
a/lunaix-os/includes/lunaix/device.h
b/lunaix-os/includes/lunaix/device.h
index fd234f0d91a8880bdba11d2c0d582b1bef21b69a..1c2445b04f84930b86f699d34daab3d3964670d0 100644
(file)
--- a/
lunaix-os/includes/lunaix/device.h
+++ b/
lunaix-os/includes/lunaix/device.h
@@
-19,7
+19,7
@@
typedef unsigned int dev_t;
struct device
{
struct device
{
- u
int
32_t magic;
+ u32_t magic;
struct llist_header siblings;
struct llist_header children;
struct device* parent;
struct llist_header siblings;
struct llist_header children;
struct device* parent;
@@
-32,14
+32,14
@@
struct device
int (*write)(struct device* dev, void* buf, size_t offset, size_t len);
int (*read_page)(struct device* dev, void* buf, size_t offset);
int (*write_page)(struct device* dev, void* buf, size_t offset);
int (*write)(struct device* dev, void* buf, size_t offset, size_t len);
int (*read_page)(struct device* dev, void* buf, size_t offset);
int (*write_page)(struct device* dev, void* buf, size_t offset);
- int (*exec_cmd)(struct device* dev, u
int
32_t req, va_list args);
+ int (*exec_cmd)(struct device* dev, u32_t req, va_list args);
};
struct device*
device_add(struct device* parent,
void* underlay,
char* name_fmt,
};
struct device*
device_add(struct device* parent,
void* underlay,
char* name_fmt,
- u
int
32_t type,
+ u32_t type,
va_list args);
struct device*
va_list args);
struct device*
diff --git
a/lunaix-os/includes/lunaix/ds/btrie.h
b/lunaix-os/includes/lunaix/ds/btrie.h
index ad3d04c3917eae9da7c1891ee55417aec2cffa91..c902c4858d016c4e1fe4abee1967de40b4508b8d 100644
(file)
--- a/
lunaix-os/includes/lunaix/ds/btrie.h
+++ b/
lunaix-os/includes/lunaix/ds/btrie.h
@@
-18,21
+18,21
@@
struct btrie_node
struct llist_header siblings;
struct llist_header nodes;
struct btrie_node* parent;
struct llist_header siblings;
struct llist_header nodes;
struct btrie_node* parent;
- u
int
32_t index;
+ u32_t index;
void* data;
};
void
void* data;
};
void
-btrie_init(struct btrie* btrie, u
int
32_t trunc_bits);
+btrie_init(struct btrie* btrie, u32_t trunc_bits);
void*
void*
-btrie_get(struct btrie* root, u
int
32_t index);
+btrie_get(struct btrie* root, u32_t index);
void
void
-btrie_set(struct btrie* root, u
int
32_t index, void* data);
+btrie_set(struct btrie* root, u32_t index, void* data);
void*
void*
-btrie_remove(struct btrie* root, u
int
32_t index);
+btrie_remove(struct btrie* root, u32_t index);
void
btrie_release(struct btrie* tree);
void
btrie_release(struct btrie* tree);
diff --git
a/lunaix-os/includes/lunaix/ds/hstr.h
b/lunaix-os/includes/lunaix/ds/hstr.h
index 5dab1cbbeb559a9ebb8a6c484e1322ade1a4ded6..d954103ce44f797024133d41f2189e37c97bc4ca 100644
(file)
--- a/
lunaix-os/includes/lunaix/ds/hstr.h
+++ b/
lunaix-os/includes/lunaix/ds/hstr.h
@@
-7,8
+7,8
@@
struct hstr
{
struct hstr
{
- u
int
32_t hash;
- u
int
32_t len;
+ u32_t hash;
+ u32_t len;
const char* value;
};
const char* value;
};
@@
-27,7
+27,7
@@
struct hstr
#define HSTR_EQ(str1, str2) ((str1)->hash == (str2)->hash)
inline void
#define HSTR_EQ(str1, str2) ((str1)->hash == (str2)->hash)
inline void
-hstr_rehash(struct hstr* hash_str, u
int
32_t truncate_to)
+hstr_rehash(struct hstr* hash_str, u32_t truncate_to)
{
hash_str->hash = strhash_32(hash_str->value, truncate_to);
}
{
hash_str->hash = strhash_32(hash_str->value, truncate_to);
}
diff --git
a/lunaix-os/includes/lunaix/ds/lru.h
b/lunaix-os/includes/lunaix/ds/lru.h
index 63660c22e72a3aaa9f17c59d03d7273da0dfbdfa..76c959749c69b7675daeebd5c792db8752001084 100644
(file)
--- a/
lunaix-os/includes/lunaix/ds/lru.h
+++ b/
lunaix-os/includes/lunaix/ds/lru.h
@@
-15,7
+15,7
@@
struct lru_zone
{
struct llist_header lead_node;
struct llist_header zones;
{
struct llist_header lead_node;
struct llist_header zones;
- u
int
32_t objects;
+ u32_t objects;
evict_cb try_evict;
};
evict_cb try_evict;
};
diff --git
a/lunaix-os/includes/lunaix/fs.h
b/lunaix-os/includes/lunaix/fs.h
index 075cc017fe33966b0e5b704d4e8b0116f761fd91..8e6961d6adc7d43ba2d6db97a72211c434a9690b 100644
(file)
--- a/
lunaix-os/includes/lunaix/fs.h
+++ b/
lunaix-os/includes/lunaix/fs.h
@@
-60,7
+60,7
@@
lru_use_one(dnode_lru, &dnode->lru); \
})
lru_use_one(dnode_lru, &dnode->lru); \
})
-typedef u
int
32_t inode_t;
+typedef u32_t inode_t;
struct v_dnode;
struct v_inode;
struct v_dnode;
struct v_inode;
@@
-83,7
+83,7
@@
struct filesystem
{
struct hlist_node fs_list;
struct hstr fs_name;
{
struct hlist_node fs_list;
struct hstr fs_name;
- u
int
32_t types;
+ u32_t types;
int fs_id;
int (*mount)(struct v_superblock* vsb, struct v_dnode* mount_point);
int (*unmount)(struct v_superblock* vsb);
int fs_id;
int (*mount)(struct v_superblock* vsb, struct v_dnode* mount_point);
int (*unmount)(struct v_superblock* vsb);
@@
-95,13
+95,13
@@
struct v_superblock
struct device* dev;
struct v_dnode* root;
struct filesystem* fs;
struct device* dev;
struct v_dnode* root;
struct filesystem* fs;
- u
int
32_t iobuf_size;
+ u32_t iobuf_size;
struct hbucket* i_cache;
void* data;
struct
{
struct hbucket* i_cache;
void* data;
struct
{
- u
int
32_t (*read_capacity)(struct v_superblock* vsb);
- u
int
32_t (*read_usage)(struct v_superblock* vsb);
+ u32_t (*read_capacity)(struct v_superblock* vsb);
+ u32_t (*read_usage)(struct v_superblock* vsb);
void (*init_inode)(struct v_superblock* vsb, struct v_inode* inode);
} ops;
};
void (*init_inode)(struct v_superblock* vsb, struct v_inode* inode);
} ops;
};
@@
-172,7
+172,7
@@
struct v_file
struct v_inode* inode;
struct v_dnode* dnode;
struct llist_header* f_list;
struct v_inode* inode;
struct v_dnode* dnode;
struct llist_header* f_list;
- u
int
32_t f_pos;
+ u32_t f_pos;
atomic_ulong ref_count;
struct v_file_ops* ops; // for caching
};
atomic_ulong ref_count;
struct v_file_ops* ops; // for caching
};
@@
-200,15
+200,15
@@
struct v_inode
{
inode_t id;
mutex_t lock;
{
inode_t id;
mutex_t lock;
- u
int
32_t itype;
+ u32_t itype;
time_t ctime;
time_t mtime;
time_t atime;
lba_t lb_addr;
time_t ctime;
time_t mtime;
time_t atime;
lba_t lb_addr;
- u
int
32_t open_count;
- u
int
32_t link_count;
- u
int
32_t lb_usage;
- u
int
32_t fsize;
+ u32_t open_count;
+ u32_t link_count;
+ u32_t lb_usage;
+ u32_t fsize;
void* data; // 允许底层FS绑定他的一些专有数据
struct llist_header aka_dnodes;
struct llist_header xattrs;
void* data; // 允许底层FS绑定他的一些专有数据
struct llist_header aka_dnodes;
struct llist_header xattrs;
@@
-229,7
+229,7
@@
struct v_mount
struct v_mount* parent;
struct v_dnode* mnt_point;
struct v_superblock* super_block;
struct v_mount* parent;
struct v_dnode* mnt_point;
struct v_superblock* super_block;
- u
int
32_t busy_counter;
+ u32_t busy_counter;
int flags;
};
int flags;
};
@@
-262,8
+262,8
@@
struct pcache
struct btrie tree;
struct llist_header pages;
struct llist_header dirty;
struct btrie tree;
struct llist_header pages;
struct llist_header dirty;
- u
int
32_t n_dirty;
- u
int
32_t n_pages;
+ u32_t n_dirty;
+ u32_t n_pages;
};
struct pcache_pg
};
struct pcache_pg
@@
-273,9
+273,9
@@
struct pcache_pg
struct lru_node lru;
struct pcache* holder;
void* pg;
struct lru_node lru;
struct pcache* holder;
void* pg;
- u
int
32_t flags;
- u
int
32_t fpos;
- u
int
32_t len;
+ u32_t flags;
+ u32_t fpos;
+ u32_t len;
};
void
};
void
@@
-376,7
+376,7
@@
void
vfs_d_free(struct v_dnode* dnode);
struct v_inode*
vfs_d_free(struct v_dnode* dnode);
struct v_inode*
-vfs_i_find(struct v_superblock* sb, u
int
32_t i_id);
+vfs_i_find(struct v_superblock* sb, u32_t i_id);
void
vfs_i_addhash(struct v_inode* inode);
void
vfs_i_addhash(struct v_inode* inode);
@@
-412,22
+412,22
@@
void
pcache_release_page(struct pcache* pcache, struct pcache_pg* page);
struct pcache_pg*
pcache_release_page(struct pcache* pcache, struct pcache_pg* page);
struct pcache_pg*
-pcache_new_page(struct pcache* pcache, u
int
32_t index);
+pcache_new_page(struct pcache* pcache, u32_t index);
void
pcache_set_dirty(struct pcache* pcache, struct pcache_pg* pg);
int
pcache_get_page(struct pcache* pcache,
void
pcache_set_dirty(struct pcache* pcache, struct pcache_pg* pg);
int
pcache_get_page(struct pcache* pcache,
- u
int
32_t index,
- u
int
32_t* offset,
+ u32_t index,
+ u32_t* offset,
struct pcache_pg** page);
int
struct pcache_pg** page);
int
-pcache_write(struct v_inode* inode, void* data, u
int32_t len, uint
32_t fpos);
+pcache_write(struct v_inode* inode, void* data, u
32_t len, u
32_t fpos);
int
int
-pcache_read(struct v_inode* inode, void* data, u
int32_t len, uint
32_t fpos);
+pcache_read(struct v_inode* inode, void* data, u
32_t len, u
32_t fpos);
void
pcache_release(struct pcache* pcache);
void
pcache_release(struct pcache* pcache);
diff --git
a/lunaix-os/includes/lunaix/fs/twifs.h
b/lunaix-os/includes/lunaix/fs/twifs.h
index a8117ef7cddb61ff4c67b59598c45365ef128691..2ee5390b65cfe240e787fcfc53d22dbee5714797 100644
(file)
--- a/
lunaix-os/includes/lunaix/fs/twifs.h
+++ b/
lunaix-os/includes/lunaix/fs/twifs.h
@@
-10,7
+10,7
@@
struct twifs_node
struct hstr name;
inode_t ino_id;
void* data;
struct hstr name;
inode_t ino_id;
void* data;
- u
int
32_t itype;
+ u32_t itype;
char name_val[VFS_NAME_MAXLEN];
struct llist_header children;
struct llist_header siblings;
char name_val[VFS_NAME_MAXLEN];
struct llist_header children;
struct llist_header siblings;
diff --git
a/lunaix-os/includes/lunaix/input.h
b/lunaix-os/includes/lunaix/input.h
index 872ea04a6ea8e17386581805da3b8e2eade63cb8..76eee9ed33a804690e8338c9f282c88194e6a1dc 100644
(file)
--- a/
lunaix-os/includes/lunaix/input.h
+++ b/
lunaix-os/includes/lunaix/input.h
@@
-21,10
+21,10
@@
struct input_evt_pkt
{
struct input_evt_pkt
{
- u
int32_t pkt_type;
// packet type
- u
int32_t scan_code;
// hardware raw code
- u
int32_t sys_code;
// driver translated code
- time_t timestamp;
// event timestamp
+ u
32_t pkt_type;
// packet type
+ u
32_t scan_code;
// hardware raw code
+ u
32_t sys_code;
// driver translated code
+ time_t timestamp; // event timestamp
};
struct input_device
};
struct input_device
diff --git
a/lunaix-os/includes/lunaix/mm/dmm.h
b/lunaix-os/includes/lunaix/mm/dmm.h
index 0a79cdc07ba75d7a5c4a25c5972905a84481ad6e..346c4794d9ecad2edba4358245d5e9f34cd83bec 100644
(file)
--- a/
lunaix-os/includes/lunaix/mm/dmm.h
+++ b/
lunaix-os/includes/lunaix/mm/dmm.h
@@
-18,12
+18,12
@@
#define PACK(size, flags) (((size) & ~0x3) | (flags))
#define PACK(size, flags) (((size) & ~0x3) | (flags))
-#define SW(p, w) (*((u
int
32_t*)(p)) = w)
-#define LW(p) (*((u
int
32_t*)(p)))
+#define SW(p, w) (*((u32_t*)(p)) = w)
+#define LW(p) (*((u32_t*)(p)))
-#define HPTR(bp) ((u
int
32_t*)(bp)-1)
+#define HPTR(bp) ((u32_t*)(bp)-1)
#define BPTR(bp) ((uint8_t*)(bp) + WSIZE)
#define BPTR(bp) ((uint8_t*)(bp) + WSIZE)
-#define FPTR(hp, size) ((u
int
32_t*)(hp + size - WSIZE))
+#define FPTR(hp, size) ((u32_t*)(hp + size - WSIZE))
#define NEXT_CHK(hp) ((uint8_t*)(hp) + CHUNK_S(LW(hp)))
#define BOUNDARY 4
#define NEXT_CHK(hp) ((uint8_t*)(hp) + CHUNK_S(LW(hp)))
#define BOUNDARY 4
diff --git
a/lunaix-os/includes/lunaix/mm/mmio.h
b/lunaix-os/includes/lunaix/mm/mmio.h
index c3f0d66fa7c3517d6fe45143c74d7d5182103557..710d4a4f08c4458bc781b4dbbf5996ee0e666390 100644
(file)
--- a/
lunaix-os/includes/lunaix/mm/mmio.h
+++ b/
lunaix-os/includes/lunaix/mm/mmio.h
@@
-1,12
+1,12
@@
#ifndef __LUNAIX_MMIO_H
#define __LUNAIX_MMIO_H
#ifndef __LUNAIX_MMIO_H
#define __LUNAIX_MMIO_H
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
void*
void*
-ioremap(uintptr_t paddr, u
int
32_t size);
+ioremap(uintptr_t paddr, u32_t size);
void*
void*
-iounmap(uintptr_t vaddr, u
int
32_t size);
+iounmap(uintptr_t vaddr, u32_t size);
#endif /* __LUNAIX_MMIO_H */
#endif /* __LUNAIX_MMIO_H */
diff --git
a/lunaix-os/includes/lunaix/mm/page.h
b/lunaix-os/includes/lunaix/mm/page.h
index 781a4cee34468291985fbf49cb0f1e876822b33f..f2c45de00bcfd0e81b365759cf5c5e818a81b14a 100644
(file)
--- a/
lunaix-os/includes/lunaix/mm/page.h
+++ b/
lunaix-os/includes/lunaix/mm/page.h
@@
-1,7
+1,7
@@
#ifndef __LUNAIX_PAGE_H
#define __LUNAIX_PAGE_H
#include <lunaix/common.h>
#ifndef __LUNAIX_PAGE_H
#define __LUNAIX_PAGE_H
#include <lunaix/common.h>
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
#define PG_MAX_ENTRIES 1024U
#define PG_LAST_TABLE PG_MAX_ENTRIES - 1
#define PG_MAX_ENTRIES 1024U
#define PG_LAST_TABLE PG_MAX_ENTRIES - 1
@@
-14,9
+14,9
@@
#define PG_ALIGN(addr) ((uintptr_t)(addr)&0xFFFFF000UL)
#define PG_ALIGN(addr) ((uintptr_t)(addr)&0xFFFFF000UL)
-#define L1_INDEX(vaddr) (u
int
32_t)(((uintptr_t)(vaddr)&0xFFC00000UL) >> 22)
-#define L2_INDEX(vaddr) (u
int
32_t)(((uintptr_t)(vaddr)&0x003FF000UL) >> 12)
-#define PG_OFFSET(vaddr) (u
int
32_t)((uintptr_t)(vaddr)&0x00000FFFUL)
+#define L1_INDEX(vaddr) (u32_t)(((uintptr_t)(vaddr)&0xFFC00000UL) >> 22)
+#define L2_INDEX(vaddr) (u32_t)(((uintptr_t)(vaddr)&0x003FF000UL) >> 12)
+#define PG_OFFSET(vaddr) (u32_t)((uintptr_t)(vaddr)&0x00000FFFUL)
#define GET_PT_ADDR(pde) PG_ALIGN(pde)
#define GET_PG_ADDR(pte) PG_ALIGN(pte)
#define GET_PT_ADDR(pde) PG_ALIGN(pde)
#define GET_PG_ADDR(pte) PG_ALIGN(pte)
@@
-66,7
+66,7
@@
typedef unsigned long ptd_t;
typedef unsigned long pt_t;
typedef unsigned int pt_attr;
typedef unsigned long ptd_t;
typedef unsigned long pt_t;
typedef unsigned int pt_attr;
-typedef u
int
32_t x86_pte_t;
+typedef u32_t x86_pte_t;
/**
* @brief 虚拟映射属性
/**
* @brief 虚拟映射属性
@@
-77,7
+77,7
@@
typedef struct
// 虚拟页地址
uintptr_t va;
// 物理页码(如果不存在映射,则为0)
// 虚拟页地址
uintptr_t va;
// 物理页码(如果不存在映射,则为0)
- u
int
32_t pn;
+ u32_t pn;
// 物理页地址(如果不存在映射,则为0)
uintptr_t pa;
// 映射的flags
// 物理页地址(如果不存在映射,则为0)
uintptr_t pa;
// 映射的flags
diff --git
a/lunaix-os/includes/lunaix/mm/pmm.h
b/lunaix-os/includes/lunaix/mm/pmm.h
index 44aa99d7b0f2e8120b970ecc1343aedd45031320..54365605a3d6cea18aed6f0c97793258e0fe9e90 100644
(file)
--- a/
lunaix-os/includes/lunaix/mm/pmm.h
+++ b/
lunaix-os/includes/lunaix/mm/pmm.h
@@
-21,12
+21,12
@@
*/
#define PP_FGLOCKED 0x2
*/
#define PP_FGLOCKED 0x2
-typedef u
int
32_t pp_attr_t;
+typedef u32_t pp_attr_t;
struct pp_struct
{
pid_t owner;
struct pp_struct
{
pid_t owner;
- u
int
32_t ref_counts;
+ u32_t ref_counts;
pp_attr_t attr;
};
pp_attr_t attr;
};
@@
-63,7
+63,7
@@
pmm_mark_chunk_free(uintptr_t start_ppn, size_t page_count);
*/
void
pmm_mark_chunk_occupied(pid_t owner,
*/
void
pmm_mark_chunk_occupied(pid_t owner,
- u
intptr
_t start_ppn,
+ u
32
_t start_ppn,
size_t page_count,
pp_attr_t attr);
size_t page_count,
pp_attr_t attr);
diff --git
a/lunaix-os/includes/lunaix/timer.h
b/lunaix-os/includes/lunaix/timer.h
index b499f3fb70402dcd75af5e419a2897b440f885f9..cdf9ef477846bb31541e897c79eb6cfa3d57261d 100644
(file)
--- a/
lunaix-os/includes/lunaix/timer.h
+++ b/
lunaix-os/includes/lunaix/timer.h
@@
-8,7
+8,7
@@
#define TIMER_MODE_PERIODIC 0x1
#define TIMER_MODE_PERIODIC 0x1
-typedef u
int
32_t ticks_t;
+typedef u32_t ticks_t;
struct lx_timer_context
{
struct lx_timer_context
{
@@
-22,7
+22,7
@@
struct lx_timer_context
* @brief Desired system running frequency
*
*/
* @brief Desired system running frequency
*
*/
- u
int
32_t running_frequency;
+ u32_t running_frequency;
/**
* @brief Ticks per hertz
*
/**
* @brief Ticks per hertz
*
@@
-46,16
+46,16
@@
struct lx_timer
* @param frequency The frequency that timer should run in Hz.
*/
void
* @param frequency The frequency that timer should run in Hz.
*/
void
-timer_init(u
int
32_t frequency);
+timer_init(u32_t frequency);
struct lx_timer*
struct lx_timer*
-timer_run_second(u
int
32_t second,
+timer_run_second(u32_t second,
void (*callback)(void*),
void* payload,
uint8_t flags);
struct lx_timer*
void (*callback)(void*),
void* payload,
uint8_t flags);
struct lx_timer*
-timer_run_ms(u
int
32_t millisecond,
+timer_run_ms(u32_t millisecond,
void (*callback)(void*),
void* payload,
uint8_t flags);
void (*callback)(void*),
void* payload,
uint8_t flags);
diff --git
a/lunaix-os/kernel/asm/x86/gdt.c
b/lunaix-os/kernel/asm/x86/gdt.c
index 1bd1c0028a77679cbfe7a439584c3b83d7682659..4c4dd54b330c61355260514cd42e445f3a367c33 100644
(file)
--- a/
lunaix-os/kernel/asm/x86/gdt.c
+++ b/
lunaix-os/kernel/asm/x86/gdt.c
@@
-1,14
+1,17
@@
#include <arch/x86/gdt.h>
#include <arch/x86/tss.h>
#include <arch/x86/gdt.h>
#include <arch/x86/tss.h>
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
#define GDT_ENTRY 6
uint64_t _gdt[GDT_ENTRY];
uint16_t _gdt_limit = sizeof(_gdt) - 1;
#define GDT_ENTRY 6
uint64_t _gdt[GDT_ENTRY];
uint16_t _gdt_limit = sizeof(_gdt) - 1;
-void _set_gdt_entry(uint32_t index, uint32_t base, uint32_t limit, uint32_t flags) {
- _gdt[index] = SEG_BASE_H(base) | flags | SEG_LIM_H(limit) | SEG_BASE_M(base);
+void
+_set_gdt_entry(u32_t index, u32_t base, u32_t limit, u32_t flags)
+{
+ _gdt[index] =
+ SEG_BASE_H(base) | flags | SEG_LIM_H(limit) | SEG_BASE_M(base);
_gdt[index] <<= 32;
_gdt[index] |= SEG_BASE_L(base) | SEG_LIM_L(limit);
}
_gdt[index] <<= 32;
_gdt[index] |= SEG_BASE_L(base) | SEG_LIM_L(limit);
}
@@
-16,7
+19,8
@@
void _set_gdt_entry(uint32_t index, uint32_t base, uint32_t limit, uint32_t flag
extern struct x86_tss _tss;
void
extern struct x86_tss _tss;
void
-_init_gdt() {
+_init_gdt()
+{
_set_gdt_entry(0, 0, 0, 0);
_set_gdt_entry(1, 0, 0xfffff, SEG_R0_CODE);
_set_gdt_entry(2, 0, 0xfffff, SEG_R0_DATA);
_set_gdt_entry(0, 0, 0, 0);
_set_gdt_entry(1, 0, 0xfffff, SEG_R0_CODE);
_set_gdt_entry(2, 0, 0xfffff, SEG_R0_DATA);
diff --git
a/lunaix-os/kernel/asm/x86/intr_routines.c
b/lunaix-os/kernel/asm/x86/intr_routines.c
index 285356f8aa9753aa84daaf258bffb53acf9c972f..97903cffebfdc5c1e3e145485e71825605527e90 100644
(file)
--- a/
lunaix-os/kernel/asm/x86/intr_routines.c
+++ b/
lunaix-os/kernel/asm/x86/intr_routines.c
@@
-17,7
+17,7
@@
LOG_MODULE("INTR")
extern void
intr_routine_page_fault(const isr_param* param);
extern void
intr_routine_page_fault(const isr_param* param);
-extern u
int
32_t debug_resv;
+extern u32_t debug_resv;
void
__print_panic_msg(const char* msg, const isr_param* param)
void
__print_panic_msg(const char* msg, const isr_param* param)
@@
-79,7
+79,7
@@
intr_routine_apic_spi(const isr_param* param)
void
intr_routine_apic_error(const isr_param* param)
{
void
intr_routine_apic_error(const isr_param* param)
{
- u
int
32_t error_reg = apic_read_reg(APIC_ESR);
+ u32_t error_reg = apic_read_reg(APIC_ESR);
char buf[32];
ksprintf(buf, "APIC error, ESR=0x%x", error_reg);
console_flush();
char buf[32];
ksprintf(buf, "APIC error, ESR=0x%x", error_reg);
console_flush();
diff --git
a/lunaix-os/kernel/asm/x86/intrhnds.c
b/lunaix-os/kernel/asm/x86/intrhnds.c
index 8aa0a72a343de67a06ef9352647f50eed418b54f..1ae386069a6b5ce48d5b2c09d4aaa95be9c107c1 100644
(file)
--- a/
lunaix-os/kernel/asm/x86/intrhnds.c
+++ b/
lunaix-os/kernel/asm/x86/intrhnds.c
@@
-1,14
+1,14
@@
#include <arch/x86/idt.h>
#include <arch/x86/idt.h>
-#include <stdint.h>
#include <arch/x86/intrhnds.h>
#include <arch/x86/intrhnds.h>
+#include <lunaix/types.h>
#define IDT_ENTRY 256
uint64_t _idt[IDT_ENTRY];
uint16_t _idt_limit = sizeof(_idt) - 1;
static inline void
#define IDT_ENTRY 256
uint64_t _idt[IDT_ENTRY];
uint16_t _idt_limit = sizeof(_idt) - 1;
static inline void
-_set_idt_entry(u
int
32_t vector,
+_set_idt_entry(u32_t vector,
uint16_t seg_selector,
void (*isr)(),
uint8_t dpl,
uint16_t seg_selector,
void (*isr)(),
uint8_t dpl,
@@
-20,7
+20,9
@@
_set_idt_entry(uint32_t vector,
_idt[vector] |= (seg_selector << 16) | (offset & 0x0000ffff);
}
_idt[vector] |= (seg_selector << 16) | (offset & 0x0000ffff);
}
-void _init_idt() {
+void
+_init_idt()
+{
_set_idt_entry(0, 8, _asm_isr0, 0, IDT_INTERRUPT);
_set_idt_entry(1, 8, _asm_isr1, 0, IDT_INTERRUPT);
_set_idt_entry(2, 8, _asm_isr2, 0, IDT_INTERRUPT);
_set_idt_entry(0, 8, _asm_isr0, 0, IDT_INTERRUPT);
_set_idt_entry(1, 8, _asm_isr1, 0, IDT_INTERRUPT);
_set_idt_entry(2, 8, _asm_isr2, 0, IDT_INTERRUPT);
diff --git
a/lunaix-os/kernel/asm/x86/tss.c
b/lunaix-os/kernel/asm/x86/tss.c
index c871613d6e145f57eb70b6aa889425cbc07cad6c..45c01ee21939ab76198649b667d97077583bc7d3 100644
(file)
--- a/
lunaix-os/kernel/asm/x86/tss.c
+++ b/
lunaix-os/kernel/asm/x86/tss.c
@@
-6,7
+6,7
@@
volatile struct x86_tss _tss = { .link = 0,
.ss0 = KDATA_SEG };
void
.ss0 = KDATA_SEG };
void
-tss_update_esp(u
int
32_t esp0)
+tss_update_esp(u32_t esp0)
{
_tss.esp0 = esp0;
}
\ No newline at end of file
{
_tss.esp0 = esp0;
}
\ No newline at end of file
diff --git
a/lunaix-os/kernel/device/device.c
b/lunaix-os/kernel/device/device.c
index 6b901a6593958ac2a38fd4ea35009fd62d67c141..b784fdbf4c3649bfcf49d99781dfa139da9a2846 100644
(file)
--- a/
lunaix-os/kernel/device/device.c
+++ b/
lunaix-os/kernel/device/device.c
@@
-15,7
+15,7
@@
struct device*
device_add(struct device* parent,
void* underlay,
char* name_fmt,
device_add(struct device* parent,
void* underlay,
char* name_fmt,
- u
int
32_t type,
+ u32_t type,
va_list args)
{
struct device* dev = vzalloc(sizeof(struct device));
va_list args)
{
struct device* dev = vzalloc(sizeof(struct device));
diff --git
a/lunaix-os/kernel/ds/btrie.c
b/lunaix-os/kernel/ds/btrie.c
index 8a4380e4c19da2320979f8462a71c5ee367c9b1b..5ce7687da18247862821ce0166b7d9521e3f5215 100644
(file)
--- a/
lunaix-os/kernel/ds/btrie.c
+++ b/
lunaix-os/kernel/ds/btrie.c
@@
-16,12
+16,12
@@
#define BTRIE_INSERT 1
struct btrie_node*
#define BTRIE_INSERT 1
struct btrie_node*
-__btrie_traversal(struct btrie* root, u
int
32_t index, int options)
+__btrie_traversal(struct btrie* root, u32_t index, int options)
{
index = index >> root->truncated;
{
index = index >> root->truncated;
- u
int
32_t lz = index ? ROUNDDOWN(31 - __builtin_clz(index), BTRIE_BITS) : 0;
- u
int
32_t bitmask = ((1 << BTRIE_BITS) - 1) << lz;
- u
int
32_t i = 0;
+ u32_t lz = index ? ROUNDDOWN(31 - __builtin_clz(index), BTRIE_BITS) : 0;
+ u32_t bitmask = ((1 << BTRIE_BITS) - 1) << lz;
+ u32_t i = 0;
struct btrie_node* tree = root->btrie_root;
// Time complexity: O(log_2(log_2(N))) where N is the index to lookup
struct btrie_node* tree = root->btrie_root;
// Time complexity: O(log_2(log_2(N))) where N is the index to lookup
@@
-57,7
+57,7
@@
__btrie_traversal(struct btrie* root, uint32_t index, int options)
}
void
}
void
-btrie_init(struct btrie* btrie, u
int
32_t trunc_bits)
+btrie_init(struct btrie* btrie, u32_t trunc_bits)
{
btrie->btrie_root = vzalloc(sizeof(struct btrie_node));
llist_init_head(&btrie->btrie_root->nodes);
{
btrie->btrie_root = vzalloc(sizeof(struct btrie_node));
llist_init_head(&btrie->btrie_root->nodes);
@@
-66,7
+66,7
@@
btrie_init(struct btrie* btrie, uint32_t trunc_bits)
}
void*
}
void*
-btrie_get(struct btrie* root, u
int
32_t index)
+btrie_get(struct btrie* root, u32_t index)
{
struct btrie_node* node = __btrie_traversal(root, index, 0);
if (!node) {
{
struct btrie_node* node = __btrie_traversal(root, index, 0);
if (!node) {
@@
-76,7
+76,7
@@
btrie_get(struct btrie* root, uint32_t index)
}
void
}
void
-btrie_set(struct btrie* root, u
int
32_t index, void* data)
+btrie_set(struct btrie* root, u32_t index, void* data)
{
struct btrie_node* node = __btrie_traversal(root, index, BTRIE_INSERT);
node->data = data;
{
struct btrie_node* node = __btrie_traversal(root, index, BTRIE_INSERT);
node->data = data;
@@
-98,7
+98,7
@@
__btrie_rm_recursive(struct btrie_node* node)
}
void*
}
void*
-btrie_remove(struct btrie* root, u
int
32_t index)
+btrie_remove(struct btrie* root, u32_t index)
{
struct btrie_node* node = __btrie_traversal(root, index, 0);
if (!node) {
{
struct btrie_node* node = __btrie_traversal(root, index, 0);
if (!node) {
diff --git
a/lunaix-os/kernel/fs/iso9660/mount.c
b/lunaix-os/kernel/fs/iso9660/mount.c
index 51679ca0757913cbcecd6995eb73109e67c431fc..5d7fdc957d4b842c573a3068d435ad32e76af082 100644
(file)
--- a/
lunaix-os/kernel/fs/iso9660/mount.c
+++ b/
lunaix-os/kernel/fs/iso9660/mount.c
@@
-11,7
+11,7
@@
struct cake_pile* drec_cache_pile;
extern void
iso9660_init_inode(struct v_superblock* vsb, struct v_inode* inode);
extern void
iso9660_init_inode(struct v_superblock* vsb, struct v_inode* inode);
-u
int
32_t
+u32_t
iso9660_rd_capacity(struct v_superblock* vsb)
{
struct iso_superblock* isovsb = (struct iso_superblock*)vsb->data;
iso9660_rd_capacity(struct v_superblock* vsb)
{
struct iso_superblock* isovsb = (struct iso_superblock*)vsb->data;
diff --git
a/lunaix-os/kernel/fs/pcache.c
b/lunaix-os/kernel/fs/pcache.c
index a6c4c31d34993b9ba9b8da91a195f51b886ad655..0f30891669108f1a13d9eb544ce1b4910e1b0f02 100644
(file)
--- a/
lunaix-os/kernel/fs/pcache.c
+++ b/
lunaix-os/kernel/fs/pcache.c
@@
-41,7
+41,7
@@
pcache_release_page(struct pcache* pcache, struct pcache_pg* page)
}
struct pcache_pg*
}
struct pcache_pg*
-pcache_new_page(struct pcache* pcache, u
int
32_t index)
+pcache_new_page(struct pcache* pcache, u32_t index)
{
struct pcache_pg* ppg = vzalloc(sizeof(struct pcache_pg));
void* pg = valloc(PG_SIZE);
{
struct pcache_pg* ppg = vzalloc(sizeof(struct pcache_pg));
void* pg = valloc(PG_SIZE);
@@
-78,8
+78,8
@@
pcache_set_dirty(struct pcache* pcache, struct pcache_pg* pg)
int
pcache_get_page(struct pcache* pcache,
int
pcache_get_page(struct pcache* pcache,
- u
int
32_t index,
- u
int
32_t* offset,
+ u32_t index,
+ u32_t* offset,
struct pcache_pg** page)
{
struct pcache_pg* pg = btrie_get(&pcache->tree, index);
struct pcache_pg** page)
{
struct pcache_pg* pg = btrie_get(&pcache->tree, index);
@@
-98,9
+98,9
@@
pcache_get_page(struct pcache* pcache,
}
int
}
int
-pcache_write(struct v_inode* inode, void* data, u
int32_t len, uint
32_t fpos)
+pcache_write(struct v_inode* inode, void* data, u
32_t len, u
32_t fpos)
{
{
- u
int
32_t pg_off, buf_off = 0;
+ u32_t pg_off, buf_off = 0;
struct pcache* pcache = inode->pg_cache;
struct pcache_pg* pg;
struct pcache* pcache = inode->pg_cache;
struct pcache_pg* pg;
@@
-110,7
+110,7
@@
pcache_write(struct v_inode* inode, void* data, uint32_t len, uint32_t fpos)
return ENOMEM;
}
return ENOMEM;
}
- u
int
32_t wr_bytes = MIN(PG_SIZE - pg_off, len - buf_off);
+ u32_t wr_bytes = MIN(PG_SIZE - pg_off, len - buf_off);
memcpy(pg->pg + pg_off, (data + buf_off), wr_bytes);
pcache_set_dirty(pcache, pg);
memcpy(pg->pg + pg_off, (data + buf_off), wr_bytes);
pcache_set_dirty(pcache, pg);
@@
-124,9
+124,9
@@
pcache_write(struct v_inode* inode, void* data, uint32_t len, uint32_t fpos)
}
int
}
int
-pcache_read(struct v_inode* inode, void* data, u
int32_t len, uint
32_t fpos)
+pcache_read(struct v_inode* inode, void* data, u
32_t len, u
32_t fpos)
{
{
- u
int
32_t pg_off, buf_off = 0, new_pg = 0;
+ u32_t pg_off, buf_off = 0, new_pg = 0;
int errno = 0;
struct pcache* pcache = inode->pg_cache;
struct pcache_pg* pg;
int errno = 0;
struct pcache* pcache = inode->pg_cache;
struct pcache_pg* pg;
@@
-149,7
+149,7
@@
pcache_read(struct v_inode* inode, void* data, uint32_t len, uint32_t fpos)
}
pg->len = errno;
}
}
pg->len = errno;
}
- u
int
32_t rd_bytes = MIN(pg->len - pg_off, len - buf_off);
+ u32_t rd_bytes = MIN(pg->len - pg_off, len - buf_off);
if (!rd_bytes)
break;
if (!rd_bytes)
break;
diff --git
a/lunaix-os/kernel/fs/twifs/twifs.c
b/lunaix-os/kernel/fs/twifs/twifs.c
index fcadafdef4b47d270739f2113f9d0195ef58df72..ca19c9dac145700ee82dbe9454a2a417469eb8ad 100644
(file)
--- a/
lunaix-os/kernel/fs/twifs/twifs.c
+++ b/
lunaix-os/kernel/fs/twifs/twifs.c
@@
-22,7
+22,7
@@
static struct twifs_node* fs_root;
static struct cake_pile* twi_pile;
static struct cake_pile* twi_pile;
-static volatile u
int
32_t inode_id = 0;
+static volatile u32_t inode_id = 0;
extern const struct v_file_ops twifs_file_ops;
extern const struct v_inode_ops twifs_inode_ops;
extern const struct v_file_ops twifs_file_ops;
extern const struct v_inode_ops twifs_inode_ops;
@@
-31,7
+31,7
@@
struct twifs_node*
__twifs_new_node(struct twifs_node* parent,
const char* name,
int name_len,
__twifs_new_node(struct twifs_node* parent,
const char* name,
int name_len,
- u
int
32_t itype)
+ u32_t itype)
{
struct twifs_node* node = cake_grab(twi_pile);
memset(node, 0, sizeof(*node));
{
struct twifs_node* node = cake_grab(twi_pile);
memset(node, 0, sizeof(*node));
diff --git
a/lunaix-os/kernel/fs/vfs.c
b/lunaix-os/kernel/fs/vfs.c
index f5b650653cf20e57bac2b41b95e85093b565014b..cc751b60e3537990f20c12358fd2123917dbd21b 100644
(file)
--- a/
lunaix-os/kernel/fs/vfs.c
+++ b/
lunaix-os/kernel/fs/vfs.c
@@
-109,13
+109,13
@@
vfs_init()
}
inline struct hbucket*
}
inline struct hbucket*
-__dcache_hash(struct v_dnode* parent, u
int
32_t* hash)
+__dcache_hash(struct v_dnode* parent, u32_t* hash)
{
{
- u
int
32_t _hash = *hash;
+ u32_t _hash = *hash;
// 确保低位更加随机
_hash = _hash ^ (_hash >> VFS_HASHBITS);
// 与parent的指针值做加法,来减小碰撞的可能性。
// 确保低位更加随机
_hash = _hash ^ (_hash >> VFS_HASHBITS);
// 与parent的指针值做加法,来减小碰撞的可能性。
- _hash += (u
int
32_t)parent;
+ _hash += (u32_t)parent;
*hash = _hash;
return &dnode_cache[_hash & VFS_HASH_MASK];
}
*hash = _hash;
return &dnode_cache[_hash & VFS_HASH_MASK];
}
@@
-130,7
+130,7
@@
vfs_dcache_lookup(struct v_dnode* parent, struct hstr* str)
return parent->parent;
}
return parent->parent;
}
- u
int
32_t hash = str->hash;
+ u32_t hash = str->hash;
struct hbucket* slot = __dcache_hash(parent, &hash);
struct v_dnode *pos, *n;
struct hbucket* slot = __dcache_hash(parent, &hash);
struct v_dnode *pos, *n;
@@
-439,7
+439,7
@@
vfs_d_free(struct v_dnode* dnode)
}
struct v_inode*
}
struct v_inode*
-vfs_i_find(struct v_superblock* sb, u
int
32_t i_id)
+vfs_i_find(struct v_superblock* sb, u32_t i_id)
{
struct hbucket* slot = &sb->i_cache[i_id & VFS_HASH_MASK];
struct v_inode *pos, *n;
{
struct hbucket* slot = &sb->i_cache[i_id & VFS_HASH_MASK];
struct v_inode *pos, *n;
diff --git
a/lunaix-os/kernel/mm/kalloc.c
b/lunaix-os/kernel/mm/kalloc.c
index aec1001a6cf3bde3e7974aeb109bf4ce4bfaf62e..0ce97e9a51ea47725eb6b86aa3636f5ff43f23bc 100644
(file)
--- a/
lunaix-os/kernel/mm/kalloc.c
+++ b/
lunaix-os/kernel/mm/kalloc.c
@@
-129,7
+129,7
@@
// mutex_lock(&kheap.lock);
// uint8_t* chunk_ptr = (uint8_t*)ptr - WSIZE;
// mutex_lock(&kheap.lock);
// uint8_t* chunk_ptr = (uint8_t*)ptr - WSIZE;
-// u
int
32_t hdr = LW(chunk_ptr);
+// u32_t hdr = LW(chunk_ptr);
// size_t sz = CHUNK_S(hdr);
// uint8_t* next_hdr = chunk_ptr + sz;
// size_t sz = CHUNK_S(hdr);
// uint8_t* next_hdr = chunk_ptr + sz;
@@
-165,7
+165,7
@@
// // and space for header
// size = ROUNDUP(size + WSIZE, BOUNDARY);
// while (ptr < (uint8_t*)heap->brk) {
// // and space for header
// size = ROUNDUP(size + WSIZE, BOUNDARY);
// while (ptr < (uint8_t*)heap->brk) {
-// u
int32_t header = *((uint
32_t*)ptr);
+// u
32_t header = *((u
32_t*)ptr);
// size_t chunk_size = CHUNK_S(header);
// if (!chunk_size && CHUNK_A(header)) {
// break;
// size_t chunk_size = CHUNK_S(header);
// if (!chunk_size && CHUNK_A(header)) {
// break;
@@
-192,20
+192,20
@@
// void
// place_chunk(uint8_t* ptr, size_t size)
// {
// void
// place_chunk(uint8_t* ptr, size_t size)
// {
-// u
int32_t header = *((uint
32_t*)ptr);
+// u
32_t header = *((u
32_t*)ptr);
// size_t chunk_size = CHUNK_S(header);
// size_t chunk_size = CHUNK_S(header);
-// *((u
int
32_t*)ptr) = PACK(size, CHUNK_PF(header) | M_ALLOCATED);
+// *((u32_t*)ptr) = PACK(size, CHUNK_PF(header) | M_ALLOCATED);
// uint8_t* n_hdrptr = (uint8_t*)(ptr + size);
// uint8_t* n_hdrptr = (uint8_t*)(ptr + size);
-// u
int
32_t diff = chunk_size - size;
+// u32_t diff = chunk_size - size;
// if (!diff) {
// // if the current free block is fully occupied
// if (!diff) {
// // if the current free block is fully occupied
-// u
int
32_t n_hdr = LW(n_hdrptr);
+// u32_t n_hdr = LW(n_hdrptr);
// // notify the next block about our avaliability
// SW(n_hdrptr, n_hdr & ~0x2);
// } else {
// // if there is remaining free space left
// // notify the next block about our avaliability
// SW(n_hdrptr, n_hdr & ~0x2);
// } else {
// // if there is remaining free space left
-// u
int
32_t remainder_hdr = PACK(diff, M_NOT_ALLOCATED |
+// u32_t remainder_hdr = PACK(diff, M_NOT_ALLOCATED |
// M_PREV_ALLOCATED); SW(n_hdrptr, remainder_hdr); SW(FPTR(n_hdrptr,
// diff), remainder_hdr);
// M_PREV_ALLOCATED); SW(n_hdrptr, remainder_hdr); SW(FPTR(n_hdrptr,
// diff), remainder_hdr);
@@
-224,32
+224,32
@@
// void*
// coalesce(uint8_t* chunk_ptr)
// {
// void*
// coalesce(uint8_t* chunk_ptr)
// {
-// u
int
32_t hdr = LW(chunk_ptr);
-// u
int
32_t pf = CHUNK_PF(hdr);
-// u
int
32_t sz = CHUNK_S(hdr);
+// u32_t hdr = LW(chunk_ptr);
+// u32_t pf = CHUNK_PF(hdr);
+// u32_t sz = CHUNK_S(hdr);
-// u
int
32_t n_hdr = LW(chunk_ptr + sz);
+// u32_t n_hdr = LW(chunk_ptr + sz);
// if (CHUNK_A(n_hdr) && pf) {
// // case 1: prev is free
// if (CHUNK_A(n_hdr) && pf) {
// // case 1: prev is free
-// u
int
32_t prev_ftr = LW(chunk_ptr - WSIZE);
+// u32_t prev_ftr = LW(chunk_ptr - WSIZE);
// size_t prev_chunk_sz = CHUNK_S(prev_ftr);
// size_t prev_chunk_sz = CHUNK_S(prev_ftr);
-// u
int
32_t new_hdr = PACK(prev_chunk_sz + sz, CHUNK_PF(prev_ftr));
+// u32_t new_hdr = PACK(prev_chunk_sz + sz, CHUNK_PF(prev_ftr));
// SW(chunk_ptr - prev_chunk_sz, new_hdr);
// SW(FPTR(chunk_ptr, sz), new_hdr);
// chunk_ptr -= prev_chunk_sz;
// } else if (!CHUNK_A(n_hdr) && !pf) {
// // case 2: next is free
// size_t next_chunk_sz = CHUNK_S(n_hdr);
// SW(chunk_ptr - prev_chunk_sz, new_hdr);
// SW(FPTR(chunk_ptr, sz), new_hdr);
// chunk_ptr -= prev_chunk_sz;
// } else if (!CHUNK_A(n_hdr) && !pf) {
// // case 2: next is free
// size_t next_chunk_sz = CHUNK_S(n_hdr);
-// u
int
32_t new_hdr = PACK(next_chunk_sz + sz, pf);
+// u32_t new_hdr = PACK(next_chunk_sz + sz, pf);
// SW(chunk_ptr, new_hdr);
// SW(FPTR(chunk_ptr, sz + next_chunk_sz), new_hdr);
// } else if (!CHUNK_A(n_hdr) && pf) {
// // case 3: both free
// SW(chunk_ptr, new_hdr);
// SW(FPTR(chunk_ptr, sz + next_chunk_sz), new_hdr);
// } else if (!CHUNK_A(n_hdr) && pf) {
// // case 3: both free
-// u
int
32_t prev_ftr = LW(chunk_ptr - WSIZE);
+// u32_t prev_ftr = LW(chunk_ptr - WSIZE);
// size_t next_chunk_sz = CHUNK_S(n_hdr);
// size_t prev_chunk_sz = CHUNK_S(prev_ftr);
// size_t next_chunk_sz = CHUNK_S(n_hdr);
// size_t prev_chunk_sz = CHUNK_S(prev_ftr);
-// u
int
32_t new_hdr =
+// u32_t new_hdr =
// PACK(next_chunk_sz + prev_chunk_sz + sz, CHUNK_PF(prev_ftr));
// SW(chunk_ptr - prev_chunk_sz, new_hdr);
// SW(FPTR(chunk_ptr, sz + next_chunk_sz), new_hdr);
// PACK(next_chunk_sz + prev_chunk_sz + sz, CHUNK_PF(prev_ftr));
// SW(chunk_ptr - prev_chunk_sz, new_hdr);
// SW(FPTR(chunk_ptr, sz + next_chunk_sz), new_hdr);
@@
-274,8
+274,8
@@
// // minus the overhead for epilogue, keep the invariant.
// heap->brk -= WSIZE;
// // minus the overhead for epilogue, keep the invariant.
// heap->brk -= WSIZE;
-// u
int32_t old_marker = *((uint
32_t*)start);
-// u
int
32_t free_hdr = PACK(sz, CHUNK_PF(old_marker));
+// u
32_t old_marker = *((u
32_t*)start);
+// u32_t free_hdr = PACK(sz, CHUNK_PF(old_marker));
// SW(start, free_hdr);
// SW(FPTR(start, sz), free_hdr);
// SW(NEXT_CHK(start), PACK(0, M_ALLOCATED | M_PREV_FREE));
// SW(start, free_hdr);
// SW(FPTR(start, sz), free_hdr);
// SW(NEXT_CHK(start), PACK(0, M_ALLOCATED | M_PREV_FREE));
diff --git
a/lunaix-os/kernel/mm/mmio.c
b/lunaix-os/kernel/mm/mmio.c
index a52dc1bf93251138ccde1670aad6058765dd5d54..99e8fb8e36298d3b45c394e2eb3a5246377a7c4b 100644
(file)
--- a/
lunaix-os/kernel/mm/mmio.c
+++ b/
lunaix-os/kernel/mm/mmio.c
@@
-4,7
+4,7
@@
#include <lunaix/spike.h>
void*
#include <lunaix/spike.h>
void*
-ioremap(uintptr_t paddr, u
int
32_t size)
+ioremap(uintptr_t paddr, u32_t size)
{
void* ptr = vmm_vmap(paddr, size, PG_PREM_RW | PG_DISABLE_CACHE);
if (ptr) {
{
void* ptr = vmm_vmap(paddr, size, PG_PREM_RW | PG_DISABLE_CACHE);
if (ptr) {
@@
-17,7
+17,7
@@
ioremap(uintptr_t paddr, uint32_t size)
}
void*
}
void*
-iounmap(uintptr_t vaddr, u
int
32_t size)
+iounmap(uintptr_t vaddr, u32_t size)
{
for (size_t i = 0; i < size; i += PG_SIZE) {
uintptr_t paddr = vmm_del_mapping(PD_REFERENCED, vaddr + i);
{
for (size_t i = 0; i < size; i += PG_SIZE) {
uintptr_t paddr = vmm_del_mapping(PD_REFERENCED, vaddr + i);
diff --git
a/lunaix-os/kernel/mm/pmm.c
b/lunaix-os/kernel/mm/pmm.c
index 91f5460ab175680273ccb5e8082ce979dcc09188..3ebe22a10d34fdcec5446283534a1e10e4ca0051 100644
(file)
--- a/
lunaix-os/kernel/mm/pmm.c
+++ b/
lunaix-os/kernel/mm/pmm.c
@@
-30,7
+30,7
@@
pmm_mark_chunk_free(uintptr_t start_ppn, size_t page_count)
void
pmm_mark_chunk_occupied(pid_t owner,
void
pmm_mark_chunk_occupied(pid_t owner,
- u
int
32_t start_ppn,
+ u32_t start_ppn,
size_t page_count,
pp_attr_t attr)
{
size_t page_count,
pp_attr_t attr)
{
@@
-140,7
+140,7
@@
pmm_ref_page(pid_t owner, void* page)
{
(void*)owner; // TODO: do smth with owner
{
(void*)owner; // TODO: do smth with owner
- u
int
32_t ppn = (uintptr_t)page >> 12;
+ u32_t ppn = (uintptr_t)page >> 12;
if (ppn >= PM_BMP_MAX_SIZE) {
return 0;
if (ppn >= PM_BMP_MAX_SIZE) {
return 0;
@@
-158,7
+158,7
@@
pmm_ref_page(pid_t owner, void* page)
struct pp_struct*
pmm_query(void* pa)
{
struct pp_struct*
pmm_query(void* pa)
{
- u
int
32_t ppn = (uintptr_t)pa >> 12;
+ u32_t ppn = (uintptr_t)pa >> 12;
if (ppn >= PM_BMP_MAX_SIZE) {
return NULL;
if (ppn >= PM_BMP_MAX_SIZE) {
return NULL;
diff --git
a/lunaix-os/kernel/mm/vmm.c
b/lunaix-os/kernel/mm/vmm.c
index 3b28bd980eefb5bdb54d6439871c8c964d3ad75a..445071c39483a7a94a211be9600a345f1ebdc281 100644
(file)
--- a/
lunaix-os/kernel/mm/vmm.c
+++ b/
lunaix-os/kernel/mm/vmm.c
@@
-85,8
+85,8
@@
vmm_del_mapping(uintptr_t mnt, uintptr_t va)
{
assert(((uintptr_t)va & 0xFFFU) == 0);
{
assert(((uintptr_t)va & 0xFFFU) == 0);
- u
int
32_t l1_index = L1_INDEX(va);
- u
int
32_t l2_index = L2_INDEX(va);
+ u32_t l1_index = L1_INDEX(va);
+ u32_t l2_index = L2_INDEX(va);
// prevent unmap of recursive mapping region
if (l1_index == 1023) {
// prevent unmap of recursive mapping region
if (l1_index == 1023) {
@@
-113,8
+113,8
@@
vmm_del_mapping(uintptr_t mnt, uintptr_t va)
int
vmm_lookup(uintptr_t va, v_mapping* mapping)
{
int
vmm_lookup(uintptr_t va, v_mapping* mapping)
{
- u
int
32_t l1_index = L1_INDEX(va);
- u
int
32_t l2_index = L2_INDEX(va);
+ u32_t l1_index = L1_INDEX(va);
+ u32_t l2_index = L2_INDEX(va);
x86_page_table* l1pt = (x86_page_table*)L1_BASE_VADDR;
x86_pte_t l1pte = l1pt->entry[l1_index];
x86_page_table* l1pt = (x86_page_table*)L1_BASE_VADDR;
x86_pte_t l1pte = l1pt->entry[l1_index];
@@
-137,8
+137,8
@@
vmm_lookup(uintptr_t va, v_mapping* mapping)
void*
vmm_v2p(void* va)
{
void*
vmm_v2p(void* va)
{
- u
int
32_t l1_index = L1_INDEX(va);
- u
int
32_t l2_index = L2_INDEX(va);
+ u32_t l1_index = L1_INDEX(va);
+ u32_t l2_index = L2_INDEX(va);
x86_page_table* l1pt = (x86_page_table*)L1_BASE_VADDR;
x86_pte_t l1pte = l1pt->entry[l1_index];
x86_page_table* l1pt = (x86_page_table*)L1_BASE_VADDR;
x86_pte_t l1pte = l1pt->entry[l1_index];
diff --git
a/lunaix-os/kernel/time/timer.c
b/lunaix-os/kernel/time/timer.c
index 989256feb9052bc980c349aa8149ef6f42d3e348..d99aac49dafc211f8fb9bf9fd2465e4bc1a0c1eb 100644
(file)
--- a/
lunaix-os/kernel/time/timer.c
+++ b/
lunaix-os/kernel/time/timer.c
@@
-40,11
+40,11
@@
static volatile struct lx_timer_context* timer_ctx = NULL;
// Don't optimize them! Took me an half hour to figure that out...
// Don't optimize them! Took me an half hour to figure that out...
-static volatile u
int
32_t rtc_counter = 0;
+static volatile u32_t rtc_counter = 0;
static volatile uint8_t apic_timer_done = 0;
static volatile uint8_t apic_timer_done = 0;
-static volatile u
int
32_t sched_ticks = 0;
-static volatile u
int
32_t sched_ticks_counter = 0;
+static volatile u32_t sched_ticks = 0;
+static volatile u32_t sched_ticks_counter = 0;
static struct cake_pile* timer_pile;
static struct cake_pile* timer_pile;
@@
-64,7
+64,7
@@
timer_init_context()
}
void
}
void
-timer_init(u
int
32_t frequency)
+timer_init(u32_t frequency)
{
timer_init_context();
{
timer_init_context();
@@
-79,8
+79,8
@@
timer_init(uint32_t frequency)
// mapping config.
// grab ourselves these irq numbers
// mapping config.
// grab ourselves these irq numbers
- u
int
32_t iv_rtc = isrm_bindirq(PC_AT_IRQ_RTC, temp_intr_routine_rtc_tick);
- u
int
32_t iv_timer = isrm_ivexalloc(temp_intr_routine_apic_timer);
+ u32_t iv_rtc = isrm_bindirq(PC_AT_IRQ_RTC, temp_intr_routine_rtc_tick);
+ u32_t iv_timer = isrm_ivexalloc(temp_intr_routine_apic_timer);
// Setup a one-shot timer, we will use this to measure the bus speed. So we
// can then calibrate apic timer to work at *nearly* accurate hz
// Setup a one-shot timer, we will use this to measure the bus speed. So we
// can then calibrate apic timer to work at *nearly* accurate hz
@@
-154,7
+154,7
@@
timer_init(uint32_t frequency)
}
struct lx_timer*
}
struct lx_timer*
-timer_run_second(u
int
32_t second,
+timer_run_second(u32_t second,
void (*callback)(void*),
void* payload,
uint8_t flags)
void (*callback)(void*),
void* payload,
uint8_t flags)
@@
-164,7
+164,7
@@
timer_run_second(uint32_t second,
}
struct lx_timer*
}
struct lx_timer*
-timer_run_ms(u
int
32_t millisecond,
+timer_run_ms(u32_t millisecond,
void (*callback)(void*),
void* payload,
uint8_t flags)
void (*callback)(void*),
void* payload,
uint8_t flags)
diff --git
a/lunaix-os/kernel/tty/lxconsole.c
b/lunaix-os/kernel/tty/lxconsole.c
index 80a7be6de25fd2b3140a54ff95da5eba0295f0d4..21802bed7a66f84bc2234f1bd4ff131d38163015 100644
(file)
--- a/
lunaix-os/kernel/tty/lxconsole.c
+++ b/
lunaix-os/kernel/tty/lxconsole.c
@@
-39,8
+39,8
@@
print_control_code(const char cntrl)
int
__lxconsole_listener(struct input_device* dev)
{
int
__lxconsole_listener(struct input_device* dev)
{
- u
int
32_t key = dev->current_pkt.sys_code;
- u
int
32_t type = dev->current_pkt.pkt_type;
+ u32_t key = dev->current_pkt.sys_code;
+ u32_t type = dev->current_pkt.pkt_type;
kbd_kstate_t state = key >> 16;
ttychr = key & 0xff;
key = key & 0xffff;
kbd_kstate_t state = key >> 16;
ttychr = key & 0xff;
key = key & 0xffff;
@@
-86,7
+86,7
@@
done:
}
int
}
int
-__tty_exec_cmd(struct device* dev, u
int
32_t req, va_list args)
+__tty_exec_cmd(struct device* dev, u32_t req, va_list args)
{
switch (req) {
case TIOCGPGRP:
{
switch (req) {
case TIOCGPGRP:
diff --git
a/lunaix-os/kernel/tty/tty.c
b/lunaix-os/kernel/tty/tty.c
index b8631b6482c935cf313702746ac045033caa87a3..399b28df6f3f23d474337709aa8ba0966ad31ac4 100644
(file)
--- a/
lunaix-os/kernel/tty/tty.c
+++ b/
lunaix-os/kernel/tty/tty.c
@@
-113,7
+113,7
@@
tty_set_cursor(uint8_t x, uint8_t y)
if (x >= TTY_WIDTH || y >= TTY_HEIGHT) {
x = y = 0;
}
if (x >= TTY_WIDTH || y >= TTY_HEIGHT) {
x = y = 0;
}
- u
int
32_t pos = y * TTY_WIDTH + x;
+ u32_t pos = y * TTY_WIDTH + x;
io_outb(0x3D4, 14);
io_outb(0x3D5, pos / 256);
io_outb(0x3D4, 15);
io_outb(0x3D4, 14);
io_outb(0x3D5, pos / 256);
io_outb(0x3D4, 15);
diff --git
a/lunaix-os/libs/hash.c
b/lunaix-os/libs/hash.c
index dc1b3ccb1c1af2f9e537457a6fc8b01637b472c5..41fa4b19dd9726610cc255927d3f8c673fcabf69 100644
(file)
--- a/
lunaix-os/libs/hash.c
+++ b/
lunaix-os/libs/hash.c
@@
-8,13
+8,13
@@
* @param str
* @return unsigned int
*/
* @param str
* @return unsigned int
*/
-u
int
32_t
-strhash_32(const char* str, u
int
32_t truncate_to)
+u32_t
+strhash_32(const char* str, u32_t truncate_to)
{
if (!str)
return 0;
{
if (!str)
return 0;
- u
int
32_t hash = 5381;
+ u32_t hash = 5381;
int c;
while ((c = *str++))
int c;
while ((c = *str++))
diff --git
a/lunaix-os/libs/klibc/stdio/ksprintf.c
b/lunaix-os/libs/klibc/stdio/ksprintf.c
index 2497e107b7821eba1ebe3eb7f09d49a2d3ce8b10..78c510a214761c8ab554a3c3066bd2ceb90196e9 100644
(file)
--- a/
lunaix-os/libs/klibc/stdio/ksprintf.c
+++ b/
lunaix-os/libs/klibc/stdio/ksprintf.c
@@
-2,7
+2,7
@@
#include <klibc/stdio.h>
#include <klibc/stdlib.h>
#include <klibc/string.h>
#include <klibc/stdio.h>
#include <klibc/stdlib.h>
#include <klibc/string.h>
-#include <
stdint
.h>
+#include <
lunaix/types
.h>
#define NUMBUFSIZ 24
#define NUMBUFSIZ 24
@@
-26,7
+26,7
@@
__ksprintf_internal(char* buffer, char* fmt, size_t max_len, va_list vargs)
// Of course, with some modifications for porting to LunaixOS :)
char numbuf[NUMBUFSIZ];
// Of course, with some modifications for porting to LunaixOS :)
char numbuf[NUMBUFSIZ];
- u
int
32_t ptr = 0;
+ u32_t ptr = 0;
for (; *fmt; ++fmt) {
if (max_len && ptr >= max_len - 1) {
break;
for (; *fmt; ++fmt) {
if (max_len && ptr >= max_len - 1) {
break;
diff --git
a/lunaix-os/scripts/x86_idt_generator.py
b/lunaix-os/scripts/x86_idt_generator.py
index a9af92ce486ddf54337bccfd33978dbf0a9f6bd9..7876ab1944f90f524c9d26c652046212d4afeb4c 100644
(file)
--- a/
lunaix-os/scripts/x86_idt_generator.py
+++ b/
lunaix-os/scripts/x86_idt_generator.py
@@
-90,7
+90,7
@@
def export_c(src: Path):
uint64_t _idt[IDT_ENTRY];
uint16_t _idt_limit = sizeof(_idt) - 1;
static inline void
uint64_t _idt[IDT_ENTRY];
uint16_t _idt_limit = sizeof(_idt) - 1;
static inline void
-_set_idt_entry(u
int
32_t vector,
+_set_idt_entry(u32_t vector,
uint16_t seg_selector,
void (*isr)(),
uint8_t dpl,
uint16_t seg_selector,
void (*isr)(),
uint8_t dpl,