Add missing patches.

This commit is contained in:
ryoon 2014-10-15 13:43:32 +00:00
parent f16a8a115a
commit f4c867b422
24 changed files with 1298 additions and 0 deletions

View file

@ -0,0 +1,27 @@
$NetBSD: patch-content_media_gmp_GMPChild.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- content/media/gmp/GMPChild.cpp.orig 2014-10-11 09:06:20.000000000 +0000
+++ content/media/gmp/GMPChild.cpp
@@ -66,19 +66,11 @@ GetPluginFile(const std::string& aPlugin
}
#endif
- nsCOMPtr<nsIFile> parent;
- rv = aLibFile->GetParent(getter_AddRefs(parent));
- if (NS_FAILED(rv)) {
- return false;
- }
-
- nsAutoString parentLeafName;
- rv = parent->GetLeafName(parentLeafName);
- if (NS_FAILED(rv)) {
+ nsAutoString leafName;
+ if (NS_FAILED(aLibFile->GetLeafName(leafName))) {
return false;
}
-
- nsAutoString baseName(Substring(parentLeafName, 4, parentLeafName.Length() - 1));
+ nsAutoString baseName(Substring(leafName, 4, leafName.Length() - 1));
#if defined(XP_MACOSX)
nsAutoString binaryName = NS_LITERAL_STRING("lib") + baseName + NS_LITERAL_STRING(".dylib");

View file

@ -0,0 +1,33 @@
$NetBSD: patch-content_media_gmp_GMPParent.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- content/media/gmp/GMPParent.cpp.orig 2014-10-11 09:06:20.000000000 +0000
+++ content/media/gmp/GMPParent.cpp
@@ -87,23 +87,16 @@ GMPParent::Init(GeckoMediaPluginService
mService = aService;
mDirectory = aPluginDir;
- // aPluginDir is <profile-dir>/<gmp-plugin-id>/<version>
- // where <gmp-plugin-id> should be gmp-gmpopenh264
- nsCOMPtr<nsIFile> parent;
- nsresult rv = aPluginDir->GetParent(getter_AddRefs(parent));
- if (NS_FAILED(rv)) {
- return rv;
- }
- nsAutoString parentLeafName;
- rv = parent->GetLeafName(parentLeafName);
+ nsAutoString leafname;
+ nsresult rv = aPluginDir->GetLeafName(leafname);
if (NS_FAILED(rv)) {
return rv;
}
LOGD(("%s::%s: %p for %s", __CLASS__, __FUNCTION__, this,
- NS_LossyConvertUTF16toASCII(parentLeafName).get()));
+ NS_LossyConvertUTF16toASCII(leafname).get()));
- MOZ_ASSERT(parentLeafName.Length() > 4);
- mName = Substring(parentLeafName, 4);
+ MOZ_ASSERT(leafname.Length() > 4);
+ mName = Substring(leafname, 4);
return ReadGMPMetaData();
}

View file

@ -0,0 +1,9 @@
$NetBSD: patch-media_libcubeb_AUTHORS,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- media/libcubeb/AUTHORS.orig 2014-10-11 09:06:39.000000000 +0000
+++ media/libcubeb/AUTHORS
@@ -4,3 +4,4 @@ Michael Wu <mwu@mozilla.com>
Paul Adenot <paul@paul.cx>
David Richards <drichards@mozilla.com>
Sebastien Alaiwan <sebastien.alaiwan@gmail.com>
+Evgeniy Vodolazskiy <waterlaz@gmail.com>

View file

