Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

update attributes syntax to @[...] #131

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kernel/modules/acpi/acpi.v
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn use_xsdt() bool {
return rsdp.revision >= 2 && rsdp.xsdt_addr != 0
}

[cinit]
@[cinit]
__global (
volatile rsdp_req = limine.LimineRSDPRequest{
response: 0
Expand Down
12 changes: 6 additions & 6 deletions kernel/modules/acpi/madt.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module acpi

[packed]
@[packed]
struct MADT {
pub:
header SDT
Expand All @@ -13,14 +13,14 @@ pub:
entries_begin u8
}

[packed]
@[packed]
struct MADTHeader {
pub:
id u8
length u8
}

[packed]
@[packed]
struct MADTLocalApic {
pub:
header MADTHeader
Expand All @@ -29,7 +29,7 @@ pub:
flags u32
}

[packed]
@[packed]
struct MADTIoApic {
pub:
header MADTHeader
Expand All @@ -39,7 +39,7 @@ pub:
gsib u32
}

[packed]
@[packed]
struct MADTISO {
pub:
header MADTHeader
Expand All @@ -49,7 +49,7 @@ pub:
flags u16
}

[packed]
@[packed]
struct MADTNMI {
pub:
header MADTHeader
Expand Down
4 changes: 2 additions & 2 deletions kernel/modules/block/partition/partition.v
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub mut:
sector_cnt u64
}

[packed]
@[packed]
struct MBRPartition {
pub mut:
drive_status u8
Expand All @@ -52,7 +52,7 @@ pub mut:
name [9]u64
}

[packed]
@[packed]
struct GPTPartitionTableHDR {
pub mut:
identifier u64
Expand Down
14 changes: 7 additions & 7 deletions kernel/modules/dev/ahci/ahci.v
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
sector_size = 0x200
)

[packed]
@[packed]
struct AHCIRegisters {
pub mut:
cap u32
Expand All @@ -58,7 +58,7 @@ pub mut:
vendor [24]u32
}

[packed]
@[packed]
struct AHCIPortRegisters {
pub mut:
clb u32
Expand All @@ -83,7 +83,7 @@ pub mut:
vs [10]u32
}

[packed]
@[packed]
struct AHCIHBACommand {
pub mut:
flags u16
Expand All @@ -94,7 +94,7 @@ pub mut:
reserved [4]u32
}

[packed]
@[packed]
struct AHCIHBAPrdt {
pub mut:
dba u32
Expand All @@ -103,7 +103,7 @@ pub mut:
dbc u32
}

[packed]
@[packed]
struct AHCIHBACommandTable {
pub mut:
cfis [64]u8
Expand All @@ -112,7 +112,7 @@ pub mut:
prdt [1]AHCIHBAPrdt
}

[packed]
@[packed]
struct AHCIFISh2d {
pub mut:
fis_type u8
Expand All @@ -134,7 +134,7 @@ pub mut:
reserved u32
}

[packed]
@[packed]
struct AHCIFISd2h {
fis_type u8
flags u8
Expand Down
2 changes: 1 addition & 1 deletion kernel/modules/dev/ata/ata.v
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ata_sectors_per_prdt = 16

const ata_bytes_per_prdt = ata_bytes_per_sector * ata_sectors_per_prdt

[packed]
@[packed]
struct PRDT {
pub mut:
buffer_phys u32
Expand Down
2 changes: 1 addition & 1 deletion kernel/modules/dev/console/console.v
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ pub fn limine_term_callback(p &limine.LimineTerminal, t u64, a u64, b u64, c u64
}
}

[cinit]
@[cinit]
__global (
volatile term_req = limine.LimineTerminalRequest{
response: 0
Expand Down
28 changes: 14 additions & 14 deletions kernel/modules/dev/nvme/nvme.v
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (
nvme_io_queue_cnt = 0x4
)

[packed]
@[packed]
struct NVMERegisters {
pub mut:
cap u64
Expand All @@ -58,7 +58,7 @@ pub mut:
acq u64
}

[packed]
@[packed]
struct NVMECommandCreateCQ {
pub mut:
rsvd1 [5]u32
Expand All @@ -71,7 +71,7 @@ pub mut:
rsvd3 [4]u32
}

[packed]
@[packed]
struct NVMECommandCreateSQ {
pub mut:
rsvd1 [5]u32
Expand All @@ -84,7 +84,7 @@ pub mut:
rsvd3 [4]u32
}

[packed]
@[packed]
struct NVMECommandDeleteQ {
pub mut:
rsvd1 [9]u32
Expand All @@ -93,7 +93,7 @@ pub mut:
rsvd3 [5]u32
}

[packed]
@[packed]
struct NVMECommandAbort {
pub mut:
rsvd1 [9]u32
Expand All @@ -102,7 +102,7 @@ pub mut:
rsvd2 [5]u32
}

[packed]
@[packed]
struct NVMECommandFeatures {
pub mut:
nsid u32
Expand All @@ -114,7 +114,7 @@ pub mut:
rsvd2 [4]u32
}

[packed]
@[packed]
struct NVMECommandIdentify {
pub mut:
nsid u32
Expand All @@ -125,7 +125,7 @@ pub mut:
rsvd2 [5]u32
}

[packed]
@[packed]
struct NVMECommandRW {
pub mut:
nsid u32
Expand Down Expand Up @@ -153,7 +153,7 @@ pub mut:
rw NVMECommandRW
}

[packed]
@[packed]
struct NVMECommand {
pub mut:
opcode u8
Expand All @@ -162,7 +162,7 @@ pub mut:
private NVMECommandPrivate
}

[packed]
@[packed]
struct NVMECompletion {
pub mut:
result u32
Expand All @@ -173,7 +173,7 @@ pub mut:
status u16
}

[packed]
@[packed]
struct NVMEPowerStateID {
pub mut:
max_power u16
Expand All @@ -193,7 +193,7 @@ pub mut:
rsvd3 [9]u8
}

[packed]
@[packed]
struct NVMEControllerID {
pub mut:
vid u16
Expand Down Expand Up @@ -240,15 +240,15 @@ pub mut:
vs [1024]u8
}

[packed]
@[packed]
struct NVMELbaf {
pub mut:
ms u16
ds u8
rp u8
}

[packed]
@[packed]
struct NVMENamespaceID {
pub mut:
nsze u64
Expand Down
4 changes: 2 additions & 2 deletions kernel/modules/dev/random/random.v
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ mut:
reseed_ctr u64
}

[inline]
@[inline]
fn rotl32(a u32, shift u32) u32 {
return (a << shift) | (a >> (32 - shift))
}

[inline]
@[inline]
fn qr(a &u32, b &u32, c &u32, d &u32) {
unsafe {
*b = *b ^ rotl32(*a + *d, 7)
Expand Down
8 changes: 4 additions & 4 deletions kernel/modules/fs/ext2/ext2.v
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import event.eventstruct
import memory
import fs

[packed]
@[packed]
struct EXT2Superblock {
pub mut:
inode_cnt u32
Expand Down Expand Up @@ -53,7 +53,7 @@ pub mut:
last_mnt_path[8] u64
}

[packed]
@[packed]
struct EXT2BlockGroupDescriptor {
pub mut:
block_addr_bitmap u32
Expand All @@ -65,7 +65,7 @@ pub mut:
reserved[7] u16
}

[packed]
@[packed]
struct EXT2Inode {
pub mut:
permissions u16
Expand All @@ -87,7 +87,7 @@ pub mut:
frag_addr u32
}

[packed]
@[packed]
struct EXT2DirectoryEntry {
pub mut:
inode_index u32
Expand Down
4 changes: 2 additions & 2 deletions kernel/modules/initramfs/initramfs.v
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ fn octal_to_int(s string) u64 {

fn C.string_free(&string)

[cinit]
@[cinit]
__global (
volatile module_req = limine.LimineModuleRequest{response: 0}
)

[manualfree]
@[manualfree]
pub fn initialise() {
if module_req.response.module_count < 1 {
panic('No initramfs')
Expand Down
8 changes: 4 additions & 4 deletions kernel/modules/ioctl/common.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ pub const ioc_typeshift = (ioc_nrshift + ioc_nrbits)
pub const ioc_sizeshift = (ioc_typeshift + ioc_typebits)
pub const ioc_dirshift = (ioc_sizeshift + ioc_sizebits)

[inline]
@[inline]
pub fn ioctl_dir(ioc u32) u32 {
return (ioc >> ioc_dirshift) & ioc_dirmask
}

[inline]
@[inline]
pub fn ioctl_type(ioc u32) u32 {
return (ioc >> ioc_typeshift) & ioc_typemask
}

[inline]
@[inline]
pub fn ioctl_size(ioc u32) u32 {
return (ioc >> ioc_sizeshift) & ioc_sizemask
}

[inline]
@[inline]
pub fn ioctl_nr(ioc u32) u32 {
return (ioc >> ioc_nrshift) & ioc_nrmask
}
2 changes: 1 addition & 1 deletion kernel/modules/lib/panic.v
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import katomic

fn C.printf_panic(charptr, ...voidptr)

[noreturn]
@[noreturn]
pub fn kpanic(gpr_state &cpulocal.GPRState, message charptr) {
asm volatile amd64 {
cli
Expand Down
Loading
Loading