cpuid 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -13,6 +13,7 @@ EOF
13
13
  gem.email = "michael.j.edgar@dartmouth.edu"
14
14
  gem.homepage = "http://github.com/michaeledgar/cpuid"
15
15
  gem.authors = ["Michael Edgar"]
16
+ gem.extensions = ["ext/cpuid/cpuid_ext/extconf.rb"]
16
17
  gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
17
18
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
19
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -1,5 +1,13 @@
1
1
  #include <ruby.h>
2
2
 
3
+ /**
4
+ * These two functions were lifted from this guy:
5
+ * http://code.google.com/p/ruby-cpuid/
6
+ * Who saved me the trouble of writing the inline assembly. However I changed
7
+ * how he exposees them to Ruby and how he defines constants and so forth.
8
+ * @michaeledgar
9
+ */
10
+
3
11
  static VALUE has_cpuid(VALUE self)
4
12
  {
5
13
  long a, c;
@@ -36,6 +44,9 @@ static VALUE run_cpuid(VALUE self, VALUE ax)
36
44
  return rb_ary_new3(4, INT2NUM(regs[0]), INT2NUM(regs[1]), INT2NUM(regs[2]), INT2NUM(regs[3]));
37
45
  }
38
46
 
47
+ /**
48
+ * I wrote this stuff. @michaeledgar
49
+ */
39
50
  void Init_cpuid_ext()
40
51
  {
41
52
  VALUE m_CPUID = rb_define_module("CPUID");
@@ -0,0 +1,3 @@
1
+ require 'mkmf'
2
+
3
+ create_makefile("cpuid/cpuid_ext")
@@ -1,2 +1,3 @@
1
- require 'ext/cpuid/cpuid_ext'
1
+
2
+ require 'cpuid/cpuid_ext'
2
3
  require 'cpuid/cpuid'
@@ -1,3 +1,4 @@
1
+
1
2
  module CPUID
2
3
  class UnsupportedFunction < StandardError; end
3
4
  extend self
@@ -9,6 +10,7 @@ module CPUID
9
10
  BRAND_STR_FN_1 = 0x80000002
10
11
  BRAND_STR_FN_2 = 0x80000003
11
12
  BRAND_STR_FN_3 = 0x80000004
13
+ ADDRESS_SIZE_FN = 0x80000008
12
14
 
13
15
  def model_information
14
16
  processor_type = [
@@ -48,6 +50,14 @@ module CPUID
48
50
  end.join
49
51
  end
50
52
 
53
+ def virtual_address_size
54
+ run_function(ADDRESS_SIZE_FN) & 0xFF00
55
+ end
56
+
57
+ def physical_address_size
58
+ run_function(ADDRESS_SIZE_FN) & 0x00FF
59
+ end
60
+
51
61
  #private
52
62
 
53
63
  def signature
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpuid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Edgar
@@ -27,8 +27,8 @@ description: " Access x86 CPUID information from Ruby, including vendor name,
27
27
  email: michael.j.edgar@dartmouth.edu
28
28
  executables: []
29
29
 
30
- extensions: []
31
-
30
+ extensions:
31
+ - ext/cpuid/cpuid_ext/extconf.rb
32
32
  extra_rdoc_files:
33
33
  - LICENSE
34
34
  - README.rdoc
@@ -39,8 +39,8 @@ files:
39
39
  - README.rdoc
40
40
  - Rakefile
41
41
  - VERSION
42
- - ext/cpuid/cpuid_ext.c
43
- - ext/cpuid/extconf.rb
42
+ - ext/cpuid/cpuid_ext/cpuid_ext.c
43
+ - ext/cpuid/cpuid_ext/extconf.rb
44
44
  - lib/cpuid.rb
45
45
  - lib/cpuid/cpuid.rb
46
46
  - test/helper.rb
@@ -1,3 +0,0 @@
1
- require 'mkmf'
2
-
3
- create_makefile("cpuid_ext")