The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: lehmann@ans-netz.de (Oliver Lehmann)
Subject: [TUHS] link() syscall implementation
Date: Sat, 14 Nov 2015 16:17:57 +0100	[thread overview]
Message-ID: <20151114161757.Horde.RL0PZVub39UDZ9-Qr0wtXdW@avocado.salatschuessel.net> (raw)
In-Reply-To: <20151114135635.Horde.6nqJB5AyLmQsx2fCZX4iZtZ@avocado.salatschuessel.net>

I've now implemented this:

         u.u_dirp.left = hiword(uap->linkname) & 0x7f00;
         u.u_dirp.right = loword(uap->linkname);

while hiword and loword being defined in my param.h like this:

# define loword(X)      (((unsigned short *)&X)[sizeof(X) - \
                         (sizeof(unsigned short)+1)])
# define hiword(X)      (((unsigned short *)&X)[0])

This results in:

         ld      r2,rr8(#4)
         and     r2,#32512
         ld      _u+78,r2
         ld      r2,rr8(#6)
         ld      _u+80,r2


versus

         ldl        rr2,rr8(#4)
         ldl        rr4,rr2
         and        r4,#32512
         ldl        _u+78,rr4

does the same but  with more instructions and of course not 1:1
binary "the same" ;)
wonder why
   u.u_dirp.l = (caddr_t)(((long)uap->linkname) & 0x7F00FFFF);
didn't worked.

At least link() is now working again (before the fix it was only
working when the file to be linked is in the working directory)

#1 ls -i /z/tmp/
  2487 hugo   2486 walter
#2 rm /z/tmp/walter
#3 ln /z/tmp/hugo /z/tmp/walter
#4 !1
ls -i /z/tmp/
  2487 hugo   2487 walter
#5 ln /z/tmp/hugo /z/walter
#6 ls -i /z/tmp/hugo /z/walter
  2487 /z/tmp/hugo                  2487 /z/walter
#7



  reply	other threads:[~2015-11-14 15:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-14 12:34 Oliver Lehmann
2015-11-14 12:56 ` Oliver Lehmann
2015-11-14 15:17   ` Oliver Lehmann [this message]
2015-11-14 21:18     ` Random832
2015-11-14 21:42       ` Oliver Lehmann
2015-11-14 23:07         ` Random832
2015-11-15 14:43           ` Oliver Lehmann
2015-11-14 13:33 ` Random832

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151114161757.Horde.RL0PZVub39UDZ9-Qr0wtXdW@avocado.salatschuessel.net \
    --to=lehmann@ans-netz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).