| package abigen |
| |
| // SysArg represents an arg to a vDSO-exported syscall. |
| type SysArg struct { |
| Name string // Name represents the name of the argument. |
| Type SysType // Type represents the type of the argument. |
| Constraint string // Constraint represents constraints on the argument (in/out/inout). |
| } |
| |
| // SysDef represents a definition of a vDSO-exported syscall. |
| type SysDef struct { |
| Name string // Name is the name of this syscall definition. |
| Ret SysType // Ret is the return type of the syscall. |
| Attrs []string // Attrs contains one or more attributes of the syscall. |
| Args []SysArg // Args represents the arguments taken by the syscall. |
| VDSOCall bool // VDSOCall represents whether the syscall is returned directly from the vDSO. |
| } |
| |
| // GoName returns a string representing the Go name of the syscall in the syscall package. |
| func (d *SysDef) GoName() string { |
| if d.Exported() { |
| return "Sys_" + d.Name |
| } |
| return "sys_" + d.Name |
| } |
| |
| // Exported determines whether a particular syscall definition should be exported. |
| func (d *SysDef) Exported() bool { |
| switch d.Name { |
| case "handle_duplicate", |
| "object_set_profile", |
| "object_wait_many", |
| "channel_create", |
| "channel_read", |
| "channel_read_etc", |
| "channel_write", |
| "pci_get_bar", |
| "pci_map_interrupt", |
| "pci_query_irq_mode", |
| "pci_set_irq_mode", |
| "pci_init", |
| "pci_add_subtract_to_range", |
| "socket_create", |
| "socket_read", |
| "socket_write", |
| "socket_accept", |
| "socket_share", |
| "system_get_dcache_line_size", |
| "system_get_features", |
| "vmar_allocate", |
| "vmar_allocate_old", |
| "vmar_map_old", |
| "vmar_protect_old", |
| "vmar_destroy", |
| "vmo_read", |
| "vmo_write", |
| "vmo_get_size", |
| "vmo_set_size", |
| "vmo_op_range", |
| "vmo_replace_as_executable": |
| return false |
| default: |
| return true |
| } |
| } |