@ -0,0 +1,24 @@
$NetBSD: patch-media_libcubeb_src_cubeb.c,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- media/libcubeb/src/cubeb.c.orig 2014-10-11 09:06:39.000000000 +0000
+++ media/libcubeb/src/cubeb.c
@@ -54,6 +54,9 @@ int opensl_init(cubeb ** context, char c
#if defined(USE_AUDIOTRACK)
int audiotrack_init(cubeb ** context, char const * context_name);
#endif
+#if defined(USE_OSS)
+int oss_init(cubeb ** context, char const * context_name);
+#endif
int
validate_stream_params(cubeb_stream_params stream_params)
@@ -120,6 +123,9 @@ cubeb_init(cubeb ** context, char const
#if defined(USE_AUDIOTRACK)
audiotrack_init,
#endif
+#if defined(USE_OSS)
+ oss_init,
+#endif
};
int i;

View file

@ -0,0 +1,404 @@
$NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- media/libcubeb/src/cubeb_oss.c.orig 2014-10-14 18:49:14.000000000 +0000
+++ media/libcubeb/src/cubeb_oss.c
@@ -0,0 +1,399 @@
+/*
+ * Copyright © 2014 Mozilla Foundation
+ *
+ * This program is made available under an ISC-style license. See the
+ * accompanying file LICENSE for details.
+ */
+#if defined(HAVE_SYS_SOUNDCARD_H)
+#include <sys/soundcard.h>
+#elif defined(HAVE_LINUX_SOUNDCARD_H)
+#include <linux/soundcard.h>
+#else
+#include <soundcard.h>
+#endif
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+
+#include "cubeb/cubeb.h"
+#include "cubeb-internal.h"
+
+#ifndef CUBEB_OSS_DEFAULT_OUTPUT
+#define CUBEB_OSS_DEFAULT_OUTPUT "/dev/dsp"
+#endif
+
+#define OSS_BUFFER_SIZE 1024
+
+struct cubeb {
+ struct cubeb_ops const * ops;
+};
+
+struct cubeb_stream {
+ cubeb * context;
+
+ cubeb_data_callback data_callback;
+ cubeb_state_callback state_callback;
+ void * user_ptr;
+ float volume;
+ float panning;
+
+ pthread_mutex_t state_mutex;
+ pthread_cond_t state_cond;
+
+ int running;
+ int stopped;
+ int floating;
+
+ /* These two vars are needed to support old versions of OSS */
+ unsigned int position_bytes;
+ unsigned int last_position_bytes;
+
+ uint64_t written_frags; /* The number of fragments written to /dev/dsp */
+ uint64_t missed_frags; /* fragments output with stopped stream */
+
+ cubeb_stream_params params;
+ int fd;
+ pthread_t th;
+};
+
+static struct cubeb_ops const oss_ops;
+
+int oss_init(cubeb ** context, char const * context_name)
+{
+ cubeb* ctx = (cubeb*)malloc(sizeof(cubeb));
+ ctx->ops = &oss_ops;
+ *context = ctx;
+ return CUBEB_OK;
+}
+
+static void oss_destroy(cubeb *ctx)
+{
+ free(ctx);
+}
+
+static char const * oss_get_backend_id(cubeb * context)
+{
+ static char oss_name[] = "oss";
+ return oss_name;
+}
+
+static int oss_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
+{
+ *max_channels = 2; /* Let's support only stereo for now */
+ return CUBEB_OK;
+}
+
+static int oss_get_min_latency(cubeb * context, cubeb_stream_params params,
+ uint32_t * latency_ms)
+{
+ /* 40ms is a big enough number to work ok */
+ *latency_ms = 40;
+ return CUBEB_OK;
+}
+
+static int oss_get_preferred_sample_rate(cubeb *context, uint32_t * rate)
+{
+ /* 48000 seems a prefered choice for most audio devices
+ * and a good choice for OSS */
+ *rate = 48000;
+ return CUBEB_OK;
+}
+
+static void run_state_callback(cubeb_stream *stream, cubeb_state state)
+{
+ if (stream->state_callback) {
+ stream->state_callback(stream, stream->user_ptr, state);
+ }
+}
+
+static long run_data_callback(cubeb_stream *stream, void *buffer, long nframes)
+{
+ long got = 0;
+ pthread_mutex_lock(&stream->state_mutex);
+ if (stream->data_callback && stream->running && !stream->stopped) {
+ pthread_mutex_unlock(&stream->state_mutex);
+ got = stream->data_callback(stream, stream->user_ptr, buffer, nframes);
+ } else {
+ pthread_mutex_unlock(&stream->state_mutex);
+ }
+ return got;
+}
+
+static void apply_volume(int16_t* buffer, unsigned int n,
+ float volume, float panning)
+{
+ float left = volume;
+ float right = volume;
+ unsigned int i;
+ int pan[2];
+ if (panning<0) {
+ right *= (1+panning);
+ } else {
+ left *= (1-panning);
+ }
+ pan[0] = 128.0*left;
+ pan[1] = 128.0*right;
+ for(i=0; i<n; i++){
+ buffer[i] = ((int)buffer[i])*pan[i%2]/128;
+ }
+}
+
+static void *writer(void *stm)
+{
+ cubeb_stream* stream = (cubeb_stream*)stm;
+ int16_t buffer[OSS_BUFFER_SIZE];
+ float f_buffer[OSS_BUFFER_SIZE];
+ int got;
+ unsigned long i;
+ while (stream->running) {
+ pthread_mutex_lock(&stream->state_mutex);
+ if (stream->stopped) {
+ pthread_mutex_unlock(&stream->state_mutex);
+ run_state_callback(stream, CUBEB_STATE_STOPPED);
+ pthread_mutex_lock(&stream->state_mutex);
+ while (stream->stopped) {
+ pthread_cond_wait(&stream->state_cond, &stream->state_mutex);
+ }
+ pthread_mutex_unlock(&stream->state_mutex);
+ run_state_callback(stream, CUBEB_STATE_STARTED);
+ continue;
+ }
+ pthread_mutex_unlock(&stream->state_mutex);
+ if (stream->floating) {
+ got = run_data_callback(stream, f_buffer,
+ OSS_BUFFER_SIZE/stream->params.channels);
+ for (i=0; i<((unsigned long)got)*stream->params.channels; i++) {
+ buffer[i] = f_buffer[i]*32767.0;
+ }
+ } else {
+ got = run_data_callback(stream, buffer,
+ OSS_BUFFER_SIZE/stream->params.channels);
+ }
+ apply_volume(buffer, got*stream->params.channels,
+ stream->volume, stream->panning);
+ if (got<0) {
+ run_state_callback(stream, CUBEB_STATE_ERROR);
+ break;
+ }
+ if (!got) {
+ run_state_callback(stream, CUBEB_STATE_DRAINED);
+ }
+ if (got) {
+ size_t i = 0;
+ size_t s = got*stream->params.channels*sizeof(int16_t);
+ while (i < s) {
+ ssize_t n = write(stream->fd, ((char*)buffer) + i, s - i);
+ if (n<=0) {
+ run_state_callback(stream, CUBEB_STATE_ERROR);
+ break;
+ }
+ i+=n;
+ }
+ stream->written_frags+=got;
+ }
+ }
+ return NULL;
+}
+
+static void oss_try_set_latency(cubeb_stream* stream, unsigned int latency)
+{
+ unsigned int latency_bytes, n_frag;
+ int frag;
+ /* fragment size of 1024 is a good choice with good chances to be accepted */
+ unsigned int frag_size=1024;
+ unsigned int frag_log=10; /* 2^frag_log = frag_size */
+ latency_bytes =
+ latency*stream->params.rate*stream->params.channels*sizeof(uint16_t)/1000;
+ n_frag = latency_bytes>>frag_log;
+ frag = (n_frag<<16) | frag_log;
+ /* Even if this fails we wish to continue, not checking for errors */
+ ioctl(stream->fd, SNDCTL_DSP_SETFRAGMENT, &frag);
+}
+
+static int oss_stream_init(cubeb * context, cubeb_stream ** stm,
+ char const * stream_name,
+ cubeb_stream_params stream_params,
+ unsigned int latency,
+ cubeb_data_callback data_callback,
+ cubeb_state_callback state_callback, void * user_ptr)
+{
+ cubeb_stream* stream = (cubeb_stream*)malloc(sizeof(cubeb_stream));
+ stream->context = context;
+ stream->data_callback = data_callback;
+ stream->state_callback = state_callback;
+ stream->user_ptr = user_ptr;
+
+ if ((stream->fd = open(CUBEB_OSS_DEFAULT_OUTPUT, O_WRONLY)) == -1) {
+ free(stream);
+ return CUBEB_ERROR;
+ }
+#define SET(what, to) do { unsigned int i = to; \
+ int j = ioctl(stream->fd, what, &i); \
+ if (j == -1 || i != to) { \
+ close(stream->fd); \
+ free(stream); \
+ return CUBEB_ERROR_INVALID_FORMAT; } } while (0)
+
+ stream->params = stream_params;
+ stream->volume = 1.0;
+ stream->panning = 0.0;
+
+ oss_try_set_latency(stream, latency);
+
+ stream->floating = 0;
+ SET(SNDCTL_DSP_CHANNELS, stream_params.channels);
+ SET(SNDCTL_DSP_SPEED, stream_params.rate);
+ switch (stream_params.format) {
+ case CUBEB_SAMPLE_S16LE:
+ SET(SNDCTL_DSP_SETFMT, AFMT_S16_LE);
+ break;
+ case CUBEB_SAMPLE_S16BE:
+ SET(SNDCTL_DSP_SETFMT, AFMT_S16_BE);
+ break;
+ case CUBEB_SAMPLE_FLOAT32LE:
+ SET(SNDCTL_DSP_SETFMT, AFMT_S16_NE);
+ stream->floating = 1;
+ break;
+ default:
+ close(stream->fd);
+ free(stream);
+ return CUBEB_ERROR;
+ }
+
+
+ pthread_mutex_init(&stream->state_mutex, NULL);
+ pthread_cond_init(&stream->state_cond, NULL);
+
+ stream->running = 1;
+ stream->stopped = 1;
+ stream->position_bytes = 0;
+ stream->last_position_bytes = 0;
+ stream->written_frags = 0;
+ stream->missed_frags = 0;
+
+ pthread_create(&stream->th, NULL, writer, (void*)stream);
+
+ *stm = stream;
+
+ return CUBEB_OK;
+}
+
+static void oss_stream_destroy(cubeb_stream * stream)
+{
+ pthread_mutex_lock(&stream->state_mutex);
+
+ stream->running = 0;
+ stream->stopped = 0;
+ pthread_cond_signal(&stream->state_cond);
+
+ pthread_mutex_unlock(&stream->state_mutex);
+
+ pthread_join(stream->th, NULL);
+
+ pthread_mutex_destroy(&stream->state_mutex);
+ pthread_cond_destroy(&stream->state_cond);
+ close(stream->fd);
+ free(stream);
+}
+
+static int oss_stream_get_latency(cubeb_stream * stream, uint32_t * latency)
+{
+ if (ioctl(stream->fd, SNDCTL_DSP_GETODELAY, latency)==-1) {
+ return CUBEB_ERROR;
+ }
+ /* Convert latency from bytes to frames */
+ *latency /= stream->params.channels*sizeof(int16_t);
+ return CUBEB_OK;
+}
+
+
+static int oss_stream_current_optr(cubeb_stream * stream, uint64_t * position)
+{
+ count_info ci;
+ /* Unfortunately, this ioctl is only available in OSS 4.x */
+#ifdef SNDCTL_DSP_CURRENT_OPTR
+ oss_count_t count;
+ if (ioctl(stream->fd, SNDCTL_DSP_CURRENT_OPTR, &count) != -1) {
+ *position = count.samples;// + count.fifo_samples;
+ return CUBEB_OK;
+ }
+#endif
+ /* Fall back to this ioctl in case the previous one fails */
+ if (ioctl(stream->fd, SNDCTL_DSP_GETOPTR, &ci) == -1) {
+ return CUBEB_ERROR;
+ }
+ /* ci.bytes is only 32 bit and will start to wrap after arithmetic overflow */
+ stream->position_bytes += ci.bytes - stream->last_position_bytes;
+ stream->last_position_bytes = ci.bytes;
+ *position = stream->position_bytes/stream->params.channels/sizeof(int16_t);
+ return CUBEB_OK;
+}
+
+static int oss_stream_get_position(cubeb_stream * stream, uint64_t * position)
+{
+ if ( oss_stream_current_optr(stream, position) == CUBEB_OK ){
+ *position -= stream->missed_frags;
+ return CUBEB_OK;
+ }
+ /* If no correct method to get position works we resort to this */
+ *position = stream->written_frags;
+ return CUBEB_OK;
+}
+
+
+static int oss_stream_start(cubeb_stream * stream)
+{
+ pthread_mutex_lock(&stream->state_mutex);
+ if (stream->stopped) {
+ uint64_t ptr;
+ oss_stream_current_optr(stream, &ptr);
+ stream->missed_frags = ptr - stream->written_frags;
+ stream->stopped = 0;
+ pthread_cond_signal(&stream->state_cond);
+ }
+ pthread_mutex_unlock(&stream->state_mutex);
+ return CUBEB_OK;
+}
+
+static int oss_stream_stop(cubeb_stream * stream)
+{
+ pthread_mutex_lock(&stream->state_mutex);
+ stream->stopped = 1;
+ pthread_mutex_unlock(&stream->state_mutex);
+ return CUBEB_OK;
+}
+
+int oss_stream_set_panning(cubeb_stream * stream, float panning)
+{
+ if (stream->params.channels == 2) {
+ stream->panning=panning;
+ }
+ return CUBEB_OK;
+}
+
+int oss_stream_set_volume(cubeb_stream * stream, float volume)
+{
+ stream->volume=volume;
+ return CUBEB_OK;
+}
+
+static struct cubeb_ops const oss_ops = {
+ .init = oss_init,
+ .get_backend_id = oss_get_backend_id,
+ .get_max_channel_count = oss_get_max_channel_count,
+ .get_min_latency = oss_get_min_latency,
+ .get_preferred_sample_rate = oss_get_preferred_sample_rate,
+ .destroy = oss_destroy,
+ .stream_init = oss_stream_init,
+ .stream_destroy = oss_stream_destroy,
+ .stream_start = oss_stream_start,
+ .stream_stop = oss_stream_stop,
+ .stream_get_position = oss_stream_get_position,
+ .stream_get_latency = oss_stream_get_latency
+};

