Skip to content

Commit

Permalink
Renamed Ronin::ASM::OS to Ronin::ASM::Syscalls (closes #50).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Feb 21, 2025
1 parent 1e6e160 commit 6b407c6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions lib/ronin/asm/program.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

require_relative 'x86'
require_relative 'x86_64'
require_relative 'os'
require_relative 'syscalls'
require_relative 'register'
require_relative 'instruction'
require_relative 'immediate'
Expand Down Expand Up @@ -51,9 +51,9 @@ class Program
}

# Mapping of Operating System names and modules.
OSES = {
linux: OS::Linux,
freebsd: OS::FreeBSD
SYSCALLS = {
linux: Syscalls::Linux,
freebsd: Syscalls::FreeBSD
}

# The Assembly Parsers
Expand Down Expand Up @@ -179,13 +179,13 @@ def initialize_arch(arch)
def initialize_os(os)
@os = os

os_module = OSES.fetch(os) do
syscall_module = SYSCALLS.fetch(os) do
raise(ArgumentError,"unknown OS: #{os.inspect}")
end

@syscalls = os_module::SYSCALLS
@syscalls = syscall_module::SYSCALLS

extend os_module
extend syscall_module
end

public
Expand Down
10 changes: 5 additions & 5 deletions lib/ronin/asm/os.rb → lib/ronin/asm/syscalls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
# along with ronin-asm. If not, see <https://www.gnu.org/licenses/>.
#

require_relative 'os/freebsd'
require_relative 'os/linux'
require_relative 'syscalls/freebsd'
require_relative 'syscalls/linux'

module Ronin
module ASM
module OS
module Syscalls
# The mapping of OS names to modules.
NAMES = {
OSES = {
linux: Linux,
freebsd: FreeBSD
}
Expand All @@ -45,7 +45,7 @@ module OS
# @since 1.0.0
#
def self.[](name)
NAMES.fetch(name) do
OSES.fetch(name) do
raise(ArgumentError,"unknown OS name: #{name.inspect}")
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

module Ronin
module ASM
module OS
module Syscalls
#
# Contains FreeBSD specific helper methods.
# Contains FreeBSD syscall numbers.
#
module FreeBSD
# System call numbers for FreeBSD.
Expand Down
4 changes: 2 additions & 2 deletions lib/ronin/asm/os/linux.rb → lib/ronin/asm/syscalls/linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

module Ronin
module ASM
module OS
module Syscalls
#
# Contains Linux specific helper methods.
# Contains Linux syscall numbers.
#
module Linux
# System call numbers for Linux.
Expand Down
4 changes: 2 additions & 2 deletions spec/os_spec.rb → spec/syscalls_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'ronin/asm/os'
require 'ronin/asm/syscalls'

describe Ronin::ASM::OS do
describe Ronin::ASM::Syscalls do
describe ".[]" do
context "when given :linux" do
it "must return #{described_class}::Linux" do
Expand Down

0 comments on commit 6b407c6

Please sign in to comment.