Skip to content

Commit

Permalink
Merge #19064
Browse files Browse the repository at this point in the history
19064: native: Remove code used for __MACH__ target r=benpicco a=Teufelchen1

### Contribution description

This PR removes code that was used to support macOS as native target. 
macOS / `__MACH__` is no longer supported by RIOT on master.

### Testing procedure

If murdock is happy, that should be enough.


Co-authored-by: Teufelchen1 <[email protected]>
  • Loading branch information
bors[bot] and Teufelchen1 authored Dec 27, 2022
2 parents c9d3bae + c9e9a8d commit 11d81d2
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 64 deletions.
5 changes: 1 addition & 4 deletions cpu/native/include/native_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* check here for more:
* http://sourceforge.net/p/predef/wiki/OperatingSystems/
*/
#if (defined(__FreeBSD__) || defined(__MACH__))
#ifdef __FreeBSD__
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#include <ucontext.h>
Expand Down Expand Up @@ -136,10 +136,7 @@ extern mode_t (*real_umask)(mode_t cmask);
extern ssize_t (*real_writev)(int fildes, const struct iovec *iov, int iovcnt);
extern ssize_t (*real_send)(int sockfd, const void *buf, size_t len, int flags);

#ifdef __MACH__
#else
extern int (*real_clock_gettime)(clockid_t clk_id, struct timespec *tp);
#endif

/**
* data structures
Expand Down
4 changes: 0 additions & 4 deletions cpu/native/include/netdev_tap.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ extern "C" {

#include "net/ethernet/hdr.h"

#ifdef __MACH__
#include "net/if_var.h"
#else
#include "net/if.h"
#endif

/**
* @brief tap interface state
Expand Down
10 changes: 1 addition & 9 deletions cpu/native/irq_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,7 @@ void native_isr_entry(int sig, siginfo_t *info, void *context)
/* disable interrupts in context */
isr_set_sigmask((ucontext_t *)context);
_native_in_isr = 1;
/*
* For register access on new platforms see:
* http://google-glog.googlecode.com/svn/trunk/m4/pc_from_ucontext.m4
* (URL added on Fri Aug 29 17:17:45 CEST 2014)
*/
#ifdef __MACH__
_native_saved_eip = ((ucontext_t *)context)->uc_mcontext->__ss.__eip;
((ucontext_t *)context)->uc_mcontext->__ss.__eip = (unsigned int)&_native_sig_leave_tramp;
#elif defined(__FreeBSD__)
#if defined(__FreeBSD__)
_native_saved_eip = ((struct sigcontext *)context)->sc_eip;
((struct sigcontext *)context)->sc_eip = (unsigned int)&_native_sig_leave_tramp;
#else /* Linux */
Expand Down
5 changes: 1 addition & 4 deletions cpu/native/native_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ char __end_stack[SIGSTKSZ];
*/
static void _native_mod_ctx_leave_sigh(ucontext_t *ctx)
{
#ifdef __MACH__
_native_saved_eip = ((ucontext_t *)ctx)->uc_mcontext->__ss.__eip;
((ucontext_t *)ctx)->uc_mcontext->__ss.__eip = (unsigned int)&_native_sig_leave_handler;
#elif defined(__FreeBSD__)
#if defined(__FreeBSD__)
_native_saved_eip = ((struct sigcontext *)ctx)->sc_eip;
((struct sigcontext *)ctx)->sc_eip = (unsigned int)&_native_sig_leave_handler;
#else /* Linux */
Expand Down
7 changes: 1 addition & 6 deletions cpu/native/netdev_tap/netdev_tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@
/* needs to be included before native's declarations of ntohl etc. */
#include "byteorder.h"

#ifdef __MACH__
#include <net/if.h>
#include <sys/types.h>
#include <ifaddrs.h>
#include <net/if_dl.h>
#elif defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/socket.h>
#include <net/if.h>
#include <ifaddrs.h>
Expand Down
10 changes: 0 additions & 10 deletions cpu/native/periph/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,21 +203,11 @@ unsigned int timer_read(tim_t dev)
DEBUG("timer_read()\n");

_native_syscall_enter();
#ifdef __MACH__
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
t.tv_sec = mts.tv_sec;
t.tv_nsec = mts.tv_nsec;
#else

if (real_clock_gettime(CLOCK_MONOTONIC, &t) == -1) {
err(EXIT_FAILURE, "timer_read: clock_gettime");
}

#endif
_native_syscall_leave();

return ts2ticks(&t) - time_null;
Expand Down
28 changes: 1 addition & 27 deletions cpu/native/tramp.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,7 @@

.text

#ifdef __MACH__
.globl __native_sig_leave_tramp
__native_sig_leave_tramp:
pushl __native_saved_eip
pushfl
pushal

pushl __native_isr_ctx
pushl __native_cur_ctx
call _swapcontext
addl $8, %esp

call _irq_enable

movl $0x0, __native_in_isr
popal
popfl

ret

.globl __native_sig_leave_handler
__native_sig_leave_handler:
pushl __native_saved_eip
movl $0x0, __native_in_isr
ret

#elif __arm__
#ifdef __arm__

.globl _native_sig_leave_tramp
_native_sig_leave_tramp:
Expand Down

0 comments on commit 11d81d2

Please sign in to comment.