View file

@ -0,0 +1,18 @@
$NetBSD: patch-media_libstagefright_frameworks_av_media_libstagefright_foundation_AString.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- media/libstagefright/frameworks/av/media/libstagefright/foundation/AString.cpp.orig 2014-10-11 09:06:39.000000000 +0000
+++ media/libstagefright/frameworks/av/media/libstagefright/foundation/AString.cpp
@@ -23,6 +23,13 @@
#include "ADebug.h"
#include "AString.h"
+#ifdef __FreeBSD__
+# include <osreldate.h>
+# if __FreeBSD_version < 900506
+# undef tolower
+# endif
+#endif
+
namespace stagefright {
// static

View file

@ -0,0 +1,13 @@
$NetBSD: patch-media_webrtc_trunk_webrtc_modules_desktop__capture_screen__capturer.cc,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer.cc.orig 2014-10-11 09:06:41.000000000 +0000
+++ media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer.cc
@@ -18,7 +18,7 @@ ScreenCapturer* ScreenCapturer::Create()
return Create(DesktopCaptureOptions::CreateDefault());
}
-#if defined(WEBRTC_LINUX)
+#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
ScreenCapturer* ScreenCapturer::CreateWithXDamage(
bool use_update_notifications) {
DesktopCaptureOptions options;

View file

@ -0,0 +1,13 @@
$NetBSD: patch-media_webrtc_trunk_webrtc_modules_desktop__capture_screen__capturer.h,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer.h.orig 2014-10-11 09:06:41.000000000 +0000
+++ media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer.h
@@ -74,7 +74,7 @@ class ScreenCapturer : public DesktopCap
static ScreenCapturer* Create(const DesktopCaptureOptions& options);
static ScreenCapturer* Create();
-#if defined(WEBRTC_LINUX)
+#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
// Creates platform-specific capturer and instructs it whether it should use
// X DAMAGE support.
static ScreenCapturer* CreateWithXDamage(bool use_x_damage);

View file

@ -0,0 +1,18 @@
$NetBSD: patch-mfbt_Atomics.h,v 1.3 2014/10/15 13:43:32 ryoon Exp $
--- mfbt/Atomics.h.orig 2014-10-11 09:06:41.000000000 +0000
+++ mfbt/Atomics.h
@@ -34,10 +34,12 @@
* loose typing of the atomic builtins. GCC 4.5 and 4.6 lacks inline
* definitions for unspecialized std::atomic and causes linking errors.
* Therefore, we require at least 4.7.0 for using libstdc++.
+ *
+ * libc++ <atomic> is only functional with clang.
*/
# if MOZ_USING_LIBSTDCXX && MOZ_LIBSTDCXX_VERSION_AT_LEAST(4, 7, 0)
# define MOZ_HAVE_CXX11_ATOMICS
-# elif MOZ_USING_LIBCXX
+# elif MOZ_USING_LIBCXX && defined(__clang__)
# define MOZ_HAVE_CXX11_ATOMICS
# endif
#elif defined(_MSC_VER) && _MSC_VER >= 1700

View file

@ -0,0 +1,38 @@
$NetBSD: patch-toolkit_modules_GMPInstallManager.jsm,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- toolkit/modules/GMPInstallManager.jsm.orig 2014-10-11 09:06:48.000000000 +0000
+++ toolkit/modules/GMPInstallManager.jsm
@@ -107,6 +107,7 @@ let GMPPrefs = {
*/
KEY_LOG_ENABLED: "media.gmp-manager.log",
KEY_ADDON_LAST_UPDATE: "media.{0}.lastUpdate",
+ KEY_ADDON_PATH: "media.{0}.path",
KEY_ADDON_VERSION: "media.{0}.version",
KEY_ADDON_AUTOUPDATE: "media.{0}.autoupdate",
KEY_URL: "media.gmp-manager.url",
@@ -888,9 +889,7 @@ GMPDownloader.prototype = {
let gmpAddon = this._gmpAddon;
let installToDirPath = Cc["@mozilla.org/file/local;1"].
createInstance(Ci.nsIFile);
- let path = OS.Path.join(OS.Constants.Path.profileDir,
- gmpAddon.id,
- gmpAddon.version);
+ let path = OS.Path.join(OS.Constants.Path.profileDir, gmpAddon.id);
installToDirPath.initWithPath(path);
log.info("install to directory path: " + installToDirPath.path);
let gmpInstaller = new GMPExtractor(zipPath, installToDirPath.path);
@@ -899,10 +898,12 @@ GMPDownloader.prototype = {
// Success, set the prefs
let now = Math.round(Date.now() / 1000);
GMPPrefs.set(GMPPrefs.KEY_ADDON_LAST_UPDATE, now, gmpAddon.id);
- // Setting the version pref signals installation completion to consumers,
- // if you need to set other prefs etc. do it before this.
+ // Setting the path pref signals installation completion to consumers,
+ // so set the version and potential other information they use first.
GMPPrefs.set(GMPPrefs.KEY_ADDON_VERSION, gmpAddon.version,
gmpAddon.id);
+ GMPPrefs.set(GMPPrefs.KEY_ADDON_PATH,
+ installToDirPath.path, gmpAddon.id);
this._deferred.resolve(extractedPaths);
}, err => {
this._deferred.reject(err);

View file

@ -0,0 +1,118 @@
$NetBSD: patch-toolkit_mozapps_extensions_internal_OpenH264Provider.jsm,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- toolkit/mozapps/extensions/internal/OpenH264Provider.jsm.orig 2014-10-11 09:06:49.000000000 +0000
+++ toolkit/mozapps/extensions/internal/OpenH264Provider.jsm
@@ -29,6 +29,7 @@ const SEC_IN_A_DAY = 24 * 6
const OPENH264_PLUGIN_ID = "gmp-gmpopenh264";
const OPENH264_PREF_BRANCH = "media." + OPENH264_PLUGIN_ID + ".";
const OPENH264_PREF_ENABLED = "enabled";
+const OPENH264_PREF_PATH = "path";
const OPENH264_PREF_VERSION = "version";
const OPENH264_PREF_LASTUPDATE = "lastUpdate";
const OPENH264_PREF_AUTOUPDATE = "autoupdate";
@@ -99,7 +100,12 @@ let OpenH264Wrapper = {
get description() { return pluginsBundle.GetStringFromName("openH264_description"); },
get fullDescription() { return OPENH264_FULLDESCRIPTION; },
- get version() { return prefs.get(OPENH264_PREF_VERSION, ""); },
+ get version() {
+ if (this.isInstalled) {
+ return prefs.get(OPENH264_PREF_VERSION, "");
+ }
+ return "";
+ },
get isActive() { return !this.userDisabled; },
get appDisabled() { return false; },
@@ -223,24 +229,17 @@ let OpenH264Wrapper = {
get pluginMimeTypes() { return []; },
get pluginLibraries() {
- if (this.isInstalled) {
- let path = this.version;
- return [path];
- }
- return [];
+ let path = prefs.get(OPENH264_PREF_PATH, null);
+ return path && path.length ? [OS.Path.basename(path)] : [];
},
get pluginFullpath() {
- if (this.isInstalled) {
- let path = OS.Path.join(OS.Constants.Path.profileDir,
- OPENH264_PLUGIN_ID,
- this.version);
- return [path];
- }
- return [];
+ let path = prefs.get(OPENH264_PREF_PATH, null);
+ return path && path.length ? [path] : [];
},
get isInstalled() {
- return this.version.length > 0;
+ let path = prefs.get(OPENH264_PREF_PATH, "");
+ return path.length > 0;
},
};
@@ -251,19 +250,14 @@ let OpenH264Provider = {
"OpenH264Provider" + "::");
OpenH264Wrapper._log = Log.repository.getLoggerWithMessagePrefix("Toolkit.OpenH264Provider",
"OpenH264Wrapper" + "::");
- this.gmpPath = null;
- if (OpenH264Wrapper.isInstalled) {
- this.gmpPath = OS.Path.join(OS.Constants.Path.profileDir,
- OPENH264_PLUGIN_ID,
- prefs.get(OPENH264_PREF_VERSION, null));
- }
+ this.gmpPath = prefs.get(OPENH264_PREF_PATH, null);
let enabled = prefs.get(OPENH264_PREF_ENABLED, true);
this._log.trace("startup() - enabled=" + enabled + ", gmpPath="+this.gmpPath);
Services.obs.addObserver(this, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, false);
prefs.observe(OPENH264_PREF_ENABLED, this.onPrefEnabledChanged, this);
- prefs.observe(OPENH264_PREF_VERSION, this.onPrefVersionChanged, this);
+ prefs.observe(OPENH264_PREF_PATH, this.onPrefPathChanged, this);
prefs.observe(OPENH264_PREF_LOGGING, configureLogging);
if (this.gmpPath && enabled) {
@@ -280,7 +274,7 @@ let OpenH264Provider = {
this._log.trace("shutdown()");
Services.obs.removeObserver(this, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
prefs.ignore(OPENH264_PREF_ENABLED, this.onPrefEnabledChanged, this);
- prefs.ignore(OPENH264_PREF_VERSION, this.onPrefVersionChanged, this);
+ prefs.ignore(OPENH264_PREF_PATH, this.onPrefPathChanged, this);
prefs.ignore(OPENH264_PREF_LOGGING, configureLogging);
return OpenH264Wrapper._updateTask;
@@ -306,25 +300,20 @@ let OpenH264Provider = {
wrapper);
},
- onPrefVersionChanged: function() {
+ onPrefPathChanged: function() {
let wrapper = OpenH264Wrapper;
AddonManagerPrivate.callAddonListeners("onUninstalling", wrapper, false);
if (this.gmpPath) {
- this._log.info("onPrefVersionChanged() - unregistering gmp directory " + this.gmpPath);
+ this._log.info("onPrefPathChanged() - removing gmp directory " + this.gmpPath);
gmpService.removePluginDirectory(this.gmpPath);
}
AddonManagerPrivate.callAddonListeners("onUninstalled", wrapper);
AddonManagerPrivate.callInstallListeners("onExternalInstall", null, wrapper, null, false);
- this.gmpPath = null;
- if (OpenH264Wrapper.isInstalled) {
- this.gmpPath = OS.Path.join(OS.Constants.Path.profileDir,
- OPENH264_PLUGIN_ID,
- prefs.get(OPENH264_PREF_VERSION, null));
- }
+ this.gmpPath = prefs.get(OPENH264_PREF_PATH, null);
if (this.gmpPath && wrapper.isActive) {
- this._log.info("onPrefVersionChanged() - registering gmp directory " + this.gmpPath);
+ this._log.info("onPrefPathChanged() - adding gmp directory " + this.gmpPath);
gmpService.addPluginDirectory(this.gmpPath);
}
AddonManagerPrivate.callAddonListeners("onInstalled", wrapper);

View file

@ -0,0 +1,44 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_Makefile.in,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/Makefile.in.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/Makefile.in
@@ -56,6 +56,39 @@ endif
# SPARC
######################################################################
#
+# Linux/SPARC
+#
+ifeq ($(OS_ARCH),Linux)
+ifneq (,$(findstring sparc,$(OS_TEST)))
+ASFILES := xptcinvoke_asm_sparc_linux_GCC3.s xptcstubs_asm_sparc_solaris.s
+endif
+endif
+#
+# NetBSD/SPARC
+#
+ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc)
+ASFILES := xptcinvoke_asm_sparc_netbsd.s xptcstubs_asm_sparc_netbsd.s
+endif
+#
+# OpenBSD/SPARC
+#
+ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDsparc)
+ASFILES := xptcinvoke_asm_sparc_openbsd.s xptcstubs_asm_sparc_openbsd.s
+endif
+#
+# OpenBSD/SPARC64
+#
+ifneq (,$(filter OpenBSDsparc64 FreeBSDsparc64,$(OS_ARCH)$(OS_TEST)))
+ASFILES := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_openbsd.s
+endif
+#
+# NetBSD/SPARC64
+#
+ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc64)
+CPPSRCS := xptcinvoke_sparc64_netbsd.cpp xptcstubs_sparc64_openbsd.cpp
+ASFILES := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_netbsd.s
+endif
+#
# Solaris/SPARC
#
ifeq ($(OS_ARCH),SunOS)

View file

@ -0,0 +1,30 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_moz.build,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/moz.build.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/moz.build
@@ -9,7 +9,7 @@ if CONFIG['OS_ARCH'] == 'Darwin':
'xptcinvoke_darwin.cpp',
'xptcstubs_darwin.cpp',
]
- if CONFIG['OS_TEST'] == 'powerpc':
+ if CONFIG['OS_TEST'] == 'ppc':
SOURCES += [
'xptcinvoke_asm_ppc_rhapsody.s',
]
@@ -19,14 +19,14 @@ if CONFIG['OS_ARCH'] == 'Darwin':
if '86' in CONFIG['OS_TEST'] and CONFIG['OS_TEST'] != 'x86_64':
DEFINES['MOZ_NEED_LEADING_UNDERSCORE'] = True
-if CONFIG['OS_ARCH'] in ('NetBSD', 'OpenBSD', 'GNU'):
+if CONFIG['OS_ARCH'] in ('OpenBSD', 'GNU'):
if CONFIG['CPU_ARCH'] == 'x86':
SOURCES += [
'xptcinvoke_gcc_x86_unix.cpp',
'xptcstubs_gcc_x86_unix.cpp'
]
-if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD') or \
+if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD', 'NetBSD', 'DragonFly') or \
CONFIG['OS_ARCH'].startswith('GNU_'):
if CONFIG['OS_TEST'] == 'x86_64':
SOURCES += [

View file

@ -0,0 +1,52 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__asm__mips.S,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_mips.S.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_mips.S
@@ -16,6 +16,47 @@
#include <sys/asm.h>
#endif
+#ifdef __NetBSD__
+# include <machine/regdef.h>
+# include <machine/asm.h>
+# ifndef fp
+# define fp s8
+# endif
+# ifndef PTRLOG
+# if SZREG == 4
+# define PTRLOG 2
+# else
+# define PTRLOG 3
+# endif
+# endif
+# ifndef SETUP_GP
+# if defined(__mips_o32)
+# define SETUP_GP \
+ .set push; \
+ .set noreorder; \
+ .cpload t9; \
+ .set pop
+# define SAVE_GP(x) \
+ .cprestore x
+# else
+# define SETUP_GP
+# define SAVE_GP(x)
+# endif
+# endif
+# ifndef ALSZ
+# if defined(__mips_n32) || defined(__mips_n64)
+# define ALSZ 15
+# define ALMASK ~15
+# else
+# define ALSZ 7
+# define ALMASK ~7
+# endif
+# endif
+#else
+# include <sys/regdef.h>
+# include <sys/asm.h>
+#endif
+
# NARGSAVE is the argument space in the callers frame, including extra
# 'shadowed' space for the argument registers. The minimum of 4
# argument slots is sometimes predefined in the header files.

View file

@ -0,0 +1,25 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__asm__ppc__netbsd.s,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc_netbsd.s.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc_netbsd.s
@@ -20,15 +20,15 @@
.section ".text"
.align 2
- .globl XPTC_InvokeByIndex
- .type XPTC_InvokeByIndex,@function
+ .globl NS_InvokeByIndex_P
+ .type NS_InvokeByIndex_P,@function
#
-# XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
-# uint32_t paramCount, nsXPTCVariant* params)
+# NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
+# PRUint32 paramCount, nsXPTCVariant* params)
#
-XPTC_InvokeByIndex:
+NS_InvokeByIndex_P:
stwu sp,-32(sp) # setup standard stack frame
mflr r0 # save LR
stw r3,8(sp) # r3 <= that

View file

@ -0,0 +1,13 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__gcc__x86__unix.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp
@@ -9,7 +9,7 @@
#include "xptc_gcc_x86_unix.h"
extern "C" {
-static void ATTRIBUTE_USED __attribute__ ((regparm(3)))
+void ATTRIBUTE_USED __attribute__ ((regparm(3)))
invoke_copy_to_stack(uint32_t paramCount, nsXPTCVariant* s, uint32_t* d)
{
for(uint32_t i = paramCount; i >0; i--, d++, s++)

View file

@ -0,0 +1,75 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__netbsd__m68k.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcinvoke_netbsd_m68k.cpp.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcinvoke_netbsd_m68k.cpp
@@ -100,6 +100,15 @@ extern "C" {
}
}
+/*
+ * SYMBOL PREFIX must be "_" for aout symbols and "" for ELF
+ */
+#ifndef __ELF__
+#define SYMBOLPREFIX "_"
+#else
+#define SYMBOLPREFIX
+#endif
+
XPTC_PUBLIC_API(nsresult)
XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
uint32_t paramCount, nsXPTCVariant* params)
@@ -107,30 +116,30 @@ XPTC_InvokeByIndex(nsISupports* that, ui
uint32_t result;
__asm__ __volatile__(
- "movl %4, sp@-\n\t"
- "movl %3, sp@-\n\t"
- "jbsr _invoke_count_words\n\t" /* count words */
- "addql #8, sp\n\t"
- "lsll #2, d0\n\t" /* *= 4 */
- "movl sp, a2\n\t" /* save original sp */
- "subl d0, sp\n\t" /* make room for params */
- "movl sp, a0\n\t"
- "movl %4, sp@-\n\t"
- "movl %3, sp@-\n\t"
- "movl a0, sp@-\n\t"
- "jbsr _invoke_copy_to_stack\n\t" /* copy params */
- "addl #12, sp\n\t"
- "movl %1, a0\n\t"
- "movl a0@, a1\n\t"
- "movl %2, d0\n\t" /* function index */
- "movl a0, d1\n\t"
- "movw a1@(8,d0:l:8), a0\n\t"
- "addl a0, d1\n\t"
- "movl a1@(12,d0:l:8), a1\n\t"
- "movl d1, sp@-\n\t"
- "jbsr a1@\n\t"
- "movl a2, sp\n\t" /* restore original sp */
- "movl d0, %0\n\t"
+ "movl %4, %%sp@-\n\t"
+ "movl %3, %%sp@-\n\t"
+ "jbsr "SYMBOLPREFIX"invoke_count_words\n\t" /* count words */
+ "addql #8, %%sp\n\t"
+ "lsll #2, %%d0\n\t" /* *= 4 */
+ "movl %%sp, %%a2\n\t" /* save original sp */
+ "subl %%d0, %%sp\n\t" /* make room for params */
+ "movl %%sp, %%a0\n\t"
+ "movl %4, %%sp@-\n\t"
+ "movl %3, %%sp@-\n\t"
+ "movl %%a0, %%sp@-\n\t"
+ "jbsr "SYMBOLPREFIX"invoke_copy_to_stack\n\t" /* copy params */
+ "addl #12, %%sp\n\t"
+ "movl %1, %%a0\n\t"
+ "movl %%a0@, %%a1\n\t"
+ "movl %2, %%d0\n\t" /* function index */
+ "movl %%a0, %%d1\n\t"
+ "movw %%a1@(8,%%d0:l:8), %%a0\n\t"
+ "addl %%a0, %%d1\n\t"
+ "movl %%a1@(12,%%d0:l:8), %%a1\n\t"
+ "movl %%d1, %%sp@-\n\t"
+ "jbsr %%a1@\n\t"
+ "movl %%a2, %%sp\n\t" /* restore original sp */
+ "movl %%d0, %0\n\t"
: "=g" (result) /* %0 */
: "g" (that), /* %1 */
"g" (methodIndex), /* %2 */

View file

@ -0,0 +1,47 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__ppc__netbsd.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc_netbsd.cpp.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc_netbsd.cpp
@@ -5,9 +5,9 @@
// Platform specific code to invoke XPCOM methods on native objects
-// The purpose of XPTC_InvokeByIndex() is to map a platform
+// The purpose of NS_InvokeByIndex_P() is to map a platform
// indepenpent call to the platform ABI. To do that,
-// XPTC_InvokeByIndex() has to determine the method to call via vtable
+// NS_InvokeByIndex_P() has to determine the method to call via vtable
// access. The parameters for the method are read from the
// nsXPTCVariant* and prepared for the native ABI. For the Linux/PPC
// ABI this means that the first 8 integral and floating point
@@ -72,8 +72,10 @@ invoke_copy_to_stack(uint32_t* d,
if ((uint32_t) d & 4) d++; // doubles are 8-byte aligned on stack
*((double*) d) = s->val.d;
d += 2;
+#if __GXX_ABI_VERSION < 100
if (gpr < GPR_COUNT)
gpr += 2;
+#endif
}
}
else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
@@ -82,8 +84,10 @@ invoke_copy_to_stack(uint32_t* d,
else {
*((float*) d) = s->val.f;
d += 1;
+#if __GXX_ABI_VERSION < 100
if (gpr < GPR_COUNT)
gpr += 1;
+#endif
}
}
else if (!s->IsPtrData() && (s->type == nsXPTType::T_I64
@@ -110,6 +114,6 @@ invoke_copy_to_stack(uint32_t* d,
}
extern "C"
-XPTC_PUBLIC_API(nsresult)
-XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
+EXPORT_XPCOM_API(nsresult)
+NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex,
uint32_t paramCount, nsXPTCVariant* params);

View file

@ -0,0 +1,89 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcinvoke__sparc64__netbsd.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_netbsd.cpp.orig 2014-10-14 18:49:14.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_netbsd.cpp
@@ -0,0 +1,84 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ */
+
+/* Platform specific code to invoke XPCOM methods on native objects */
+
+#include "xptcprivate.h"
+
+#if !defined(__sparc64__) && !defined(_LP64)
+#error "This code is for Sparc64 only"
+#endif
+
+extern "C" PRUint32
+invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s)
+{
+ /*
+ We need to copy the parameters for this function to locals and use them
+ from there since the parameters occupy the same stack space as the stack
+ we're trying to populate.
+ */
+ PRUint64 *l_d = d;
+ nsXPTCVariant *l_s = s;
+ PRUint64 l_paramCount = paramCount;
+ PRUint64 regCount = 0; // return the number of registers to load from the stack
+
+ for(PRUint64 i = 0; i < l_paramCount; i++, l_d++, l_s++)
+ {
+ if (regCount < 5) regCount++;
+
+ if (l_s->IsPtrData())
+ {
+ *l_d = (PRUint64)l_s->ptr;
+ continue;
+ }
+ switch (l_s->type)
+ {
+ case nsXPTType::T_I8 : *((PRInt64*)l_d) = l_s->val.i8; break;
+ case nsXPTType::T_I16 : *((PRInt64*)l_d) = l_s->val.i16; break;
+ case nsXPTType::T_I32 : *((PRInt64*)l_d) = l_s->val.i32; break;
+ case nsXPTType::T_I64 : *((PRInt64*)l_d) = l_s->val.i64; break;
+
+ case nsXPTType::T_U8 : *((PRUint64*)l_d) = l_s->val.u8; break;
+ case nsXPTType::T_U16 : *((PRUint64*)l_d) = l_s->val.u16; break;
+ case nsXPTType::T_U32 : *((PRUint64*)l_d) = l_s->val.u32; break;
+ case nsXPTType::T_U64 : *((PRUint64*)l_d) = l_s->val.u64; break;
+
+ /* in the case of floats, we want to put the bits in to the
+ 64bit space right justified... floats in the paramter array on
+ sparcv9 use odd numbered registers.. %f1, %f3, so we have to skip
+ the space that would be occupied by %f0, %f2, etc.
+ */
+ case nsXPTType::T_FLOAT : *(((float*)l_d) + 1) = l_s->val.f; break;
+ case nsXPTType::T_DOUBLE: *((double*)l_d) = l_s->val.d; break;
+ case nsXPTType::T_BOOL : *((PRInt64*)l_d) = l_s->val.b; break;
+ case nsXPTType::T_CHAR : *((PRUint64*)l_d) = l_s->val.c; break;
+ case nsXPTType::T_WCHAR : *((PRInt64*)l_d) = l_s->val.wc; break;
+
+ default:
+ // all the others are plain pointer types
+ *((void**)l_d) = l_s->val.p;
+ break;
+ }
+ }
+
+ return regCount;
+}

View file

@ -0,0 +1,31 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcstubs__arm__netbsd.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcstubs_arm_netbsd.cpp.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcstubs_arm_netbsd.cpp
@@ -86,18 +86,23 @@ PrepareAndDispatch(nsXPTCStubBase* self,
* so they are contiguous with values passed on the stack, and then calls
* PrepareAndDispatch() to do the dirty work.
*/
+#ifndef __ELF__
+#define SYMBOLPREFIX "_"
+#else
+#define SYMBOLPREFIX
+#endif
#define STUB_ENTRY(n) \
__asm__( \
- ".global _Stub"#n"__14nsXPTCStubBase\n\t" \
-"_Stub"#n"__14nsXPTCStubBase:\n\t" \
+ ".global "SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase\n\t" \
+SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase:\n\t" \
"stmfd sp!, {r1, r2, r3} \n\t" \
"mov ip, sp \n\t" \
"stmfd sp!, {fp, ip, lr, pc} \n\t" \
"sub fp, ip, #4 \n\t" \
"mov r1, #"#n" \n\t" /* = methodIndex */ \
"add r2, sp, #16 \n\t" \
- "bl _PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi \n\t" \
+ "bl "SYMBOLPREFIX"PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi \n\t" \
"ldmea fp, {fp, sp, lr} \n\t" \
"add sp, sp, #12 \n\t" \
"mov pc, lr \n\t" \

View file

@ -0,0 +1,52 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcstubs__asm__mips.S,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcstubs_asm_mips.S.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcstubs_asm_mips.S
@@ -14,6 +14,47 @@
#include <sys/asm.h>
#endif
+#ifdef __NetBSD__
+# include <machine/regdef.h>
+# include <machine/asm.h>
+# ifndef fp
+# define fp s8
+# endif
+# ifndef PTRLOG
+# if SZREG == 4
+# define PTRLOG 2
+# else
+# define PTRLOG 3
+# endif
+# endif
+# ifndef SETUP_GP
+# if defined(__mips_o32)
+# define SETUP_GP \
+ .set push; \
+ .set noreorder; \
+ .cpload t9; \
+ .set pop
+# define SAVE_GP(x) \
+ .cprestore x
+# else
+# define SETUP_GP
+# define SAVE_GP(x)
+# endif
+# endif
+# ifndef ALSZ
+# if defined(__mips_n32) || defined(__mips_n64)
+# define ALSZ 15
+# define ALMASK ~15
+# else
+# define ALSZ 7
+# define ALMASK ~7
+# endif
+# endif
+#else
+# include <sys/regdef.h>
+# include <sys/asm.h>
+#endif
+
# NARGSAVE is the argument space in the callers frame, including extra
# 'shadowed' space for the argument registers. The minimum of 4
# argument slots is sometimes predefined in the header files.

View file

@ -0,0 +1,71 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcstubs__asm__sparc64__netbsd.s,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc64_netbsd.s.orig 2014-10-14 18:49:14.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc64_netbsd.s
@@ -0,0 +1,66 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1999 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ */
+
+ .global SharedStub
+
+/*
+ in the frame for the function that called SharedStub are the
+ rest of the parameters we need
+
+*/
+
+SharedStub:
+! we don't create a new frame yet, but work within the frame of the calling
+! function to give ourselves the other parameters we want
+
+ mov %o0, %o1 ! shuffle the index up to 2nd place
+ mov %i0, %o0 ! the original 'this'
+ add %fp, 0x7ff + 136, %o2 ! previous stack top adjusted to the first argument slot (beyond 'this')
+
+! save off the original incoming parameters that arrived in
+! registers, the ABI guarantees the space for us to do this
+ stx %i1, [%fp + 0x7ff + 136]
+ stx %i2, [%fp + 0x7ff + 144]
+ stx %i3, [%fp + 0x7ff + 152]
+ stx %i4, [%fp + 0x7ff + 160]
+ stx %i5, [%fp + 0x7ff + 168]
+! now we can build our own stack frame
+ save %sp,-(128 + 64),%sp ! room for the register window and
+ ! struct pointer, rounded up to 0 % 64
+! our function now appears to have been called
+! as SharedStub(nsISupports* that, PRUint32 index, PRUint32* args)
+! so we can just copy these through
+
+ mov %i0, %o0
+ mov %i1, %o1
+ mov %i2, %o2
+ call PrepareAndDispatch
+ nop
+ mov %o0,%i0 ! propagate return value
+ b .LL1
+ nop
+.LL1:
+ ret
+ restore
+
+ .size SharedStub, .-SharedStub
+ .type SharedStub, #function

View file

@ -0,0 +1,13 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcstubs__gcc__x86__unix.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp
@@ -10,7 +10,7 @@
#include "xptc_gcc_x86_unix.h"
extern "C" {
-static nsresult ATTRIBUTE_USED
+nsresult ATTRIBUTE_USED
__attribute__ ((regparm (3)))
PrepareAndDispatch(uint32_t methodIndex, nsXPTCStubBase* self, uint32_t* args)
{

View file

@ -0,0 +1,41 @@
$NetBSD: patch-xpcom_reflect_xptcall_md_unix_xptcstubs__netbsd__m68k.cpp,v 1.1 2014/10/15 13:43:32 ryoon Exp $
--- xpcom/reflect/xptcall/md/unix/xptcstubs_netbsd_m68k.cpp.orig 2014-10-11 09:06:50.000000000 +0000
+++ xpcom/reflect/xptcall/md/unix/xptcstubs_netbsd_m68k.cpp
@@ -91,17 +91,27 @@ extern "C" {
}
}
+/*
+ * Beware: use % instead of %% for register identifiers in a preprocessor macro
+ * SYMBOL PREFIX must be "_" for aout and "" for ELF
+ */
+#ifndef __ELF__
+#define SYMBOLPREFIX "_"
+#else
+#define SYMBOLPREFIX
+#endif
+
#define STUB_ENTRY(n) \
__asm__( \
- ".global _Stub"#n"__14nsXPTCStubBase\n\t" \
-"_Stub"#n"__14nsXPTCStubBase:\n\t" \
- "link a6,#0 \n\t" \
- "lea a6@(12), a0 \n\t" /* pointer to args */ \
- "movl a0, sp@- \n\t" \
- "movl #"#n", sp@- \n\t" /* method index */ \
- "movl a6@(8), sp@- \n\t" /* this */ \
- "jbsr _PrepareAndDispatch \n\t" \
- "unlk a6 \n\t" \
+ ".global "SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase\n\t" \
+SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase:\n\t" \
+ "link %a6,#0 \n\t" \
+ "lea %a6@(12), %a0 \n\t" /* pointer to args */ \
+ "movl %a0, %sp@- \n\t" \
+ "movl #"#n", %sp@- \n\t" /* method index */ \
+ "movl %a6@(8), %sp@- \n\t" /* this */ \
+ "jbsr "SYMBOLPREFIX"PrepareAndDispatch\n\t" \
+ "unlk %a6 \n\t" \
"rts \n\t" \
);