The Artima Developer Community
Sponsored Link

Java Buzz Forum
AMD64 Easter Egg

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
AMD64 Easter Egg Posted: Sep 18, 2006 7:47 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: AMD64 Easter Egg
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

I mentioned this in one of the round table stand up meetings some months ago, but never got around to blog it. It's a little easter egg program for the AMD64. I saw it here 275 days ago.

The reason it took me this long is that I want to clean the program up a little bit to get rid of the high level C stuff. I got a copy of Richard Blum's Professional Assembly Language from the local SoftwarePlus store when it went out of business last month (and was practically giving their books away (buy one at half price and get a second one (of less or equal value) free)). And one of his first examples is a cpuid program. So I modified the sample program a little bit to run the AMD64 easter egg instruction:

.section .data
output:
  .ascii "The processor slogan is 'xxxxxxxxxxxxxxxx'\n"

.section .text
.globl _start
_start:
  movl $0x8fffffff, %eax
  cpuid

  movl $output, %edi
  movl %eax, 25(%edi)
  movl %ebx, 29(%edi)
  movl %ecx, 33(%edi)
  movl %edx, 37(%edi)

  movl $4, %eax
  movl $1, %ebx
  movl $output, %ecx
  movl $43, %edx
  int $0x80

  movl $1, %eax
  movl $0, %ebx
  int $0x80

It uses a couple of Linux system calls. Assemble, link and run it thusly:

[weiqi@gao]$ as -o cpuid.o cpuid.s
[weiqi@gao]$ ld -o cpuid cpuid.o
[weiqi@gao]$ ./cpuid
The processor slogan is 'IT'S HAMMER TIME'

Read: AMD64 Easter Egg

Topic: SQLiteJDBC 0.22 Previous Topic   Next Topic Topic: Update On Super Simple Java ORM Replacement in 80 Lines

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use