[syscalls][docs] Make system functions synopsis be generated, various locations match
Make parameter names follow
https://fuchsia.googlesource.com/docs/+/master/development/api/system.md#parameters
and make docs, abigen, and implementation match.
ZX-559 #comment [syscalls][docs] Make system functions synopsis be generated, various locations match
ZX-968 #comment [syscalls][docs] Make system functions synopsis be generated, various locations match
Test: CQ
Change-Id: I5af03f0582654a81869c9ceeaf880357eaba4b54
diff --git a/docs/syscalls/system_get_features.md b/docs/syscalls/system_get_features.md
index 7154f6a..20ad101 100644
--- a/docs/syscalls/system_get_features.md
+++ b/docs/syscalls/system_get_features.md
@@ -8,10 +8,12 @@
## SYNOPSIS
+<!-- Updated by scripts/update-docs-from-abigen, do not edit this section manually. -->
+
```
#include <zircon/syscalls.h>
-zx_status_t zx_system_features(uint32_t kind, uint32_t* features);
+zx_status_t zx_system_get_features(uint32_t kind, uint32_t* features);
```
## DESCRIPTION
diff --git a/docs/syscalls/system_get_physmem.md b/docs/syscalls/system_get_physmem.md
index 3ca94a9..a387ad1 100644
--- a/docs/syscalls/system_get_physmem.md
+++ b/docs/syscalls/system_get_physmem.md
@@ -8,10 +8,12 @@
## SYNOPSIS
+<!-- Updated by scripts/update-docs-from-abigen, do not edit this section manually. -->
+
```
#include <zircon/syscalls.h>
-size_t zx_system_get_physmem(void);
+uint64_t zx_system_get_physmem(void);
```
## DESCRIPTION
diff --git a/docs/syscalls/system_mexec.md b/docs/syscalls/system_mexec.md
index 73e36cd..9d3b7a5 100644
--- a/docs/syscalls/system_mexec.md
+++ b/docs/syscalls/system_mexec.md
@@ -8,6 +8,8 @@
## SYNOPSIS
+<!-- Updated by scripts/update-docs-from-abigen, do not edit this section manually. -->
+
```
#include <zircon/syscalls.h>
@@ -37,9 +39,9 @@
*resource* must have resource kind **ZX_RSRC_KIND_ROOT**.
-*kernel* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_READ**.
+*kernel_vmo* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_READ**.
-*bootimage* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_READ**.
+*bootimage_vmo* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_READ**.
## RETURN VALUE
diff --git a/docs/syscalls/system_mexec_payload_get.md b/docs/syscalls/system_mexec_payload_get.md
index 86afe9d..a723531 100644
--- a/docs/syscalls/system_mexec_payload_get.md
+++ b/docs/syscalls/system_mexec_payload_get.md
@@ -8,11 +8,14 @@
## SYNOPSIS
+<!-- Updated by scripts/update-docs-from-abigen, do not edit this section manually. -->
+
```
#include <zircon/syscalls.h>
zx_status_t zx_system_mexec_payload_get(zx_handle_t resource,
- void* buffer, size_t len);
+ void* buffer,
+ size_t buffer_size);
```
## DESCRIPTION
@@ -24,7 +27,7 @@
*resource* must be of type *ZX_RSRC_KIND_ROOT*.
-*buffer* and *len* must point to a buffer that is no longer than 16KiB.
+*buffer* and *buffer_size* must point to a buffer that is no longer than 16KiB.
## RIGHTS
diff --git a/kernel/syscalls/system.cpp b/kernel/syscalls/system.cpp
index 58486c5..b51f7f8 100644
--- a/kernel/syscalls/system.cpp
+++ b/kernel/syscalls/system.cpp
@@ -152,7 +152,7 @@
// zx_status_t zx_system_mexec_payload_get
zx_status_t sys_system_mexec_payload_get(zx_handle_t resource,
user_out_ptr<void> user_buffer,
- size_t len) {
+ size_t buffer_size) {
// Highly privilidged, only root resource should have access.
zx_status_t result = validate_resource(resource, ZX_RSRC_KIND_ROOT);
if (result != ZX_OK) {
@@ -160,31 +160,31 @@
}
// Limit the size of the result that we can return to userspace.
- if (len > kBootdataPlatformExtraBytes) {
+ if (buffer_size > kBootdataPlatformExtraBytes) {
return ZX_ERR_INVALID_ARGS;
}
fbl::AllocChecker ac;
ktl::unique_ptr<uint8_t[]> buffer;
- buffer.reset(new (&ac) uint8_t[len]);
+ buffer.reset(new (&ac) uint8_t[buffer_size]);
if (!ac.check()) {
return ZX_ERR_NO_MEMORY;
}
- memset(buffer.get(), 0, len);
+ memset(buffer.get(), 0, buffer_size);
// Create a zero length ZBI in the buffer.
- zbi::Zbi image(buffer.get(), len);
+ zbi::Zbi image(buffer.get(), buffer_size);
zbi_result_t zbi_result = image.Reset();
if (zbi_result != ZBI_RESULT_OK) {
return ZX_ERR_INTERNAL;
}
- result = platform_mexec_patch_zbi(buffer.get(), len);
+ result = platform_mexec_patch_zbi(buffer.get(), buffer_size);
if (result != ZX_OK) {
return result;
}
- return user_buffer.copy_array_to_user(buffer.get(), len);
+ return user_buffer.copy_array_to_user(buffer.get(), buffer_size);
}
// zx_status_t zx_system_mexec
diff --git a/scripts/update-docs-from-abigen b/scripts/update-docs-from-abigen
index 4d8fd06..c0e0ac4 100755
--- a/scripts/update-docs-from-abigen
+++ b/scripts/update-docs-from-abigen
@@ -438,8 +438,12 @@
'socket_share',
'socket_shutdown',
'socket_write',
+ 'system_get_features',
'system_get_num_cpus',
+ 'system_get_physmem',
'system_get_version',
+ 'system_mexec',
+ 'system_mexec_payload_get',
'task_bind_exception_port',
'task_kill',
'task_resume_from_exception',
diff --git a/system/public/zircon/syscalls.abigen b/system/public/zircon/syscalls.abigen
index 2e1f337..1a68149 100644
--- a/system/public/zircon/syscalls.abigen
+++ b/system/public/zircon/syscalls.abigen
@@ -113,7 +113,7 @@
#^ get supported hardware capabilities
syscall system_get_features vdsocall
(kind: uint32_t)
- returns (zx_status_t, out: uint32_t features);
+ returns (zx_status_t, features: uint32_t features);
# Abstraction of machine operations
@@ -1080,10 +1080,10 @@
#^ Soft reboot the system with a new kernel and bootimage
#! resource must have resource kind ZX_RSRC_KIND_ROOT.
-#! kernel must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ.
-#! bootimage must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ.
+#! kernel_vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ.
+#! bootimage_vmo must be of type ZX_OBJ_TYPE_VMO and have ZX_RIGHT_READ.
syscall system_mexec
- (resource: zx_handle_t, kernel: zx_handle_t, bootimage: zx_handle_t)
+ (resource: zx_handle_t, kernel_vmo: zx_handle_t, bootimage_vmo: zx_handle_t)
returns (zx_status_t);
#^ Return a ZBI containing ZBI entries necessary to boot this system