* [9fans] 9syscall
@ 2014-06-12 13:17 erik quanstrom
2014-06-12 13:34 ` cinap_lenrek
0 siblings, 1 reply; 7+ messages in thread
From: erik quanstrom @ 2014-06-12 13:17 UTC (permalink / raw)
To: 9fans
case amd64
if(~ $i seek)
echo TEXT _seek'(SB)', 1, '$0'
if not
echo TEXT $i'(SB)', 1, '$0'
why is this necessary? surely this is artefact?
- erik
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] 9syscall
2014-06-12 13:17 [9fans] 9syscall erik quanstrom
@ 2014-06-12 13:34 ` cinap_lenrek
2014-06-12 13:41 ` erik quanstrom
0 siblings, 1 reply; 7+ messages in thread
From: cinap_lenrek @ 2014-06-12 13:34 UTC (permalink / raw)
To: 9fans
because the kernel assumes that returned vlong is passed
by reference in the first argument, where on amd64, the
(amd64) calling convention returns it in 64 bit AX register.
so seek() is a library func that emulates the previous convention
for _seek() syscall.
--
cinap
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] 9syscall
2014-06-12 13:34 ` cinap_lenrek
@ 2014-06-12 13:41 ` erik quanstrom
2014-06-12 14:11 ` cinap_lenrek
2014-06-12 14:30 ` cinap_lenrek
0 siblings, 2 replies; 7+ messages in thread
From: erik quanstrom @ 2014-06-12 13:41 UTC (permalink / raw)
To: 9fans
On Thu Jun 12 09:35:29 EDT 2014, cinap_lenrek@felloff.net wrote:
> because the kernel assumes that returned vlong is passed
> by reference in the first argument, where on amd64, the
> (amd64) calling convention returns it in 64 bit AX register.
>
> so seek() is a library func that emulates the previous convention
> for _seek() syscall.
that's not how the amd64 kernel has worked. the registers are 64 bits,
the return value, regardless of where it is is 64 bits. for example, anything
returning an address would already just work, such as segbrk.
- erik
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] 9syscall
2014-06-12 13:41 ` erik quanstrom
@ 2014-06-12 14:11 ` cinap_lenrek
2014-06-12 14:18 ` erik quanstrom
2014-06-12 14:30 ` cinap_lenrek
1 sibling, 1 reply; 7+ messages in thread
From: cinap_lenrek @ 2014-06-12 14:11 UTC (permalink / raw)
To: 9fans
yes. what was returned by register keeps being returned by register (segbrk).
--
cinap
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] 9syscall
2014-06-12 14:11 ` cinap_lenrek
@ 2014-06-12 14:18 ` erik quanstrom
0 siblings, 0 replies; 7+ messages in thread
From: erik quanstrom @ 2014-06-12 14:18 UTC (permalink / raw)
To: 9fans
On Thu Jun 12 10:12:56 EDT 2014, cinap_lenrek@felloff.net wrote:
> yes. what was returned by register keeps being returned by register (segbrk).
so therefore seek is not special either on amd64.
by the way seek(fd, 0xffffffffull, 0) will always return -1
on the architectures with the sign extension hack.
- erik
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] 9syscall
2014-06-12 13:41 ` erik quanstrom
2014-06-12 14:11 ` cinap_lenrek
@ 2014-06-12 14:30 ` cinap_lenrek
2014-06-12 14:51 ` erik quanstrom
1 sibling, 1 reply; 7+ messages in thread
From: cinap_lenrek @ 2014-06-12 14:30 UTC (permalink / raw)
To: 9fans
the difference is, returning pointers the natural way works on all archs.
returning vlong works differently depending on the arch. so
the "portable" syscall handlers use a convention that works the
same on all archs, assuming returned vlong is passed by reference.
no doubt, you *could* return it "naturally" on 64bit arch. maybe your 64bit
kernel does, i dont know.
--
cinap
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] 9syscall
2014-06-12 14:30 ` cinap_lenrek
@ 2014-06-12 14:51 ` erik quanstrom
0 siblings, 0 replies; 7+ messages in thread
From: erik quanstrom @ 2014-06-12 14:51 UTC (permalink / raw)
To: 9fans
On Thu Jun 12 10:31:30 EDT 2014, cinap_lenrek@felloff.net wrote:
> the difference is, returning pointers the natural way works on all archs.
> returning vlong works differently depending on the arch. so
> the "portable" syscall handlers use a convention that works the
> same on all archs, assuming returned vlong is passed by reference.
is that portable or is that a 32-bit assumption?
- erik
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-06-12 14:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 13:17 [9fans] 9syscall erik quanstrom
2014-06-12 13:34 ` cinap_lenrek
2014-06-12 13:41 ` erik quanstrom
2014-06-12 14:11 ` cinap_lenrek
2014-06-12 14:18 ` erik quanstrom
2014-06-12 14:30 ` cinap_lenrek
2014-06-12 14:51 ` erik quanstrom
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).