source: trunk/System/Sources/libc/patches/patch-linux_amd64_socket.diff @ 442

Last change on this file since 442 was 442, checked in by khorben, 11 years ago

Added two patches for Linux/amd64 support (still missing setjmp/longjmp)

File size: 5.4 KB
  • libc/Makefile

    diff -p -u -r1.94 Makefile
    dist: 
    172172                $(PACKAGE)-$(VERSION)/src/socket/kernel/linux/Makefile \
    173173                $(PACKAGE)-$(VERSION)/src/socket/kernel/linux/common.h \
    174174                $(PACKAGE)-$(VERSION)/src/socket/kernel/linux/project.conf \
     175                $(PACKAGE)-$(VERSION)/src/socket/kernel/linux/amd64/Makefile \
     176                $(PACKAGE)-$(VERSION)/src/socket/kernel/linux/amd64/syscalls.S \
     177                $(PACKAGE)-$(VERSION)/src/socket/kernel/linux/amd64/project.conf \
    175178                $(PACKAGE)-$(VERSION)/src/socket/kernel/linux/arm/Makefile \
    176179                $(PACKAGE)-$(VERSION)/src/socket/kernel/linux/arm/syscalls.S \
    177180                $(PACKAGE)-$(VERSION)/src/socket/kernel/linux/arm/project.conf \
  • libc/src/socket/syscalls.S

    diff -p -u -r1.16 syscalls.S
     
    3131
    3232/* Linux */
    3333#elif defined(__linux__)
    34 # if defined(__arm__)
     34# if defined(__amd64__)
     35#  include "kernel/linux/amd64/syscalls.S"
     36# elif defined(__arm__)
    3537#  include "kernel/linux/arm/syscalls.S"
    3638# elif defined(__i386__)
    3739#  include "kernel/linux/i386/syscalls.S"
  • libc/src/socket/kernel/linux/Makefile

    diff -p -u -r1.2 Makefile
     
    1 SUBDIRS = arm i386
     1SUBDIRS = amd64 arm i386
    22
    33
    44all: subdirs
  • libc/src/socket/kernel/linux/common.h

    diff -p -u -r1.4 common.h
     
    1919# define SOCKET_KERNEL_LINUX_COMMON_H
    2020
    2121
    22 # define SYS_socket             1
    23 # define SYS_bind               2
    24 # define SYS_connect            3
    25 # define SYS_listen             4
    26 # define SYS_accept             5
    27 # define SYS_getsockname        6
    28 # define SYS_recv               9
    29 # define SYS_send               10
    30 # define SYS_sendto             11
    31 # define SYS_recvfrom           12
    32 # define SYS_setsockopt         14
    33 # define SYS_getsockopt         15
    34 # define SYS_sendmsg            16
    35 # define SYS_recvmsg            17
    36 # define SYS_socketcall         102
     22# ifdef __amd64__
     23#  define SYS_socket            41
     24#  define SYS_connect           42
     25#  define SYS_accept            43
     26#  define SYS_sendto            44
     27#  define SYS_recvfrom          45
     28#  define SYS_send              46 /* FIXME is this correct? */
     29#  define SYS_sendmsg           46
     30#  define SYS_recv              47 /* FIXME is this correct? */
     31#  define SYS_recvmsg           47
     32#  define SYS_shutdown          48
     33#  define SYS_bind              49
     34#  define SYS_listen            50
     35#  define SYS_getsockname       51
     36#  define SYS_setsockopt        54
     37#  define SYS_getsockopt        55
     38# else
     39#  define SYS_socket            1
     40#  define SYS_bind              2
     41#  define SYS_connect           3
     42#  define SYS_listen            4
     43#  define SYS_accept            5
     44#  define SYS_getsockname       6
     45#  define SYS_recv              9
     46#  define SYS_send              10
     47#  define SYS_sendto            11
     48#  define SYS_recvfrom          12
     49#  define SYS_setsockopt        14
     50#  define SYS_getsockopt        15
     51#  define SYS_sendmsg           16
     52#  define SYS_recvmsg           17
     53#  define SYS_socketcall        102
     54# endif
    3755
    3856#endif /* !KERNEL_SOCKET_LINUX_COMMON_H */
  • libc/src/socket/kernel/linux/project.conf

    diff -p -u -r1.2 project.conf
     
    1 subdirs=arm,i386
     1subdirs=amd64,arm,i386
    22dist=Makefile,common.h
  • src/socket/kernel/linux/amd64/Makefile

    diff -Naur libc.orig/src/socket/kernel/linux/amd64/Makefile libc/src/socket/kernel/linux/amd64/Makefile
    old new  
     1
     2
     3all:
     4
     5clean:
     6
     7distclean: clean
     8
     9install: all
     10
     11uninstall:
     12
     13.PHONY: all clean distclean install uninstall
  • src/socket/kernel/linux/amd64/project.conf

    diff -Naur libc.orig/src/socket/kernel/linux/amd64/project.conf libc/src/socket/kernel/linux/amd64/project.conf
    old new  
     1dist=Makefile,syscalls.S
  • src/socket/kernel/linux/amd64/syscalls.S

    diff -Naur libc.orig/src/socket/kernel/linux/amd64/syscalls.S libc/src/socket/kernel/linux/amd64/syscalls.S
    old new  
     1/* $Id$ */
     2/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
     3/* This file is part of DeforaOS System libc */
     4/* This program is free software: you can redistribute it and/or modify
     5 * it under the terms of the GNU General Public License as published by
     6 * the Free Software Foundation, version 3 of the License.
     7 *
     8 * This program is distributed in the hope that it will be useful,
     9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11 * GNU General Public License for more details.
     12 *
     13 * You should have received a copy of the GNU General Public License
     14 * along with this program.  If not, see <http://www.gnu.org/licenses/>. */
     15
     16
     17
     18_syscall:
     19        mov     %rcx, %r10
     20        syscall
     21        jnc     .errnoret
     22.errno:
     23#ifdef PIC
     24        mov     errno@GOTPCREL(%rip), %rcx
     25        mov     %rax, (%rcx)
     26#else
     27        mov     %rax, errno
     28#endif
     29        mov     $-1, %rax
     30.errnoret:
     31        ret
     32
     33
     34/* macros */
     35#ifdef PIC
     36# define SYSCALL(name) \
     37.global name; \
     38.type name,@function; \
     39name:; \
     40        mov     $SYS_ ## name, %rax; \
     41        jmp     _syscall@PLT
     42#else
     43# define SYSCALL(name) \
     44.global name; \
     45.type name,@function; \
     46name:; \
     47        mov     $SYS_ ## name, %rax; \
     48        jmp     _syscall
     49#endif
Note: See TracBrowser for help on using the repository browser.