[Libre-soc-bugs] [Bug 982] Support PowerPC ABI in ISACaller
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Tue Sep 5 19:44:44 BST 2023
https://bugs.libre-soc.org/show_bug.cgi?id=982
--- Comment #7 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Jacob Lifshay from comment #6)
still too complex.
> #define RETRY_SYSCALL(retval, call) \
> do { \
> retval = (call); \
> } while(retval == -1 && errno == EINTR)
cut this
> int main() {
> unsigned char buf[BUFSZ];
> int fd;
> RETRY_SYSCALL(fd, open("/proc/cmdline", O_RDONLY | O_CLOEXEC));
cut macro.
> if(fd == -1)
> return 1;
cut. assume success.
> while(1) {
cut loop
> ssize_t read_count;
> RETRY_SYSCALL(read_count, read(fd, buf, sizeof(buf)));
cut macro
> ssize_t pos = 0;
> while(pos < read_count) {
cut loop
> ssize_t write_count, left = read_count - pos;
> RETRY_SYSCALL(write_count, write(STDOUT_FILENO, &buf[pos],
> left));
cut macro
> if(write_count == -1)
> return 1;
cut. assume success
> pos += write_count;
cut. assume write amount is same as read amount
now that's down to a manageable easy program that when disassembled
is blindingly-obvious, and could easily fit into a VERY SHORT
test_caller_sc_***.py unit test.
do learn to stop making "perfect" the enemy of "good enough".
your experience and preference for rust is hampering delivery
and costing you (and the team) money that they could earn far
quicker.
a *second* unit test - under pypowersim - would be to run
the program that you wrote, as a way to test expected error conditions,
but that is *optional*... after everything else has been done,
and likely there are some libc6 unit tests that could drop in
here (cross-ref to NGI Search Grant)
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list